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