1 //=========================================
6 char tit[]="--------------------------";
7 TH1F pions=TH1F("Qpi",tit,100,0.5,PMax);
10 TH2F qplotP, qplotKa, qplotPi, qplotE;
13 void dedxhis(Int_t pcod=0,Float_t pmin=0,Float_t pmax=1300)
15 if(!q1plot)q1plot = new TH1F("Qhis","Particle charge",100,0.5,PMax);
16 if(!qplot){ qplot = new TH2F("Qtrm","Qtrm vs Pmom",100,0,1300,100,0,13);
17 // TH2F qplotP, qplotKa, qplotPi, qplotE;
19 qplotP.SetMarkerStyle(8); qplotP.SetMarkerColor(kBlack); qplotP.SetMarkerSize(.2);
21 qplotKa.SetMarkerStyle(8); qplotKa.SetMarkerColor(kRed); qplotKa.SetMarkerSize(.2);
23 qplotPi.SetMarkerStyle(8); qplotPi.SetMarkerColor(kBlue); qplotPi.SetMarkerSize(.2);
25 qplotE.SetMarkerStyle(8); qplotE.SetMarkerColor(kGreen); qplotE.SetMarkerSize(.2);
28 qplotPi.Reset(); qplotKa.Reset(); qplotE.Reset();
30 // -------------------------------------------------------------
32 for(Int_t i=0;i<NStat;i++){
33 TVector tabv(*( pid->GetVec(i) ));
34 Qtr=tabv(6);Pmom=tabv(10);
37 //qplot->Fill( Pmom,Qtr );
38 if(tabv(11)==2212)qplotP.Fill( Pmom,Qtr );
39 if(tabv(11)== 321)qplotKa.Fill( Pmom,Qtr );
40 if(tabv(11)== 211)qplotPi.Fill( Pmom,Qtr );
41 if(tabv(11)== 11)qplotE.Fill( Pmom,Qtr );
44 else { if(tabv(11)==pcod && tabv(0)>=1 )qplot->Fill( Pmom,Qtr );}
46 //if( tabv(0)>=2 && tabv(11)==pcod )qplot->Fill( Pmom,Qtr );
47 //if(tabv(0)>=1)qplot->Fill( Pmom,Qtr );
48 if(Pmom>pmin&&Pmom<pmax)q1plot->Fill(Qtr);
50 // ------------------------------------------------------------
51 // c1=new TCanvas("c1"," ",10,10,700,500);
52 // pad1 =new TPad("p1"," " ,0 , 0,0,1,21);
53 // pad1 =new TPad("p1"," " ,0 , 0,.3,1,21);
54 // pad2 =new TPad("p2"," " ,.35, 0, 1,1,0);
55 // pad2->Draw(); pad2->cd();
56 //.....................
57 //if(pcod==0){ qplotP.Draw(); qplotKa.Draw("same"); qplotPi.Draw("same"); qplotE.Draw("same"); }
61 //qplotP->GetXaxis()->SetTitleSize(0.05);
62 //qplotP->GetYaxis()->SetTitleSize(0.05);
63 //gPad->SetFillColor(kWhite); // b.b.
64 gStyle->SetOptStat(0);
65 qplotP->SetXTitle("(Mev/c)");
66 qplotP->SetYTitle("(mips)");
67 qplotP.Draw(); qplotKa.Draw("same"); qplotPi.Draw("same");
69 TText *text = new TText(800.,11.,"Protons");
70 text->SetTextSize(0.05);
71 text->SetTextColor(kBlack);
73 TText *text = new TText(800.,10.,"Kaons");
74 text->SetTextSize(0.05);
75 text->SetTextColor(kRed);
77 TText *text = new TText(800.,9.,"Pions");
78 text->SetTextSize(0.05);
79 text->SetTextColor(kBlue);
81 TText *text = new TText(800.,8.,"Electrons");
82 text->SetTextSize(0.05);
83 text->SetTextColor(kGreen);
89 c1->Range(0,0,1300,10);
90 gStyle->SetLineColor(kRed);
91 gStyle->SetLineWidth(2);
93 for(Int_t j=0;j<3;j++){
94 Float_t x1,x2,y1,y2,xx1,xx2,yy1,yy2;
95 x1=pid->cut[j+1][0]; x2=pid->cut[j+2][0];
96 y1=y2=pid->cut[j+2][2];
97 lj[j]=new TLine(1000*x1,y1,1000*x2,y2);
99 if(j==0){yy1=10.;}else{yy1=lj[j-1]->GetY1();}
102 lk[j]=new TLine(1000*xx1,yy1,1000*xx2,yy2);
105 //Draw pions-kaons cuts.
106 //..................................
108 for(Int_t j=0;j<7;j++){
109 Float_t x1,x2,y1,y2,xx1,xx2,yy1,yy2;
110 x1=pid->cut[j+2][0]; x2=pid->cut[j+3][0];
111 y1=y2=pid->cut[j+3][5];
112 mj[j]=new TLine(1000*x1,y1,1000*x2,y2);
114 if(j==0){yy1=10.;}else{yy1=mj[j-1]->GetY1();}
117 mk[j]=new TLine(1000*xx1,yy1,1000*xx2,yy2);
120 //Draw kaons-protons cuts.
121 gStyle->SetLineWidth(1.);
124 void qhispi(Float_t pmin=0,Float_t pmax=1300)
126 char tit[]="--------------------------";
127 sprintf(tit,"%s%.1f %.1f","Pmom ",pmin,pmax);
128 // TH1F *qpi = new TH1F("Qpi",tit,100,0.5,PMax);
129 // TH1F *nhit = new TH1F("Nhit",tit,100,0,6);
130 TH2F *nhit = new TH2F("Nhit",tit,100,0,6,100,0,1300);
131 // -------------------------------------------------------------
133 for(Int_t i=0;i<NStat;i++){
134 TVector tabv(*( pid->GetVec(i) ));
135 Qtr=tabv(6);Pmom=tabv(10);
136 if(Pmom>pmin&&Pmom<pmax&&abs(tabv(11))==211)qpi->Fill(Qtr);
137 // if(tabv(11)==2212)nhit->Fill(tabv(0));
138 if(tabv(11)==211)nhit->Fill(tabv(0),Pmom);
140 // ------------------------------------------------------------
141 int pistat=qpi->GetEntries();
142 //qpi->SetMaximum(pistat+1);
143 qpi->SetMaximum(HMax);
144 qpi->SetFillColor(42);
146 TF1 *fun=qpi->GetFunction("gaus");
147 fun->SetLineWidth(.1);
148 qpi->SetLineWidth(.1);
150 //---------------------------
152 gaus1=new TF1("g1","gaus",.5,2);
153 qpi->SetMaximum(-1111);
154 gaus1->SetParameter(0, qpi->GetMaximum() );
155 qpi->SetMaximum(HMax);
156 gaus1->SetParameter(1,1);
157 gaus1->SetParameter(2,.12);
158 gaus1->SetLineWidth(.1);
163 void qhiska(Float_t pmin=0,Float_t pmax=1300)
165 TH1F *qka = new TH1F("Qka","Particle charge",100,0.5,PMax);
166 // -------------------------------------------------------------
168 for(Int_t i=0;i<NStat;i++){
169 TVector tabv(*( pid->GetVec(i) ));
170 Qtr=tabv(6);Pmom=tabv(10);
171 // qplot->Fill( Pmom,Qtr );
172 if(Pmom>pmin&&Pmom<pmax&&tabv(11)==321)qka->Fill(Qtr);
174 // ------------------------------------------------------------
175 qka->SetFillColor(0);
176 qka->SetLineColor(kRed);
177 //...................
178 qka->Fit("gaus","0");
179 TF1 *fun=qka->GetFunction("gaus");
180 fun->SetLineWidth(.1);
181 qka->SetLineWidth(.1);
183 //...................
184 // qka->Draw("same");
185 // gaus_k(pmin,pmax,qka);
189 void qhisp(Float_t pmin=0,Float_t pmax=1300)
191 TH1F *qpr = new TH1F("Qpr","Particle charge",100,0.5,PMax);
192 // -------------------------------------------------------------
195 for(Int_t i=0;i<NStat;i++){
196 TVector tabv(*( pid->GetVec(i) ));
197 Qtr=tabv(6);Pmom=tabv(10);
198 // qplot->Fill( Pmom,Qtr );
199 if(Pmom>pmin&&Pmom<pmax&&tabv(11)==2212)qpr->Fill(Qtr);
201 // ------------------------------------------------------------
202 qpr->SetFillColor(16);
203 //...................
204 qpr->Fit("gaus","0");
205 TF1 *fun=qpr->GetFunction("gaus");
206 fun->SetLineWidth(.1);
207 qpr->SetLineWidth(.1);
209 //...................
210 // qpr->Draw("same");
211 // gaus_p(pmin,pmax,qpr);
213 //---------------------------------------
215 void gaus_k(Float_t pmin=450,Float_t pmax=470,TH1F *qka){
217 if(pmin==410&&pmax==470){xmean=pid->cut[5][3]; xsig=pid->cut[5][4];}
219 if(pmin==470&&pmax==530){xmean=pid->cut[6][3]; xsig=pid->cut[6][4];}
221 if(pmin==730&&pmax==830){xmean=pid->cut[10][3]; xsig=pid->cut[10][4];}
223 if(pmin==830&&pmax==930){xmean=pid->cut[11][3]; xsig=pid->cut[11][4];}
225 if(pmin==930&&pmax==1030){xmean=pid->cut[12][3]; xsig=pid->cut[12][4];}
227 gaus1=new TF1("g1","gaus",xmean-3*xsig,xmean+3*xsig);
228 qka->SetMaximum(-1111);
229 gaus1->SetParameter(0, qka->GetMaximum() );
230 qka->SetMaximum(HMax);
231 gaus1->SetParameter(1,xmean);
232 gaus1->SetParameter(2,xsig);
233 gaus1->SetLineWidth(.1);
236 //---------------------------------------
237 void gaus_p(Float_t pmin=730,Float_t pmax=830,TH1F *qp){
239 if(pmin==730&&pmax==830){xmean=pid->cut[10][5]; xsig=pid->cut[10][6];}
241 if(pmin==830&&pmax==930){xmean=pid->cut[11][5]; xsig=pid->cut[11][6];}
243 if(pmin==930&&pmax==1030){xmean=pid->cut[12][5]; xsig=pid->cut[12][6];}
245 gaus1=new TF1("g1","gaus",xmean-3*xsig,xmean+3*xsig);
246 qp->SetMaximum(-1111);
247 gaus1->SetParameter(0, qp->GetMaximum() );
248 qp->SetMaximum(HMax);
249 gaus1->SetParameter(1,xmean);
250 gaus1->SetParameter(2,xsig);
251 gaus1->SetLineWidth(.1);
255 //----b.b.---------------------------------
256 void fitpi(Float_t pmin=0,Float_t pmax=1300,char *tit)
258 cout<<"fitpi: NStat, PMax, pmin, pmax ="<<NStat<<","<<PMax<<","<<pmin<<","<<pmax<<endl;
259 TH1F *q1fit = new TH1F("Qfit",tit,100,0.5,PMax);
260 // -------------------------------------------------------------
262 for(Int_t i=0;i<NStat;i++){
263 TVector tabv(*( pid->GetVec(i) ));
264 Qtr=tabv(6);Pmom=tabv(10);
265 if(Pmom>pmin&&Pmom<pmax&&tabv(11)==211)q1fit->Fill(Qtr);
267 q1fit->SetFillColor(0);
268 q1fit->SetLineColor(kRed);
273 //---------------------------------------
274 void fitka(Float_t pmin=0,Float_t pmax=1300,char *tit)
276 //TH1F *q1fit = new TH1F("Qfit",tit,100,0.5,PMax);
277 TH1F *q1fit = new TH1F("Qfit",tit,100,0.5,10.);
278 // -------------------------------------------------------------
280 for(Int_t i=0;i<NStat;i++){
281 TVector tabv(*( pid->GetVec(i) ));
282 Qtr=tabv(6);Pmom=tabv(10);
283 if(Pmom>pmin&&Pmom<pmax&&tabv(11)==321)q1fit->Fill(Qtr);
285 q1fit->SetFillColor(0);
286 q1fit->SetLineColor(kRed);
290 //---------------------------------------
291 void fitp(Float_t pmin=0,Float_t pmax=1300,char *tit)
293 TH1F *q1fit = new TH1F("Qfit",tit,100,0.5,PMax);
294 // -------------------------------------------------------------
296 for(Int_t i=0;i<NStat;i++){
297 TVector tabv(*( pid->GetVec(i) ));
298 Qtr=tabv(6);Pmom=tabv(10);
299 if(Pmom>pmin&&Pmom<pmax&&tabv(11)==2212)q1fit->Fill(Qtr);
301 q1fit->SetFillColor(0);
305 //---------------------------------------
309 eff(321,321,"same",2);
310 eff(2212,2212,"same",1);
312 //---------------------------------------
313 void eff(int pc=211,int pc2=211,char *opt="",int color=2)
315 const Int_t HSize=100;
316 TH1F *efpi = new TH1F("Effpi","Eff of PID",HSize,0.025,1400);
317 TH1F *pmom = new TH1F("Pmom" ,"Eff of PID",HSize,0.025,1400);
318 TH1F *heff = new TH1F("Eff%" ,"Eff of PID",HSize,0.025,1400);
319 // -------------------------------------------------------------
322 for(Int_t i=0;i<NStat;i++){
323 TVector tabv(*( pid->GetVec(i) ));
324 Qtr=tabv(6);Pmom=tabv(10);
325 Pcode= ( pid->GetPcode(Qtr,Pmom/1000.) );
327 if(Pcode==pc&&tabv(11)==pc2) efpi->Fill(Pmom);
328 if(tabv(11)==pc2) pmom->Fill(Pmom);
331 // ------------------------------------------------------------
332 for(int i=1;i<=HSize;i++){
333 if( pmom->fArray[i] > 0 )
334 heff->fArray[i] = color * ( efpi->fArray[i] )/( pmom->fArray[i] );
336 heff->SetLineColor(color);
337 if(color==1)heff->SetLineWidth(2)else heff->SetLineWidth(.5);
340 pmom->SetFillColor(16); pmom->Draw();
341 efpi->SetFillColor(0); //42
344 //---------------------------------------
346 Float_t xpmin[]={410,470,730,830,930};
347 Float_t xpmax[]={470,530,830,930,1030};
349 PMax=3; HMax=500; NStat=99000;
351 pmin=xpmin[NRange];pmax=xpmax[NRange];NRange++;if(NRange==5)NRange=0;
352 qhispi(pmin,pmax); qhisp(pmin,pmax); qhiska(pmin,pmax);
354 //---------------------------------------
358 //pmin=xpmin[NRange];pmax=xpmax[NRange];NRange++;if(NRange==5)NRange=0;
359 pmin=200;pmax=300; // b.b.
361 sprintf(str,"Kaons %d - %d MeV/c",pmin,pmax);
363 fitka(pmin,pmax,str);
366 //--b.b.-------------------------------------
371 cout<<"fitpiall: NRange ="<<NRange<<endl;
372 //pmin=xpmin[NRange];pmax=xpmax[NRange];NRange++;if(NRange==5)NRange=0;
373 pmin=100;pmax=200; // b.b.
375 sprintf(str,"Pions %d - %d MeV/c",pmin,pmax);
377 cout<<"fitpiall: pmin, pmax ="<<pmin<<","<<pmax<<endl;
378 fitpi(pmin,pmax,str);
381 //---------------------------------------
385 if(NRange==0)NRange=2;
386 pmin=xpmin[NRange];pmax=xpmax[NRange];NRange++;if(NRange==5)NRange=2;
388 sprintf(str,"Protons %d - %d MeV/c",pmin,pmax);
396 pid->SetCut(3,.3, 0 , 2.5, 2.5 , 9, 9, 10 ); //200-300
398 pid->SetCut(5,.47, 1 , 0.12, 1.98 , 1.17 , 2.5, 10 );//410-470
399 pid->SetCut(6,.53, 1 , 0.12, 1.73 , 0.15 , 2.5, 10 );//470-530
400 pid->SetCut(7,.59, 0 , 0, 1.18 , 1.125 , 2.5, 10 );//530-590
402 pid->SetCut(8,.65, 0 , 0, 1.18, 1.125 , 2.3, 10 );//590-650
404 //---------------------------------------
405 void qhisall(Float_t pmin=0.25,Float_t pmax=.700)
412 //--------------------------------------
414 TH1F *his = new TH1F("pcode","tit",100,10,2300);
416 for(Int_t i=0;i<NStat;i++){
417 TVector tabv(*( pid->GetVec(i) ));
418 Pcod=tabv(11); if(Pcod>0) his->Fill(Pcod);
420 his->SetFillColor(0);his->SetLineColor(kRed);his->Draw();
424 TH1F *hisR = new TH1F("Rec signal","tit",100,0,13);
425 TH1F *hisH = new TH1F("Hit signal","tit",100,0,13);
427 for(Int_t i=0;i<NStat;i++){
428 TVector tabv(*( pid->GetVec(i) ));
429 xx=tabv(1); if(tabv(0)>0) hisR->Fill(xx);
431 hisR->SetFillColor(0);hisR->SetLineColor(kRed);hisR->Draw();
432 hisH->SetFillColor(0);hisH->SetLineColor(kBlue);hisH->Draw("same");
434 //-------------------------------------
437 TH1F *his = new TH1F("pmom","tit",100,0,1000);
439 for(Int_t i=0;i<NStat;i++){
440 TVector tabv(*( pid->GetVec(i) ));
441 xx=tabv(10); if(tabv(0)>0) his->Fill(xx);
443 his->SetFillColor(0);his->SetLineColor(kRed);his->Draw();
449 if(jtrack==NStat)jtrack=0;
450 for(Int_t i=jtrack;i<NStat;i++){
451 TVector tabv(*( pid->GetVec(i) ));
455 cout<<"Track No "<<jtrack<<endl;
456 pid->Print(jtrack++);
459 // Fill histogram for track number
460 //--------------------------------
462 TH1F *his = new TH1F("tracks","tit",100,0,15000);
464 for(Int_t i=0;i<NStat;i++){
465 TVector tabv(*( pid->GetVec(i) ));
469 his->SetFillColor(0);his->SetLineColor(kRed);his->Draw();
471 // Fill pid table with reconstructed tracks
475 #include <iostream.h>
480 #include "AliITSgeom.h"
481 #include "AliITStrackerV2.h"
482 #include "AliITStrackV2.h"
483 #include "AliITSclusterV2.h"
488 #include "TObjArray.h"
495 struct GoodTrackITS {
504 void filltab_tracks(){
506 cerr<<"Filling of track table...\n";
509 Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const Int_t event);
511 const Int_t MAX=15000;
512 Int_t nentr=0; TObjArray tarray(2000);
514 TFile *tf=TFile::Open("AliITStracksV2.root");
515 if (!tf->IsOpen()) {cerr<<"Can't open AliITStracksV2.root !\n"; return 3;}
516 char tname[100]; sprintf(tname,"TreeT_ITS_%d",event);
517 TTree *tracktree=(TTree*)tf->Get(tname);
518 if (!tracktree) {cerr<<"Can't get a tree with ITS tracks !\n"; return 4;}
519 TBranch *tbranch=tracktree->GetBranch("tracks");
520 nentr=(Int_t)tracktree->GetEntries();
521 for (Int_t i=0; i<nentr; i++) {
522 AliITStrackV2 *iotrack=new AliITStrackV2;
523 tbranch->SetAddress(&iotrack);
524 tracktree->GetEvent(i);
525 tarray.AddLast(iotrack);
527 delete tracktree; //Thanks to Mariana Bondila
531 /* Generate a list of "good" tracks */
532 GoodTrackITS gt[MAX];
534 Float_t ConvRadAng=180./TMath::Pi();
535 ifstream in("good_tracks_its");
537 cerr<<"Reading good tracks...\n";
538 while (in>>gt[ngood].lab>>gt[ngood].code>>
539 gt[ngood].px>>gt[ngood].py>>gt[ngood].pz>>
540 gt[ngood].x >>gt[ngood].y >>gt[ngood].z) {
544 cerr<<"Too many good tracks !\n";
548 if (!in.eof()) cerr<<"Read error (good_tracks_its) !\n";
550 cerr<<"Marking good tracks (this will take a while)...\n";
551 ngood=good_tracks_its(gt,MAX,event);
552 ofstream out("good_tracks_its");
554 for (Int_t ngd=0; ngd<ngood; ngd++)
555 out<<gt[ngd].lab<<' '<<gt[ngd].code<<' '
556 <<gt[ngd].px<<' '<<gt[ngd].py<<' '<<gt[ngd].pz<<' '
557 <<gt[ngd].x <<' '<<gt[ngd].y <<' '<<gt[ngd].z <<endl;
558 } else cerr<<"Can not open file (good_tracks_its) !\n";
561 cerr<<"Number of good tracks : "<<ngood<<endl;
562 TH1F *hp=new TH1F("hp","PHI resolution",50,-20.,20.); hp->SetFillColor(4);
563 TH1F *hl=new TH1F("hl","LAMBDA resolution",50,-20,20);hl->SetFillColor(4);
564 TH1F *hpt=new TH1F("hpt","Relative Pt resolution",30,-10.,10.);
565 hpt->SetFillColor(2);
566 TH1F *hmpt=new TH1F("hmpt","Transverse impact parameter",30,-300,300);
567 hmpt->SetFillColor(6);
568 TH1F *hz=new TH1F("hz","Longitudinal impact parameter",30,-300,300);
569 //hmpt->SetFillColor(6);
571 AliITStrackV2 *trk=(AliITStrackV2*)tarray.UncheckedAt(0);
572 Double_t pmin=0.1*(100/0.299792458/0.2/trk->GetConvConst());
573 Double_t pmax=6.0+pmin;
575 TH1F *hgood=new TH1F("hgood","Good tracks",30,pmin,pmax);
576 TH1F *hfound=new TH1F("hfound","Found tracks",30,pmin,pmax);
577 TH1F *hfake=new TH1F("hfake","Fake tracks",30,pmin,pmax);
578 TH1F *hg=new TH1F("hg","",30,pmin,pmax); //efficiency for good tracks
579 hg->SetLineColor(4); hg->SetLineWidth(2);
580 TH1F *hf=new TH1F("hf","Efficiency for fake tracks",30,pmin,pmax);
581 hf->SetFillColor(1); hf->SetFillStyle(3013); hf->SetLineWidth(2);
583 TH1F *hptw=new TH1F("hptw","Weghted pt",30,pmax,pmin);
586 Int_t lab=gt[ngood].lab, tlab=-1;
587 Double_t pxg=gt[ngood].px, pyg=gt[ngood].py, pzg=gt[ngood].pz;
588 Double_t ptg=TMath::Sqrt(pxg*pxg+pyg*pyg);
589 Double_t pg=1000.*TMath::Sqrt(pxg*pxg+pyg*pyg+pzg*pzg); // b.b.
592 if (ptg<pmin) continue;
596 AliITStrackV2 *track=0;
598 for (j=0; j<nentr; j++) {
599 track=(AliITStrackV2*)tarray.UncheckedAt(j);
600 tlab=track->GetLabel();
601 if (lab==TMath::Abs(tlab)) break;
604 cerr<<"Track "<<lab<<" was not found !\n";
607 //track->Propagate(track->GetAlpha(),3.,0.1/65.19*1.848,0.1*1.848);
608 track->PropagateTo(3.,0.0028,65.19);
610 track->PropagateToVertex();
612 if (lab==tlab) hfound->Fill(ptg);
613 else { hfake->Fill(ptg); cerr<<lab<<" fake\n";}
615 Double_t xv,par[5]; track->GetExternalParameters(xv,par);
616 Float_t phi=TMath::ASin(par[2]) + track->GetAlpha();
617 if (phi<-TMath::Pi()) phi+=2*TMath::Pi();
618 if (phi>=TMath::Pi()) phi-=2*TMath::Pi();
619 Float_t lam=TMath::ATan(par[3]);
620 Float_t pt_1=TMath::Abs(par[4]);
621 Double_t phig=TMath::ATan2(pyg,pxg);
622 //hp->Fill((phi - phig)*1000.);
624 Double_t lamg=TMath::ATan2(pzg,ptg);
625 //hl->Fill((lam - lamg)*1000.);
627 Double_t d=10000*track->GetD();
630 //hptw->Fill(ptg,TMath::Abs(d));
632 Double_t z=10000*track->GetZ();
637 // ------------------------------------------------ b.b. -----
639 Float_t mom=1000.*(1./(pt_1*TMath::Cos(lam)));
640 Float_t dedx=track->GetdEdx();
641 //hep->Fill(mom,dedx,1.);
642 Int_t pcode=gt[ngood].code;
643 pid->SetEdep(10000*nev+ngood,dedx);
644 pid->SetPmom(10000*nev+ngood,mom);
645 pid->SetPcod(10000*nev+ngood,abs(pcode));
646 //cout<<"!!!!! pcode, pmod, dedx ="<<pcode<<","<<mom<<","<<dedx<<endl;
652 Stat_t ng=hgood->GetEntries();
653 //cerr<<"Good tracks "<<ng<<endl;
654 Stat_t nf=hfound->GetEntries();
655 Stat_t nfak=hfake->GetEntries();
657 cerr<<"Integral efficiency is about "<<nf/ng*100.<<" %\n";
658 //delete gAlice; //b.b.
659 cout<<"Done with nfound(good): "<<nf<<" + nfake: "<<nfak<<" = "<<nf+nfak<<" tracks."<<endl;
660 // -------------------- b.b. -------------------
665 Int_t good_tracks_its(GoodTrackITS *gt, const Int_t max, const Int_t event) {
666 if (gAlice) {delete gAlice; gAlice=0;}
668 TFile *file=TFile::Open("galice.root");
669 if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; exit(4);}
670 if (!(gAlice=(AliRun*)file->Get("gAlice"))) {
671 cerr<<"gAlice have not been found on galice.root !\n";
675 Int_t np=gAlice->GetEvent(event);
677 Int_t *good=new Int_t[np];
679 for (k=0; k<np; k++) good[k]=0;
681 AliITS *ITS=(AliITS*)gAlice->GetDetector("ITS");
683 cerr<<"can't get ITS !\n"; exit(8);
685 AliITSgeom *geom=ITS->GetITSgeom();
687 cerr<<"can't get ITS geometry !\n"; exit(9);
690 TFile *cf=TFile::Open("AliITSclustersV2.root");
692 cerr<<"Can't open AliITSclustersV2.root !\n"; exit(6);
694 char cname[100]; sprintf(cname,"TreeC_ITS_%d",event);
695 TTree *cTree=(TTree*)cf->Get(cname);
697 cerr<<"Can't get cTree !\n"; exit(7);
699 TBranch *branch=cTree->GetBranch("Clusters");
701 cerr<<"Can't get clusters branch !\n"; exit(8);
703 TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000);
704 branch->SetAddress(&clusters);
706 Int_t entr=(Int_t)cTree->GetEntries();
707 for (k=0; k<entr; k++) {
709 Int_t ncl=clusters->GetEntriesFast(); if (ncl==0) continue;
710 Int_t lay,lad,det; geom->GetModuleId(k,lay,lad,det);
711 if (lay<1 || lay>6) {
712 cerr<<"wrong layer !\n"; exit(10);
715 AliITSclusterV2 *pnt=(AliITSclusterV2*)clusters->UncheckedAt(ncl);
716 Int_t l0=pnt->GetLabel(0);
717 Int_t l1=pnt->GetLabel(1);
718 Int_t l2=pnt->GetLabel(2);
719 Int_t mask=1<<(lay-1);
720 if (l0>=0) good[l0]|=mask;
721 if (l1>=0) good[l1]|=mask;
722 if (l2>=0) good[l2]|=mask;
725 clusters->Delete(); delete clusters;
726 delete cTree; //Thanks to Mariana Bondila
729 ifstream in("good_tracks_tpc");
731 cerr<<"can't get good_tracks_tpc !\n"; exit(11);
734 Double_t px,py,pz,x,y,z;
736 while (in>>lab>>code>>px>>py>>pz>>x>>y>>z) {
737 if (good[lab] != 0x3F) continue;
738 TParticle *p = (TParticle*)gAlice->Particle(lab);
740 gt[nt].code=p->GetPdgCode();
741 //**** px py pz - in global coordinate system
742 gt[nt].px=p->Px(); gt[nt].py=p->Py(); gt[nt].pz=p->Pz();
743 gt[nt].x=gt[nt].y=gt[nt].z=0.;
745 if (nt==max) {cerr<<"Too many good tracks !\n"; break;}
750 delete gAlice; gAlice=0;
757 //----------------------------------------
763 for(int t=0;t<10000;t++){
764 track=t; signal=5.; pmom=1200.; pcode=321;
765 pid->SetEdep(10000*nev+track,signal);
766 pid->SetPmom(10000*nev+track,pmom);
767 pid->SetPcod(10000*nev+track,abs(pcode));
775 TFile *f=new TFile("pidhit.root");
776 AliITSPid *pid=(AliITSPid*)f->Get("AliITSPid");
778 {cout<<"Load PID object from PIDHIT.ROOT file"<<endl;}
779 else{cout<<"ERROR load PID object from PIDHIT.ROOT file"<<endl;}
786 gROOT->ProcessLine(".q");
788 //---------------------------------------