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