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