]>
Commit | Line | Data |
---|---|---|
5d60c8f9 | 1 | // $Id$ |
2 | ||
3 | //___________________________________________________________________________ | |
4 | ///////////////////////////////////////////////////////////////////////////// | |
5 | // // | |
6 | // File reader for HLT tracks ESD // | |
7 | // // | |
8 | // loizides@ikf.uni-frankfurt.de // | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #include <Riostream.h> | |
12 | #include <TMath.h> | |
13 | #include <TString.h> | |
14 | #include <TObjString.h> | |
15 | #include <TTree.h> | |
16 | #include <TFile.h> | |
17 | #include <AliESD.h> | |
18 | #include <AliESDtrack.h> | |
19 | #include <AliESDHLTtrack.h> | |
4aa41877 | 20 | #include <AliHLTTrack.h> |
21 | #include <AliHLTVertex.h> | |
04a02430 | 22 | #include <AliKalmanTrack.h> |
5d60c8f9 | 23 | #include <AliJetEventParticles.h> |
24 | #include "AliJetParticlesReaderHLT.h" | |
25 | ||
26 | ClassImp(AliJetParticlesReaderHLT) | |
27 | ||
28 | AliJetParticlesReaderHLT::AliJetParticlesReaderHLT(Bool_t bMapper, const Char_t* esdfilename) : | |
d9a296b1 | 29 | AliJetParticlesReaderESD(0,esdfilename), |
04a02430 | 30 | fTrackerType(bMapper), |
31 | fMinHits(0), | |
32 | fMinWeight(0) | |
5d60c8f9 | 33 | { |
34 | //constructor | |
35 | } | |
36 | ||
37 | /********************************************************************/ | |
38 | ||
39 | AliJetParticlesReaderHLT::AliJetParticlesReaderHLT( | |
40 | Bool_t bMapper, | |
41 | TObjArray* dirs, | |
42 | const Char_t* esdfilename) : | |
d9a296b1 | 43 | AliJetParticlesReaderESD(0,dirs,esdfilename), |
04a02430 | 44 | fTrackerType(bMapper), |
45 | fMinHits(0), | |
46 | fMinWeight(0) | |
47 | ||
5d60c8f9 | 48 | { |
49 | //constructor | |
50 | } | |
51 | ||
52 | /********************************************************************/ | |
53 | ||
54 | AliJetParticlesReaderHLT::~AliJetParticlesReaderHLT() | |
55 | { | |
56 | //desctructor | |
57 | } | |
58 | ||
59 | Int_t AliJetParticlesReaderHLT::ReadESD(AliESD* esd) | |
60 | { | |
61 | //Reads one ESD | |
62 | ||
63 | if (esd == 0) | |
64 | { | |
65 | Error("ReadESD","ESD is NULL"); | |
66 | return kFALSE; | |
67 | } | |
68 | ||
04a02430 | 69 | Float_t mf = esd->GetMagneticField(); |
70 | if (mf <= 0.0) | |
71 | { | |
72 | Error("ReadESD","Magnetic Field is 0. Skipping to next event."); | |
73 | return kFALSE; | |
74 | } | |
75 | AliKalmanTrack::SetMagneticField(mf/10.); | |
76 | ||
a86edc4e | 77 | Info("ReadESD","Reading Event %d",fCurrentDir*1000+fCurrentEvent); |
5d60c8f9 | 78 | if((!fOwner) || (fEventParticles==0)) |
79 | fEventParticles = new AliJetEventParticles(); | |
80 | ||
04a02430 | 81 | Int_t ntr=0; |
82 | if(fTrackerType){ | |
83 | ntr =esd->GetNumberOfHLTHoughTracks(); | |
84 | Info("ReadESD","Found %d conformal tracks.",ntr); | |
85 | } else { | |
86 | ntr=esd->GetNumberOfHLTHoughTracks(); | |
87 | Info("ReadESD","Found %d hough tracks.",ntr); | |
88 | } | |
89 | fEventParticles->Reset(ntr); | |
90 | ||
91 | TString headdesc=""; | |
92 | headdesc+="Run "; | |
93 | headdesc+=esd->GetRunNumber(); | |
94 | headdesc+=": Ev "; | |
95 | headdesc+=esd->GetEventNumber(); | |
96 | fEventParticles->SetHeader(headdesc); | |
97 | ||
5d60c8f9 | 98 | Double_t vertexpos[3];//vertex position |
99 | const AliESDVertex* kvertex = esd->GetVertex(); | |
100 | if (kvertex == 0) | |
101 | { | |
102 | Info("ReadESD","ESD returned NULL pointer to vertex - assuming (0.0,0.0,0.0)"); | |
103 | vertexpos[0] = 0.0; | |
104 | vertexpos[1] = 0.0; | |
105 | vertexpos[2] = 0.0; | |
106 | } | |
107 | else | |
108 | { | |
109 | kvertex->GetXYZ(vertexpos); | |
110 | } | |
111 | ||
112 | fEventParticles->SetVertex(vertexpos[0],vertexpos[1],vertexpos[2]); | |
74e5a625 | 113 | //cout << vertexpos[0] << " " << vertexpos[1] << " " << vertexpos[2] << endl; |
4aa41877 | 114 | AliHLTVertex v; |
2304b433 | 115 | v.SetX(vertexpos[0]); |
116 | v.SetY(vertexpos[1]); | |
117 | v.SetZ(vertexpos[2]); | |
53f1300c | 118 | |
04a02430 | 119 | for (Int_t i = 0;i<ntr; i++) { |
120 | AliESDHLTtrack *kesdtrack; | |
121 | if(fTrackerType){ | |
122 | kesdtrack=esd->GetHLTConfMapTrack(i); | |
123 | } else { | |
124 | kesdtrack=esd->GetHLTHoughTrack(i); | |
125 | } | |
5d60c8f9 | 126 | |
04a02430 | 127 | if (kesdtrack == 0) |
5d60c8f9 | 128 | { |
129 | Error("ReadESD","Can not get track %d", i); | |
130 | continue; | |
131 | } | |
132 | ||
46a140bc | 133 | //const Float_t kpid=kesdtrack->GetPID(); |
134 | const Int_t knhits=kesdtrack->GetNHits(); | |
135 | const Int_t kweight=kesdtrack->GetWeight(); | |
136 | //cout << i << " " << kweight << " " << knhits << endl; | |
137 | if((fMinHits>0) && (knhits<fMinHits)) continue; | |
138 | if(kweight>1000) continue; //avoid ghosts | |
139 | if((fMinWeight>0) && (kweight<fMinWeight)) continue; | |
140 | ||
141 | Float_t px=kesdtrack->GetPx(); | |
142 | Float_t py=kesdtrack->GetPy(); | |
143 | Float_t pz=kesdtrack->GetPz(); | |
ce054528 | 144 | if(TMath::IsNaN(px)||TMath::IsNaN(py)||TMath::IsNaN(pz)) continue; |
145 | if(TMath::Abs(px)>1e3||TMath::Abs(py)>1e3||TMath::Abs(pz)>1e3) continue; | |
53f1300c | 146 | //cout << px << " " << py << " " << pz << " " << TMath::Sqrt(px*px+py*py) << endl; |
46a140bc | 147 | |
78a77a8f | 148 | if(0&&fTrackerType){ |
53f1300c | 149 | #if 0 |
2304b433 | 150 | //kesdtrack->SetCharge(-kesdtrack->GetCharge()); |
53f1300c | 151 | Double_t mom[3]; |
b9a6a391 | 152 | if(!kesdtrack->GetPxPyPzAt(0,mom)) continue; |
53f1300c | 153 | px=mom[0]; |
154 | py=mom[1]; | |
155 | pz=mom[2]; | |
53f1300c | 156 | #else |
4aa41877 | 157 | AliHLTTrack l3; |
75a0c43e | 158 | //if(!kesdtrack->ComesFromMainVertex()) continue; |
53f1300c | 159 | //cout << "Pos: " << kesdtrack->GetFirstPointX() << " " << kesdtrack->GetFirstPointY() << " " << kesdtrack->GetFirstPointZ() << endl; |
75a0c43e | 160 | l3.SetFirstPoint(kesdtrack->GetFirstPointX(),kesdtrack->GetFirstPointY(),kesdtrack->GetFirstPointZ()); |
161 | l3.SetLastPoint(kesdtrack->GetLastPointX(),kesdtrack->GetLastPointY(),kesdtrack->GetLastPointZ()); | |
162 | l3.SetCharge(kesdtrack->GetCharge()); | |
163 | l3.SetPt(kesdtrack->GetPt()); | |
164 | l3.SetTgl(kesdtrack->GetTgl()); | |
165 | l3.SetPsi(kesdtrack->GetPsi()); | |
166 | l3.CalculateHelix(); | |
53f1300c | 167 | Double_t xc=0.,yc=0.,zc=0.; |
46a140bc | 168 | l3.GetClosestPoint(&v,xc,yc,zc); |
169 | if(TMath::Abs(zc)>10.) continue; | |
ce054528 | 170 | l3.SetFirstPoint(0,0,0); |
53f1300c | 171 | //cout << "Pos: " << xc << " " << yc << " " << zc << endl; |
75a0c43e | 172 | l3.UpdateToFirstPoint(); |
46a140bc | 173 | px=l3.GetPx(); |
174 | py=l3.GetPy(); | |
175 | pz=l3.GetPz(); | |
53f1300c | 176 | #endif |
75a0c43e | 177 | } |
46a140bc | 178 | const Float_t kpt=TMath::Sqrt(px*px+py*py); |
53f1300c | 179 | //cout << px << " " << py << " " << pz << " " << kpt << endl; |
78a77a8f | 180 | |
46a140bc | 181 | const Float_t kp=TMath::Sqrt(pz*pz+kpt*kpt); |
182 | const Float_t keta=0.5*TMath::Log((kp+pz+1e-30)/(kp-pz+1e-30)); | |
183 | const Float_t kphi=TMath::Pi()+TMath::ATan2(-py,-px); | |
5d60c8f9 | 184 | |
04a02430 | 185 | if(IsAcceptedParticle(kpt,kphi,keta)) |
46a140bc | 186 | fEventParticles->AddParticle(px,py,pz,kp,i,kesdtrack->GetMCid(),knhits,kpt,kphi,keta); |
04a02430 | 187 | } //loop over tracks |
5d60c8f9 | 188 | |
5d60c8f9 | 189 | return kTRUE; |
190 | } |