1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "TVirtualMC.h"
21 #include "AliTrackReference.h"
22 #include "AliExternalTrackParam.h"
23 #include "AliKalmanTrack.h"
26 // Track Reference object is created every time particle is
27 // crossing detector bounds. The object is created by Step Manager
29 // The class stores the following informations:
31 // track position: X,Y,X
32 // track momentum px, py, pz
33 // track length and time of fligth: both in cm
34 // status bits from Monte Carlo
38 ClassImp(AliTrackReference)
40 //_______________________________________________________________________
41 AliTrackReference::AliTrackReference():
55 // Default constructor
56 // Creates empty object
58 for(Int_t i=0; i<16; i++) ResetBit(BIT(i));
61 //_______________________________________________________________________
62 AliTrackReference::AliTrackReference(Int_t label) :
71 fLength(gMC->TrackLength()),
72 fTime(gMC->TrackTime()),
76 // Create Reference object out of label and
77 // data in TVirtualMC object
79 // Creates an object and fill all parameters
80 // from data in VirtualMC
82 // Sylwester Radomski, (S.Radomski@gsi.de)
88 gMC->TrackPosition(vec[0],vec[1],vec[2]);
94 gMC->TrackMomentum(vec[0],vec[1],vec[2],vec[3]);
100 // Set Up status code
101 // Copy Bits from virtual MC
103 for(Int_t i=0; i<16; i++) ResetBit(BIT(i));
105 SetBit(BIT(0), gMC->IsNewTrack());
106 SetBit(BIT(1), gMC->IsTrackAlive());
107 SetBit(BIT(2), gMC->IsTrackDisappeared());
108 SetBit(BIT(3), gMC->IsTrackEntering());
109 SetBit(BIT(4), gMC->IsTrackExiting());
110 SetBit(BIT(5), gMC->IsTrackInside());
111 SetBit(BIT(6), gMC->IsTrackOut());
112 SetBit(BIT(7), gMC->IsTrackStop());
114 //_______________________________________________________________________
115 AliExternalTrackParam * AliTrackReference::MakeTrack(const AliTrackReference *ref, Double_t mass)
118 // Make dummy track from the track reference
119 // negative mass means opposite charge
123 for (Int_t i=0;i<15;i++) cc[i]=0;
124 Double_t x = ref->X(), y = ref->Y(), z = ref->Z();
125 Double_t alpha = TMath::ATan2(y,x);
126 Double_t xr = TMath::Sqrt(x*x+y*y);
127 xx[0] = ref->LocalY();
129 xx[3] = ref->Pz()/ref->Pt();
130 xx[4] = 1./ref->Pt();
131 if (mass<0) xx[4]*=-1.; // negative mass - negative direction
132 Double_t alphap = TMath::ATan2(ref->Py(),ref->Px())-alpha;
133 if (alphap> TMath::Pi()) alphap-=TMath::Pi();
134 if (alphap<-TMath::Pi()) alphap+=TMath::Pi();
135 xx[2] = TMath::Sin(alphap);
137 AliExternalTrackParam * track = new AliExternalTrackParam(xr,alpha,xx,cc);