]>
Commit | Line | Data |
---|---|---|
3f6ade4c | 1 | /**************************************************************************** |
2 | * A standalone comparison macro for the upgraded ITS. * | |
3 | * * | |
4 | * Creates list of "trackable" tracks, * | |
5 | * calculates efficiency, resolutions etc. * | |
6 | * The ESD tracks must be in an appropriate state: kITSrefit * | |
7 | * * | |
8 | * The efficiency and resolutions are calculated * | |
9 | * wrt "primary-like" pions within the acceptance tan(lambda)~[-1,1] * | |
10 | * and for tracks having all 7 clusters correctly assigned. * | |
11 | * * | |
12 | * Before running, load the ITSU libraries: * | |
13 | * gSystem->Load("libITSUpgradeBase");gSystem->Load("libITSUpgradeRec"); * | |
14 | * * | |
15 | * Origin: I.Belikov, IPHC, Iouri.Belikov@iphc.cnrs.fr * | |
16 | ****************************************************************************/ | |
17 | ||
18 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
19 | #include <TMath.h> | |
20 | #include <TError.h> | |
21 | #include <Riostream.h> | |
22 | #include <TH1F.h> | |
23 | #include <TH2F.h> | |
24 | #include <TTree.h> | |
25 | #include <TParticle.h> | |
26 | #include <TCanvas.h> | |
27 | #include <TLine.h> | |
28 | #include <TText.h> | |
29 | #include <TBenchmark.h> | |
30 | #include <TStyle.h> | |
31 | #include <TFile.h> | |
32 | #include <TROOT.h> | |
33 | ||
34 | #include "AliStack.h" | |
35 | #include "AliHeader.h" | |
36 | #include "AliGenEventHeader.h" | |
37 | #include "AliTrackReference.h" | |
38 | #include "AliRunLoader.h" | |
39 | #include "AliRun.h" | |
40 | #include "AliESDEvent.h" | |
41 | #include "AliESDtrack.h" | |
42 | ||
43 | #include "UPGRADE/AliITSUClusterPix.h" | |
44 | #include "UPGRADE/AliITSULoader.h" | |
45 | #endif | |
46 | ||
47 | Int_t GoodTracksCooked(const Char_t *dir="."); | |
48 | ||
49 | extern AliRun *gAlice; | |
50 | extern TBenchmark *gBenchmark; | |
51 | extern TROOT *gROOT; | |
52 | ||
53 | static Int_t allgood=0; | |
54 | static Int_t allselected=0; | |
55 | static Int_t allfound=0; | |
56 | ||
57 | void root(TH1 *h) { | |
58 | Int_t nb=h->GetNbinsX(); | |
59 | for (Int_t i=0; i<nb; i++) { | |
60 | Float_t c=h->GetBinContent(i); | |
61 | c=TMath::Sqrt(c); | |
62 | h->SetBinContent(i,c); | |
63 | ||
64 | Float_t e=h->GetBinError(i); | |
65 | if (c!=0) e = 0.5*e/c; | |
66 | h->SetBinError(i,e); | |
67 | } | |
68 | } | |
69 | void divide(TH1 *h) { | |
70 | Int_t nb=h->GetNbinsX(); | |
71 | for (Int_t i=0; i<nb; i++) { | |
72 | Float_t c=h->GetBinContent(i); | |
73 | c *= h->GetBinCenter(i); | |
74 | h->SetBinContent(i,c); | |
75 | ||
76 | Float_t e=h->GetBinError(i); | |
77 | e *= h->GetBinCenter(i); | |
78 | h->SetBinError(i,e); | |
79 | } | |
80 | } | |
81 | ||
82 | Int_t AliITSUComparisonCooked | |
83 | (Float_t ptcutl=0.01, Float_t ptcuth=10., const Char_t *dir=".") { | |
84 | gBenchmark->Start("AliITSUComparisonCooked"); | |
85 | ||
86 | ::Info("AliITSUComparisonCooked.C","Doing comparison..."); | |
87 | ||
88 | ||
89 | TH1F *hp=(TH1F*)gROOT->FindObject("hp"); | |
90 | if (!hp) hp=new TH1F("hp","PHI resolution",50,-20.,20.); | |
91 | hp->SetFillColor(4); | |
92 | ||
93 | TH1F *hl=(TH1F*)gROOT->FindObject("hl"); | |
94 | if (!hl) hl=new TH1F("hl","LAMBDA resolution",50,-20,20); | |
95 | hl->SetFillColor(4); | |
96 | ||
97 | //TH1F *hz=(TH1F*)gROOT->FindObject("hz"); | |
98 | //if (!hz) hz=new TH1F("hz","Longitudinal impact parameter",30,-777.,777.); | |
99 | ||
100 | ||
101 | Int_t nb=100; | |
102 | Float_t xbins[nb+1]; | |
103 | Double_t a=TMath::Log(ptcuth/ptcutl)/nb; | |
104 | for (Int_t i=0; i<=nb; i++) xbins[i] = ptcutl*TMath::Exp(i*a); | |
105 | ||
106 | TH1F *hgood=(TH1F*)gROOT->FindObject("hgood"); | |
107 | if (!hgood) hgood=new TH1F("hgood","Good tracks",nb,xbins); | |
108 | ||
109 | TH1F *hfound=(TH1F*)gROOT->FindObject("hfound"); | |
110 | if (!hfound) hfound=new TH1F("hfound","Found tracks",nb,xbins); | |
111 | ||
112 | TH1F *hfake=(TH1F*)gROOT->FindObject("hfake"); | |
113 | if (!hfake) hfake=new TH1F("hfake","Fake tracks",nb,xbins); | |
114 | ||
115 | TH1F *hg=(TH1F*)gROOT->FindObject("hg"); | |
116 | if (!hg) hg=new TH1F("hg","Efficiency for good tracks",nb,xbins); | |
117 | hg->SetLineColor(4); hg->SetLineWidth(2); | |
118 | ||
119 | TH1F *hf=(TH1F*)gROOT->FindObject("hf"); | |
120 | if (!hf) hf=new TH1F("hf","Efficiency for fake tracks",nb,xbins); | |
121 | hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2); | |
122 | ||
123 | TH1F *hpt=(TH1F*)gROOT->FindObject("hpt"); | |
124 | if (!hpt) hpt=new TH1F("hpt","Relative Pt resolution",nb,xbins); | |
125 | hpt->Sumw2(); | |
126 | TH1F *hd=(TH1F*)gROOT->FindObject("hd"); | |
127 | if (!hd) | |
128 | hd=new TH1F("hd","Transverse impact parameter",nb,xbins); | |
129 | hd->Sumw2(); | |
130 | ||
131 | ||
132 | Char_t fname[100]; | |
133 | sprintf(fname,"%s/GoodTracksCooked.root",dir); | |
134 | ||
135 | TFile *refFile=TFile::Open(fname,"old"); | |
136 | if (!refFile || !refFile->IsOpen()) { | |
137 | ::Info("AliITSUComparisonCooked.C","Marking good tracks (will take a while)..."); | |
138 | if (GoodTracksCooked(dir)) { | |
139 | ::Error("AliITSUComparisonCooked.C","Can't generate the reference file !"); | |
140 | return 1; | |
141 | } | |
142 | } | |
143 | refFile=TFile::Open(fname,"old"); | |
144 | if (!refFile || !refFile->IsOpen()) { | |
145 | ::Error("AliITSUComparisonCooked.C","Can't open the reference file !"); | |
146 | return 1; | |
147 | } | |
148 | ||
149 | TTree *itsTree=(TTree*)refFile->Get("itsTree"); | |
150 | if (!itsTree) { | |
151 | ::Error("AliITSUComparisonCooked.C","Can't get the reference tree !"); | |
152 | return 2; | |
153 | } | |
154 | TBranch *branch=itsTree->GetBranch("ITS"); | |
155 | if (!branch) { | |
156 | ::Error("AliITSUComparisonCooked.C","Can't get the ITS branch !"); | |
157 | return 3; | |
158 | } | |
159 | TClonesArray dummy("AliTrackReference",1000), *refs=&dummy; | |
160 | branch->SetAddress(&refs); | |
161 | ||
162 | ||
163 | sprintf(fname,"%s/AliESDs.root",dir); | |
164 | TFile *ef=TFile::Open(fname); | |
165 | if ((!ef)||(!ef->IsOpen())) { | |
166 | sprintf(fname,"%s/AliESDits.root",dir); | |
167 | ef=TFile::Open(fname); | |
168 | if ((!ef)||(!ef->IsOpen())) { | |
169 | ::Error("AliITSUComparisonCooked.C","Can't open AliESDits.root !"); | |
170 | return 4; | |
171 | } | |
172 | } | |
173 | AliESDEvent* event = new AliESDEvent(); | |
174 | TTree* esdTree = (TTree*) ef->Get("esdTree"); | |
175 | if (!esdTree) { | |
176 | ::Error("AliITSComparison.C", "no ESD tree found"); | |
177 | return 6; | |
178 | } | |
179 | event->ReadFromTree(esdTree); | |
180 | ||
181 | ||
182 | //******* Loop over events ********* | |
183 | Int_t e=0; | |
184 | while (esdTree->GetEvent(e)) { | |
185 | cout<<endl<<endl<<"********* Processing event number: "<<e<<"*******\n"; | |
186 | ||
187 | Int_t nentr=event->GetNumberOfTracks(); | |
188 | allfound+=nentr; | |
189 | ||
190 | if (itsTree->GetEvent(e++)==0) { | |
191 | cerr<<"No reconstructable tracks !\n"; | |
192 | continue; | |
193 | } | |
194 | ||
195 | Int_t ngood=refs->GetEntriesFast(); | |
196 | allgood+=ngood; | |
197 | ||
198 | const Int_t MAX=15000; | |
199 | Int_t notf[MAX], nnotf=0; | |
200 | Int_t fake[MAX], nfake=0; | |
201 | Int_t mult[MAX], numb[MAX], nmult=0; | |
202 | Int_t k; | |
203 | for (k=0; k<ngood; k++) { | |
204 | AliTrackReference *ref=(AliTrackReference*)refs->UncheckedAt(k); | |
205 | Int_t lab=ref->Label(), tlab=-1; | |
206 | Float_t ptg=TMath::Sqrt(ref->Px()*ref->Px() + ref->Py()*ref->Py()); | |
207 | ||
208 | Int_t pdg=(Int_t)ref->GetLength(); //this is particle's PDG ! | |
209 | if (TMath::Abs(pdg)!=211) continue; //select pions only | |
210 | ||
211 | if (ptg<ptcutl) continue; | |
212 | if (ptg>ptcuth) continue; | |
213 | ||
214 | allselected++; | |
215 | ||
216 | hgood->Fill(ptg); | |
217 | ||
218 | AliESDtrack *esd=0; | |
219 | Int_t cnt=0; | |
220 | for (Int_t i=0; i<nentr; i++) { | |
221 | AliESDtrack *t=event->GetTrack(i); | |
222 | UInt_t status=t->GetStatus(); | |
223 | ||
224 | if ((status&AliESDtrack::kITSrefit)==0) continue; | |
225 | if (t->GetITSclusters(0)<4) continue; | |
226 | ||
227 | Int_t lbl=t->GetLabel(); | |
228 | if (lab==TMath::Abs(lbl)) { | |
229 | if (cnt==0) {esd=t; tlab=lbl;} | |
230 | if (lbl> 0) {esd=t; tlab=lbl;} | |
231 | cnt++; | |
232 | } | |
233 | } | |
234 | if (cnt==0) { | |
235 | notf[nnotf++]=lab; | |
236 | continue; | |
237 | } else if (cnt>1){ | |
238 | mult[nmult]=lab; | |
239 | numb[nmult]=cnt; nmult++; | |
240 | } | |
241 | ||
242 | if (lab==tlab) hfound->Fill(ptg); | |
243 | else { | |
244 | fake[nfake++]=lab; | |
245 | hfake->Fill(ptg); | |
246 | } | |
247 | ||
248 | if (esd->GetLabel()<0) continue; //resolutions for good tracks only | |
249 | ||
250 | Double_t alpha=esd->GetAlpha(),xv,par[5]; | |
251 | esd->GetExternalParameters(xv,par); | |
252 | Float_t phi=TMath::ASin(par[2]) + alpha; | |
253 | if (phi<-TMath::Pi()) phi+=2*TMath::Pi(); | |
254 | if (phi>=TMath::Pi()) phi-=2*TMath::Pi(); | |
255 | Float_t lam=TMath::ATan(par[3]); | |
256 | Float_t pt_1=TMath::Abs(par[4]); | |
257 | ||
258 | Float_t phig=TMath::ATan2(ref->Py(),ref->Px()); | |
259 | hp->Fill((phi - phig)*1000.); | |
260 | ||
261 | Float_t lamg=TMath::ATan2(ref->Pz(),ptg); | |
262 | hl->Fill((lam - lamg)*1000.); | |
263 | ||
264 | Float_t d,z; esd->GetImpactParameters(d,z); | |
265 | d*=10000; //microns | |
266 | Float_t w=d*d; | |
267 | hd->Fill(ptg, w); | |
268 | //z*=10000; //microns | |
269 | //hz->Fill(z); | |
270 | ||
271 | w=(pt_1 - 1/ptg)*100 * (pt_1-1/ptg)*100; | |
272 | hpt->Fill(ptg, w); | |
273 | ||
274 | } | |
275 | ||
276 | cout<<"\nList of Not found tracks :\n"; | |
277 | for (k=0; k<nnotf; k++){ | |
278 | cout<<notf[k]<<"\t"; | |
279 | if ((k%9)==8) cout<<"\n"; | |
280 | } | |
281 | cout<<"\n\nList of fake tracks :\n"; | |
282 | for (k=0; k<nfake; k++){ | |
283 | cout<<fake[k]<<"\t"; | |
284 | if ((k%9)==8) cout<<"\n"; | |
285 | } | |
286 | cout<<"\n\nList of multiple found tracks :\n"; | |
287 | for (k=0; k<nmult; k++) { | |
288 | cout<<"id. "<<mult[k] | |
289 | <<" found - "<<numb[k]<<"times\n"; | |
290 | } | |
291 | cout<<endl; | |
292 | ||
293 | cout<<"Number of found tracks : "<<nentr<<endl; | |
294 | cout<<"Number of \"good\" tracks : "<<ngood<<endl; | |
295 | ||
296 | refs->Clear(); | |
297 | } //***** End of the loop over events | |
298 | ||
299 | delete event; | |
300 | delete esdTree; | |
301 | ef->Close(); | |
302 | ||
303 | delete itsTree; | |
304 | refFile->Close(); | |
305 | ||
306 | Stat_t ng=hgood->GetEntries(), nf=hfound->GetEntries(); | |
307 | if (ng!=0) cout<<"\n\nIntegral efficiency is about "<<nf/ng*100.<<" %\n"; | |
308 | cout<<"Total number selected of \"good\" tracks ="<<allselected<<endl<<endl; | |
309 | cout<<"Total number of found tracks ="<<allfound<<endl; | |
310 | cout<<"Total number of \"good\" tracks ="<<allgood<<endl; | |
311 | cout<<endl; | |
312 | ||
313 | gStyle->SetOptStat(111110); | |
314 | gStyle->SetOptFit(1); | |
315 | ||
316 | TCanvas *c1=new TCanvas("c1","",0,0,700,850); | |
317 | ||
318 | Int_t minc=33; | |
319 | ||
320 | TPad *p1=new TPad("p1","",0,0.3,.5,.6); p1->Draw(); | |
321 | p1->cd(); p1->SetFillColor(42); p1->SetFrameFillColor(10); | |
322 | hp->SetFillColor(4); hp->SetXTitle("(mrad)"); | |
323 | if (hp->GetEntries()<minc) hp->Draw(); else hp->Fit("gaus"); c1->cd(); | |
324 | ||
325 | TPad *p2=new TPad("p2","",0.5,.3,1,.6); p2->Draw(); | |
326 | p2->cd(); p2->SetFillColor(42); p2->SetFrameFillColor(10); | |
327 | hl->SetXTitle("(mrad)"); | |
328 | if (hl->GetEntries()<minc) hl->Draw(); else hl->Fit("gaus"); c1->cd(); | |
329 | ||
330 | TPad *p3=new TPad("p3","",0,0,0.5,0.3); | |
331 | p3->SetLogx(); p3->SetGridx(); p3->SetGridy(); | |
332 | p3->Draw(); | |
333 | p3->cd(); p3->SetFillColor(42); p3->SetFrameFillColor(10); | |
334 | hpt->SetXTitle("p_{T} (GeV/c)"); | |
335 | hpt->SetYTitle("(%)"); | |
336 | TH1F *hh=new TH1F(*hfound); | |
337 | //hh->Add(hfake); | |
338 | hpt->Divide(hh); | |
339 | root(hpt); | |
340 | divide(hpt); | |
341 | hpt->Draw(); c1->cd(); | |
342 | ||
343 | TPad *p4=new TPad("p4","",0.5,0,1,0.3); | |
344 | p4->SetLogx(); p4->SetGridx(); p4->SetGridy(); | |
345 | p4->Draw(); | |
346 | p4->cd(); p4->SetFillColor(42); p4->SetFrameFillColor(10); | |
347 | hd->SetXTitle("p_{T} (GeV/c)"); | |
348 | hd->SetYTitle("(micron)"); | |
349 | hd->Divide(hh); | |
350 | root(hd); | |
351 | hd->Draw(); c1->cd(); | |
352 | ||
353 | //hz->Draw("same"); c1->cd(); | |
354 | ||
355 | ||
356 | TPad *p5=new TPad("p5","",0,0.6,1,1); | |
357 | p5->SetLogx(); p5->SetGridx(); p5->SetGridy(); | |
358 | p5->Draw(); p5->cd(); | |
359 | p5->SetFillColor(41); p5->SetFrameFillColor(10); | |
360 | hfound->Sumw2(); hgood->Sumw2(); hfake->Sumw2(); | |
361 | hg->Divide(hfound,hgood,1,1.,"b"); | |
362 | hf->Divide(hfake,hgood,1,1.,"b"); | |
363 | hg->SetYTitle("Tracking efficiency (%)"); | |
364 | hg->SetXTitle("p_{T} (GeV/c)"); | |
365 | hg->Scale(100); | |
366 | hg->Draw(); | |
367 | ||
368 | hf->SetFillColor(1); | |
369 | hf->SetFillStyle(3013); | |
370 | hf->SetLineColor(2); | |
371 | hf->SetLineWidth(2); | |
372 | hf->Scale(100); | |
373 | hf->Draw("histsame"); | |
374 | TText *text = new TText(0.4, 20., "Fake tracks"); | |
375 | text->SetTextSize(0.05); | |
376 | text->Draw(); | |
377 | text = new TText(0.4, 80., "Good tracks"); | |
378 | text->SetTextSize(0.05); | |
379 | text->Draw(); | |
380 | ||
381 | TFile fc("AliITSUComparisonCooked.root","RECREATE"); | |
382 | c1->Write(); | |
383 | fc.Close(); | |
384 | ||
385 | gBenchmark->Stop("AliITSUComparisonCooked"); | |
386 | gBenchmark->Show("AliITSUComparisonCooked"); | |
387 | ||
388 | return 0; | |
389 | } | |
390 | ||
391 | ||
392 | ||
393 | Int_t GoodTracksCooked(const Char_t *dir) { | |
394 | if (gAlice) { | |
395 | delete AliRunLoader::Instance(); | |
396 | delete gAlice;//if everything was OK here it is already NULL | |
397 | gAlice = 0x0; | |
398 | } | |
399 | ||
400 | Char_t fname[100]; | |
401 | sprintf(fname,"%s/galice.root",dir); | |
402 | ||
403 | AliRunLoader *rl = AliRunLoader::Open(fname,"COMPARISON"); | |
404 | if (!rl) { | |
405 | ::Error("GoodTracksCooked","Can't start session !"); | |
406 | return 1; | |
407 | } | |
408 | ||
409 | rl->LoadgAlice(); | |
410 | rl->LoadHeader(); | |
411 | rl->LoadKinematics(); | |
412 | ||
413 | AliITSULoader* itsl = (AliITSULoader*)rl->GetLoader("ITSLoader"); | |
414 | if (itsl == 0x0) { | |
415 | ::Error("GoodTracksCooked","Can not find the ITSLoader"); | |
416 | delete rl; | |
417 | return 4; | |
418 | } | |
419 | itsl->LoadRecPoints(); | |
420 | ||
421 | ||
422 | Int_t nev=rl->GetNumberOfEvents(); | |
423 | ::Info("GoodTracksCooked","Number of events : %d\n",nev); | |
424 | ||
425 | sprintf(fname,"%s/GoodTracksCooked.root",dir); | |
426 | TFile *itsFile=TFile::Open(fname,"recreate"); | |
427 | TClonesArray dummy2("AliTrackReference",1000), *itsRefs=&dummy2; | |
428 | TTree itsTree("itsTree","Tree with info about the reconstructable ITS tracks"); | |
429 | itsTree.Branch("ITS",&itsRefs); | |
430 | ||
431 | //******** Loop over generated events | |
432 | for (Int_t e=0; e<nev; e++) { | |
433 | Int_t k; | |
434 | ||
435 | rl->GetEvent(e); itsFile->cd(); | |
436 | ||
437 | Int_t np = rl->GetHeader()->GetNtrack(); | |
438 | cout<<"Event "<<e<<" Number of particles: "<<np<<endl; | |
439 | ||
440 | AliGenEventHeader *h=rl->GetHeader()->GenEventHeader(); | |
441 | TArrayF vtx(3); | |
442 | h->PrimaryVertex(vtx); | |
443 | ||
444 | //******** Fill the "good" masks | |
445 | Int_t *good=new Int_t[np]; for (k=0; k<np; k++) good[k]=0; | |
446 | ||
447 | TTree *cTree=itsl->TreeR(); | |
448 | if (!cTree) { | |
449 | ::Error("GoodTracksCooked","Can't get the cluster tree !"); | |
450 | delete rl; | |
451 | return 8; | |
452 | } | |
453 | ||
454 | const Int_t nLayers=7; | |
455 | TBranch *branch[nLayers]; | |
456 | TClonesArray clusters[nLayers]; | |
457 | for (Int_t layer=0; layer<nLayers; layer++) { | |
458 | TClonesArray *ptr = | |
459 | new(clusters+layer) TClonesArray("AliITSUClusterPix",1000); | |
460 | Char_t bname[33]; | |
461 | sprintf(bname,"ITSRecPoints%d\0",layer); | |
462 | branch[layer]=cTree->GetBranch(bname); | |
463 | if (!branch[layer]) { | |
464 | ::Error("GoodTracksCooked","Can't get the clusters branch !"); | |
465 | delete rl; | |
466 | return 9; | |
467 | } | |
468 | branch[layer]->SetAddress(&ptr); | |
469 | } | |
470 | ||
471 | Int_t entr=(Int_t)cTree->GetEntries(); | |
472 | for (k=0; k<entr; k++) { | |
473 | cTree->GetEvent(k); | |
474 | for (Int_t lay=0; lay<nLayers; lay++) { | |
475 | Int_t ncl=clusters[lay].GetEntriesFast(); if (ncl==0) continue; | |
476 | while (ncl--) { | |
477 | AliITSUClusterPix *pnt= | |
478 | (AliITSUClusterPix*)clusters[lay].UncheckedAt(ncl); | |
479 | Int_t l0=pnt->GetLabel(0); | |
480 | if (l0>=np) { | |
481 | // cerr<<"Wrong label: "<<l0<<endl; | |
482 | continue; | |
483 | } | |
484 | Int_t l1=pnt->GetLabel(1); | |
485 | if (l1>=np) { | |
486 | // cerr<<"Wrong label: "<<l1<<endl; | |
487 | continue; | |
488 | } | |
489 | Int_t l2=pnt->GetLabel(2); | |
490 | if (l2>=np) { | |
491 | // cerr<<"Wrong label: "<<l2<<endl; | |
492 | continue; | |
493 | } | |
494 | Int_t mask=1<<lay; | |
495 | if (l0>=0) good[l0]|=mask; | |
496 | if (l1>=0) good[l1]|=mask; | |
497 | if (l2>=0) good[l2]|=mask; | |
498 | } | |
499 | clusters[lay].Clear(); | |
500 | } | |
501 | } | |
502 | ||
503 | ||
504 | ||
505 | //****** select tracks which are "good" enough | |
506 | AliStack* stack = rl->Stack(); | |
507 | Int_t nt=0; | |
508 | for (k=0; k<np; k++) { | |
509 | if (good[k] != 0x7F) continue; | |
510 | ||
511 | TParticle *p = (TParticle*)stack->Particle(k); | |
512 | if (p == 0x0) { | |
513 | cerr<<"Can not get particle "<<k<<endl; | |
514 | continue; | |
515 | } | |
516 | ||
517 | if (p->Pt() <= 0.) continue; | |
518 | if (TMath::Abs(p->Pz()/p->Pt())>0.999) continue; | |
519 | ||
520 | Double_t dx=p->Vx()-vtx[0], dy=p->Vy()-vtx[1], dz=p->Vz()-vtx[2]; | |
521 | if (TMath::Sqrt(dx*dx+dy*dy)>0.0001) continue; //Primary-like | |
522 | if (TMath::Abs(dz) > 0.0001) continue; | |
523 | ||
524 | AliTrackReference *ref=new((*itsRefs)[nt]) AliTrackReference(); | |
525 | ref->SetLabel(k); | |
526 | Int_t pdg=p->GetPdgCode(); | |
527 | ref->SetLength(pdg); //This will the particle's PDG ! | |
528 | ref->SetMomentum(p->Px(),p->Py(),p->Pz()); | |
529 | ref->SetPosition(p->Vx(),p->Vy(),p->Vz()); | |
530 | nt++; | |
531 | } | |
532 | ||
533 | itsTree.Fill(); | |
534 | itsRefs->Clear(); | |
535 | ||
536 | delete[] good; | |
537 | ||
538 | } //*** end of the loop over generated events | |
539 | ||
540 | itsTree.Write(); | |
541 | itsFile->Close(); | |
542 | ||
543 | delete rl; | |
544 | return 0; | |
545 | } | |
546 | ||
547 |