LCOV - code coverage report
Current view: top level - STEER/STEERBase - AliTrackReference.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 62 65 95.4 %
Date: 2016-06-14 17:26:59 Functions: 7 8 87.5 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             : 
      18             : #include "TVirtualMC.h"
      19             : #include "TParticle.h"
      20             : 
      21             : #include "AliTrackReference.h"
      22             : #include <Riostream.h>
      23             : 
      24             : // 
      25             : // Track Reference object is created every time particle is 
      26             : // crossing detector bounds. The object is created by Step Manager
      27             : //
      28             : // The class stores the following informations:
      29             : // track label, 
      30             : // track position: X,Y,X
      31             : // track momentum px, py, pz
      32             : // track length and time of fligth: both in cm
      33             : // status bits from Monte Carlo
      34             : //
      35             : 
      36             : 
      37             : using std::endl;
      38             : using std::cout;
      39         176 : ClassImp(AliTrackReference)
      40             : 
      41             : //_______________________________________________________________________
      42             :  AliTrackReference::AliTrackReference():
      43         524 :    TObject(),
      44         524 :    fTrack(0),
      45         524 :    fX(0),
      46         524 :    fY(0),
      47         524 :    fZ(0),
      48         524 :    fPx(0),
      49         524 :    fPy(0),
      50         524 :    fPz(0),
      51         524 :    fLength(0),
      52         524 :    fTime(0),
      53         524 :    fUserId(0),
      54         524 :    fDetectorId(-999)
      55        2620 : {
      56             :   //
      57             :   // Default constructor
      58             :   // Creates empty object
      59             : 
      60       17816 :   for(Int_t i=0; i<16; i++) ResetBit(BIT(i));
      61        1048 : }
      62             : 
      63             : AliTrackReference::AliTrackReference(const AliTrackReference &tr) :
      64        8894 :   TObject(tr),
      65        8894 :   fTrack(tr.fTrack),
      66        8894 :   fX(tr.fX),
      67        8894 :   fY(tr.fY),
      68        8894 :   fZ(tr.fZ),
      69        8894 :   fPx(tr.fPx),
      70        8894 :   fPy(tr.fPy),
      71        8894 :   fPz(tr.fPz),
      72        8894 :   fLength(tr.fLength),
      73        8894 :   fTime(tr.fTime),
      74        8894 :   fUserId(tr.fUserId),
      75        8894 :   fDetectorId(tr.fDetectorId)
      76       44470 : {
      77             :     // Copy Constructor
      78       17788 : }
      79             : 
      80             : //_______________________________________________________________________
      81             : AliTrackReference::AliTrackReference(Int_t label, Int_t id) :
      82       52509 :   TObject(),
      83       52509 :   fTrack(label),
      84       52509 :   fX(0),
      85       52509 :   fY(0),
      86       52509 :   fZ(0),
      87       52509 :   fPx(0),
      88       52509 :   fPy(0),
      89       52509 :   fPz(0),
      90      157527 :   fLength(TVirtualMC::GetMC()->TrackLength()),
      91      157527 :   fTime(TVirtualMC::GetMC()->TrackTime()),
      92       52509 :   fUserId(0),
      93       52509 :   fDetectorId(id)
      94      262545 : {
      95             :   //
      96             :   // Create Reference object out of label and
      97             :   // data in TVirtualMC object
      98             :   //
      99             :   // Creates an object and fill all parameters 
     100             :   // from data in VirtualMC
     101             :   //
     102             :   // Sylwester Radomski, (S.Radomski@gsi.de)
     103             :   // GSI, Jan 31, 2003
     104             :   //
     105             :     
     106       52509 :   Double_t vec[4];
     107             :   
     108      105018 :   TVirtualMC::GetMC()->TrackPosition(vec[0],vec[1],vec[2]);
     109             : 
     110       52509 :   fX = vec[0];
     111       52509 :   fY = vec[1];
     112       52509 :   fZ = vec[2];
     113             :   
     114      105018 :   TVirtualMC::GetMC()->TrackMomentum(vec[0],vec[1],vec[2],vec[3]);
     115             :   
     116       52509 :   fPx = vec[0];
     117       52509 :   fPy = vec[1];
     118       52509 :   fPz = vec[2];
     119             : 
     120             :   // Set Up status code 
     121             :   // Copy Bits from virtual MC
     122             : 
     123      945162 :   for(Int_t i=14; i<22; i++) ResetBit(BIT(i));
     124             : 
     125      157527 :   SetBit(BIT(14), TVirtualMC::GetMC()->IsNewTrack());
     126      157527 :   SetBit(BIT(15), TVirtualMC::GetMC()->IsTrackAlive());
     127      157527 :   SetBit(BIT(16), TVirtualMC::GetMC()->IsTrackDisappeared());
     128      157527 :   SetBit(BIT(17), TVirtualMC::GetMC()->IsTrackEntering());
     129      157527 :   SetBit(BIT(18), TVirtualMC::GetMC()->IsTrackExiting());
     130      157527 :   SetBit(BIT(19), TVirtualMC::GetMC()->IsTrackInside());
     131      157527 :   SetBit(BIT(20), TVirtualMC::GetMC()->IsTrackOut());
     132      157527 :   SetBit(BIT(21), TVirtualMC::GetMC()->IsTrackStop()); 
     133             :   //
     134             :   // This particle has to be kept
     135             : 
     136      105018 : }
     137             : /*
     138             : AliExternalTrackParam * AliTrackReference::MakeTrack(const AliTrackReference *ref, Double_t mass)
     139             : {
     140             :   //
     141             :   // Make dummy track from the track reference 
     142             :   // negative mass means opposite charge 
     143             :   //
     144             :   Double_t xx[5];
     145             :   Double_t cc[15];
     146             :   for (Int_t i=0;i<15;i++) cc[i]=0;
     147             :   Double_t x = ref->X(), y = ref->Y(), z = ref->Z();
     148             :   Double_t alpha = TMath::ATan2(y,x);
     149             :   Double_t xr = TMath::Sqrt(x*x+y*y);
     150             :   xx[0] = ref->LocalY();
     151             :   xx[1] = z;
     152             :   xx[3] = ref->Pz()/ref->Pt();
     153             :   xx[4] = 1./ref->Pt(); 
     154             :   if (mass<0) xx[4]*=-1.;  // negative mass - negative direction
     155             :   Double_t alphap = TMath::ATan2(ref->Py(),ref->Px())-alpha;
     156             :   if (alphap> TMath::Pi()) alphap-=TMath::Pi();
     157             :   if (alphap<-TMath::Pi()) alphap+=TMath::Pi();
     158             :   xx[2] = TMath::Sin(alphap);
     159             : 
     160             :   AliExternalTrackParam * track = new  AliExternalTrackParam(xr,alpha,xx,cc);
     161             :   return track;
     162             : }
     163             : */
     164             : //_______________________________________________________________________
     165             : void
     166             : AliTrackReference::Print(Option_t* /*opt*/) const
     167             : {
     168           0 :   cout << Form("Label %d P=%7.2f (PX,PY,PZ)=(%7.2f,%7.2f,%7.2f) (X,Y,Z)=(%7.2f,%7.2f,%7.2f)"
     169             :                " Length=%7.2f Time=%7.2f UserId=%d",
     170           0 :                Label(),P(),Px(),Py(),Pz(),X(),Y(),Z(),GetLength(),GetTime(),UserId()) << endl;
     171           0 : }
     172             : 

Generated by: LCOV version 1.11