Formatting changes.
[u/mrichter/AliRoot.git] / TPC / AliTPCScanPID.C
CommitLineData
31ab0ad9 1///////////////////////////////////////////////////////////
2// Test macro for AliTPCtracksPid.root file //
3// JINR Dubna Aug 2002 //
4///////////////////////////////////////////////////////////
5void
6AliTPCScanPID(Int_t evNumber2=3) {
7 //................. Prepare histogramms ................
8 TH2F *qplot = new TH2F("Qtrm","Qtrm vs Pmom",100,0,1300,100,0,13);
9 TH2F *qplotP= new TH2F("Qtrm1","Qtrm vs Pmom",100,0,1300,100,0,13);
10 TH2F *qplotKa= new TH2F("Qtrm2","Qtrm vs Pmom",100,0,1300,100,0,13);
11 TH2F *qplotPi= new TH2F("Qtrm3","Qtrm vs Pmom",100,0,1300,100,0,13);
12 TH2F *qplotE= new TH2F("Qtrm4","Qtrm vs Pmom",100,0,1300,100,0,13);
13 qplotP.SetMarkerStyle(8); qplotP.SetMarkerColor(kBlack); qplotP.SetMarkerSize(.3);
14 qplotKa.SetMarkerStyle(8); qplotKa.SetMarkerColor(kRed); qplotKa.SetMarkerSize(.3);
15 qplotPi.SetMarkerStyle(8); qplotPi.SetMarkerColor(kBlue); qplotPi.SetMarkerSize(.3);
16 qplotE.SetMarkerStyle(8); qplotE.SetMarkerColor(kGreen); qplotE.SetMarkerSize(.3);
17 //......................................................
18
19TFile *fpid = new TFile("AliTPCtracksPid.root","read");
20//
21// Loop over events
22//
23for (int nev=0; nev< evNumber2; nev++) {
24 char tpidname[30];
25 sprintf(tpidname,"TreeT%d",nev);
26 TTree *tracktree=(TTree*)fpid->Get(tpidname);
27 TBranch *tbranch=tracktree->GetBranch("pids");
28
29 Int_t nentr=tbranch->GetEntries();
30 cout<<"Found PID for "<<nentr<<" TPC tracks on "<<tpidname<<endl;
31
32 AliTPCtrackPid *iopid=0;
33for(Int_t ii=0;ii<nentr;ii++)
34 {
35 AliTPCtrackPid *iopid=new AliTPCtrackPid;
36 tbranch->SetAddress(&iopid);
37 tracktree->GetEvent(ii);
38
39 Float_t xsignal=iopid->fSignal/50.;
40
41 if(iopid->fPcode ==2212)qplotP.Fill(1000*iopid->fMom,xsignal);
42 if(iopid->fPcode == 321)qplotKa.Fill(1000*iopid->fMom,xsignal );
43 if(iopid->fPcode == 211)qplotPi.Fill(1000*iopid->fMom,xsignal );
44 if(iopid->fPcode == 11)qplotE.Fill(1000*iopid->fMom,xsignal );
45
46 //cout<<"PID pcode,fsignal,fmom= "
47 // <<iopid->fPcode<<","<<iopid->fSignal<<","<<iopid->fMom<<endl;
48 delete iopid;
49 }// Enf for ii (tracks)
50 }// End for nev (events)
51 fpid->Close();
52 //...................... Draw histogramms .................
53 TCanvas *c1 = new TCanvas("PID_test","Scan PID ",200,10,900,700);
54 c1->Divide(1,1);
55 //.........................................................
56 c1->cd(1); gPad->SetFillColor(33);
57 qplot->Draw();
58 qplotP.Draw("same");qplotKa.Draw("same");qplotPi.Draw("same");qplotE.Draw("same");
59 AliTPCPid *pid =new AliTPCPid(100);
60 pid.fCutKa->SetLineColor(kRed);
61 pid.fCutKa->Draw("same");
62
63 c1->Print("PIDplot.ps");
64 cout<<"End of file AliTPCtracksPid.root "<<endl;
65
66 return;
67}
68
69