8 #include "TBenchmark.h"
9 #include "AliTOFTrackV2.h"
13 Int_t AliTOFanalyzeMatchingV2Phenix()
15 // Read TPC and TRD reconstructed tracks and matched
17 // origin: F. Pierella | pierella@bo.infn.it
18 // Analysis done a la TOF in PHENIX
21 gStyle->SetOptStat(0);
22 gStyle->SetOptTitle(0);
23 gStyle->SetPalette(1);
24 gStyle->SetCanvasColor(33);
25 gStyle->SetFrameFillColor(18);
28 gBenchmark->Start("AliTOFanalyzeMatchingV2");
36 // Dynamically link some shared libs
37 if(gClassTable->GetID("AliRun") < 0) {
38 gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C");
43 // ==================>histos
44 TH2F *hpvsm = new TH2F("hpvsm"," ",170,-0.5,1.2,400,-4.,4.);
45 hpvsm->GetXaxis()->SetTitle("mass [GeV/c^{2}]");
46 hpvsm->GetYaxis()->SetTitle("charge*momentum [GeV/c]");
48 TH2F *hdEdXvsp = new TH2F("hdEdXvsp"," ",400,-4.,4.,1000,0.,1000.);
49 hdEdXvsp->GetYaxis()->SetTitle("dE/dX [au]");
50 hdEdXvsp->GetXaxis()->SetTitle("charge*momentum [GeV/c]");
52 TH2F *hdEdXvsabsp = new TH2F("hdEdXvsabsp"," ",400,0.,4.,100,0.,1000.);
53 hdEdXvsabsp->GetYaxis()->SetTitle("dE/dX [au]");
54 hdEdXvsabsp->GetXaxis()->SetTitle("momentum [GeV/c]");
56 TH2F *hinvpvstof= new TH2F("hinvpvstof"," ",300,10.,40.,400,-4.,4.);
57 hinvpvstof->GetYaxis()->SetTitle("charge/momentum [(GeV/c)^{-1}]");
58 hinvpvstof->GetXaxis()->SetTitle("Time of flight [ns]");
60 TH2F *htofvsp = new TH2F("htofvsp"," ",400,0.,4.,300,10.,40.);
61 htofvsp->GetYaxis()->SetTitle("Time of flight [ns]");
62 htofvsp->GetXaxis()->SetTitle("momentum [GeV/c]");
64 TH2F *hsqmvsp = new TH2F("hsqmvsp"," ",400,-4.,4.,130,-0.1,1.2);
65 hsqmvsp->GetYaxis()->SetTitle("mass^{2} (GeV/c^{2})^{2}");
66 hsqmvsp->GetXaxis()->SetTitle("charge*momentum [GeV/c]");
69 TH2F *hinvbgvsp = new TH2F("hinvbgvsp"," ",400,-4.,4.,50,0.,5);
70 hinvbgvsp->GetXaxis()->SetTitle("charge*momentum [GeV/c]");
71 hinvbgvsp->GetYaxis()->SetTitle("1/(#beta #gamma)");
73 TH2F *hpvstofde = new TH2F("hpvstofde"," ",350,-5,30.,400,-4.,4.);
74 hpvstofde->GetXaxis()->SetTitle("Time-of-flight difference from electron [ns]");
75 hpvstofde->GetYaxis()->SetTitle("charge*momentum [GeV/c]");
78 TH2F *hinvpvstofde = new TH2F("hinvpvstofde"," ",350,-5,30.,400,-4.,4.);
79 hinvpvstofde->GetXaxis()->SetTitle("Time-of-flight difference from electron [ns]");
80 hinvpvstofde->GetYaxis()->SetTitle("charge/momentum [(GeV/c)^{-1}]");
81 // =======================================> done
85 // chain in the case of more events
87 ch.Add("tofTracks*.root"); // use wildcards
89 TClonesArray *arr = new TClonesArray("AliTOFTrackV2");
90 T->GetBranch("tracks")->SetAutoDelete(kFALSE);
91 T->SetBranchAddress("tracks",&arr);
92 Int_t nentries = (Int_t)(T->GetEntries());
93 cout << "number of events " << nentries << endl;
94 for (Int_t ev=0;ev<nentries;ev++) {
97 Int_t ntracks = arr->GetEntriesFast();
98 cout << ntracks << endl;
99 for (Int_t i=0;i<ntracks;i++) {
100 AliTOFTrackV2 *toftrack = (AliTOFTrackV2*)arr->At(i);
101 if(toftrack->GetTrackLabel()<0) continue; // reject fake
103 Float_t momTPC=toftrack->GetPTPC(); // signed momentum
104 if(toftrack->GetPdgCode()<0) momTPC=-momTPC;
105 Int_t pdgCode=toftrack->GetPdgCode();
106 //if(TMath::Abs(pdgCode)!=211) continue;
107 hdEdXvsp->Fill(momTPC,toftrack->GetdEdX());
108 hdEdXvsabsp->Fill(TMath::Abs(momTPC),toftrack->GetdEdX());
110 Int_t matchStatus=toftrack->GetMatchingStatus();
111 Float_t tof=toftrack->GetTof();
112 if(matchStatus==3 || matchStatus==4){ // track has a tof
113 htofvsp->Fill(TMath::Abs(momTPC),tof);
114 hinvpvstof->Fill(tof,1./momTPC);
115 } // if(matchStatus==3 || matchStatus==4)
117 Float_t length=toftrack->GetLength();
118 // starting mass calculation/ only possible with track length
119 if(length>0. && (matchStatus==3 || matchStatus==4)) // to be skipped when track length will be in the Kalman
121 Float_t squareMass=momTPC*momTPC*((29.9792*tof/length)*(29.9792*tof/length)-1);
122 hsqmvsp->Fill(momTPC,TMath::Abs(squareMass));
123 Float_t dummy=squareMass;
124 if(dummy<0) dummy=-dummy;
125 Float_t mass=TMath::Sqrt(dummy);
126 if(squareMass<0) mass=-mass;
127 hpvsm->Fill(mass,momTPC);
128 Float_t invbg=TMath::Sqrt(dummy)/TMath::Abs(momTPC);
129 hinvbgvsp->Fill(momTPC,invbg);
130 Float_t betaEl=TMath::Abs(momTPC)/TMath::Sqrt(momTPC*momTPC+0.000510999*0.000510999);
131 Float_t tofEl=length/(betaEl*29.9792); // [ns]
132 hpvstofde->Fill((tof-tofEl),momTPC);
133 hinvpvstofde->Fill((tof-tofEl),1./momTPC);
134 } // if(toftrack->GetLength()>0.)
136 } // end loop on tracks
137 } // end loop on 'events'
139 gStyle->SetPalette(1);
140 gStyle->SetCanvasColor(10);
141 gStyle->SetFrameFillColor(10);
145 TCanvas* c1 = new TCanvas("c1", "TOF a la PHENIX (I)",210, 210, 740, 690);
146 c1->SetFillColor(10);
149 c1->SetHighLightColor(2);
150 c1->SetFillColor(10);
151 c1->SetBorderSize(2);
157 hpvsm->Draw("contz");
159 //Float_t x1=0.67, y1=0.875, x2=0.85, y2=0.95;
160 /*hpvsm->Draw("contz");*/
161 //pl.DrawPaveLabel(x1,y1,x2,y2,"CONTZ","brNDC");
178 TCanvas* c2 = new TCanvas("c2", "TOF a la PHENIX (II)", 210, 210, 740, 690);
179 c2->SetFillColor(10);
182 //gStyle->SetOptStat(0);
183 c2->SetHighLightColor(2);
184 c2->SetFillColor(10);
185 c2->SetBorderSize(2);
193 hsqmvsp->Draw("contz");
214 TCanvas* c2b = new TCanvas("c2b", " ", 210, 210, 740, 690);
215 c2b->SetFillColor(10);
217 //gStyle->SetOptStat(0);
218 c2b->SetHighLightColor(2);
219 c2b->SetFillColor(10);
220 c2b->SetBorderSize(2);
226 hinvpvstofde->SetFillColor(33);
227 hinvpvstofde->SetFillStyle(3001);
228 hinvpvstofde->Draw();
236 TCanvas* c3 = new TCanvas("c3", "TOF a la PHENIX (II)", 210, 210, 740, 690);
237 c3->SetFillColor(10);
240 //gStyle->SetOptStat(0);
241 c3->SetHighLightColor(2);
242 c3->SetFillColor(10);
243 c3->SetBorderSize(2);
249 hpvsm->Draw("contz");
254 hsqmvsp->Draw("contz");