]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliTrackReference.cxx
added new files to build system
[u/mrichter/AliRoot.git] / STEER / AliTrackReference.cxx
CommitLineData
aab9c8d5 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
0742d588 16/* $Id$ */
116cbefd 17
2cad796f 18#include "TVirtualMC.h"
0742d588 19
2d74ba4f 20#include "AliRun.h"
0742d588 21#include "AliTrackReference.h"
ac3eaff4 22#include "AliExternalTrackParam.h"
23#include "AliKalmanTrack.h"
65b311b3 24#include <Riostream.h>
2d74ba4f 25
26//
27// Track Reference object is created every time particle is
28// crossing detector bounds. The object is created by Step Manager
29//
30// The class stores the following informations:
31// track label,
32// track position: X,Y,X
33// track momentum px, py, pz
34// track length and time of fligth: both in cm
35// status bits from Monte Carlo
36//
37
aab9c8d5 38
39ClassImp(AliTrackReference)
40
e2afb3b6 41//_______________________________________________________________________
42 AliTrackReference::AliTrackReference():
448312df 43 TObject(),
e2afb3b6 44 fTrack(0),
45 fX(0),
46 fY(0),
47 fZ(0),
48 fPx(0),
49 fPy(0),
50 fPz(0),
448312df 51 fLength(0),
3142ebc3 52 fTime(0),
53 fUserId(0)
aab9c8d5 54{
55 //
56 // Default constructor
2d74ba4f 57 // Creates empty object
58
59 for(Int_t i=0; i<16; i++) ResetBit(BIT(i));
60}
61
62//_______________________________________________________________________
448312df 63AliTrackReference::AliTrackReference(Int_t label) :
90e48c0c 64 TObject(),
65 fTrack(label),
66 fX(0),
67 fY(0),
68 fZ(0),
69 fPx(0),
70 fPy(0),
71 fPz(0),
72 fLength(gMC->TrackLength()),
3142ebc3 73 fTime(gMC->TrackTime()),
74 fUserId(0)
448312df 75{
2d74ba4f 76 //
77 // Create Reference object out of label and
78 // data in TVirtualMC object
79 //
80 // Creates an object and fill all parameters
81 // from data in VirtualMC
aab9c8d5 82 //
2d74ba4f 83 // Sylwester Radomski, (S.Radomski@gsi.de)
84 // GSI, Jan 31, 2003
85 //
2cad796f 86
90e48c0c 87 Double_t vec[4];
2d74ba4f 88
90e48c0c 89 gMC->TrackPosition(vec[0],vec[1],vec[2]);
2d74ba4f 90
91 fX = vec[0];
92 fY = vec[1];
93 fZ = vec[2];
94
90e48c0c 95 gMC->TrackMomentum(vec[0],vec[1],vec[2],vec[3]);
2d74ba4f 96
97 fPx = vec[0];
98 fPy = vec[1];
b745fc4c 99 fPz = vec[2];
2d74ba4f 100
101 // Set Up status code
102 // Copy Bits from virtual MC
103
104 for(Int_t i=0; i<16; i++) ResetBit(BIT(i));
105
2cad796f 106 SetBit(BIT(0), gMC->IsNewTrack());
107 SetBit(BIT(1), gMC->IsTrackAlive());
108 SetBit(BIT(2), gMC->IsTrackDisappeared());
109 SetBit(BIT(3), gMC->IsTrackEntering());
110 SetBit(BIT(4), gMC->IsTrackExiting());
111 SetBit(BIT(5), gMC->IsTrackInside());
112 SetBit(BIT(6), gMC->IsTrackOut());
113 SetBit(BIT(7), gMC->IsTrackStop());
aab9c8d5 114}
2d74ba4f 115//_______________________________________________________________________
ac3eaff4 116AliExternalTrackParam * AliTrackReference::MakeTrack(const AliTrackReference *ref, Double_t mass)
117{
118 //
119 // Make dummy track from the track reference
120 // negative mass means opposite charge
121 //
122 Double_t xx[5];
123 Double_t cc[15];
124 for (Int_t i=0;i<15;i++) cc[i]=0;
125 Double_t x = ref->X(), y = ref->Y(), z = ref->Z();
126 Double_t alpha = TMath::ATan2(y,x);
127 Double_t xr = TMath::Sqrt(x*x+y*y);
b31d3cd8 128 xx[0] = ref->LocalY();
ac3eaff4 129 xx[1] = z;
130 xx[3] = ref->Pz()/ref->Pt();
c9ec41e8 131 xx[4] = 1./ref->Pt();
ac3eaff4 132 if (mass<0) xx[4]*=-1.; // negative mass - negative direction
133 Double_t alphap = TMath::ATan2(ref->Py(),ref->Px())-alpha;
134 if (alphap> TMath::Pi()) alphap-=TMath::Pi();
135 if (alphap<-TMath::Pi()) alphap+=TMath::Pi();
136 xx[2] = TMath::Sin(alphap);
c9ec41e8 137
ac3eaff4 138 AliExternalTrackParam * track = new AliExternalTrackParam(xr,alpha,xx,cc);
ac3eaff4 139 return track;
140}
141
65b311b3 142//_______________________________________________________________________
143void
144AliTrackReference::Print(Option_t* opt) const
145{
146 cout << Form("Label %d P=%7.2f (X,Y,Z)=(%7.2f,%7.2f,%7.2f) (PX,PY,PZ)=(%7.2f,%7.2f,%7.2f)"
147 " Length=%7.2f Time=%7.2f UserId=%d",
148 Label(),P(),Px(),Py(),Pz(),X(),Y(),Z(),GetLength(),GetTime()) << endl;
149}
ac3eaff4 150