]>
Commit | Line | Data |
---|---|---|
48a73d39 | 1 | enum EHisto_t { |
2 | kAcceptedTracks, | |
3 | kMatchedTracks, | |
4 | kMismatchedTracks, | |
5 | kUncorrelatedTracks, | |
6 | kMatchedCorrelatedTracks, | |
7 | kMatchedGoodTracks, | |
8 | kNHistos | |
9 | }; | |
10 | const Char_t *histoName[kNHistos] = { | |
11 | "hAcceptedTracks", | |
12 | "hMatchedTracks", | |
13 | "hMismatchedTracks", | |
14 | "hUncorrelatedTracks", | |
15 | "hMatchedCorrelatedTracks", | |
16 | "hMatchedGoodTracks" | |
17 | }; | |
18 | ||
19 | enum ECharge_t { | |
20 | kPositive, | |
21 | kNegative, | |
22 | kNCharges | |
23 | }; | |
24 | const Char_t *chargeName[kNCharges] = { | |
25 | "positive", | |
26 | "negative" | |
27 | }; | |
28 | ||
29 | enum EParam_t { | |
30 | kCentrality, | |
31 | kPt, | |
32 | kEta, | |
33 | kPhi, | |
34 | kNParams | |
35 | }; | |
36 | ||
37 | const Int_t NcentralityBins = 10; | |
38 | Double_t centralityBin[NcentralityBins + 1] = {0., 5., 10., 20., 30., 40., 50., 60., 70., 80., 90.}; | |
39 | ||
40 | const Int_t NptBins = 46; | |
41 | Double_t ptBin[NptBins + 1] = {0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0}; | |
42 | ||
43 | const Int_t NetaBins = 20; | |
44 | Double_t etaMin = -1.; | |
45 | Double_t etaMax = 1.; | |
46 | Double_t etaStep = (etaMax - etaMin) / NetaBins; | |
47 | Double_t etaBin[NetaBins + 1]; /* computed at run-time */ | |
48 | ||
49 | const Int_t NphiBins = 200; | |
50 | Double_t phiMin = 0.; | |
51 | Double_t phiMax = 2. * TMath::Pi(); | |
52 | Double_t phiStep = (phiMax - phiMin) / NphiBins; | |
53 | Double_t phiBin[NphiBins + 1]; /* computed at run-time */ | |
54 | ||
55 | const Int_t NptsubBins = 5; | |
56 | Double_t ptsubBin[NptsubBins + 1] = {0.2, 0.5, 1.0, 1.5, 3.0, 5.0}; | |
57 | Int_t ptsubBinMin[NptsubBins] = {0, 6, 16, 21, 36}; | |
58 | Int_t ptsubBinMax[NptsubBins] = {5, 15, 20, 35, 45}; | |
59 | ||
60 | Int_t multcentColor[10] = { | |
61 | kRed, | |
62 | kOrange+1, | |
63 | kOrange, | |
64 | kYellow, | |
65 | kYellow+1, | |
66 | kGreen, | |
67 | kGreen+1, | |
68 | kCyan+1, | |
69 | kBlue, | |
70 | kMagenta, | |
71 | // kMagenta+1 | |
72 | }; | |
73 | ||
74 | const Char_t *extendedChargeName[2] = {"positive", "negative"}; | |
75 | ||
76 | const Double_t kEpsilon = 0.001; | |
77 | ||
78 | TOFmatchEff(const Char_t *filename, const Char_t *enabledfilename = NULL, Int_t evMax = kMaxInt) | |
79 | { | |
80 | ||
81 | /* include path for ACLic */ | |
82 | gSystem->AddIncludePath("-I$ALICE_ROOT/include"); | |
83 | gSystem->AddIncludePath("-I$ALICE_ROOT/TOF"); | |
84 | /* load libraries */ | |
85 | gSystem->Load("libANALYSIS"); | |
86 | gSystem->Load("libANALYSISalice"); | |
87 | /* build analysis task class */ | |
88 | gROOT->LoadMacro("AliAnalysisParticle.cxx+g"); | |
89 | gROOT->LoadMacro("AliAnalysisEvent.cxx+g"); | |
90 | gROOT->LoadMacro("AliAnalysisTrack.cxx+g"); | |
91 | ||
92 | /* open file, get tree and connect */ | |
93 | TFile *filein = TFile::Open(filename); | |
94 | TTree *treein = (TTree *)filein->Get("aodTree"); | |
95 | printf("got \"aodTree\": %d entries\n", treein->GetEntries()); | |
96 | AliAnalysisEvent *analysisEvent = new AliAnalysisEvent(); | |
97 | TClonesArray *analysisTrackArray = new TClonesArray("AliAnalysisTrack"); | |
98 | AliAnalysisTrack *analysisTrack = NULL; | |
99 | treein->SetBranchAddress("AnalysisEvent", &analysisEvent); | |
100 | treein->SetBranchAddress("AnalysisTrack", &analysisTrackArray); | |
101 | ||
102 | /* open enabled flag map */ | |
103 | TH1F *hEnabledFlag = NULL; | |
104 | if (enabledfilename) { | |
105 | TFile *enabledfile = TFile::Open(enabledfilename); | |
106 | hEnabledFlag = (TH1F *)enabledfile->Get("hEnabledFlag"); | |
107 | } | |
108 | ||
109 | /* binning */ | |
110 | for (Int_t ieta = 0; ieta < NetaBins + 1; ieta++) | |
111 | etaBin[ieta] = etaMin + ieta * etaStep; | |
112 | for (Int_t iphi = 0; iphi < NphiBins + 1; iphi++) | |
113 | phiBin[iphi] = phiMin + iphi * phiStep; | |
114 | /* THnSparse */ | |
115 | Int_t NparamBins[kNParams] = {NcentralityBins, NptBins, NetaBins, NphiBins}; | |
116 | Double_t *paramBin[kNParams] = {centralityBin, ptBin, etaBin, phiBin}; | |
117 | THnSparseF *hHisto[kNHistos][kNCharges]; | |
118 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) | |
119 | for (Int_t icharge = 0; icharge < kNCharges; icharge++) { | |
120 | hHisto[ihisto][icharge] = new THnSparseF(Form("hHisto_%s_%s", histoName[ihisto], chargeName[icharge]), "", kNParams, NparamBins); | |
121 | for (Int_t iparam = 0; iparam < kNParams; iparam++) | |
122 | hHisto[ihisto][icharge]->SetBinEdges(iparam, paramBin[iparam]); | |
123 | } | |
124 | #if 0 | |
125 | TH2F *hHistoPID[kNHistos][AliPID::kSPECIES][kNCharges]; | |
126 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) | |
127 | for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) | |
128 | for (Int_t icharge = 0; icharge < kNCharges; icharge++) { | |
129 | hHistoPID[ihisto][ipart][icharge] = new TH2F(Form("hHistoPID_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]), "", NcentralityBins, centralityBin, NptBins, ptBin); | |
130 | } | |
131 | #endif | |
132 | /* histos */ | |
133 | TH2F *hFEAMap = new TH2F("hFEAMap", "", 72, 0., 18., 91, 0., 91.); | |
134 | ||
135 | /* start stopwatch */ | |
136 | TStopwatch timer; | |
137 | timer.Start(); | |
138 | ||
139 | /* loop over events */ | |
140 | Double_t param[kNParams]; | |
141 | Int_t charge; | |
142 | Int_t index, sector, sectorStrip, padx, fea; | |
143 | Float_t hitmapx, hitmapy; | |
144 | AliTOFcalibHisto calib; | |
145 | calib.LoadCalibHisto(); | |
146 | for (Int_t iev = 0; iev < treein->GetEntries() && iev < evMax; iev++) { | |
147 | /* get event */ | |
148 | treein->GetEvent(iev); | |
149 | if (iev % 1000 == 0) printf("iev = %d\n", iev); | |
150 | /* check vertex */ | |
151 | if (!analysisEvent->AcceptVertex()) continue; | |
152 | /* check collision candidate */ | |
153 | if (!analysisEvent->IsCollisionCandidate()) continue; | |
154 | /* check centrality quality */ | |
155 | if (analysisEvent->GetCentralityQuality() != 0.) continue; | |
156 | ||
157 | /*** ACCEPTED EVENT ***/ | |
158 | ||
159 | /* get centrality */ | |
160 | param[kCentrality] = analysisEvent->GetCentralityPercentile(AliAnalysisEvent::kCentEst_V0M); | |
161 | ||
162 | /* loop over tracks */ | |
163 | for (Int_t itrk = 0; itrk < analysisTrackArray->GetEntries(); itrk++) { | |
164 | /* get track */ | |
165 | analysisTrack = (AliAnalysisTrack *)analysisTrackArray->At(itrk); | |
166 | if (!analysisTrack) continue; | |
167 | /* check accepted track */ | |
168 | if (!analysisTrack->AcceptTrack()) continue; | |
169 | ||
170 | /*** ACCEPTED TRACK ***/ | |
171 | ||
172 | /* get track info */ | |
173 | param[kPt] = analysisTrack->GetPt(); | |
174 | param[kEta] = analysisTrack->GetEta(); | |
175 | param[kPhi] = analysisTrack->GetPhi(); | |
176 | charge = analysisTrack->GetSign() > 0. ? kPositive : kNegative; | |
177 | index = analysisTrack->GetTOFIndex(); | |
178 | ||
179 | /* fill accepted tracks histos */ | |
180 | hHisto[kAcceptedTracks][charge]->Fill(param); | |
181 | #if 0 | |
182 | for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) { | |
183 | if (TMath::Abs(analysisTrack->GetY(AliPID::ParticleMass(ipart))) > 0.5) continue; | |
184 | hHistoPID[kAcceptedTracks][ipart][charge]->Fill(param[kCentrality], param[kPt]); | |
185 | } | |
186 | #endif | |
187 | ||
188 | /* check TOF PID */ | |
189 | if (!analysisTrack->HasTOFPID()) continue; | |
190 | /* check channel enabled */ | |
191 | // if (hEnabledFlag && hEnabledFlag->GetBinContent(index + 1) == 0.) continue; | |
192 | ||
193 | /*** ACCEPTED TRACK WITH TOF SIGNAL ***/ | |
194 | ||
195 | /* fill FEA map */ | |
196 | sector = calib.GetCalibMap(AliTOFcalibHisto::kSector, index); | |
197 | sectorStrip = calib.GetCalibMap(AliTOFcalibHisto::kSectorStrip, index); | |
198 | padx = calib.GetCalibMap(AliTOFcalibHisto::kPadX, index); | |
199 | fea = padx / 12; | |
200 | hitmapx = sector + ((Double_t)(3 - fea) + 0.5) / 4.; | |
201 | hitmapy = sectorStrip; | |
202 | hFEAMap->Fill(hitmapx, hitmapy); | |
203 | ||
204 | /* fill matched tracks histos */ | |
205 | hHisto[kMatchedTracks][charge]->Fill(param); | |
206 | if (!analysisTrack->IsMismatchMC()) { | |
207 | hHisto[kMatchedGoodTracks][charge]->Fill(param); | |
208 | hHisto[kMatchedCorrelatedTracks][charge]->Fill(param); | |
209 | } | |
210 | else { | |
211 | hHisto[kMismatchedTracks][charge]->Fill(param); | |
212 | if (!analysisTrack->IsUncorrelatedMismatchMC()) | |
213 | hHisto[kMatchedCorrelatedTracks][charge]->Fill(param); | |
214 | else | |
215 | hHisto[kUncorrelatedTracks][charge]->Fill(param); | |
216 | } | |
217 | #if 0 | |
218 | for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) { | |
219 | if (TMath::Abs(analysisTrack->GetY(AliPID::ParticleMass(ipart))) > 0.5) continue; | |
220 | hHistoPID[kMatchedTracks][ipart][charge]->Fill(param[kCentrality], param[kPt]); | |
221 | if (!analysisTrack->IsMismatchMC()) { | |
222 | hHistoPID[kMatchedGoodTracks][charge]->Fill(param); | |
223 | hHistoPID[kMatchedCorrelatedTracks][charge]->Fill(param); | |
224 | } | |
225 | else { | |
226 | hHistoPID[kMismatchedTracks][charge]->Fill(param); | |
227 | if (!analysisTrack->IsUncorrelatedMismatchMC()) | |
228 | hHistoPID[kMatchedCorrelatedTracks][charge]->Fill(param); | |
229 | else | |
230 | hHistoPID[kUncorrelatedTracks][charge]->Fill(param); | |
231 | } | |
232 | } | |
233 | #endif | |
234 | } | |
235 | } | |
236 | ||
237 | /* stop stopwatch */ | |
238 | timer.Stop(); | |
239 | timer.Print(); | |
240 | ||
241 | TFile *fileout = TFile::Open(Form("TOFmatchEff.%s", filename), "RECREATE"); | |
242 | hFEAMap->Write(); | |
243 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) | |
244 | for (Int_t icharge = 0; icharge < kNCharges; icharge++) { | |
245 | hHisto[ihisto][icharge]->Write(); | |
246 | } | |
247 | #if 0 | |
248 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) | |
249 | for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) | |
250 | for (Int_t icharge = 0; icharge < kNCharges; icharge++) { | |
251 | hHistoPID[ihisto][ipart][icharge]->Write(); | |
252 | } | |
253 | #endif | |
254 | fileout->Close(); | |
255 | ||
256 | } | |
257 | ||
258 | //_____________________________________________________________________________- | |
259 | ||
260 | TOFmatchEff_efficiencyPt(const Char_t *filename) | |
261 | { | |
262 | ||
263 | /* get data */ | |
264 | TFile *filein = TFile::Open(filename); | |
265 | THnSparseF *hHisto[kNHistos][kNCharges]; | |
266 | TH2F *hHistoPID[kNHistos][AliPID::kSPECIES][kNCharges]; | |
267 | TH1D *hHistoPt_MB[kNHistos][kNCharges], *hHistoPt_centrality[NcentralityBins][kNHistos][kNCharges]; | |
268 | TH1D *hHistoPIDPt_MB[kNHistos][AliPID::kSPECIES][kNCharges], *hHistoPIDPt_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges]; | |
269 | TH1D *hHistoAllPt_MB[kNHistos], *hHistoAllPt_centrality[NcentralityBins][kNHistos]; | |
270 | /* loop over histos */ | |
271 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) { | |
272 | ||
273 | /* INCLUSIVE */ | |
274 | ||
275 | hHistoAllPt_MB[ihisto] = new TH1D(Form("hHistoAllPt_MB_%s", histoName[ihisto]), "", NptBins, ptBin); | |
276 | for (Int_t icent = 0; icent < NcentralityBins; icent++) | |
277 | hHistoAllPt_centrality[icent][ihisto] = new TH1D(Form("hHistoAllPt_centrality%d_%s", icent, histoName[ihisto]), "", NptBins, ptBin); | |
278 | ||
279 | /* SINGLE PARTICLE */ | |
280 | ||
281 | for (Int_t icharge = 0; icharge < kNCharges; icharge++) { | |
282 | ||
283 | /* get histo */ | |
284 | hHisto[ihisto][icharge] = (THnSparseF *)filein->Get(Form("hHisto_%s_%s", histoName[ihisto], chargeName[icharge])); | |
285 | ||
286 | /* MB projection */ | |
287 | hHistoPt_MB[ihisto][icharge] = hHisto[ihisto][icharge]->Projection(kPt); | |
288 | hHistoPt_MB[ihisto][icharge]->SetName(Form("hHistoPt_MB_%s_%s", histoName[ihisto], chargeName[icharge])); | |
289 | hHistoPt_MB[ihisto][icharge]->Sumw2(); | |
290 | hHistoAllPt_MB[ihisto]->Add(hHistoPt_MB[ihisto][icharge]); | |
291 | ||
292 | /* centrality projection */ | |
293 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
294 | ||
295 | hHisto[ihisto][icharge]->GetAxis(kCentrality)->SetRange(icent + 1, icent + 1); | |
296 | hHistoPt_centrality[icent][ihisto][icharge] = hHisto[ihisto][icharge]->Projection(kPt); | |
297 | hHistoPt_centrality[icent][ihisto][icharge]->SetName(Form("hHistoPt_centrality%d_%s_%s", icent, histoName[ihisto], chargeName[icharge])); | |
298 | hHistoPt_centrality[icent][ihisto][icharge]->Sumw2(); | |
299 | hHistoAllPt_centrality[icent][ihisto]->Add(hHistoPt_centrality[icent][ihisto][icharge]); | |
300 | } | |
301 | ||
302 | #if 0 | |
303 | for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) { | |
304 | ||
305 | /* get histo */ | |
306 | hHistoPID[ihisto][ipart][icharge] = (TH2F *)filein->Get(Form("hHistoPID_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge])); | |
307 | ||
308 | /* MB projection */ | |
309 | hHistoPIDPt_MB[ihisto][ipart][icharge] = hHistoPID[ihisto][ipart][icharge]->ProjectionY("hpy"); | |
310 | hHistoPIDPt_MB[ihisto][ipart][icharge]->SetName(Form("hHistoPIDPt_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge])); | |
311 | hHistoPIDPt_MB[ihisto][ipart][icharge]->Sumw2(); | |
312 | ||
313 | /* centrality projection */ | |
314 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
315 | hHistoPIDPt_centrality[icent][ihisto][ipart][icharge] = hHistoPID[ihisto][ipart][icharge]->ProjectionY("hpy", icent + 1, icent + 1); | |
316 | hHistoPIDPt_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hHistoPIDPt_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge])); | |
317 | hHistoPIDPt_centrality[icent][ihisto][ipart][icharge]->Sumw2(); | |
318 | ||
319 | } | |
320 | ||
321 | } | |
322 | #endif | |
323 | ||
324 | } | |
325 | } | |
326 | ||
327 | /* output */ | |
328 | TString str = filename; | |
329 | str.Insert(str.Length() - TString(".root").Length(), ".efficiencyPt"); | |
330 | TFile *fileout = TFile::Open(str.Data(), "RECREATE"); | |
331 | ||
332 | /* efficiencies/fractions and write */ | |
333 | TH1D *hEfficiencyPt_MB[kNHistos][kNCharges], *hEfficiencyPt_centrality[NcentralityBins][kNHistos][kNCharges], *hEfficiencyPt_ratioMB_centrality[NcentralityBins][kNHistos][kNCharges]; | |
334 | TH1D *hEfficiencyPIDPt_MB[kNHistos][AliPID::kSPECIES][kNCharges], *hEfficiencyPIDPt_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges], *hEfficiencyPIDPt_ratioMB_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges]; | |
335 | TH1D *hEfficiencyAllPt_MB[kNHistos], *hEfficiencyAllPt_centrality[NcentralityBins][kNHistos], *hEfficiencyAllPt_ratioMB_centrality[NcentralityBins][kNHistos]; | |
336 | ||
337 | TH1D *hFractionPt_MB[kNHistos][kNCharges], *hFractionPt_centrality[NcentralityBins][kNHistos][kNCharges], *hFractionPt_ratioMB_centrality[NcentralityBins][kNHistos][kNCharges]; | |
338 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) { | |
339 | ||
340 | if (ihisto == kAcceptedTracks) continue; | |
341 | ||
342 | /* INCLUSIVE */ | |
343 | ||
344 | /* MB efficiency */ | |
345 | hEfficiencyAllPt_MB[ihisto] = new TH1D(*hHistoAllPt_MB[ihisto]); | |
346 | hEfficiencyAllPt_MB[ihisto]->SetName(Form("hEfficiencyAllPt_MB_%s", histoName[ihisto])); | |
347 | hEfficiencyAllPt_MB[ihisto]->SetLineWidth(2); | |
348 | hEfficiencyAllPt_MB[ihisto]->SetLineColor(1); | |
349 | hEfficiencyAllPt_MB[ihisto]->SetMarkerStyle(20); | |
350 | hEfficiencyAllPt_MB[ihisto]->SetMarkerColor(1); | |
351 | hEfficiencyAllPt_MB[ihisto]->Divide(hEfficiencyAllPt_MB[ihisto], hHistoAllPt_MB[kAcceptedTracks], 1, 1, "B"); | |
352 | hEfficiencyAllPt_MB[ihisto]->Write(); | |
353 | ||
354 | /* multiplicity/centrality efficiency */ | |
355 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
356 | hEfficiencyAllPt_centrality[icent][ihisto] = new TH1D(*hHistoAllPt_centrality[icent][ihisto]); | |
357 | hEfficiencyAllPt_centrality[icent][ihisto]->SetName(Form("hEfficiencyAllPt_centrality%d_%s", icent, histoName[ihisto])); | |
358 | hEfficiencyAllPt_centrality[icent][ihisto]->SetLineWidth(2); | |
359 | hEfficiencyAllPt_centrality[icent][ihisto]->SetLineColor(multcentColor[icent]); | |
360 | hEfficiencyAllPt_centrality[icent][ihisto]->SetMarkerStyle(20); | |
361 | hEfficiencyAllPt_centrality[icent][ihisto]->SetMarkerColor(multcentColor[icent]); | |
362 | hEfficiencyAllPt_centrality[icent][ihisto]->Divide(hEfficiencyAllPt_centrality[icent][ihisto], hHistoAllPt_centrality[icent][kAcceptedTracks], 1, 1, "B"); | |
363 | hEfficiencyAllPt_centrality[icent][ihisto]->Write(); | |
364 | ||
365 | /* ratio wrt. MB */ | |
366 | hEfficiencyAllPt_ratioMB_centrality[icent][ihisto] = new TH1D(*hEfficiencyAllPt_centrality[icent][ihisto]); | |
367 | hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->SetName(Form("hEfficiencyAllPt_ratioMB_centrality%d_%s", icent, histoName[ihisto])); | |
368 | hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->SetLineWidth(2); | |
369 | hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->SetLineColor(multcentColor[icent]); | |
370 | hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->SetMarkerStyle(20); | |
371 | hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->SetMarkerColor(multcentColor[icent]); | |
372 | hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->Divide(hEfficiencyAllPt_MB[ihisto]); | |
373 | hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->Write(); | |
374 | } | |
375 | ||
376 | /* SINGLE PARTICLE */ | |
377 | ||
378 | for (Int_t icharge = 0; icharge < kNCharges; icharge++) { | |
379 | ||
380 | /* MB efficiency */ | |
381 | hEfficiencyPt_MB[ihisto][icharge] = new TH1D(*hHistoPt_MB[ihisto][icharge]); | |
382 | hEfficiencyPt_MB[ihisto][icharge]->SetName(Form("hEfficiencyPt_MB_%s_%s", histoName[ihisto], chargeName[icharge])); | |
383 | hEfficiencyPt_MB[ihisto][icharge]->SetLineWidth(2); | |
384 | hEfficiencyPt_MB[ihisto][icharge]->SetLineColor(1); | |
385 | hEfficiencyPt_MB[ihisto][icharge]->SetMarkerStyle(20); | |
386 | hEfficiencyPt_MB[ihisto][icharge]->SetMarkerColor(1); | |
387 | hEfficiencyPt_MB[ihisto][icharge]->Divide(hEfficiencyPt_MB[ihisto][icharge], hHistoPt_MB[kAcceptedTracks][icharge], 1, 1, "B"); | |
388 | hEfficiencyPt_MB[ihisto][icharge]->Write(); | |
389 | ||
390 | /* multiplicity/centrality efficiency */ | |
391 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
392 | hEfficiencyPt_centrality[icent][ihisto][icharge] = new TH1D(*hHistoPt_centrality[icent][ihisto][icharge]); | |
393 | hEfficiencyPt_centrality[icent][ihisto][icharge]->SetName(Form("hEfficiencyPt_centrality%d_%s_%s", icent, histoName[ihisto], chargeName[icharge])); | |
394 | hEfficiencyPt_centrality[icent][ihisto][icharge]->SetLineWidth(2); | |
395 | hEfficiencyPt_centrality[icent][ihisto][icharge]->SetLineColor(multcentColor[icent]); | |
396 | hEfficiencyPt_centrality[icent][ihisto][icharge]->SetMarkerStyle(20); | |
397 | hEfficiencyPt_centrality[icent][ihisto][icharge]->SetMarkerColor(multcentColor[icent]); | |
398 | hEfficiencyPt_centrality[icent][ihisto][icharge]->Divide(hEfficiencyPt_centrality[icent][ihisto][icharge], hHistoPt_centrality[icent][kAcceptedTracks][icharge], 1, 1, "B"); | |
399 | hEfficiencyPt_centrality[icent][ihisto][icharge]->Write(); | |
400 | ||
401 | /* ratio wrt. MB */ | |
402 | hEfficiencyPt_ratioMB_centrality[icent][ihisto][icharge] = new TH1D(*hEfficiencyPt_centrality[icent][ihisto][icharge]); | |
403 | hEfficiencyPt_ratioMB_centrality[icent][ihisto][icharge]->SetName(Form("hEfficiencyPt_ratioMB_centrality%d_%s_%s", icent, histoName[ihisto], chargeName[icharge])); | |
404 | hEfficiencyPt_ratioMB_centrality[icent][ihisto][icharge]->SetLineWidth(2); | |
405 | hEfficiencyPt_ratioMB_centrality[icent][ihisto][icharge]->SetLineColor(multcentColor[icent]); | |
406 | hEfficiencyPt_ratioMB_centrality[icent][ihisto][icharge]->SetMarkerStyle(20); | |
407 | hEfficiencyPt_ratioMB_centrality[icent][ihisto][icharge]->SetMarkerColor(multcentColor[icent]); | |
408 | hEfficiencyPt_ratioMB_centrality[icent][ihisto][icharge]->Divide(hEfficiencyPt_MB[ihisto][icharge]); | |
409 | hEfficiencyPt_ratioMB_centrality[icent][ihisto][icharge]->Write(); | |
410 | } | |
411 | ||
412 | #if 0 | |
413 | for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) { | |
414 | ||
415 | /* MB efficiency */ | |
416 | hEfficiencyPIDPt_MB[ihisto][ipart][icharge] = new TH1D(*hHistoPIDPt_MB[ihisto][ipart][icharge]); | |
417 | hEfficiencyPIDPt_MB[ihisto][ipart][icharge]->SetName(Form("hEfficiencyPIDPt_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge])); | |
418 | hEfficiencyPIDPt_MB[ihisto][ipart][icharge]->SetLineWidth(2); | |
419 | hEfficiencyPIDPt_MB[ihisto][ipart][icharge]->SetLineColor(1); | |
420 | hEfficiencyPIDPt_MB[ihisto][ipart][icharge]->SetMarkerStyle(20); | |
421 | hEfficiencyPIDPt_MB[ihisto][ipart][icharge]->SetMarkerColor(1); | |
422 | hEfficiencyPIDPt_MB[ihisto][ipart][icharge]->Divide(hEfficiencyPIDPt_MB[ihisto][ipart][icharge], hHistoPIDPt_MB[kAcceptedTracks][ipart][icharge], 1, 1, "B"); | |
423 | hEfficiencyPIDPt_MB[ihisto][ipart][icharge]->Write(); | |
424 | ||
425 | /* multiplicity/centrality efficiency */ | |
426 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
427 | ||
428 | hEfficiencyPIDPt_centrality[icent][ihisto][ipart][icharge] = new TH1D(*hHistoPIDPt_centrality[icent][ihisto][ipart][icharge]); | |
429 | hEfficiencyPIDPt_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hEfficiencyPIDPt_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge])); | |
430 | hEfficiencyPIDPt_centrality[icent][ihisto][ipart][icharge]->SetLineWidth(2); | |
431 | hEfficiencyPIDPt_centrality[icent][ihisto][ipart][icharge]->SetLineColor(multcentColor[icent]); | |
432 | hEfficiencyPIDPt_centrality[icent][ihisto][ipart][icharge]->SetMarkerStyle(20); | |
433 | hEfficiencyPIDPt_centrality[icent][ihisto][ipart][icharge]->SetMarkerColor(multcentColor[icent]); | |
434 | ||
435 | hEfficiencyPIDPt_centrality[icent][ihisto][ipart][icharge]->Divide(hEfficiencyPIDPt_centrality[icent][ihisto][ipart][icharge], hHistoPIDPt_centrality[icent][kAcceptedTracks][ipart][icharge], 1, 1, "B"); | |
436 | hEfficiencyPIDPt_centrality[icent][ihisto][ipart][icharge]->Write(); | |
437 | ||
438 | /* ratio wrt. MB */ | |
439 | hEfficiencyPIDPt_ratioMB_centrality[icent][ihisto][ipart][icharge] = new TH1D(*hEfficiencyPIDPt_centrality[icent][ihisto][ipart][icharge]); | |
440 | hEfficiencyPIDPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hEfficiencyPIDPt_ratioMB_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge])); | |
441 | hEfficiencyPIDPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetLineWidth(2); | |
442 | hEfficiencyPIDPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetLineColor(multcentColor[icent]); | |
443 | hEfficiencyPIDPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetMarkerStyle(20); | |
444 | hEfficiencyPIDPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetMarkerColor(multcentColor[icent]); | |
445 | hEfficiencyPIDPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->Divide(hEfficiencyPIDPt_MB[ihisto][ipart][icharge]); | |
446 | hEfficiencyPIDPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->Write(); | |
447 | } | |
448 | ||
449 | ||
450 | } | |
451 | #endif | |
452 | ||
453 | } | |
454 | } | |
455 | ||
456 | fileout->Close(); | |
457 | ||
458 | } | |
459 | ||
460 | //_____________________________________________________________________________- | |
461 | ||
462 | TOFmatchEff_efficiencyPhi(const Char_t *filename) | |
463 | { | |
464 | ||
465 | /* get data */ | |
466 | TFile *filein = TFile::Open(filename); | |
467 | THnSparseF *hHisto[kNHistos][kNCharges]; | |
468 | TH1D *hHistoPhi_MB[kNHistos][kNCharges], *hHistoPhi_centrality[NcentralityBins][kNHistos][kNCharges]; | |
469 | TH1D *hHistoPhi_MB_pt[NptsubBins][kNHistos][kNCharges], *hHistoPhi_centrality_pt[NcentralityBins][NptsubBins][kNHistos][kNCharges]; | |
470 | /* loop over histos */ | |
471 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) | |
472 | for (Int_t icharge = 0; icharge < kNCharges; icharge++) { | |
473 | ||
474 | /* get histo */ | |
475 | hHisto[ihisto][icharge] = (THnSparseF *)filein->Get(Form("hHisto_%s_%s", histoName[ihisto], chargeName[icharge])); | |
476 | ||
477 | /* MB projection */ | |
478 | hHisto[ihisto][icharge]->GetAxis(kPt)->SetRange(0, 0); | |
479 | hHisto[ihisto][icharge]->GetAxis(kCentrality)->SetRange(0, 0); | |
480 | hHistoPhi_MB[ihisto][icharge] = hHisto[ihisto][icharge]->Projection(kPhi); | |
481 | hHistoPhi_MB[ihisto][icharge]->SetName(Form("hHistoPhi_MB_%s_%s", histoName[ihisto], chargeName[icharge])); | |
482 | hHistoPhi_MB[ihisto][icharge]->Sumw2(); | |
483 | /* pt bins */ | |
484 | for (Int_t ipt = 0; ipt < NptsubBins; ipt++) { | |
485 | hHisto[ihisto][icharge]->GetAxis(kPt)->SetRange(ptsubBinMin[ipt] + 1, ptsubBinMax[ipt] + 1); | |
486 | hHisto[ihisto][icharge]->GetAxis(kCentrality)->SetRange(0, 0); | |
487 | hHistoPhi_MB_pt[ipt][ihisto][icharge] = hHisto[ihisto][icharge]->Projection(kPhi); | |
488 | hHistoPhi_MB_pt[ipt][ihisto][icharge]->SetName(Form("hHistoPhi_MB_pt%d_%s_%s", ipt, histoName[ihisto], chargeName[icharge])); | |
489 | hHistoPhi_MB_pt[ipt][ihisto][icharge]->Sumw2(); | |
490 | } | |
491 | ||
492 | /* centrality projection */ | |
493 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
494 | hHisto[ihisto][icharge]->GetAxis(kPt)->SetRange(0, 0); | |
495 | hHisto[ihisto][icharge]->GetAxis(kCentrality)->SetRange(icent + 1, icent + 1); | |
496 | hHistoPhi_centrality[icent][ihisto][icharge] = hHisto[ihisto][icharge]->Projection(kPhi); | |
497 | hHistoPhi_centrality[icent][ihisto][icharge]->SetName(Form("hHistoPhi_centrality%d_%s_%s", icent, histoName[ihisto], chargeName[icharge])); | |
498 | hHistoPhi_centrality[icent][ihisto][icharge]->Sumw2(); | |
499 | /* pt bins */ | |
500 | for (Int_t ipt = 0; ipt < NptsubBins; ipt++) { | |
501 | hHisto[ihisto][icharge]->GetAxis(kPt)->SetRange(ptsubBinMin[ipt] + 1, ptsubBinMax[ipt] + 1); | |
502 | hHisto[ihisto][icharge]->GetAxis(kCentrality)->SetRange(icent + 1, icent + 1); | |
503 | hHistoPhi_centrality_pt[icent][ipt][ihisto][icharge] = hHisto[ihisto][icharge]->Projection(kPhi); | |
504 | hHistoPhi_centrality_pt[icent][ipt][ihisto][icharge]->SetName(Form("hHistoPhi_centrality%d_pt%d_%s_%s", icent, ipt, histoName[ihisto], chargeName[icharge])); | |
505 | hHistoPhi_centrality_pt[icent][ipt][ihisto][icharge]->Sumw2(); | |
506 | } | |
507 | } | |
508 | } | |
509 | ||
510 | /* output */ | |
511 | TString str = filename; | |
512 | str.Insert(str.Length() - TString(".root").Length(), ".efficiencyPhi"); | |
513 | TFile *fileout = TFile::Open(str.Data(), "RECREATE"); | |
514 | ||
515 | /* efficiencies/fractions and write */ | |
516 | TH1D *hEfficiencyPhi_MB[kNHistos][kNCharges], *hEfficiencyPhi_centrality[NcentralityBins][kNHistos][kNCharges], *hEfficiencyPhi_ratioMB_centrality[NcentralityBins][kNHistos][kNCharges]; | |
517 | TH1D *hEfficiencyPhi_MB_pt[NptsubBins][kNHistos][kNCharges], *hEfficiencyPhi_centrality_pt[NcentralityBins][NptsubBins][kNHistos][kNCharges], *hEfficiencyPhi_ratioMB_centrality_pt[NcentralityBins][NptsubBins][kNHistos][kNCharges]; | |
518 | ||
519 | ||
520 | TH1D *hFractionPhi_MB[kNHistos][kNCharges], *hFractionPhi_centrality[NcentralityBins][kNHistos][kNCharges], *hFractionPhi_ratioMB_centrality[NcentralityBins][kNHistos][kNCharges]; | |
521 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) { | |
522 | for (Int_t icharge = 0; icharge < kNCharges; icharge++) { | |
523 | ||
524 | if (ihisto == kAcceptedTracks) continue; | |
525 | ||
526 | /* MB efficiency */ | |
527 | hEfficiencyPhi_MB[ihisto][icharge] = new TH1D(*hHistoPhi_MB[ihisto][icharge]); | |
528 | hEfficiencyPhi_MB[ihisto][icharge]->SetName(Form("hEfficiencyPhi_MB_%s_%s", histoName[ihisto], chargeName[icharge])); | |
529 | hEfficiencyPhi_MB[ihisto][icharge]->SetLineWidth(2); | |
530 | hEfficiencyPhi_MB[ihisto][icharge]->SetLineColor(1); | |
531 | hEfficiencyPhi_MB[ihisto][icharge]->SetMarkerStyle(20); | |
532 | hEfficiencyPhi_MB[ihisto][icharge]->SetMarkerColor(1); | |
533 | hEfficiencyPhi_MB[ihisto][icharge]->Divide(hEfficiencyPhi_MB[ihisto][icharge], hHistoPhi_MB[kAcceptedTracks][icharge], 1, 1, "B"); | |
534 | hEfficiencyPhi_MB[ihisto][icharge]->Write(); | |
535 | /* pt bins */ | |
536 | for (Int_t ipt = 0; ipt < NptsubBins; ipt++) { | |
537 | hEfficiencyPhi_MB_pt[ipt][ihisto][icharge] = new TH1D(*hHistoPhi_MB_pt[ipt][ihisto][icharge]); | |
538 | hEfficiencyPhi_MB_pt[ipt][ihisto][icharge]->SetName(Form("hEfficiencyPhi_MB_pt%d_%s_%s", ipt, histoName[ihisto], chargeName[icharge])); | |
539 | hEfficiencyPhi_MB_pt[ipt][ihisto][icharge]->SetLineWidth(2); | |
540 | hEfficiencyPhi_MB_pt[ipt][ihisto][icharge]->SetLineColor(1); | |
541 | hEfficiencyPhi_MB_pt[ipt][ihisto][icharge]->SetMarkerStyle(20); | |
542 | hEfficiencyPhi_MB_pt[ipt][ihisto][icharge]->SetMarkerColor(1); | |
543 | hEfficiencyPhi_MB_pt[ipt][ihisto][icharge]->Divide(hEfficiencyPhi_MB_pt[ipt][ihisto][icharge], hHistoPhi_MB_pt[ipt][kAcceptedTracks][icharge], 1, 1, "B"); | |
544 | hEfficiencyPhi_MB_pt[ipt][ihisto][icharge]->Write(); | |
545 | } | |
546 | ||
547 | /* multiplicity/centrality efficiency */ | |
548 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
549 | hEfficiencyPhi_centrality[icent][ihisto][icharge] = new TH1D(*hHistoPhi_centrality[icent][ihisto][icharge]); | |
550 | hEfficiencyPhi_centrality[icent][ihisto][icharge]->SetName(Form("hEfficiencyPhi_centrality%d_%s_%s", icent, histoName[ihisto], chargeName[icharge])); | |
551 | hEfficiencyPhi_centrality[icent][ihisto][icharge]->SetLineWidth(2); | |
552 | hEfficiencyPhi_centrality[icent][ihisto][icharge]->SetLineColor(multcentColor[icent]); | |
553 | hEfficiencyPhi_centrality[icent][ihisto][icharge]->SetMarkerStyle(20); | |
554 | hEfficiencyPhi_centrality[icent][ihisto][icharge]->SetMarkerColor(multcentColor[icent]); | |
555 | hEfficiencyPhi_centrality[icent][ihisto][icharge]->Divide(hEfficiencyPhi_centrality[icent][ihisto][icharge], hHistoPhi_centrality[icent][kAcceptedTracks][icharge], 1, 1, "B"); | |
556 | hEfficiencyPhi_centrality[icent][ihisto][icharge]->Write(); | |
557 | ||
558 | /* ratio wrt. MB */ | |
559 | hEfficiencyPhi_ratioMB_centrality[icent][ihisto][icharge] = new TH1D(*hEfficiencyPhi_centrality[icent][ihisto][icharge]); | |
560 | hEfficiencyPhi_ratioMB_centrality[icent][ihisto][icharge]->SetName(Form("hEfficiencyPhi_ratioMB_centrality%d_%s_%s", icent, histoName[ihisto], chargeName[icharge])); | |
561 | hEfficiencyPhi_ratioMB_centrality[icent][ihisto][icharge]->SetLineWidth(2); | |
562 | hEfficiencyPhi_ratioMB_centrality[icent][ihisto][icharge]->SetLineColor(multcentColor[icent]); | |
563 | hEfficiencyPhi_ratioMB_centrality[icent][ihisto][icharge]->SetMarkerStyle(20); | |
564 | hEfficiencyPhi_ratioMB_centrality[icent][ihisto][icharge]->SetMarkerColor(multcentColor[icent]); | |
565 | hEfficiencyPhi_ratioMB_centrality[icent][ihisto][icharge]->Divide(hEfficiencyPhi_MB[ihisto][icharge]); | |
566 | hEfficiencyPhi_ratioMB_centrality[icent][ihisto][icharge]->Write(); | |
567 | } | |
568 | ||
569 | } | |
570 | } | |
571 | ||
572 | fileout->Close(); | |
573 | ||
574 | } | |
575 | ||
576 | //_____________________________________________________________________________- | |
577 | ||
578 | TOFmatchEff_efficiencyEta(const Char_t *filename) | |
579 | { | |
580 | ||
581 | /* get data */ | |
582 | TFile *filein = TFile::Open(filename); | |
583 | THnSparseF *hHisto[kNHistos][kNCharges]; | |
584 | TH1D *hHistoEta_MB[kNHistos][kNCharges], *hHistoEta_centrality[NcentralityBins][kNHistos][kNCharges]; | |
585 | TH1D *hHistoEta_MB_pt[NptsubBins][kNHistos][kNCharges], *hHistoEta_centrality_pt[NcentralityBins][NptsubBins][kNHistos][kNCharges]; | |
586 | /* loop over histos */ | |
587 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) | |
588 | for (Int_t icharge = 0; icharge < kNCharges; icharge++) { | |
589 | ||
590 | /* get histo */ | |
591 | hHisto[ihisto][icharge] = (THnSparseF *)filein->Get(Form("hHisto_%s_%s", histoName[ihisto], chargeName[icharge])); | |
592 | ||
593 | /* MB projection */ | |
594 | hHisto[ihisto][icharge]->GetAxis(kPt)->SetRange(0, 0); | |
595 | hHisto[ihisto][icharge]->GetAxis(kCentrality)->SetRange(0, 0); | |
596 | hHistoEta_MB[ihisto][icharge] = hHisto[ihisto][icharge]->Projection(kEta); | |
597 | hHistoEta_MB[ihisto][icharge]->SetName(Form("hHistoEta_MB_%s_%s", histoName[ihisto], chargeName[icharge])); | |
598 | hHistoEta_MB[ihisto][icharge]->Sumw2(); | |
599 | /* pt bins */ | |
600 | for (Int_t ipt = 0; ipt < NptsubBins; ipt++) { | |
601 | hHisto[ihisto][icharge]->GetAxis(kPt)->SetRange(ptsubBinMin[ipt] + 1, ptsubBinMax[ipt] + 1); | |
602 | hHisto[ihisto][icharge]->GetAxis(kCentrality)->SetRange(0, 0); | |
603 | hHistoEta_MB_pt[ipt][ihisto][icharge] = hHisto[ihisto][icharge]->Projection(kEta); | |
604 | hHistoEta_MB_pt[ipt][ihisto][icharge]->SetName(Form("hHistoEta_MB_pt%d_%s_%s", ipt, histoName[ihisto], chargeName[icharge])); | |
605 | hHistoEta_MB_pt[ipt][ihisto][icharge]->Sumw2(); | |
606 | } | |
607 | ||
608 | /* centrality projection */ | |
609 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
610 | hHisto[ihisto][icharge]->GetAxis(kPt)->SetRange(0, 0); | |
611 | hHisto[ihisto][icharge]->GetAxis(kCentrality)->SetRange(icent + 1, icent + 1); | |
612 | hHistoEta_centrality[icent][ihisto][icharge] = hHisto[ihisto][icharge]->Projection(kEta); | |
613 | hHistoEta_centrality[icent][ihisto][icharge]->SetName(Form("hHistoEta_centrality%d_%s_%s", icent, histoName[ihisto], chargeName[icharge])); | |
614 | hHistoEta_centrality[icent][ihisto][icharge]->Sumw2(); | |
615 | /* pt bins */ | |
616 | for (Int_t ipt = 0; ipt < NptsubBins; ipt++) { | |
617 | hHisto[ihisto][icharge]->GetAxis(kPt)->SetRange(ptsubBinMin[ipt] + 1, ptsubBinMax[ipt] + 1); | |
618 | hHisto[ihisto][icharge]->GetAxis(kCentrality)->SetRange(icent + 1, icent + 1); | |
619 | hHistoEta_centrality_pt[icent][ipt][ihisto][icharge] = hHisto[ihisto][icharge]->Projection(kEta); | |
620 | hHistoEta_centrality_pt[icent][ipt][ihisto][icharge]->SetName(Form("hHistoEta_centrality%d_pt%d_%s_%s", icent, ipt, histoName[ihisto], chargeName[icharge])); | |
621 | hHistoEta_centrality_pt[icent][ipt][ihisto][icharge]->Sumw2(); | |
622 | } | |
623 | } | |
624 | } | |
625 | ||
626 | /* output */ | |
627 | TString str = filename; | |
628 | str.Insert(str.Length() - TString(".root").Length(), ".efficiencyEta"); | |
629 | TFile *fileout = TFile::Open(str.Data(), "RECREATE"); | |
630 | ||
631 | /* efficiencies/fractions and write */ | |
632 | TH1D *hEfficiencyEta_MB[kNHistos][kNCharges], *hEfficiencyEta_centrality[NcentralityBins][kNHistos][kNCharges], *hEfficiencyEta_ratioMB_centrality[NcentralityBins][kNHistos][kNCharges]; | |
633 | TH1D *hEfficiencyEta_MB_pt[NptsubBins][kNHistos][kNCharges], *hEfficiencyEta_centrality_pt[NcentralityBins][NptsubBins][kNHistos][kNCharges], *hEfficiencyEta_ratioMB_centrality_pt[NcentralityBins][NptsubBins][kNHistos][kNCharges]; | |
634 | ||
635 | ||
636 | TH1D *hFractionEta_MB[kNHistos][kNCharges], *hFractionEta_centrality[NcentralityBins][kNHistos][kNCharges], *hFractionEta_ratioMB_centrality[NcentralityBins][kNHistos][kNCharges]; | |
637 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) { | |
638 | for (Int_t icharge = 0; icharge < kNCharges; icharge++) { | |
639 | ||
640 | if (ihisto == kAcceptedTracks) continue; | |
641 | ||
642 | /* MB efficiency */ | |
643 | hEfficiencyEta_MB[ihisto][icharge] = new TH1D(*hHistoEta_MB[ihisto][icharge]); | |
644 | hEfficiencyEta_MB[ihisto][icharge]->SetName(Form("hEfficiencyEta_MB_%s_%s", histoName[ihisto], chargeName[icharge])); | |
645 | hEfficiencyEta_MB[ihisto][icharge]->SetLineWidth(2); | |
646 | hEfficiencyEta_MB[ihisto][icharge]->SetLineColor(1); | |
647 | hEfficiencyEta_MB[ihisto][icharge]->SetMarkerStyle(20); | |
648 | hEfficiencyEta_MB[ihisto][icharge]->SetMarkerColor(1); | |
649 | hEfficiencyEta_MB[ihisto][icharge]->Divide(hEfficiencyEta_MB[ihisto][icharge], hHistoEta_MB[kAcceptedTracks][icharge], 1, 1, "B"); | |
650 | hEfficiencyEta_MB[ihisto][icharge]->Write(); | |
651 | /* pt bins */ | |
652 | for (Int_t ipt = 0; ipt < NptsubBins; ipt++) { | |
653 | hEfficiencyEta_MB_pt[ipt][ihisto][icharge] = new TH1D(*hHistoEta_MB_pt[ipt][ihisto][icharge]); | |
654 | hEfficiencyEta_MB_pt[ipt][ihisto][icharge]->SetName(Form("hEfficiencyEta_MB_pt%d_%s_%s", ipt, histoName[ihisto], chargeName[icharge])); | |
655 | hEfficiencyEta_MB_pt[ipt][ihisto][icharge]->SetLineWidth(2); | |
656 | hEfficiencyEta_MB_pt[ipt][ihisto][icharge]->SetLineColor(1); | |
657 | hEfficiencyEta_MB_pt[ipt][ihisto][icharge]->SetMarkerStyle(20); | |
658 | hEfficiencyEta_MB_pt[ipt][ihisto][icharge]->SetMarkerColor(1); | |
659 | hEfficiencyEta_MB_pt[ipt][ihisto][icharge]->Divide(hEfficiencyEta_MB_pt[ipt][ihisto][icharge], hHistoEta_MB_pt[ipt][kAcceptedTracks][icharge], 1, 1, "B"); | |
660 | hEfficiencyEta_MB_pt[ipt][ihisto][icharge]->Write(); | |
661 | } | |
662 | ||
663 | /* multiplicity/centrality efficiency */ | |
664 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
665 | hEfficiencyEta_centrality[icent][ihisto][icharge] = new TH1D(*hHistoEta_centrality[icent][ihisto][icharge]); | |
666 | hEfficiencyEta_centrality[icent][ihisto][icharge]->SetName(Form("hEfficiencyEta_centrality%d_%s_%s", icent, histoName[ihisto], chargeName[icharge])); | |
667 | hEfficiencyEta_centrality[icent][ihisto][icharge]->SetLineWidth(2); | |
668 | hEfficiencyEta_centrality[icent][ihisto][icharge]->SetLineColor(multcentColor[icent]); | |
669 | hEfficiencyEta_centrality[icent][ihisto][icharge]->SetMarkerStyle(20); | |
670 | hEfficiencyEta_centrality[icent][ihisto][icharge]->SetMarkerColor(multcentColor[icent]); | |
671 | hEfficiencyEta_centrality[icent][ihisto][icharge]->Divide(hEfficiencyEta_centrality[icent][ihisto][icharge], hHistoEta_centrality[icent][kAcceptedTracks][icharge], 1, 1, "B"); | |
672 | hEfficiencyEta_centrality[icent][ihisto][icharge]->Write(); | |
673 | ||
674 | /* ratio wrt. MB */ | |
675 | hEfficiencyEta_ratioMB_centrality[icent][ihisto][icharge] = new TH1D(*hEfficiencyEta_centrality[icent][ihisto][icharge]); | |
676 | hEfficiencyEta_ratioMB_centrality[icent][ihisto][icharge]->SetName(Form("hEfficiencyEta_ratioMB_centrality%d_%s_%s", icent, histoName[ihisto], chargeName[icharge])); | |
677 | hEfficiencyEta_ratioMB_centrality[icent][ihisto][icharge]->SetLineWidth(2); | |
678 | hEfficiencyEta_ratioMB_centrality[icent][ihisto][icharge]->SetLineColor(multcentColor[icent]); | |
679 | hEfficiencyEta_ratioMB_centrality[icent][ihisto][icharge]->SetMarkerStyle(20); | |
680 | hEfficiencyEta_ratioMB_centrality[icent][ihisto][icharge]->SetMarkerColor(multcentColor[icent]); | |
681 | hEfficiencyEta_ratioMB_centrality[icent][ihisto][icharge]->Divide(hEfficiencyEta_MB[ihisto][icharge]); | |
682 | hEfficiencyEta_ratioMB_centrality[icent][ihisto][icharge]->Write(); | |
683 | } | |
684 | ||
685 | } | |
686 | } | |
687 | ||
688 | fileout->Close(); | |
689 | ||
690 | } | |
691 | ||
692 | #if 0 | |
693 | //_____________________________________________________________________________- | |
694 | ||
695 | TOFmatchMC_efficiencyCent(const Char_t *filename, const Char_t *particle = "", const Char_t *charge = "", const Char_t *trdmode = "") | |
696 | { | |
697 | ||
698 | const Int_t npt = 4; | |
699 | Double_t pt[npt + 1] = {0., 0.5, 1.0, 1.5, 5.0}; | |
700 | ||
701 | /* get data */ | |
702 | TFile *filein = TFile::Open(filename); | |
703 | THnSparseF *hHisto[kNHistos]; | |
704 | TH1D *hHisto_all[kNHistos], *hHisto_MB_all[kNHistos], *hHisto_pt[kNHistos][MAXMULTCENTBINS], *hHisto_MB_pt[kNHistos][MAXMULTCENTBINS]; | |
705 | /* loop over histos */ | |
706 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) { | |
707 | if (ihisto == kMatchedCorrelatedTracks) continue; | |
708 | /* get histo */ | |
709 | hHisto[ihisto] = (THnSparseF *)filein->Get(histoName[ihisto]); | |
710 | /* set range limits */ | |
711 | hHisto[ihisto]->GetAxis(kRapidity)->SetRangeUser(-0.5 + kEpsilon, 0.5 - kEpsilon); | |
712 | hHisto[ihisto]->GetAxis(kEta)->SetRangeUser(-0.8 + kEpsilon, 0.8 - kEpsilon); | |
713 | hHisto[ihisto]->GetAxis(kPt)->SetRangeUser(0. + kEpsilon, 5.0 - kEpsilon); | |
714 | /* select particle if requested */ | |
715 | for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) | |
716 | if (TString(particle) == AliPID::ParticleName(ipart)) | |
717 | hHisto[ihisto]->GetAxis(kParticle)->SetRange(ipart + 1, ipart + 1); | |
718 | /* select charge if requested */ | |
719 | if (TString(charge) == "plus") | |
720 | hHisto[ihisto]->GetAxis(kCharge)->SetRange(1, 1); | |
721 | else if (TString(charge) == "minus") | |
722 | hHisto[ihisto]->GetAxis(kCharge)->SetRange(2, 2); | |
723 | /* select TRD mode if requested */ | |
724 | if (TString(trdmode) == "trdout") | |
725 | hHisto[ihisto]->GetAxis(kTRDmode)->SetRange(1, 1); | |
726 | else if (TString(trdmode) == "notrdout") | |
727 | hHisto[ihisto]->GetAxis(kTRDmode)->SetRange(2, 2); | |
728 | /* all projection */ | |
729 | hHisto_all[ihisto] = hHisto[ihisto]->Projection(kMultCent); | |
730 | hHisto_all[ihisto]->SetName(Form("%s_all", histoName[ihisto])); | |
731 | hHisto_all[ihisto]->Sumw2(); | |
732 | /* MB all projection */ | |
733 | hHisto_MB_all[ihisto] = new TH1D(*hHisto_all[ihisto]); | |
734 | hHisto_MB_all[ihisto]->SetName(Form("%s_MB_all", histoName[ihisto])); | |
735 | for (Int_t i = 0; i < hHisto_MB_all[ihisto]->GetNbinsX(); i++) { | |
736 | hHisto_MB_all[ihisto]->SetBinContent(i + 1, hHisto_all[ihisto]->Integral()); | |
737 | hHisto_MB_all[ihisto]->SetBinError(i + 1, TMath::Sqrt(hHisto_all[ihisto]->Integral())); | |
738 | } | |
739 | /* pt projection */ | |
740 | for (Int_t ibin = 0; ibin < npt; ibin++) { | |
741 | hHisto[ihisto]->GetAxis(kPt)->SetRangeUser(pt[ibin] + kEpsilon, pt[ibin + 1] - kEpsilon); | |
742 | hHisto_pt[ihisto][ibin] = hHisto[ihisto]->Projection(kMultCent); | |
743 | hHisto_pt[ihisto][ibin]->SetName(Form("%s_pt%3.1f-%3.1f", histoName[ihisto], pt[ibin], pt[ibin + 1])); | |
744 | hHisto_pt[ihisto][ibin]->Sumw2(); | |
745 | /* MB pt projection */ | |
746 | hHisto_MB_pt[ihisto][ibin] = new TH1D(*hHisto_pt[ihisto][ibin]); | |
747 | hHisto_MB_pt[ihisto][ibin]->SetName(Form("%s_MB_pt%3.1f-%3.1f", histoName[ihisto], pt[ibin], pt[ibin + 1])); | |
748 | for (Int_t i = 0; i < hHisto_MB_pt[ihisto][ibin]->GetNbinsX(); i++) { | |
749 | hHisto_MB_pt[ihisto][ibin]->SetBinContent(i + 1, hHisto_pt[ihisto][ibin]->Integral()); | |
750 | hHisto_MB_pt[ihisto][ibin]->SetBinError(i + 1, TMath::Sqrt(hHisto_pt[ihisto][ibin]->Integral())); | |
751 | } | |
752 | } | |
753 | } | |
754 | /*** matched correlated histos ***/ | |
755 | /* all projection */ | |
756 | hHisto_all[kMatchedCorrelatedTracks] = new TH1D(*hHisto_all[kMatchedTracks]); | |
757 | hHisto_all[kMatchedCorrelatedTracks]->Add(hHisto_all[kUncorrelatedTracks], -1.); | |
758 | hHisto_all[kMatchedCorrelatedTracks]->SetName(Form("%s_all", histoName[kMatchedCorrelatedTracks])); | |
759 | /* MB all projection */ | |
760 | hHisto_MB_all[kMatchedCorrelatedTracks] = new TH1D(*hHisto_MB_all[kMatchedTracks]); | |
761 | hHisto_MB_all[kMatchedCorrelatedTracks]->Add(hHisto_MB_all[kUncorrelatedTracks], -1.); | |
762 | hHisto_MB_all[kMatchedCorrelatedTracks]->SetName(Form("%s_MB_all", histoName[kMatchedCorrelatedTracks])); | |
763 | /* pt projection */ | |
764 | for (Int_t ibin = 0; ibin < npt; ibin++) { | |
765 | hHisto_pt[kMatchedCorrelatedTracks][ibin] = new TH1D(*hHisto_pt[kMatchedTracks][ibin]); | |
766 | hHisto_pt[kMatchedCorrelatedTracks][ibin]->Add(hHisto_pt[kUncorrelatedTracks][ibin], -1.); | |
767 | hHisto_pt[kMatchedCorrelatedTracks][ibin]->SetName(Form("%s_pt%3.1f-%3.1f", histoName[kMatchedCorrelatedTracks], pt[ibin], pt[ibin + 1])); | |
768 | /* MB pt projection */ | |
769 | hHisto_MB_pt[kMatchedCorrelatedTracks][ibin] = new TH1D(*hHisto_MB_pt[kMatchedTracks][ibin]); | |
770 | hHisto_MB_pt[kMatchedCorrelatedTracks][ibin]->Add(hHisto_MB_pt[kUncorrelatedTracks][ibin], -1.); | |
771 | hHisto_MB_pt[kMatchedCorrelatedTracks][ibin]->SetName(Form("%s_MB_pt%3.1f-%3.1f", histoName[kMatchedCorrelatedTracks], pt[ibin], pt[ibin + 1])); | |
772 | } | |
773 | ||
774 | /* output */ | |
775 | TString str = filename; | |
776 | str.Insert(str.Length() - TString(".root").Length(), ".efficiencyCent"); | |
777 | for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) | |
778 | if (TString(particle) == AliPID::ParticleName(ipart)) | |
779 | str.Insert(str.Length() - TString(".root").Length(), Form(".%s", AliPID::ParticleName(ipart))); | |
780 | if (TString(charge) == "plus") | |
781 | str.Insert(str.Length() - TString(".root").Length(), ".plus"); | |
782 | else if (TString(charge) == "minus") | |
783 | str.Insert(str.Length() - TString(".root").Length(), ".minus"); | |
784 | if (TString(trdmode) == "trdout") | |
785 | str.Insert(str.Length() - TString(".root").Length(), ".trdout"); | |
786 | else if (TString(trdmode) == "notrdout") | |
787 | str.Insert(str.Length() - TString(".root").Length(), ".notrdout"); | |
788 | TFile *fileout = TFile::Open(str.Data(), "RECREATE"); | |
789 | ||
790 | /* efficiencies/fractions and write */ | |
791 | TH1D *hEfficiency_all[kNHistos], *hEfficiency_MB_all[kNHistos], *hEfficiency_ratioMB_all[kNHistos], *hEfficiency_pt[kNHistos][MAXMULTCENTBINS], *hEfficiency_MB_pt[kNHistos][MAXMULTCENTBINS], *hEfficiency_ratioMB_pt[kNHistos][MAXMULTCENTBINS]; | |
792 | ||
793 | ||
794 | // TH1D *hEfficiency_MB[kNHistos], *hEfficiency_multcent[kNHistos][MAXMULTCENTBINS], *hEfficiency_ratioMB_multcent[kNHistos][MAXMULTCENTBINS]; | |
795 | // TH1D *hFraction_MB[kNHistos], *hFraction_multcent[kNHistos][MAXMULTCENTBINS], *hFraction_ratioMB_multcent[kNHistos][MAXMULTCENTBINS]; | |
796 | for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) { | |
797 | if (ihisto == kAcceptedTracks) continue; | |
798 | /* all efficiency */ | |
799 | hEfficiency_all[ihisto] = new TH1D(*hHisto_all[ihisto]); | |
800 | hEfficiency_all[ihisto]->SetName(Form("%s_efficiency_all", histoName[ihisto])); | |
801 | hEfficiency_all[ihisto]->SetLineWidth(2); | |
802 | hEfficiency_all[ihisto]->SetLineColor(1); | |
803 | hEfficiency_all[ihisto]->SetMarkerStyle(20); | |
804 | hEfficiency_all[ihisto]->SetMarkerColor(1); | |
805 | hEfficiency_all[ihisto]->Divide(hHisto_all[kAcceptedTracks]); | |
806 | hEfficiency_all[ihisto]->Write(); | |
807 | /* MB all efficiency */ | |
808 | hEfficiency_MB_all[ihisto] = new TH1D(*hHisto_MB_all[ihisto]); | |
809 | hEfficiency_MB_all[ihisto]->SetName(Form("%s_efficiency_MB_all", histoName[ihisto])); | |
810 | hEfficiency_MB_all[ihisto]->Divide(hHisto_MB_all[kAcceptedTracks]); | |
811 | hEfficiency_MB_all[ihisto]->Write(); | |
812 | /* ratio wrt. MB */ | |
813 | hEfficiency_ratioMB_all[ihisto] = new TH1D(*hEfficiency_all[ihisto]); | |
814 | hEfficiency_ratioMB_all[ihisto]->SetName(Form("%s_efficiency_ratioMB_all", histoName[ihisto])); | |
815 | hEfficiency_ratioMB_all[ihisto]->Divide(hEfficiency_MB_all[ihisto]); | |
816 | hEfficiency_ratioMB_all[ihisto]->Write(); | |
817 | /* pt efficiency */ | |
818 | for (Int_t ibin = 0; ibin < npt; ibin++) { | |
819 | hEfficiency_pt[ihisto][ibin] = new TH1D(*hHisto_pt[ihisto][ibin]); | |
820 | hEfficiency_pt[ihisto][ibin]->SetName(Form("%s_efficiency_pt%3.1f-%3.1f", histoName[ihisto], pt[ibin], pt[ibin + 1])); | |
821 | hEfficiency_pt[ihisto][ibin]->SetLineWidth(2); | |
822 | hEfficiency_pt[ihisto][ibin]->SetLineColor(multcentColor[ibin]); | |
823 | hEfficiency_pt[ihisto][ibin]->SetMarkerStyle(20); | |
824 | hEfficiency_pt[ihisto][ibin]->SetMarkerColor(multcentColor[ibin]); | |
825 | hEfficiency_pt[ihisto][ibin]->Divide(hHisto_pt[kAcceptedTracks][ibin]); | |
826 | hEfficiency_pt[ihisto][ibin]->Write(); | |
827 | /* MB pt efficiency */ | |
828 | hEfficiency_MB_pt[ihisto][ibin] = new TH1D(*hHisto_MB_pt[ihisto][ibin]); | |
829 | hEfficiency_MB_pt[ihisto][ibin]->SetName(Form("%s_efficiency_MB_pt%3.1f-%3.1f", histoName[ihisto], pt[ibin], pt[ibin + 1])); | |
830 | hEfficiency_MB_pt[ihisto][ibin]->Divide(hHisto_MB_pt[kAcceptedTracks][ibin]); | |
831 | hEfficiency_MB_pt[ihisto][ibin]->Write(); | |
832 | /* ratio wrt. central */ | |
833 | hEfficiency_ratioMB_pt[ihisto][ibin] = new TH1D(*hEfficiency_pt[ihisto][ibin]); | |
834 | hEfficiency_ratioMB_pt[ihisto][ibin]->SetName(Form("%s_efficiency_ratioMB_pt%3.1f-%3.1f", histoName[ihisto], pt[ibin], pt[ibin + 1])); | |
835 | hEfficiency_ratioMB_pt[ihisto][ibin]->Divide(hEfficiency_MB_pt[ihisto][ibin]); | |
836 | hEfficiency_ratioMB_pt[ihisto][ibin]->Write(); | |
837 | } | |
838 | ||
839 | #if 0 | |
840 | ||
841 | if (ihisto == kAcceptedTracks || ihisto == kMatchedTracks) continue; | |
842 | /* MB fraction */ | |
843 | hFraction_MB[ihisto] = new TH1D(*hHisto_MB[ihisto]); | |
844 | hFraction_MB[ihisto]->SetName(Form("%s_fraction_MB", histoName[ihisto])); | |
845 | hFraction_MB[ihisto]->SetLineWidth(2); | |
846 | hFraction_MB[ihisto]->SetLineColor(1); | |
847 | hFraction_MB[ihisto]->SetMarkerStyle(20); | |
848 | hFraction_MB[ihisto]->SetMarkerColor(1); | |
849 | hFraction_MB[ihisto]->Divide(hHisto_MB[kMatchedTracks]); | |
850 | hFraction_MB[ihisto]->Write(); | |
851 | /* multiplicity/centrality fraction */ | |
852 | for (Int_t ibin = 0; ibin < hHisto[kMatchedTracks]->GetAxis(kMultCent)->GetNbins(); ibin++) { | |
853 | hFraction_multcent[ihisto][ibin] = new TH1D(*hHisto_multcent[ihisto][ibin]); | |
854 | hFraction_multcent[ihisto][ibin]->SetName(Form("%s_fraction_multcent%d", histoName[ihisto], ibin)); | |
855 | hFraction_multcent[ihisto][ibin]->SetLineWidth(2); | |
856 | hFraction_multcent[ihisto][ibin]->SetLineColor(multcentColor[ibin]); | |
857 | hFraction_multcent[ihisto][ibin]->SetMarkerStyle(20); | |
858 | hFraction_multcent[ihisto][ibin]->SetMarkerColor(multcentColor[ibin]); | |
859 | hFraction_multcent[ihisto][ibin]->Divide(hHisto_multcent[kMatchedTracks][ibin]); | |
860 | hFraction_multcent[ihisto][ibin]->Write(); | |
861 | /* ratio wrt. MB */ | |
862 | hFraction_ratioMB_multcent[ihisto][ibin] = new TH1D(*hFraction_multcent[ihisto][ibin]); | |
863 | hFraction_ratioMB_multcent[ihisto][ibin]->SetName(Form("%s_fraction_ratioMB_multcent%d", histoName[ihisto], ibin)); | |
864 | hFraction_ratioMB_multcent[ihisto][ibin]->SetLineWidth(2); | |
865 | hFraction_ratioMB_multcent[ihisto][ibin]->SetLineColor(multcentColor[ibin]); | |
866 | hFraction_ratioMB_multcent[ihisto][ibin]->SetMarkerStyle(20); | |
867 | hFraction_ratioMB_multcent[ihisto][ibin]->SetMarkerColor(multcentColor[ibin]); | |
868 | hFraction_ratioMB_multcent[ihisto][ibin]->Divide(hFraction_MB[ihisto]); | |
869 | hFraction_ratioMB_multcent[ihisto][ibin]->Write(); | |
870 | } | |
871 | ||
872 | #endif | |
873 | ||
874 | } | |
875 | fileout->Close(); | |
876 | ||
877 | } | |
878 | #endif | |
879 | ||
880 | //_____________________________________________________________________________- | |
881 | ||
882 | TH1D * | |
883 | TOFmatchMC_get(const Char_t *filename, const Char_t *name, Option_t *opt = "", Int_t color = 1, Int_t marker = 20) | |
884 | { | |
885 | ||
886 | TFile *f = TFile::Open(filename); | |
887 | if (!f || !f->IsOpen()) | |
888 | return NULL; | |
889 | TH1D *h = (TH1D *)f->Get(name); | |
890 | if (!h) | |
891 | return NULL; | |
892 | h->SetLineColor(color); | |
893 | h->SetLineWidth(2); | |
894 | h->SetMarkerColor(color); | |
895 | h->SetMarkerStyle(marker); | |
896 | h->Draw(opt); | |
897 | return h; | |
898 | } | |
899 | ||
900 | //_____________________________________________________________________________- | |
901 | ||
902 | TH1D * | |
903 | TOFmatchMC_divide(const Char_t *filename, const Char_t *name1, const Char_t *name2, Option_t *opt = "") | |
904 | { | |
905 | ||
906 | TFile *f = TFile::Open(filename); | |
907 | if (!f || !f->IsOpen()) | |
908 | return NULL; | |
909 | TH1D *h1 = (TH1D *)f->Get(name1); | |
910 | TH1D *h2 = (TH1D *)f->Get(name2); | |
911 | if (!h1 || !h2) | |
912 | return NULL; | |
913 | TH1D *hr = new TH1D(*h1); | |
914 | hr->Divide(h2); | |
915 | hr->Draw(opt); | |
916 | return hr; | |
917 | } | |
918 | ||
919 | //_____________________________________________________________________________- | |
920 | ||
921 | TH1D * | |
922 | TOFmatchMC_sub(const Char_t *filename, const Char_t *name1, const Char_t *name2, Option_t *opt = "", Int_t color = 1, Int_t marker = 20) | |
923 | { | |
924 | ||
925 | TFile *f = TFile::Open(filename); | |
926 | if (!f || !f->IsOpen()) | |
927 | return NULL; | |
928 | TH1D *h1 = (TH1D *)f->Get(name1); | |
929 | TH1D *h2 = (TH1D *)f->Get(name2); | |
930 | if (!h1 || !h2) | |
931 | return NULL; | |
932 | TH1D *hr = new TH1D(*h1); | |
933 | hr->Add(h2, -1.); | |
934 | hr->SetLineColor(color); | |
935 | hr->SetLineWidth(2); | |
936 | hr->SetMarkerColor(color); | |
937 | hr->SetMarkerStyle(marker); | |
938 | hr->Draw(opt); | |
939 | return hr; | |
940 | } | |
941 | ||
942 | //_____________________________________________________________________________- | |
943 | ||
944 | TH1D * | |
945 | TOFmatchMC_compare(const Char_t *filename1, const Char_t *filename2, const Char_t *name, Option_t *opt = "", Int_t color = 1, Int_t marker = 20) | |
946 | { | |
947 | ||
948 | TFile *f1 = TFile::Open(filename1); | |
949 | TFile *f2 = TFile::Open(filename2); | |
950 | if (!f1 || !f2 || !f1->IsOpen() || !f2->IsOpen()) | |
951 | return NULL; | |
952 | TH1D *h1 = (TH1D *)f1->Get(name); | |
953 | TH1D *h2 = (TH1D *)f2->Get(name); | |
954 | if (!h1 || !h2) | |
955 | return NULL; | |
956 | TH1D *hr = new TH1D(*h1); | |
957 | hr->Divide(h2); | |
958 | hr->SetLineColor(color); | |
959 | hr->SetLineWidth(2); | |
960 | hr->SetMarkerColor(color); | |
961 | hr->SetMarkerStyle(marker); | |
962 | hr->Draw(opt); | |
963 | return hr; | |
964 | } | |
965 | ||
966 | //_____________________________________________________________________________- | |
967 | ||
968 | TH1D * | |
969 | TOFmatchMC_comparesub(const Char_t *filename1, const Char_t *filename2, const Char_t *name1, const Char_t *name2, Option_t *opt = "", Int_t color = 1, Int_t marker = 20) | |
970 | { | |
971 | ||
972 | TFile *f1 = TFile::Open(filename1); | |
973 | TFile *f2 = TFile::Open(filename2); | |
974 | if (!f1 || !f2 || !f1->IsOpen() || !f2->IsOpen()) | |
975 | return NULL; | |
976 | TH1D *h11 = (TH1D *)f1->Get(name1); | |
977 | TH1D *h21 = (TH1D *)f2->Get(name1); | |
978 | TH1D *h12 = (TH1D *)f1->Get(name2); | |
979 | TH1D *h22 = (TH1D *)f2->Get(name2); | |
980 | if (!h11 || !h21 || !h12 || !h22) | |
981 | return NULL; | |
982 | TH1D *hs1 = new TH1D(*h11); | |
983 | hs1->Add(h12, -1.); | |
984 | TH1D *hs2 = new TH1D(*h21); | |
985 | hs2->Add(h22, -1.); | |
986 | TH1D *hr = new TH1D(*hs1); | |
987 | hr->Divide(hs2); | |
988 | hr->SetLineColor(color); | |
989 | hr->SetLineWidth(2); | |
990 | hr->SetMarkerColor(color); | |
991 | hr->SetMarkerStyle(marker); | |
992 | hr->Draw(opt); | |
993 | return hr; | |
994 | } | |
995 | ||
996 | ||
997 | TH1D * | |
998 | TOFmatchEff_efficiencyPt_MB_plot(const Char_t *filename, Int_t ihisto = kMatchedTracks, Int_t icharge, Int_t marker = 20, Int_t color = 2, Option_t *opt = "") | |
999 | { | |
1000 | ||
1001 | TCanvas *cCanvas1 = new TCanvas("cCanvas1"); | |
1002 | TCanvas *cCanvas2 = new TCanvas("cCanvas2"); | |
1003 | const Char_t *destdir = "matchingEfficiency_DATA"; | |
1004 | ||
1005 | Double_t ptMin = 0.5; | |
1006 | Double_t ptMax = 5.0; | |
1007 | ||
1008 | TF1 *fEff = new TF1("fEff", "[0] + [1] * x - [2] * TMath::Exp(-[3] * TMath::Power(x, [4]))", 0., 5.0); | |
1009 | fEff->SetParameter(0, 0.5); | |
1010 | fEff->SetParameter(1, 0.); | |
1011 | fEff->SetParameter(2, 0.5); | |
1012 | fEff->SetParameter(3, 1.); | |
1013 | fEff->SetParameter(4, 2.); | |
1014 | ||
1015 | ||
1016 | TFile *filein = TFile::Open(filename); | |
1017 | TH1D *hEfficiencyPt = (TH1D *)filein->Get(Form("hEfficiencyPt_MB_%s_%s", histoName[ihisto], chargeName[icharge])); | |
1018 | hEfficiencyPt->Fit(fEff, "0", "", 0.5, 5.0); | |
1019 | hEfficiencyPt->SetTitle(Form("%s tracks;p_{T} (GeV/c);acceptance #times efficiency;", extendedChargeName[icharge])); | |
1020 | hEfficiencyPt->SetMinimum(0.4); | |
1021 | hEfficiencyPt->SetMaximum(0.8); | |
1022 | hEfficiencyPt->SetMarkerStyle(marker); | |
1023 | hEfficiencyPt->SetMarkerColor(color); | |
1024 | hEfficiencyPt->SetMarkerSize(1.5); | |
1025 | hEfficiencyPt->SetLineWidth(2); | |
1026 | hEfficiencyPt->SetLineColor(color); | |
1027 | hEfficiencyPt->GetXaxis()->SetRangeUser(ptMin + 0.001, ptMax - 0.001); | |
1028 | hEfficiencyPt->SetStats(kFALSE); | |
1029 | cCanvas1->cd(); | |
1030 | hEfficiencyPt->Draw(opt); | |
1031 | fEff->Draw("same"); | |
1032 | ||
1033 | cCanvas1->SetGridx(); | |
1034 | cCanvas1->SetGridy(); | |
1035 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_%s.C", destdir, chargeName[icharge])); | |
1036 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_%s.root", destdir, chargeName[icharge])); | |
1037 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_%s.png", destdir, chargeName[icharge])); | |
1038 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_%s.eps", destdir, chargeName[icharge])); | |
1039 | ||
1040 | TH1D *hRatioPt = new TH1D(*hEfficiencyPt); | |
1041 | hRatioPt->Divide(fEff); | |
1042 | hRatioPt->SetTitle(Form("%s tracks;p_{T} (GeV/c);ratio wrt. fitted dependence;", extendedChargeName[icharge])); | |
1043 | hRatioPt->SetMinimum(0.9); | |
1044 | hRatioPt->SetMaximum(1.1); | |
1045 | cCanvas2->cd(); | |
1046 | hRatioPt->Draw(); | |
1047 | ||
1048 | cCanvas2->SetGridx(); | |
1049 | cCanvas2->SetGridy(); | |
1050 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_%s.C", destdir, chargeName[icharge])); | |
1051 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_%s.root", destdir, chargeName[icharge])); | |
1052 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_%s.png", destdir, chargeName[icharge])); | |
1053 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_%s.eps", destdir, chargeName[icharge])); | |
1054 | ||
1055 | ||
1056 | // hEfficiencyPt->Add(fEff, -1.); | |
1057 | return hEfficiencyPt; | |
1058 | } | |
1059 | ||
1060 | ||
1061 | //_____________________________________________________________________________- | |
1062 | ||
1063 | TH1D * | |
1064 | TOFmatchEff_efficiencyPt_centrality_all_plot(const Char_t *filename, Int_t ihisto = kMatchedTracks, Int_t marker = 20, Int_t color = 1, Option_t *opt = "") | |
1065 | { | |
1066 | ||
1067 | TCanvas *cCanvas1 = new TCanvas("cCanvas1"); | |
1068 | TCanvas *cCanvas2 = new TCanvas("cCanvas2"); | |
1069 | const Char_t *destdir = "matchingEfficiency_DATA"; | |
1070 | ||
1071 | Double_t ptMin = 0.5; | |
1072 | Double_t ptMax = 5.0; | |
1073 | ||
1074 | TF1 *fMismatchFrac = new TF1("fMismatchFrac", "([0]+[1]*TMath::Exp(-[2]*TMath::Power(x,[3])))*[4]", 0., 5.0); | |
1075 | fMismatchFrac->SetParameter(0, 0.0447133); | |
1076 | fMismatchFrac->SetParameter(1, 0.179172); | |
1077 | fMismatchFrac->SetParameter(2, 2.54333); | |
1078 | fMismatchFrac->SetParameter(3, 1.16819); | |
1079 | fMismatchFrac->SetParameter(4, 1.); | |
1080 | ||
1081 | TF1 *fEff = new TF1("fEff", "([0] + [1] * x - [2] * TMath::Exp(-[3] * TMath::Power(x, [4]))) * [5]", 0., 5.0); | |
1082 | fEff->SetParameter(0, 0.5); | |
1083 | fEff->SetParameter(1, 0.); | |
1084 | fEff->SetParameter(2, 0.5); | |
1085 | fEff->SetParameter(3, 1.); | |
1086 | fEff->SetParameter(4, 2.); | |
1087 | fEff->FixParameter(5, 1.); | |
1088 | ||
1089 | TFile *filein = TFile::Open(filename); | |
1090 | TH1D *hEfficiencyPt = (TH1D *)filein->Get(Form("hEfficiencyAllPt_MB_%s", histoName[ihisto])); | |
1091 | hEfficiencyPt->Fit(fEff, "0", "", 0.5, 5.0); | |
1092 | hEfficiencyPt->SetTitle("all particles;p_{T} (GeV/c);acceptance #times efficiency;"); | |
1093 | hEfficiencyPt->SetMinimum(0.4); | |
1094 | hEfficiencyPt->SetMaximum(0.8); | |
1095 | hEfficiencyPt->SetMarkerStyle(marker); | |
1096 | hEfficiencyPt->SetMarkerColor(color); | |
1097 | hEfficiencyPt->SetMarkerSize(1.5); | |
1098 | hEfficiencyPt->SetLineWidth(2); | |
1099 | hEfficiencyPt->SetLineColor(color); | |
1100 | hEfficiencyPt->GetXaxis()->SetRangeUser(0.5 + 0.001, 5.0 - 0.001); | |
1101 | hEfficiencyPt->SetStats(kFALSE); | |
1102 | cCanvas1->cd(); | |
1103 | hEfficiencyPt->Draw(opt); | |
1104 | fEff->Draw("same"); | |
1105 | ||
1106 | cCanvas1->SetGridx(); | |
1107 | cCanvas1->SetGridy(); | |
1108 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.C", destdir)); | |
1109 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.root", destdir)); | |
1110 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.png", destdir)); | |
1111 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.eps", destdir)); | |
1112 | ||
1113 | TH1D *hRatioPt = new TH1D(*hEfficiencyPt); | |
1114 | hRatioPt->Divide(fEff); | |
1115 | hRatioPt->SetTitle("all particles;p_{T} (GeV/c);ratio wrt. fitted dependence;"); | |
1116 | hRatioPt->SetMinimum(0.9); | |
1117 | hRatioPt->SetMaximum(1.1); | |
1118 | cCanvas2->cd(); | |
1119 | hRatioPt->Draw(); | |
1120 | ||
1121 | cCanvas2->SetGridx(); | |
1122 | cCanvas2->SetGridy(); | |
1123 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_all.C", destdir)); | |
1124 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_all.root", destdir)); | |
1125 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_all.png", destdir)); | |
1126 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_all.eps", destdir)); | |
1127 | ||
1128 | /* fix efficiency shape and release scale factor */ | |
1129 | fEff->FixParameter(0, fEff->GetParameter(0)); | |
1130 | fEff->FixParameter(1, fEff->GetParameter(1)); | |
1131 | fEff->FixParameter(2, fEff->GetParameter(2)); | |
1132 | fEff->FixParameter(3, fEff->GetParameter(3)); | |
1133 | fEff->FixParameter(4, fEff->GetParameter(4)); | |
1134 | fEff->ReleaseParameter(5); | |
1135 | ||
1136 | TH1D *hEfficiencyCent = new TH1D("hEfficiencyCent", "all particles;centrality percentile;acceptance x efficiency scale factor;", NcentralityBins, centralityBin); | |
1137 | hEfficiencyCent->SetMinimum(0.95); | |
1138 | hEfficiencyCent->SetMaximum(1.05); | |
1139 | hEfficiencyCent->SetMarkerStyle(marker); | |
1140 | hEfficiencyCent->SetMarkerColor(color); | |
1141 | hEfficiencyCent->SetMarkerSize(1.5); | |
1142 | hEfficiencyCent->SetLineWidth(2); | |
1143 | hEfficiencyCent->SetLineColor(color); | |
1144 | hEfficiencyCent->SetStats(kFALSE); | |
1145 | ||
1146 | ||
1147 | TH1D *hEfficiencyPt_cent[NcentralityBins]; | |
1148 | TH1D *hRatioPt_cent[NcentralityBins]; | |
1149 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
1150 | ||
1151 | ||
1152 | hEfficiencyPt_cent[icent] = (TH1D *)filein->Get(Form("hEfficiencyAllPt_centrality%d_%s", icent, histoName[ihisto])); | |
1153 | hEfficiencyPt_cent[icent]->Fit(fEff, "", "", 0.5, 5.0); | |
1154 | ||
1155 | hEfficiencyPt_cent[icent]->SetTitle(Form("all particles (%d-%d\%);p_{T} (GeV/c);acceptance #times efficiency;", (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1])); | |
1156 | hEfficiencyPt_cent[icent]->SetMinimum(0.2); | |
1157 | hEfficiencyPt_cent[icent]->SetMaximum(0.8); | |
1158 | hEfficiencyPt_cent[icent]->SetMarkerStyle(marker); | |
1159 | hEfficiencyPt_cent[icent]->SetMarkerColor(color); | |
1160 | hEfficiencyPt_cent[icent]->SetMarkerSize(1.5); | |
1161 | hEfficiencyPt_cent[icent]->SetLineWidth(2); | |
1162 | hEfficiencyPt_cent[icent]->SetLineColor(color); | |
1163 | hEfficiencyPt_cent[icent]->GetXaxis()->SetRangeUser(0.5 + 0.001, 5.0 - 0.001); | |
1164 | hEfficiencyPt_cent[icent]->SetStats(kFALSE); | |
1165 | cCanvas1->cd(); | |
1166 | hEfficiencyPt_cent[icent]->Draw(opt); | |
1167 | fEff->Draw("same"); | |
1168 | ||
1169 | hEfficiencyCent->SetBinContent(icent + 1, fEff->GetParameter(5)); | |
1170 | hEfficiencyCent->SetBinError(icent + 1, fEff->GetParError(5)); | |
1171 | ||
1172 | cCanvas1->SetGridx(); | |
1173 | cCanvas1->SetGridy(); | |
1174 | cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.C", destdir, icent)); | |
1175 | cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.root", destdir, icent)); | |
1176 | cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.png", destdir, icent)); | |
1177 | cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.eps", destdir, icent)); | |
1178 | ||
1179 | hRatioPt_cent[icent] = new TH1D(*hEfficiencyPt_cent[icent]); | |
1180 | hRatioPt_cent[icent]->Divide(fEff); | |
1181 | hRatioPt_cent[icent]->SetTitle(Form("all particles (%d-%d\%);p_{T} (GeV/c);ratio wrt. fitted dependence;", (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1])); | |
1182 | hRatioPt_cent[icent]->SetMinimum(0.9); | |
1183 | hRatioPt_cent[icent]->SetMaximum(1.1); | |
1184 | cCanvas2->cd(); | |
1185 | hRatioPt_cent[icent]->Draw(); | |
1186 | ||
1187 | cCanvas2->SetGridx(); | |
1188 | cCanvas2->SetGridy(); | |
1189 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.C", destdir, icent)); | |
1190 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.root", destdir, icent)); | |
1191 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.png", destdir, icent)); | |
1192 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.eps", destdir, icent)); | |
1193 | ||
1194 | ||
1195 | } | |
1196 | ||
1197 | TF1 *fEffCent = new TF1("fEffCent", "[0] - [1] * TMath::Exp(-[2] * TMath::Power(x, [3]))", 0., 90.); | |
1198 | fEffCent->SetParameter(0, 1.02); | |
1199 | fEffCent->SetParameter(1, 0.04); | |
1200 | fEffCent->SetParameter(2, 0.001); | |
1201 | fEffCent->SetParameter(3, 2.); | |
1202 | // hEfficiencyCent->Fit(fEffCent, "q0", "", 0., 90.); | |
1203 | ||
1204 | TCanvas *cCanvas3 = new TCanvas("cCanvas3"); | |
1205 | hEfficiencyCent->Draw(); | |
1206 | // fEffCent->Draw("same"); | |
1207 | ||
1208 | cCanvas3->SetGridx(); | |
1209 | cCanvas3->SetGridy(); | |
1210 | cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.C", destdir)); | |
1211 | cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.root", destdir)); | |
1212 | cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.png", destdir)); | |
1213 | cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.eps", destdir)); | |
1214 | ||
1215 | TCanvas *cCanvas4 = new TCanvas("cCanvas4"); | |
1216 | ||
1217 | TH1D *hRatioCent = new TH1D(*hEfficiencyCent); | |
1218 | hRatioCent->Divide(fEffCent); | |
1219 | hRatioCent->SetTitle(Form("all particles;centrality percentile;ratio wrt. fitted dependence;")); | |
1220 | hRatioCent->SetMinimum(0.95); | |
1221 | hRatioCent->SetMaximum(1.05); | |
1222 | cCanvas4->cd(); | |
1223 | hRatioCent->Draw(); | |
1224 | ||
1225 | cCanvas4->SetGridx(); | |
1226 | cCanvas4->SetGridy(); | |
1227 | cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.C", destdir)); | |
1228 | cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.root", destdir)); | |
1229 | cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.png", destdir)); | |
1230 | cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.eps", destdir)); | |
1231 | ||
1232 | ||
1233 | ||
1234 | // hEfficiencyPt->Add(fEff, -1.); | |
1235 | return hEfficiencyCent; | |
1236 | } | |
1237 | ||
1238 | ||
1239 | //_____________________________________________________________________________- | |
1240 | ||
1241 | TH1D * | |
1242 | TOFmatchEff_efficiencyPt_centrality_all_plot_nomismatch(const Char_t *filename, Int_t ihisto = kMatchedTracks, Int_t marker = 20, Int_t color = 1, Option_t *opt = "") | |
1243 | { | |
1244 | ||
1245 | TF1 *fpol0 = (TF1 *)gROOT->GetFunction("pol0"); | |
1246 | fpol0->SetRange(0., 5.0); | |
1247 | ||
1248 | TCanvas *cCanvas1 = new TCanvas("cCanvas1"); | |
1249 | TCanvas *cCanvas2 = new TCanvas("cCanvas2"); | |
1250 | const Char_t *destdir = "matchingEfficiency_DATA"; | |
1251 | ||
1252 | Double_t ptMin = 0.5; | |
1253 | Double_t ptMax = 5.0; | |
1254 | ||
1255 | TF1 *fMismatchCorr = new TF1("fMismatchCorr", "1. - ([0]+[1]*TMath::Exp(-[2]*TMath::Power(x,[3])))*[4]", 0., 5.0); | |
1256 | fMismatchCorr->SetParameter(0, 4.47133e-02); | |
1257 | fMismatchCorr->SetParameter(1, 1.79172e-01); | |
1258 | fMismatchCorr->SetParameter(2, 2.54333e+00); | |
1259 | fMismatchCorr->SetParameter(3, 1.16819e+00); | |
1260 | fMismatchCorr->SetParameter(4, 1.); | |
1261 | ||
1262 | TF1 *fMismatchScale = new TF1("fMismatchScale", "[0] + [1] * TMath::Exp(-[2] * x)", 0., 100.); | |
1263 | fMismatchScale->SetParameter(0, -6.36877e-02); | |
1264 | fMismatchScale->SetParameter(1, 1.74818e+00); | |
1265 | fMismatchScale->SetParameter(2, 3.00818e-02); | |
1266 | ||
1267 | TFile *filein = TFile::Open(filename); | |
1268 | TH1D *hEfficiencyPt = (TH1D *)filein->Get(Form("hEfficiencyAllPt_MB_%s", histoName[ihisto])); | |
1269 | if (ihisto != kMatchedCorrelatedTracks) | |
1270 | hEfficiencyPt->Multiply(fMismatchCorr); | |
1271 | hEfficiencyPt->SetTitle("all particles;p_{T} (GeV/c);acceptance #times efficiency;"); | |
1272 | hEfficiencyPt->SetMinimum(0.4); | |
1273 | hEfficiencyPt->SetMaximum(0.8); | |
1274 | hEfficiencyPt->SetMarkerStyle(marker); | |
1275 | hEfficiencyPt->SetMarkerColor(color); | |
1276 | hEfficiencyPt->SetMarkerSize(1.5); | |
1277 | hEfficiencyPt->SetLineWidth(2); | |
1278 | hEfficiencyPt->SetLineColor(color); | |
1279 | hEfficiencyPt->GetXaxis()->SetRangeUser(0.5 + 0.001, 5.0 - 0.001); | |
1280 | hEfficiencyPt->SetStats(kFALSE); | |
1281 | cCanvas1->cd(); | |
1282 | hEfficiencyPt->Draw(opt); | |
1283 | ||
1284 | cCanvas1->SetGridx(); | |
1285 | cCanvas1->SetGridy(); | |
1286 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.C", destdir)); | |
1287 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.root", destdir)); | |
1288 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.png", destdir)); | |
1289 | cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.eps", destdir)); | |
1290 | ||
1291 | TH1D *hEfficiencyCent = new TH1D("hEfficiencyCent", "all particles;centrality percentile;acceptance x efficiency scale factor;", NcentralityBins, centralityBin); | |
1292 | hEfficiencyCent->SetMinimum(0.95); | |
1293 | hEfficiencyCent->SetMaximum(1.05); | |
1294 | hEfficiencyCent->SetMarkerStyle(marker); | |
1295 | hEfficiencyCent->SetMarkerColor(color); | |
1296 | hEfficiencyCent->SetMarkerSize(1.5); | |
1297 | hEfficiencyCent->SetLineWidth(2); | |
1298 | hEfficiencyCent->SetLineColor(color); | |
1299 | hEfficiencyCent->SetStats(kFALSE); | |
1300 | ||
1301 | ||
1302 | TH1D *hEfficiencyPt_cent[NcentralityBins]; | |
1303 | TH1D *hRatioPt_cent[NcentralityBins]; | |
1304 | Double_t centmean; | |
1305 | for (Int_t icent = 0; icent < NcentralityBins; icent++) { | |
1306 | ||
1307 | centmean = 0.5 * (centralityBin[icent] + centralityBin[icent + 1]); | |
1308 | hEfficiencyPt_cent[icent] = (TH1D *)filein->Get(Form("hEfficiencyAllPt_centrality%d_%s", icent, histoName[ihisto])); | |
1309 | fMismatchCorr->SetParameter(4, fMismatchScale->Eval(centmean)); | |
1310 | if (ihisto != kMatchedCorrelatedTracks) | |
1311 | hEfficiencyPt_cent[icent]->Multiply(fMismatchCorr); | |
1312 | hEfficiencyPt_cent[icent]->Divide(hEfficiencyPt); | |
1313 | hEfficiencyPt_cent[icent]->Fit(fpol0, "q0", "", 0.5, 5.0); | |
1314 | hEfficiencyPt_cent[icent]->SetTitle(Form("all particles (%d-%d\%);p_{T} (GeV/c);acceptance #times efficiency;", (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1])); | |
1315 | hEfficiencyPt_cent[icent]->SetMinimum(0.2); | |
1316 | hEfficiencyPt_cent[icent]->SetMaximum(0.8); | |
1317 | hEfficiencyPt_cent[icent]->SetMarkerStyle(marker); | |
1318 | hEfficiencyPt_cent[icent]->SetMarkerColor(color); | |
1319 | hEfficiencyPt_cent[icent]->SetMarkerSize(1.5); | |
1320 | hEfficiencyPt_cent[icent]->SetLineWidth(2); | |
1321 | hEfficiencyPt_cent[icent]->SetLineColor(color); | |
1322 | hEfficiencyPt_cent[icent]->GetXaxis()->SetRangeUser(0.5 + 0.001, 5.0 - 0.001); | |
1323 | hEfficiencyPt_cent[icent]->SetStats(kFALSE); | |
1324 | cCanvas1->cd(); | |
1325 | hEfficiencyPt_cent[icent]->Draw(opt); | |
1326 | fpol0->Draw("same"); | |
1327 | ||
1328 | hEfficiencyCent->SetBinContent(icent + 1, fpol0->GetParameter(0)); | |
1329 | hEfficiencyCent->SetBinError(icent + 1, fpol0->GetParError(0)); | |
1330 | ||
1331 | cCanvas1->SetGridx(); | |
1332 | cCanvas1->SetGridy(); | |
1333 | cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.C", destdir, icent)); | |
1334 | cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.root", destdir, icent)); | |
1335 | cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.png", destdir, icent)); | |
1336 | cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.eps", destdir, icent)); | |
1337 | ||
1338 | hRatioPt_cent[icent] = new TH1D(*hEfficiencyPt_cent[icent]); | |
1339 | hRatioPt_cent[icent]->Divide(fpol0); | |
1340 | hRatioPt_cent[icent]->SetTitle(Form("all particles (%d-%d\%);p_{T} (GeV/c);ratio wrt. fitted dependence;", (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1])); | |
1341 | hRatioPt_cent[icent]->SetMinimum(0.9); | |
1342 | hRatioPt_cent[icent]->SetMaximum(1.1); | |
1343 | cCanvas2->cd(); | |
1344 | hRatioPt_cent[icent]->Draw(); | |
1345 | ||
1346 | cCanvas2->SetGridx(); | |
1347 | cCanvas2->SetGridy(); | |
1348 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.C", destdir, icent)); | |
1349 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.root", destdir, icent)); | |
1350 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.png", destdir, icent)); | |
1351 | cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.eps", destdir, icent)); | |
1352 | ||
1353 | ||
1354 | } | |
1355 | ||
1356 | TF1 *fEffCent = new TF1("fEffCent", "[0] - [1] * TMath::Exp(-[2] * TMath::Power(x, [3]))", 0., 90.); | |
1357 | fEffCent->SetParameter(0, 1.02); | |
1358 | fEffCent->SetParameter(1, 0.04); | |
1359 | fEffCent->SetParameter(2, 0.001); | |
1360 | fEffCent->SetParameter(3, 2.); | |
1361 | // hEfficiencyCent->Fit(fEffCent, "q0", "", 0., 90.); | |
1362 | ||
1363 | TCanvas *cCanvas3 = new TCanvas("cCanvas3"); | |
1364 | hEfficiencyCent->Draw(); | |
1365 | // fEffCent->Draw("same"); | |
1366 | ||
1367 | cCanvas3->SetGridx(); | |
1368 | cCanvas3->SetGridy(); | |
1369 | cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.C", destdir)); | |
1370 | cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.root", destdir)); | |
1371 | cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.png", destdir)); | |
1372 | cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.eps", destdir)); | |
1373 | ||
1374 | TCanvas *cCanvas4 = new TCanvas("cCanvas4"); | |
1375 | ||
1376 | TH1D *hRatioCent = new TH1D(*hEfficiencyCent); | |
1377 | hRatioCent->Divide(fEffCent); | |
1378 | hRatioCent->SetTitle(Form("all particles;centrality percentile;ratio wrt. fitted dependence;")); | |
1379 | hRatioCent->SetMinimum(0.95); | |
1380 | hRatioCent->SetMaximum(1.05); | |
1381 | cCanvas4->cd(); | |
1382 | hRatioCent->Draw(); | |
1383 | ||
1384 | cCanvas4->SetGridx(); | |
1385 | cCanvas4->SetGridy(); | |
1386 | cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.C", destdir)); | |
1387 | cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.root", destdir)); | |
1388 | cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.png", destdir)); | |
1389 | cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.eps", destdir)); | |
1390 | ||
1391 | ||
1392 | ||
1393 | // hEfficiencyPt->Add(fEff, -1.); | |
1394 | return hEfficiencyCent; | |
1395 | } | |
1396 | ||
1397 | ||
1398 | TH1D * | |
1399 | TOFmatchEff_rapidityCut(const Char_t *filename, Int_t ipart, Int_t icharge, Int_t color = 2, Int_t marker = 20, Option_t *opt = "") | |
1400 | { | |
1401 | ||
1402 | TFile *filein = TFile::Open(filename); | |
1403 | TH1D *hEfficiency_MB = (TH1D *)filein->Get(Form("hEfficiencyPt_MB_hMatchedTracks_%s", chargeName[icharge])); | |
1404 | TH1D *hEfficiencyPID_MB = (TH1D *)filein->Get(Form("hEfficiencyPIDPt_MB_hMatchedTracks_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge])); | |
1405 | ||
1406 | TH1D *hRatio = new TH1D(*hEfficiencyPID_MB); | |
1407 | hRatio->Divide(hEfficiency_MB); | |
1408 | hRatio->SetLineColor(color); | |
1409 | hRatio->SetLineWidth(2); | |
1410 | hRatio->SetMarkerColor(color); | |
1411 | hRatio->SetMarkerStyle(marker); | |
1412 | hRatio->Draw(opt); | |
1413 | return hRatio; | |
1414 | } | |
1415 | ||
1416 | void | |
1417 | TOFmatchEff_checkFEAmap(const Char_t *filename) | |
1418 | { | |
1419 | ||
1420 | TFile *filein = TFile::Open(filename); | |
1421 | TH2F *hFEAMap = (TH2F *)filein->Get("hFEAMap"); | |
1422 | TH2F *hEmptyFEA = new TH2F("hEmptyFEA", "", 72, 0., 18., 91, 0., 91.); | |
1423 | ||
1424 | Float_t nhits = hFEAMap->GetEntries(); | |
1425 | if (nhits <= 0) { | |
1426 | printf("found not hits.\n"); | |
1427 | return; | |
1428 | } | |
1429 | printf("found %d hits\n", nhits); | |
1430 | Float_t avhits = nhits / (hFEAMap->GetNbinsX() * hFEAMap->GetNbinsX()); | |
1431 | printf("on average %f hits/FEA\n", avhits); | |
1432 | ||
1433 | TH1F *hFEANormHit = new TH1F("hFEANormHit", "", 1000, 0., 3.); | |
1434 | for (Int_t ibinx = 0; ibinx < hFEAMap->GetNbinsX(); ibinx++) | |
1435 | for (Int_t ibiny = 0; ibiny < hFEAMap->GetNbinsY(); ibiny++) { | |
1436 | if (hFEAMap->GetBinContent(ibinx + 1, ibiny + 1) == 0.) { | |
1437 | hEmptyFEA->SetBinContent(ibinx + 1, ibiny + 1, 1.); | |
1438 | continue; | |
1439 | } | |
1440 | hFEANormHit->Fill(hFEAMap->GetBinContent(ibinx + 1, ibiny + 1) / avhits); | |
1441 | } | |
1442 | ||
1443 | TCanvas *cCanvas1 = new TCanvas("cCanvas1"); | |
1444 | cCanvas1->Divide(1, 2); | |
1445 | cCanvas1->cd(1); | |
1446 | hFEAMap->Draw("colz"); | |
1447 | cCanvas1->cd(2); | |
1448 | hEmptyFEA->Draw("colz"); | |
1449 | ||
1450 | TCanvas *cCanvas2 = new TCanvas("cCanvas2"); | |
1451 | hFEANormHit->Draw(); | |
1452 | ||
1453 | ||
1454 | TFile *fileout = TFile::Open(Form("TOFmatchEff_checkFEAmap.%s", filename), "RECREATE"); | |
1455 | hFEAMap->Write(); | |
1456 | hFEANormHit->Write(); | |
1457 | hEmptyFEA->Write(); | |
1458 | fileout->Close(); | |
1459 | } |