]>
Commit | Line | Data |
---|---|---|
7f6ddf58 | 1 | /**************************************************************************** |
2 | * Very important, delicate and rather obscure macro. * | |
3 | * * | |
4 | * Creates list of "trackable" tracks, * | |
7f6ddf58 | 5 | * calculates efficiency, resolutions etc. * |
6 | * * | |
024a7fe9 | 7 | * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * |
7f6ddf58 | 8 | * with several nice improvements by: M.Ivanov, GSI, m.ivanov@gsi.de * |
9 | ****************************************************************************/ | |
10 | ||
be9c5115 | 11 | #ifndef __CINT__ |
12 | #include "alles.h" | |
b9de75e1 | 13 | #include "AliTPCtracker.h" |
be9c5115 | 14 | #endif |
15 | ||
f38c8ae5 | 16 | struct GoodTrackTPC { |
cc80f89e | 17 | Int_t lab; |
18 | Int_t code; | |
19 | Float_t px,py,pz; | |
20 | Float_t x,y,z; | |
21 | }; | |
cc80f89e | 22 | |
7f6ddf58 | 23 | Int_t AliTPCComparison(Int_t event=0) { |
9b280d80 | 24 | cerr<<"Doing comparison...\n"; |
73042f01 | 25 | |
7f6ddf58 | 26 | const Int_t MAX=20000; |
27 | Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const Int_t event); | |
8c555625 | 28 | |
7f6ddf58 | 29 | gBenchmark->Start("AliTPCComparison"); |
afc42102 | 30 | |
7f6ddf58 | 31 | Int_t nentr=0,i=0; TObjArray tarray(MAX); |
32 | { /*Load tracks*/ | |
afc42102 | 33 | TFile *tf=TFile::Open("AliTPCtracks.root"); |
7f6ddf58 | 34 | if (!tf->IsOpen()) {cerr<<"Can't open AliTPCtracks.root !\n"; return 3;} |
35 | ||
36 | char tname[100]; sprintf(tname,"TreeT_TPC_%d",event); | |
37 | TTree *tracktree=(TTree*)tf->Get(tname); | |
38 | if (!tracktree) {cerr<<"Can't get a tree with TPC tracks !\n"; return 4;} | |
afc42102 | 39 | |
7f6ddf58 | 40 | TBranch *tbranch=tracktree->GetBranch("tracks"); |
41 | nentr=(Int_t)tracktree->GetEntries(); | |
42 | AliTPCtrack *iotrack=0; | |
43 | for (i=0; i<nentr; i++) { | |
be9c5115 | 44 | iotrack=new AliTPCtrack; |
73042f01 | 45 | tbranch->SetAddress(&iotrack); |
46 | tracktree->GetEvent(i); | |
73042f01 | 47 | tarray.AddLast(iotrack); |
7f6ddf58 | 48 | } |
49 | delete tracktree; //Thanks to Mariana Bondila | |
b9de75e1 | 50 | tf->Close(); |
7f6ddf58 | 51 | } |
8c555625 | 52 | |
7f6ddf58 | 53 | /* Generate a list of "good" tracks */ |
f38c8ae5 | 54 | GoodTrackTPC gt[MAX]; |
cc80f89e | 55 | Int_t ngood=0; |
be9c5115 | 56 | ifstream in("good_tracks_tpc"); |
cc80f89e | 57 | if (in) { |
58 | cerr<<"Reading good tracks...\n"; | |
7f6ddf58 | 59 | while (in>>gt[ngood].lab>>gt[ngood].code>> |
be9c5115 | 60 | gt[ngood].px>>gt[ngood].py>>gt[ngood].pz>> |
61 | gt[ngood].x >>gt[ngood].y >>gt[ngood].z) { | |
cc80f89e | 62 | ngood++; |
63 | cerr<<ngood<<'\r'; | |
f38c8ae5 | 64 | if (ngood==MAX) { |
cc80f89e | 65 | cerr<<"Too many good tracks !\n"; |
66 | break; | |
67 | } | |
68 | } | |
be9c5115 | 69 | if (!in.eof()) cerr<<"Read error (good_tracks_tpc) !\n"; |
cc80f89e | 70 | } else { |
71 | cerr<<"Marking good tracks (this will take a while)...\n"; | |
7f6ddf58 | 72 | ngood=good_tracks_tpc(gt,MAX, event); |
be9c5115 | 73 | ofstream out("good_tracks_tpc"); |
cc80f89e | 74 | if (out) { |
75 | for (Int_t ngd=0; ngd<ngood; ngd++) | |
7f6ddf58 | 76 | out<<gt[ngd].lab<<' '<<gt[ngd].code<<' '<< |
be9c5115 | 77 | gt[ngd].px<<' '<<gt[ngd].py<<' '<<gt[ngd].pz<<' '<< |
78 | gt[ngd].x <<' '<<gt[ngd].y <<' '<<gt[ngd].z <<endl; | |
79 | } else cerr<<"Can not open file (good_tracks_tpc) !\n"; | |
cc80f89e | 80 | out.close(); |
81 | } | |
7f6ddf58 | 82 | |
83 | ||
cc80f89e | 84 | |
cc80f89e | 85 | TH1F *hp=new TH1F("hp","PHI resolution",50,-20.,20.); hp->SetFillColor(4); |
86 | TH1F *hl=new TH1F("hl","LAMBDA resolution",50,-20,20);hl->SetFillColor(4); | |
8c555625 | 87 | TH1F *hpt=new TH1F("hpt","Relative Pt resolution",30,-10.,10.); |
88 | hpt->SetFillColor(2); | |
cc80f89e | 89 | TH1F *hmpt=new TH1F("hmpt","Relative Pt resolution (pt>4GeV/c)",30,-60,60); |
90 | hmpt->SetFillColor(6); | |
8c555625 | 91 | |
7f6ddf58 | 92 | TH1F *hgood=new TH1F("hgood","Good tracks",30,0.1,6.1); |
93 | TH1F *hfound=new TH1F("hfound","Found tracks",30,0.1,6.1); | |
94 | TH1F *hfake=new TH1F("hfake","Fake tracks",30,0.1,6.1); | |
95 | TH1F *hg=new TH1F("hg","",30,0.1,6.1); //efficiency for good tracks | |
8c555625 | 96 | hg->SetLineColor(4); hg->SetLineWidth(2); |
7f6ddf58 | 97 | TH1F *hf=new TH1F("hf","Efficiency for fake tracks",30,0.1,6.1); |
8c555625 | 98 | hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2); |
99 | ||
cc80f89e | 100 | TH1F *he =new TH1F("he","dE/dX for pions with 0.4<p<0.5 GeV/c",50,0.,100.); |
7f6ddf58 | 101 | TH2F *hep=new TH2F("hep","dE/dX vs momentum",50,0.,2.,50,0.,400.); |
be9c5115 | 102 | hep->SetMarkerStyle(8); |
103 | hep->SetMarkerSize(0.4); | |
8c555625 | 104 | |
7f6ddf58 | 105 | //MI change |
106 | Int_t mingood=ngood; | |
107 | Int_t track_notfound[MAX], itrack_notfound=0; | |
108 | Int_t track_fake[MAX], itrack_fake=0; | |
109 | Int_t track_multifound[MAX], track_multifound_n[MAX], itrack_multifound=0; | |
cf98c13f | 110 | |
cc80f89e | 111 | while (ngood--) { |
cf98c13f | 112 | Int_t lab=gt[ngood].lab,tlab=-1; |
cc80f89e | 113 | Float_t ptg= |
114 | TMath::Sqrt(gt[ngood].px*gt[ngood].px + gt[ngood].py*gt[ngood].py); | |
8c555625 | 115 | |
7f6ddf58 | 116 | if (ptg<1e-33) continue; // for those not crossing 0 pad row |
b9de75e1 | 117 | |
8c555625 | 118 | hgood->Fill(ptg); |
cc80f89e | 119 | |
cf98c13f | 120 | AliTPCtrack *track=0; |
7f6ddf58 | 121 | for (i=0; i<nentr; i++) { |
cf98c13f | 122 | track=(AliTPCtrack*)tarray.UncheckedAt(i); |
73042f01 | 123 | tlab=track->GetLabel(); |
cc80f89e | 124 | if (lab==TMath::Abs(tlab)) break; |
8c555625 | 125 | } |
7f6ddf58 | 126 | if (i==nentr) { |
cf98c13f | 127 | track_notfound[itrack_notfound++]=lab; |
cc80f89e | 128 | continue; |
129 | } | |
cf98c13f | 130 | |
131 | //MI change - addition | |
132 | Int_t micount=0; | |
133 | Int_t mi; | |
134 | AliTPCtrack * mitrack; | |
7f6ddf58 | 135 | for (mi=0; mi<nentr; mi++) { |
cf98c13f | 136 | mitrack=(AliTPCtrack*)tarray.UncheckedAt(mi); |
137 | if (lab==TMath::Abs(mitrack->GetLabel())) micount++; | |
138 | } | |
139 | if (micount>1) { | |
cf98c13f | 140 | track_multifound[itrack_multifound]=lab; |
141 | track_multifound_n[itrack_multifound]=micount; | |
142 | itrack_multifound++; | |
143 | } | |
144 | ||
7f6ddf58 | 145 | Double_t xk=gt[ngood].x; |
cc80f89e | 146 | track->PropagateTo(xk); |
3c0f9266 | 147 | |
cc80f89e | 148 | if (lab==tlab) hfound->Fill(ptg); |
cf98c13f | 149 | else { |
150 | track_fake[itrack_fake++]=lab; | |
151 | hfake->Fill(ptg); | |
cf98c13f | 152 | } |
cc80f89e | 153 | |
be9c5115 | 154 | Double_t par[5]; track->GetExternalParameters(xk,par); |
155 | Float_t phi=TMath::ASin(par[2]) + track->GetAlpha(); | |
156 | if (phi<-TMath::Pi()) phi+=2*TMath::Pi(); | |
157 | if (phi>=TMath::Pi()) phi-=2*TMath::Pi(); | |
158 | Float_t lam=TMath::ATan(par[3]); | |
159 | Float_t pt_1=TMath::Abs(par[4]); | |
cc80f89e | 160 | |
161 | if (TMath::Abs(gt[ngood].code)==11 && ptg>4.) { | |
be9c5115 | 162 | hmpt->Fill((pt_1 - 1/ptg)/(1/ptg)*100.); |
cc80f89e | 163 | } else { |
164 | Float_t phig=TMath::ATan2(gt[ngood].py,gt[ngood].px); | |
cc80f89e | 165 | hp->Fill((phi - phig)*1000.); |
3c0f9266 | 166 | |
cc80f89e | 167 | Float_t lamg=TMath::ATan2(gt[ngood].pz,ptg); |
cc80f89e | 168 | hl->Fill((lam - lamg)*1000.); |
169 | ||
be9c5115 | 170 | hpt->Fill((pt_1 - 1/ptg)/(1/ptg)*100.); |
cc80f89e | 171 | } |
73042f01 | 172 | |
be9c5115 | 173 | Float_t mom=1./(pt_1*TMath::Cos(lam)); |
73042f01 | 174 | Float_t dedx=track->GetdEdx(); |
cc80f89e | 175 | hep->Fill(mom,dedx,1.); |
176 | if (TMath::Abs(gt[ngood].code)==211) | |
177 | if (mom>0.4 && mom<0.5) { | |
178 | he->Fill(dedx,1.); | |
179 | } | |
73042f01 | 180 | |
cc80f89e | 181 | } |
182 | ||
cf98c13f | 183 | cout<<"\nList of Not found tracks :\n"; |
cf98c13f | 184 | for ( i = 0; i< itrack_notfound; i++){ |
185 | cout<<track_notfound[i]<<"\t"; | |
186 | if ((i%5)==4) cout<<"\n"; | |
187 | } | |
188 | cout<<"\nList of fake tracks :\n"; | |
189 | for ( i = 0; i< itrack_fake; i++){ | |
190 | cout<<track_fake[i]<<"\t"; | |
191 | if ((i%5)==4) cout<<"\n"; | |
192 | } | |
193 | cout<<"\nList of multiple found tracks :\n"; | |
194 | for ( i=0; i<itrack_multifound; i++) { | |
7f6ddf58 | 195 | cout<<"id. "<<track_multifound[i] |
196 | <<" found - "<<track_multifound_n[i]<<"times\n"; | |
cf98c13f | 197 | } |
8c555625 | 198 | |
7f6ddf58 | 199 | Stat_t ng=hgood->GetEntries(), nf=hfound->GetEntries(); |
200 | if (ng!=0) cerr<<"\n\nIntegral efficiency is about "<<nf/ng*100.<<" %\n"; | |
201 | cout<<"Total number of found tracks ="<<nentr<<endl; | |
202 | cout<<"Total number of \"good\" tracks =" | |
203 | <<mingood<<" (selected for comparison: "<<ng<<')'<<endl<<endl; | |
204 | ||
205 | ||
8c555625 | 206 | gStyle->SetOptStat(111110); |
207 | gStyle->SetOptFit(1); | |
208 | ||
209 | TCanvas *c1=new TCanvas("c1","",0,0,700,850); | |
210 | ||
211 | TPad *p1=new TPad("p1","",0,0.3,.5,.6); p1->Draw(); | |
212 | p1->cd(); p1->SetFillColor(42); p1->SetFrameFillColor(10); | |
213 | hp->SetFillColor(4); hp->SetXTitle("(mrad)"); hp->Fit("gaus"); c1->cd(); | |
214 | ||
215 | TPad *p2=new TPad("p2","",0.5,.3,1,.6); p2->Draw(); | |
216 | p2->cd(); p2->SetFillColor(42); p2->SetFrameFillColor(10); | |
217 | hl->SetXTitle("(mrad)"); hl->Fit("gaus"); c1->cd(); | |
218 | ||
219 | TPad *p3=new TPad("p3","",0,0,0.5,0.3); p3->Draw(); | |
220 | p3->cd(); p3->SetFillColor(42); p3->SetFrameFillColor(10); | |
221 | hpt->SetXTitle("(%)"); hpt->Fit("gaus"); c1->cd(); | |
222 | ||
223 | TPad *p4=new TPad("p4","",0.5,0,1,0.3); p4->Draw(); | |
224 | p4->cd(); p4->SetFillColor(42); p4->SetFrameFillColor(10); | |
cc80f89e | 225 | hmpt->SetXTitle("(%)"); hmpt->Fit("gaus"); c1->cd(); |
8c555625 | 226 | |
227 | TPad *p5=new TPad("p5","",0,0.6,1,1); p5->Draw(); p5->cd(); | |
3c0f9266 | 228 | p5->SetFillColor(41); p5->SetFrameFillColor(10); |
8c555625 | 229 | hfound->Sumw2(); hgood->Sumw2(); hfake->Sumw2(); |
230 | hg->Divide(hfound,hgood,1,1.,"b"); | |
231 | hf->Divide(hfake,hgood,1,1.,"b"); | |
232 | hg->SetMaximum(1.4); | |
233 | hg->SetYTitle("Tracking efficiency"); | |
234 | hg->SetXTitle("Pt (GeV/c)"); | |
235 | hg->Draw(); | |
236 | ||
7f6ddf58 | 237 | TLine *line1 = new TLine(0.1,1.0,6.1,1.0); line1->SetLineStyle(4); |
8c555625 | 238 | line1->Draw("same"); |
7f6ddf58 | 239 | TLine *line2 = new TLine(0.1,0.9,6.1,0.9); line2->SetLineStyle(4); |
8c555625 | 240 | line2->Draw("same"); |
241 | ||
242 | hf->SetFillColor(1); | |
243 | hf->SetFillStyle(3013); | |
244 | hf->SetLineColor(2); | |
245 | hf->SetLineWidth(2); | |
246 | hf->Draw("histsame"); | |
247 | TText *text = new TText(0.461176,0.248448,"Fake tracks"); | |
248 | text->SetTextSize(0.05); | |
249 | text->Draw(); | |
250 | text = new TText(0.453919,1.11408,"Good tracks"); | |
251 | text->SetTextSize(0.05); | |
252 | text->Draw(); | |
3c0f9266 | 253 | |
254 | ||
255 | ||
256 | TCanvas *c2=new TCanvas("c2","",320,32,530,590); | |
257 | ||
258 | TPad *p6=new TPad("p6","",0.,0.,1.,.5); p6->Draw(); | |
259 | p6->cd(); p6->SetFillColor(42); p6->SetFrameFillColor(10); | |
260 | he->SetFillColor(2); he->SetFillStyle(3005); | |
261 | he->SetXTitle("Arbitrary Units"); | |
262 | he->Fit("gaus"); c2->cd(); | |
263 | ||
264 | TPad *p7=new TPad("p7","",0.,0.5,1.,1.); p7->Draw(); | |
265 | p7->cd(); p7->SetFillColor(42); p7->SetFrameFillColor(10); | |
266 | hep->SetXTitle("p (Gev/c)"); hep->SetYTitle("dE/dX (Arb. Units)"); | |
267 | hep->Draw(); c1->cd(); | |
268 | ||
cf98c13f | 269 | gBenchmark->Stop("AliTPCComparison"); |
270 | gBenchmark->Show("AliTPCComparison"); | |
271 | ||
272 | ||
73042f01 | 273 | return 0; |
cc80f89e | 274 | } |
3c0f9266 | 275 | |
cc80f89e | 276 | |
7f6ddf58 | 277 | Int_t good_tracks_tpc(GoodTrackTPC *gt, const Int_t max, const Int_t event) { |
278 | Int_t nt=0; | |
cc80f89e | 279 | |
f38c8ae5 | 280 | TFile *file=TFile::Open("galice.root"); |
73042f01 | 281 | if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);} |
282 | ||
283 | if (!(gAlice=(AliRun*)file->Get("gAlice"))) { | |
284 | cerr<<"gAlice have not been found on galice.root !\n"; | |
285 | exit(5); | |
286 | } | |
287 | ||
7f6ddf58 | 288 | Int_t np=gAlice->GetEvent(event); |
cc80f89e | 289 | |
73042f01 | 290 | AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC"); |
291 | Int_t ver = TPC->IsVersion(); | |
292 | cerr<<"TPC version "<<ver<<" has been found !\n"; | |
293 | ||
024a7fe9 | 294 | AliTPCParamSR *digp=(AliTPCParamSR*)file->Get("75x40_100x60"); |
295 | if(digp){ | |
296 | cerr<<"2 pad-lenght geom hits with 3 pad-length geom digits...\n"; | |
297 | delete digp; | |
298 | digp = new AliTPCParamSR(); | |
299 | } | |
300 | else | |
301 | { | |
302 | digp =(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60"); | |
303 | } | |
73042f01 | 304 | if (!digp) { cerr<<"TPC parameters have not been found !\n"; exit(6); } |
305 | TPC->SetParam(digp); | |
306 | ||
024a7fe9 | 307 | |
308 | ||
73042f01 | 309 | Int_t nrow_up=digp->GetNRowUp(); |
310 | Int_t nrows=digp->GetNRowLow()+nrow_up; | |
311 | Int_t zero=digp->GetZeroSup(); | |
7f6ddf58 | 312 | Int_t gap=Int_t(0.125*nrows), shift=Int_t(0.5*gap); |
cc80f89e | 313 | Int_t good_number=Int_t(0.4*nrows); |
314 | ||
7f6ddf58 | 315 | Int_t *good=new Int_t[np]; |
316 | Int_t i; | |
317 | for (i=0; i<np; i++) good[i]=0; | |
318 | ||
319 | ||
320 | switch (ver) { | |
321 | case 1: | |
322 | { | |
323 | char cname[100]; sprintf(cname,"TreeC_TPC_%d",event); | |
324 | TFile *cf=TFile::Open("AliTPCclusters.root"); | |
325 | if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n";exit(5);} | |
326 | AliTPCClustersArray *pca=new AliTPCClustersArray, &ca=*pca; | |
327 | ca.Setup(digp); | |
328 | ca.SetClusterType("AliTPCcluster"); | |
329 | ca.ConnectTree(cname); | |
330 | Int_t nrows=Int_t(ca.GetTree()->GetEntries()); | |
331 | for (Int_t n=0; n<nrows; n++) { | |
332 | AliSegmentID *s=ca.LoadEntry(n); | |
333 | Int_t sec,row; | |
334 | digp->AdjustSectorRow(s->GetID(),sec,row); | |
335 | AliTPCClustersRow &clrow = *ca.GetRow(sec,row); | |
336 | Int_t ncl=clrow.GetArray()->GetEntriesFast(); | |
337 | while (ncl--) { | |
338 | AliTPCcluster *c=(AliTPCcluster*)clrow[ncl]; | |
339 | Int_t lab=c->GetLabel(0); | |
340 | if (lab<0) continue; //noise cluster | |
341 | lab=TMath::Abs(lab); | |
342 | ||
343 | if (sec>=digp->GetNInnerSector()) | |
344 | if (row==nrow_up-1) good[lab]|=0x4000; | |
345 | if (sec>=digp->GetNInnerSector()) | |
346 | if (row==nrow_up-1-gap) good[lab]|=0x1000; | |
347 | ||
348 | if (sec>=digp->GetNInnerSector()) | |
349 | if (row==nrow_up-1-shift) good[lab]|=0x2000; | |
350 | if (sec>=digp->GetNInnerSector()) | |
351 | if (row==nrow_up-1-gap-shift) good[lab]|=0x800; | |
352 | ||
353 | good[lab]++; | |
354 | } | |
355 | ca.ClearRow(sec,row); | |
356 | } | |
357 | delete pca; | |
358 | cf->Close(); | |
359 | } | |
afc42102 | 360 | break; |
7f6ddf58 | 361 | case 2: |
362 | { | |
7a09f434 | 363 | char dname[100]; sprintf(dname,"TreeD_75x40_100x60_150x60_%d",event); |
7f6ddf58 | 364 | TTree *TD=(TTree*)gDirectory->Get(dname); |
365 | AliSimDigits da, *digits=&da; | |
366 | TD->GetBranch("Segment")->SetAddress(&digits); | |
367 | ||
368 | Int_t *count = new Int_t[np]; | |
369 | Int_t i; | |
370 | for (i=0; i<np; i++) count[i]=0; | |
371 | ||
372 | Int_t sectors_by_rows=(Int_t)TD->GetEntries(); | |
373 | for (i=0; i<sectors_by_rows; i++) { | |
374 | if (!TD->GetEvent(i)) continue; | |
375 | Int_t sec,row; | |
376 | digp->AdjustSectorRow(digits->GetID(),sec,row); | |
377 | cerr<<sec<<' '<<row<<" \r"; | |
378 | digits->First(); | |
379 | do { //Many thanks to J.Chudoba who noticed this | |
380 | Int_t it=digits->CurrentRow(), ip=digits->CurrentColumn(); | |
381 | Short_t dig = digits->GetDigit(it,ip); | |
382 | Int_t idx0=digits->GetTrackID(it,ip,0); | |
383 | Int_t idx1=digits->GetTrackID(it,ip,1); | |
384 | Int_t idx2=digits->GetTrackID(it,ip,2); | |
8ded1b7a | 385 | if (idx0>=0 && dig>=zero && idx0<np) count[idx0]+=1; |
386 | if (idx1>=0 && dig>=zero && idx1<np) count[idx1]+=1; | |
387 | if (idx2>=0 && dig>=zero && idx2<np) count[idx2]+=1; | |
afc42102 | 388 | } while (digits->Next()); |
7f6ddf58 | 389 | for (Int_t j=0; j<np; j++) { |
390 | if (count[j]>1) { | |
391 | if (sec>=digp->GetNInnerSector()) | |
392 | if (row==nrow_up-1 ) good[j]|=0x4000; | |
393 | if (sec>=digp->GetNInnerSector()) | |
394 | if (row==nrow_up-1-gap) good[j]|=0x1000; | |
395 | ||
396 | if (sec>=digp->GetNInnerSector()) | |
397 | if (row==nrow_up-1-shift) good[j]|=0x2000; | |
398 | if (sec>=digp->GetNInnerSector()) | |
399 | if (row==nrow_up-1-gap-shift) good[j]|=0x800; | |
400 | good[j]++; | |
401 | } | |
402 | count[j]=0; | |
403 | } | |
404 | } | |
405 | delete[] count; | |
406 | delete TD; //Thanks to Mariana Bondila | |
afc42102 | 407 | } |
7f6ddf58 | 408 | break; |
409 | default: | |
410 | cerr<<"Invalid TPC version !\n"; | |
411 | file->Close(); | |
412 | exit(7); | |
cc80f89e | 413 | } |
7f6ddf58 | 414 | |
415 | ||
416 | /** select tracks which are "good" enough **/ | |
417 | for (i=0; i<np; i++) { | |
418 | if ((good[i]&0x5000) != 0x5000) | |
419 | if ((good[i]&0x2800) != 0x2800) continue; | |
420 | if ((good[i]&0x7FF ) < good_number) continue; | |
421 | ||
422 | TParticle *p = (TParticle*)gAlice->Particle(i); | |
423 | ||
424 | if (p->Pt()<0.100) continue; | |
425 | if (TMath::Abs(p->Pz()/p->Pt())>0.999) continue; | |
426 | ||
427 | Int_t j=p->GetFirstMother(); | |
428 | if (j>=0) { | |
024a7fe9 | 429 | TParticle *pp = (TParticle*)gAlice->Particle(j); |
430 | if (pp->GetFirstMother()>=0) continue;//only one decay is allowed | |
431 | /* for cascade hyperons only | |
432 | Int_t jj=pp->GetFirstMother(); | |
433 | if (jj>=0) { | |
434 | TParticle *ppp = (TParticle*)gAlice->Particle(jj); | |
435 | if (ppp->GetFirstMother()>=0) continue;//two decays are allowed | |
436 | } | |
437 | */ | |
7f6ddf58 | 438 | } |
439 | ||
440 | gt[nt].lab=i; | |
441 | gt[nt].code=p->GetPdgCode(); | |
442 | gt[nt].px=0.; gt[nt].py=0.; gt[nt].pz=0.; | |
527abbe9 | 443 | gt[nt].x=0.; gt[nt].y=0.; gt[nt].z=0.; |
7f6ddf58 | 444 | nt++; |
445 | if (nt==max) {cerr<<"Too many good tracks !\n"; break;} | |
446 | cerr<<np-i<<" \r"; | |
447 | } | |
448 | ||
449 | /** check if there is also information at the entrance of the TPC **/ | |
450 | TTree *TH=gAlice->TreeH(); np=(Int_t)TH->GetEntries(); | |
451 | for (i=0; i<np; i++) { | |
452 | TPC->ResetHits(); | |
453 | TH->GetEvent(i); | |
454 | AliTPChit *phit = (AliTPChit*)TPC->FirstHit(-1); | |
455 | for ( ; phit; phit=(AliTPChit*)TPC->NextHit() ) { | |
456 | if (phit->fQ !=0. ) continue; | |
457 | ||
458 | Double_t px=phit->X(), py=phit->Y(), pz=phit->Z(); | |
459 | ||
460 | if ((phit=(AliTPChit*)TPC->NextHit())==0) break; | |
461 | if (phit->fQ != 0.) continue; | |
462 | ||
463 | Double_t x=phit->X(), y=phit->Y(), z=phit->Z(); | |
464 | if (TMath::Sqrt(x*x+y*y)>90.) continue; | |
465 | ||
466 | Int_t j, lab=phit->Track(); | |
467 | for (j=0; j<nt; j++) {if (gt[j].lab==lab) break;} | |
468 | if (j==nt) continue; | |
469 | ||
470 | // (px,py,pz) - in global coordinate system, (x,y,z) - in local ! | |
471 | gt[j].px=px; gt[j].py=py; gt[j].pz=pz; | |
472 | Float_t cs,sn; digp->AdjustCosSin(phit->fSector,cs,sn); | |
473 | gt[j].x = x*cs + y*sn; | |
474 | gt[j].y =-x*sn + y*cs; | |
475 | gt[j].z = z; | |
476 | } | |
477 | cerr<<np-i<<" \r"; | |
478 | } | |
479 | ||
480 | delete[] good; | |
481 | ||
be9c5115 | 482 | delete gAlice; gAlice=0; |
7f6ddf58 | 483 | |
73042f01 | 484 | file->Close(); |
cf98c13f | 485 | gBenchmark->Stop("AliTPCComparison"); |
486 | gBenchmark->Show("AliTPCComparison"); | |
cc80f89e | 487 | return nt; |
8c555625 | 488 | } |
489 | ||
73042f01 | 490 | |
491 |