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