forked from alisw/AliRoot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAliTOFanalyzeMatchingV2Phenix.C
262 lines (210 loc) · 7.1 KB
/
AliTOFanalyzeMatchingV2Phenix.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#ifndef __CINT__
#include "TFile.h"
#include "TTask.h"
#include "TTree.h"
#include "TSystem.h"
#include "TROOT.h"
#include "TFolder.h"
#include "TBenchmark.h"
#include "AliTOFTrackV2.h"
#endif
Int_t AliTOFanalyzeMatchingV2Phenix()
{
// Read TPC and TRD reconstructed tracks and matched
// with TOF digits
// origin: F. Pierella | pierella@bo.infn.it
// Analysis done a la TOF in PHENIX
gROOT->Reset();
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
gStyle->SetPalette(1);
gStyle->SetCanvasColor(33);
gStyle->SetFrameFillColor(18);
gBenchmark->Start("AliTOFanalyzeMatchingV2");
if(gAlice){
delete gAlice;
gAlice=0;
}
else{
// Dynamically link some shared libs
if(gClassTable->GetID("AliRun") < 0) {
gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C");
loadlibs();
} // end if
}
// ==================>histos
TH2F *hpvsm = new TH2F("hpvsm"," ",170,-0.5,1.2,400,-4.,4.);
hpvsm->GetXaxis()->SetTitle("mass [GeV/c^{2}]");
hpvsm->GetYaxis()->SetTitle("charge*momentum [GeV/c]");
TH2F *hdEdXvsp = new TH2F("hdEdXvsp"," ",400,-4.,4.,1000,0.,1000.);
hdEdXvsp->GetYaxis()->SetTitle("dE/dX [au]");
hdEdXvsp->GetXaxis()->SetTitle("charge*momentum [GeV/c]");
TH2F *hdEdXvsabsp = new TH2F("hdEdXvsabsp"," ",400,0.,4.,100,0.,1000.);
hdEdXvsabsp->GetYaxis()->SetTitle("dE/dX [au]");
hdEdXvsabsp->GetXaxis()->SetTitle("momentum [GeV/c]");
TH2F *hinvpvstof= new TH2F("hinvpvstof"," ",300,10.,40.,400,-4.,4.);
hinvpvstof->GetYaxis()->SetTitle("charge/momentum [(GeV/c)^{-1}]");
hinvpvstof->GetXaxis()->SetTitle("Time of flight [ns]");
TH2F *htofvsp = new TH2F("htofvsp"," ",400,0.,4.,300,10.,40.);
htofvsp->GetYaxis()->SetTitle("Time of flight [ns]");
htofvsp->GetXaxis()->SetTitle("momentum [GeV/c]");
TH2F *hsqmvsp = new TH2F("hsqmvsp"," ",400,-4.,4.,130,-0.1,1.2);
hsqmvsp->GetYaxis()->SetTitle("mass^{2} (GeV/c^{2})^{2}");
hsqmvsp->GetXaxis()->SetTitle("charge*momentum [GeV/c]");
TH2F *hinvbgvsp = new TH2F("hinvbgvsp"," ",400,-4.,4.,50,0.,5);
hinvbgvsp->GetXaxis()->SetTitle("charge*momentum [GeV/c]");
hinvbgvsp->GetYaxis()->SetTitle("1/(#beta #gamma)");
TH2F *hpvstofde = new TH2F("hpvstofde"," ",350,-5,30.,400,-4.,4.);
hpvstofde->GetXaxis()->SetTitle("Time-of-flight difference from electron [ns]");
hpvstofde->GetYaxis()->SetTitle("charge*momentum [GeV/c]");
TH2F *hinvpvstofde = new TH2F("hinvpvstofde"," ",350,-5,30.,400,-4.,4.);
hinvpvstofde->GetXaxis()->SetTitle("Time-of-flight difference from electron [ns]");
hinvpvstofde->GetYaxis()->SetTitle("charge/momentum [(GeV/c)^{-1}]");
// =======================================> done
// chain in the case of more events
TChain ch("T");
ch.Add("tofTracks*.root"); // use wildcards
TClonesArray *arr = new TClonesArray("AliTOFTrackV2");
T->GetBranch("tracks")->SetAutoDelete(kFALSE);
T->SetBranchAddress("tracks",&arr);
Int_t nentries = (Int_t)(T->GetEntries());
cout << "number of events " << nentries << endl;
for (Int_t ev=0;ev<nentries;ev++) {
arr->Clear();
T->GetEntry(ev);
Int_t ntracks = arr->GetEntriesFast();
cout << ntracks << endl;
for (Int_t i=0;i<ntracks;i++) {
AliTOFTrackV2 *toftrack = (AliTOFTrackV2*)arr->At(i);
if(toftrack->GetTrackLabel()<0) continue; // reject fake
Float_t momTPC=toftrack->GetPTPC(); // signed momentum
if(toftrack->GetPdgCode()<0) momTPC=-momTPC;
Int_t pdgCode=toftrack->GetPdgCode();
//if(TMath::Abs(pdgCode)!=211) continue;
hdEdXvsp->Fill(momTPC,toftrack->GetdEdX());
hdEdXvsabsp->Fill(TMath::Abs(momTPC),toftrack->GetdEdX());
Int_t matchStatus=toftrack->GetMatchingStatus();
Float_t tof=toftrack->GetTof();
if(matchStatus==3 || matchStatus==4){ // track has a tof
htofvsp->Fill(TMath::Abs(momTPC),tof);
hinvpvstof->Fill(tof,1./momTPC);
} // if(matchStatus==3 || matchStatus==4)
Float_t length=toftrack->GetLength();
// starting mass calculation/ only possible with track length
if(length>0. && (matchStatus==3 || matchStatus==4)) // to be skipped when track length will be in the Kalman
{
Float_t squareMass=momTPC*momTPC*((29.9792*tof/length)*(29.9792*tof/length)-1);
hsqmvsp->Fill(momTPC,TMath::Abs(squareMass));
Float_t dummy=squareMass;
if(dummy<0) dummy=-dummy;
Float_t mass=TMath::Sqrt(dummy);
if(squareMass<0) mass=-mass;
hpvsm->Fill(mass,momTPC);
Float_t invbg=TMath::Sqrt(dummy)/TMath::Abs(momTPC);
hinvbgvsp->Fill(momTPC,invbg);
Float_t betaEl=TMath::Abs(momTPC)/TMath::Sqrt(momTPC*momTPC+0.000510999*0.000510999);
Float_t tofEl=length/(betaEl*29.9792); // [ns]
hpvstofde->Fill((tof-tofEl),momTPC);
hinvpvstofde->Fill((tof-tofEl),1./momTPC);
} // if(toftrack->GetLength()>0.)
} // end loop on tracks
} // end loop on 'events'
gStyle->SetPalette(1);
gStyle->SetCanvasColor(10);
gStyle->SetFrameFillColor(10);
//TPaveLabel pl;
TCanvas* c1 = new TCanvas("c1", "TOF a la PHENIX (I)",210, 210, 740, 690);
c1->SetFillColor(10);
c1->cd();
gPad->SetGrid();
c1->SetHighLightColor(2);
c1->SetFillColor(10);
c1->SetBorderSize(2);
c1->Divide(2,2);
c1->cd(1);
gPad->SetGridx();
gPad->SetGridy();
hpvsm->Draw("contz");
//Float_t x1=0.67, y1=0.875, x2=0.85, y2=0.95;
/*hpvsm->Draw("contz");*/
//pl.DrawPaveLabel(x1,y1,x2,y2,"CONTZ","brNDC");
c1->cd(2);
gPad->SetGridx();
gPad->SetGridy();
hdEdXvsp->Draw();
c1->cd(3);
gPad->SetGridx();
gPad->SetGridy();
hinvpvstof->Draw();
c1->cd(4);
gPad->SetGridx();
gPad->SetGridy();
htofvsp->Draw();
TCanvas* c2 = new TCanvas("c2", "TOF a la PHENIX (II)", 210, 210, 740, 690);
c2->SetFillColor(10);
c2->cd();
//gStyle->SetOptStat(0);
c2->SetHighLightColor(2);
c2->SetFillColor(10);
c2->SetBorderSize(2);
c2->SetGridy();
c2->Divide(2,2);
c2->cd(1);
gPad->SetGridx();
gPad->SetGridy();
hsqmvsp->Draw("contz");
c2->cd(2);
gPad->SetGridx();
gPad->SetGridy();
hinvbgvsp->Draw();
c2->cd(3);
gPad->SetGridx();
gPad->SetGridy();
gPad->SetLogx();
hdEdXvsabsp->Draw();
c2->cd(4);
gPad->SetGridx();
gPad->SetGridy();
hpvstofde->Draw();
TCanvas* c2b = new TCanvas("c2b", " ", 210, 210, 740, 690);
c2b->SetFillColor(10);
c2b->cd();
//gStyle->SetOptStat(0);
c2b->SetHighLightColor(2);
c2b->SetFillColor(10);
c2b->SetBorderSize(2);
c2b->SetGridy();
c2b->Divide(2,2);
c2b->cd(1);
gPad->SetGridx();
gPad->SetGridy();
hinvpvstofde->SetFillColor(33);
hinvpvstofde->SetFillStyle(3001);
hinvpvstofde->Draw();
c2b->cd(2);
gPad->SetGridx();
gPad->SetGridy();
hpvstofde->Draw();
TCanvas* c3 = new TCanvas("c3", "TOF a la PHENIX (II)", 210, 210, 740, 690);
c3->SetFillColor(10);
c3->cd();
//gStyle->SetOptStat(0);
c3->SetHighLightColor(2);
c3->SetFillColor(10);
c3->SetBorderSize(2);
c3->SetGridy();
c3->Divide(2,2);
c3->cd(1);
gPad->SetGridx();
gPad->SetGridy();
hpvsm->Draw("contz");
c3->cd(2);
gPad->SetGridx();
gPad->SetGridy();
hsqmvsp->Draw("contz");
c3->cd(3);
gPad->SetGridx();
gPad->SetGridy();
gPad->SetLogx();
hdEdXvsabsp->Draw();
}