BmnRoot
Loading...
Searching...
No Matches
BmnLambdaAnalRun7.cxx
Go to the documentation of this file.
1#include "BmnLambdaAnalRun7.h"
2
3void BmnLambdaAnalRun7::targetListsByCutsEstablished(set <TString>& commonCuts, set <TString>& uniqueCuts) {
4
5 for (auto it0 = fTargCutsMap.begin(); it0 != fTargCutsMap.end(); it0++) {
6 vector <TString> targets;
7 targets.push_back(it0->first);
8
9 BmnParticlePairCut* cut0 = it0->second;
10
11 for (auto it1 = fTargCutsMap.begin(); it1 != fTargCutsMap.end(); it1++) {
12
13 if (it0 == it1)
14 continue;
15
16 TString tar1 = it1->first;
17 BmnParticlePairCut* cut1 = it1->second;
18
19 if (*cut0 == *cut1)
20 targets.push_back(tar1);
21 }
22
23 if (targets.size() > 1) {
24 for (auto it2 : targets)
25 commonCuts.insert(it2);
26 } else
27 uniqueCuts.insert(targets.at(0));
28 }
29}
30
32 // Looking for data related to trigg. eff ...
33 if (fTrigEffData.size())
34 ReadData();
35
36 set <TString> commonCuts;
37 set <TString> uniqueCuts;
38
39 targetListsByCutsEstablished(commonCuts, uniqueCuts);
40
41 cout << "Targets with the same cuts ..." << endl;
42 for (auto it : commonCuts)
43 cout << it << " ";
44 cout << endl;
45
46 cout << "Targets with unique cuts ..." << endl;
47 for (auto it : uniqueCuts)
48 cout << it << " ";
49 cout << endl;
50
51 TH1F* hSpectraAll = new TH1F("massSpectrumAll", "massSpectrumAll", 75, xLow, xUp);
52
53 // Getting spectrum for each target ...
54 TCanvas* d = new TCanvas("d", "d", 1200, 1200);
55 d->Divide(TMath::Sqrt(fTargCutsMap.size()), TMath::Sqrt(fTargCutsMap.size()));
56
57 for (auto it0 = fTargCutsMap.begin(); it0 != fTargCutsMap.end(); it0++) {
58 d->cd(1 + distance(fTargCutsMap.begin(), it0));
59
60 fTarget.clear();
61
62 fTarget.push_back(it0->first);
63
64 hSpectrumImproved = new TH1F(Form("massSpectrum_%s", fTarget.at(0).Data()), "massSpectrum", 75, xLow, xUp);
65 hSpectrumImproved->SetTitle(Form("Invariant mass: #Lambda^{0} #rightarrow #pi^{-} + p (%s)", fTarget.at(0).Data()));
66
67 vector <TString> fList = createFilelist();
68 cout << "nFiles# " << fList.size() << endl;
69
70 // Getting cut values to be used ...
71 BmnParticlePairCut* cut = fTargCutsMap.find(fTarget.at(0))->second;
72
73 for (auto it = fList.begin(); it != fList.end(); it++) {
74 if (fNFiles && distance(fList.begin(), it) == fNFiles)
75 break;
76
77 ReadFile(*it, cut, fTrigEffs);
78 }
79
80 hSpectraAll->Add(hSpectrumImproved);
81 // hSpectraAll->Sumw2();
82
83 // Fitting obtained spectrum ...
84 Double_t mean = -1., sigma = -1.;
85 pair <Double_t, Double_t> T = make_pair(-1., -1.);
86 pair <Double_t, Double_t> B = make_pair(-1., -1.);
87
88 fitSpectrum(hSpectrumImproved, mean, sigma, T, B);
89
90 d->cd(1 + distance(fTargCutsMap.begin(), it0));
91 hSpectrumImproved->Draw("PE1X0");
92 DrawH(hSpectrumImproved, mean, sigma, T, B);
93 }
94
95 TCanvas* c = new TCanvas("c", "c", 800, 600);
96 c->Divide(1, 1);
97
98 // Fitting obtained spectrum ...
99 Double_t mean = -1., sigma = -1.;
100 pair <Double_t, Double_t> T = make_pair(-1., -1.);
101 pair <Double_t, Double_t> B = make_pair(-1., -1.);
102
103 fitSpectrum(hSpectraAll, mean, sigma, T, B);
104
105 gStyle->SetOptStat(0);
106
107 c->cd(1);
108 hSpectraAll->Draw("PE1X0");
109
110 TString targs = " ";
111 for (auto it : fTargCutsMap)
112 targs += it.first + " ";
113
114 hSpectraAll->SetTitle(Form("Invariant mass: #Lambda^{0} #rightarrow #pi^{-} + p (%s)", targs.Data()));
115 DrawH(hSpectraAll, mean, sigma, T, B, commonCuts.size());
116
117 c->SaveAs("allTargets.pdf");
118 d->SaveAs("allTargets_sepView.pdf");
119
120 delete c;
121 delete d;
122}
123
125 fTarget.clear();
126 fTarget.push_back(target);
127
128 if (!(fMcList.size() && fDataList.size()))
129 doTargetAnal();
130 else
131 doTargetAnalPath();
132}
133
134void BmnLambdaAnalRun7::doTargetAnalPath() {
135 isPtY = kTRUE;
136
137 // Looking for data related to trigg. eff ...
138 if (fTrigEffData.size())
139 ReadData();
140
141 hSpectraPt = new TH1F*[nPtBins];
142 hSpectraY = new TH1F*[nYBins];
143
144 for (Int_t iPt = 0; iPt < nPtBins; iPt++) {
145 Double_t pt0 = fPtBinMap.find(iPt)->second.first;
146 Double_t pt1 = fPtBinMap.find(iPt)->second.second;
147
148 hSpectraPt[iPt] = new TH1F(Form("P_{t} = [%G, %G] GeV/c", pt0, pt1),
149 Form("P_{t} = [%G, %G] GeV/c", pt0, pt1), 75, xLow, xUp);
150 }
151
152 for (Int_t iY = 0; iY < nYBins; iY++) {
153 Double_t y0 = fYBinMap.find(iY)->second.first;
154 Double_t y1 = fYBinMap.find(iY)->second.second;
155
156 hSpectraY[iY] = new TH1F(Form("Y = [%G, %G]", y0, y1), Form("Y = [%G, %G]", y0, y1), 75, xLow, xUp);
157 }
158
159 BmnParticlePairCut* cut = fTargCutsMap.find(fTarget.at(0))->second;
160
161 vector <vector < TString >> lists
162 {
163 fMcList, fDataList
164 };
165
166 map <Int_t, vector < TH1F >> pathBinsPt[2]; // path bin [mc or data] --> vector of *hSpectraPt[iBin]
167 map <Int_t, vector < TH1F >> pathBinsY[2]; // path bin [mc or data]--> vector of *hSpectraY[iBin]
168
169 // Loop over lists (mc, data)
170 for (size_t iList = 0; iList < lists.size(); iList++) {
171
172 // Loop over each path bin ...
173 for (auto path = fPathBins.begin(); path != fPathBins.end(); path++) {
174 // Resetting hSpectraPt and hSpectraY ...
175 for (Int_t iPt = 0; iPt < nPtBins; iPt++)
176 hSpectraPt[iPt]->Reset();
177
178 for (Int_t iY = 0; iY < nYBins; iY++)
179 hSpectraY[iY]->Reset();
180
181 // Loop over each list (dst files)
182 for (auto dst = lists.at(iList).begin(); dst != lists.at(iList).end(); dst++) {
183 if (fNFiles && distance(lists.at(iList).begin(), dst) == fNFiles)
184 break;
185
186 ReadFile(*dst, cut, fTrigEffs, path->second.first, path->second.second);
187 }
188
189 vector <TH1F> tmp;
190
191 for (Int_t iPt = 0; iPt < nPtBins; iPt++)
192 tmp.push_back(*hSpectraPt[iPt]);
193 pathBinsPt[iList][distance(fPathBins.begin(), path)] = tmp;
194
195 tmp.clear();
196
197 for (Int_t iY = 0; iY < nYBins; iY++)
198 tmp.push_back(*hSpectraY[iY]);
199 pathBinsY[iList][distance(fPathBins.begin(), path)] = tmp;
200 }
201 }
202
203 vector <SdeltaS> data;
204
205 TH1F* h = nullptr;
206 Double_t mean = -1., sigma = -1.;
207 pair <Double_t, Double_t> T = make_pair(-1., -1.);
208 pair <Double_t, Double_t> B = make_pair(-1., -1.);
209
210 for (size_t iList = 0; iList < lists.size(); iList++) {
211 for (auto pathBin : pathBinsPt[iList]) {
212 Int_t bin = pathBin.first;
213 vector <TH1F> vec = pathBin.second;
214
215 for (Int_t iPt = 0; iPt < nPtBins; iPt++) {
216 TH1F* hPt = &vec.at(iPt);
217
218 h = (TH1F*) hPt->Clone();
219
220 fitSpectrum(h, mean, sigma, T, B);
221
222 delete hPt->GetListOfFunctions()->FindObject("f");
223 delete hPt->GetListOfFunctions()->FindObject("f2");
224
225 TF1* f1 = (TF1*) h->GetListOfFunctions()->FindObject("f1");
226
227 Double_t dS = TMath::Sqrt(T.second - B.second);
228 Double_t dB = deltaB(f1, fitSpectrum(hPt));
229
230 //TF1* f11 = (TF1*) hPt->GetListOfFunctions()->FindObject("f11");
231
232 Double_t errTotRelNom = TMath::Sqrt((dS / (T.second - B.second)) * (dS / (T.second - B.second))
233 + (dB / B.second) * (dB / B.second));
234
235 SdeltaS ss;
236 ss.dSet = (iList) ? "DATA" : "MC";
237 ss.pathBin = bin;
238 ss.ptBin = iPt;
239 ss.s = Int_t(T.second - B.second);
240 ss.ds = Int_t(errTotRelNom * (T.second - B.second));
241
242 data.emplace_back(std::move(ss));
243 }
244 }
245
246 for (auto pathBin : pathBinsY[iList]) {
247 Int_t bin = pathBin.first;
248 vector <TH1F> vec = pathBin.second;
249 for (Int_t iY = 0; iY < nYBins; iY++) {
250 TH1F* hY = &vec.at(iY);
251
252 h = (TH1F*) hY->Clone();
253
254 fitSpectrum(h, mean, sigma, T, B);
255
256 delete hY->GetListOfFunctions()->FindObject("f");
257 delete hY->GetListOfFunctions()->FindObject("f2");
258
259 TF1* f1 = (TF1*) h->GetListOfFunctions()->FindObject("f1");
260
261 Double_t dS = TMath::Sqrt(T.second - B.second);
262 Double_t dB = deltaB(f1, fitSpectrum(hY));
263
264 //TF1* f11 = (TF1*) hY->GetListOfFunctions()->FindObject("f11");
265
266 Double_t errTotRelNom = TMath::Sqrt((dS / (T.second - B.second)) * (dS / (T.second - B.second))
267 + (dB / B.second) * (dB / B.second));
268
269 SdeltaS ss;
270 ss.dSet = (iList) ? "DATA" : "MC";
271 ss.pathBin = bin;
272 ss.yBin = iY;
273 ss.s = Int_t(T.second - B.second);
274 ss.ds = Int_t(errTotRelNom * (T.second - B.second));
275
276 data.emplace_back(std::move(ss));
277 }
278 }
279 }
280
281 // Drawing obtained histos ...
282 const Int_t nSets = 2;
283
284 TH1F * pathPt[nSets][fPtBinMap.size()];
285 for (Int_t iSet = 0; iSet < nSets; iSet++)
286 for (Int_t iPt = 0; iPt < nPtBins; iPt++) {
287 Double_t min = fPtBinMap.find(iPt)->second.first;
288 Double_t max = fPtBinMap.find(iPt)->second.second;
289
290 Int_t nBins = fPathBins.size();
291 Double_t xMin = fPathBins.begin()->second.first;
292 Double_t xMax = fPathBins.rbegin()->second.second;
293
294 pathPt[iSet][iPt] = new TH1F(Form("%d, %G < P_{t} < %G [GeV/c]", iSet, min, max), Form("%G < P_{t} < %G [GeV/c]; Path [cm]; N_{#Lambda}", min, max), nBins, xMin, xMax);
295
296 for (auto bin = fPathBins.begin(); bin != fPathBins.end(); bin++) {
297 pathPt[iSet][iPt]->GetXaxis()->SetBinLabel(1 + bin->first, Form("(%G - %G)", bin->second.first, bin->second.second));
298 pathPt[iSet][iPt]->GetXaxis()->SetLabelSize(0.07);
299 pathPt[iSet][iPt]->GetXaxis()->SetTitleSize(0.05);
300 pathPt[iSet][iPt]->GetYaxis()->SetLabelSize(0.06);
301 pathPt[iSet][iPt]->GetYaxis()->SetTitleSize(0.06);
302 pathPt[iSet][iPt]->GetYaxis()->CenterTitle();
303 }
304 }
305
306 TH1F * pathY[nSets][fPtBinMap.size()];
307 for (Int_t iSet = 0; iSet < nSets; iSet++)
308 for (Int_t iY = 0; iY < nYBins; iY++) {
309 Double_t min = fYBinMap.find(iY)->second.first;
310 Double_t max = fYBinMap.find(iY)->second.second;
311
312 Int_t nBins = fPathBins.size();
313 Double_t xMin = fPathBins.begin()->second.first;
314 Double_t xMax = fPathBins.rbegin()->second.second;
315
316 pathY[iSet][iY] = new TH1F(Form("%d, %G < Y < %G", iSet, min, max), Form("%G < Y < %G; Path [cm]; N_{#Lambda}", min, max), nBins, xMin, xMax);
317
318 for (auto bin = fPathBins.begin(); bin != fPathBins.end(); bin++) {
319 pathY[iSet][iY]->GetXaxis()->SetBinLabel(1 + bin->first, Form("(%G - %G)", bin->second.first, bin->second.second));
320 pathY[iSet][iY]->GetXaxis()->SetLabelSize(0.07);
321 pathY[iSet][iY]->GetXaxis()->SetTitleSize(0.05);
322 pathY[iSet][iY]->GetYaxis()->SetLabelSize(0.06);
323 pathY[iSet][iY]->GetYaxis()->SetTitleSize(0.06);
324 pathY[iSet][iY]->GetYaxis()->CenterTitle();
325 }
326 }
327
328 // Filling created histograms ...
329 for (SdeltaS it : data) {
330 TString dSample = it.dSet;
331
332 Int_t pt = it.ptBin;
333 Int_t y = it.yBin;
334 Int_t path = it.pathBin;
335
336 Int_t s = it.s;
337 //Int_t ds = it.ds;
338
339 if (pt > -1) {
340 pathPt[dSample.Contains("MC") ? 0 : 1][pt]->SetBinContent(path + 1, s);
341 pathPt[dSample.Contains("MC") ? 0 : 1][pt]->SetBinError(path + 1, 0);
342 }
343
344 if (y > -1) {
345 pathY[dSample.Contains("MC") ? 0 : 1][y]->SetBinContent(path + 1, s);
346 pathY[dSample.Contains("MC") ? 0 : 1][y]->SetBinError(path + 1, 0);
347 }
348 }
349
350 gStyle->SetOptStat(0);
351 gStyle->SetTitleFontSize(0.1);
352 gStyle->SetTitleY(1.0);
353 gStyle->SetPaintTextFormat("4.3f");
354
355 Int_t ww = 800;
356 Int_t wh = 800;
357 Int_t nDivs = (nPtBins > nYBins) ? nPtBins : nYBins;
358
359 TCanvas* c = new TCanvas("c", "c", nDivs * ww, 2 * wh);
360 c->Divide(nDivs, 2);
361
362 Int_t iPad = 1;
363
364 for (Int_t iPt = 0; iPt < nPtBins; iPt++) {
365 c->cd(iPad)->SetLeftMargin(.16);
366
367 // Normalization procedure (for MC?) ...
368 TH1F* hMc = pathPt[0][iPt];
369 TH1F* hData = pathPt[1][iPt];
370
371 // Bin sum over all MC
372 Double_t mcSum = 0.;
373 for (Int_t iBin = 1; iBin < hMc->GetNbinsX() + 1; iBin++)
374 mcSum += hMc->GetBinContent(iBin);
375
376 // Bin sum over all data
377 Double_t dataSum = 0.;
378 for (Int_t iBin = 1; iBin < hData->GetNbinsX() + 1; iBin++)
379 dataSum += hData->GetBinContent(iBin);
380
381 for (Int_t iBin = 1; iBin < pathPt[0][iPt]->GetNbinsX() + 1; iBin++)
382 pathPt[0][iPt]->SetBinContent(iBin, (dataSum / mcSum) * pathPt[0][iPt]->GetBinContent(iBin)); // MC
383
384
385 Double_t max0 = pathPt[0][iPt]->GetMaximum();
386 Double_t max1 = pathPt[1][iPt]->GetMaximum();
387
388 pathPt[0][iPt]->GetYaxis()->SetRangeUser(0, 1.3 * ((max0 > max1) ? max0 : max1));
389 pathPt[1][iPt]->GetYaxis()->SetRangeUser(0, 1.3 * ((max0 > max1) ? max0 : max1));
390
391 pathPt[0][iPt]->Draw("PE1X0");
392 pathPt[0][iPt]->SetLineColor(kBlue);
393 pathPt[0][iPt]->SetMarkerColor(kBlue);
394 pathPt[0][iPt]->SetMarkerSize(5);
395 pathPt[0][iPt]->SetMarkerStyle(20);
396
397 pathPt[1][iPt]->Draw("PE1X0same");
398 pathPt[1][iPt]->SetLineColor(kRed);
399 pathPt[1][iPt]->SetMarkerColor(kRed);
400 pathPt[1][iPt]->SetMarkerSize(5);
401 pathPt[1][iPt]->SetMarkerStyle(20);
402
403 iPad++;
404 }
405
406 iPad = nDivs + 1;
407
408 for (Int_t iY = 0; iY < nYBins; iY++) {
409 c->cd(iPad)->SetLeftMargin(.16);
410
411 // Normalization procedure (for MC?) ...
412 TH1F* hMc = pathY[0][iY];
413 TH1F* hData = pathY[1][iY];
414
415 // Bin sum over all MC
416 Double_t mcSum = 0.;
417 for (Int_t iBin = 1; iBin < hMc->GetNbinsX() + 1; iBin++)
418 mcSum += hMc->GetBinContent(iBin);
419
420 // Bin sum over all data
421 Double_t dataSum = 0.;
422 for (Int_t iBin = 1; iBin < hData->GetNbinsX() + 1; iBin++)
423 dataSum += hData->GetBinContent(iBin);
424
425 for (Int_t iBin = 1; iBin < pathY[0][iY]->GetNbinsX() + 1; iBin++)
426 pathY[0][iY]->SetBinContent(iBin, (dataSum / mcSum) * pathY[0][iY]->GetBinContent(iBin)); // MC
427
428 Double_t max0 = pathY[0][iY]->GetMaximum();
429 Double_t max1 = pathY[1][iY]->GetMaximum();
430
431 pathY[0][iY]->GetYaxis()->SetRangeUser(0, 1.3 * ((max0 > max1) ? max0 : max1));
432 pathY[1][iY]->GetYaxis()->SetRangeUser(0, 1.3 * ((max0 > max1) ? max0 : max1));
433
434 pathY[0][iY]->Draw("PE1X0");
435 pathY[0][iY]->SetLineColor(kBlue);
436 pathY[0][iY]->SetMarkerColor(kBlue);
437 pathY[0][iY]->SetMarkerSize(5);
438 pathY[0][iY]->SetMarkerStyle(20);
439
440 pathY[1][iY]->Draw("PE1X0same");
441 pathY[1][iY]->SetLineColor(kRed);
442 pathY[1][iY]->SetMarkerColor(kRed);
443 pathY[1][iY]->SetMarkerSize(5);
444 pathY[1][iY]->SetMarkerStyle(20);
445
446 iPad++;
447 }
448
449 c->SaveAs("nLambdaPathBins.pdf");
450}
451
452void BmnLambdaAnalRun7::doTargetAnal(vector <TString> targets) {
453 fTarget.clear();
454
455 for (auto tar : targets)
456 fTarget.push_back(tar);
457
458 doTargetAnal();
459}
460
461void BmnLambdaAnalRun7::doTargetAnal() {
462 isPtY = kTRUE;
463
464 // Looking for data related to trigg. eff ...
465 if (fTrigEffData.size())
466 ReadData();
467
468 hSpectraPt = new TH1F*[nPtBins];
469 hSpectraY = new TH1F*[nYBins];
470
471 for (Int_t iPt = 0; iPt < nPtBins; iPt++) {
472 Double_t pt0 = fPtBinMap.find(iPt)->second.first;
473 Double_t pt1 = fPtBinMap.find(iPt)->second.second;
474
475 hSpectraPt[iPt] = new TH1F(Form("P_{t} = [%G, %G] GeV/c", pt0, pt1),
476 Form("P_{t} = [%G, %G] GeV/c", pt0, pt1), 75, xLow, xUp);
477 }
478
479 for (Int_t iY = 0; iY < nYBins; iY++) {
480 Double_t y0 = fYBinMap.find(iY)->second.first;
481 Double_t y1 = fYBinMap.find(iY)->second.second;
482
483 hSpectraY[iY] = new TH1F(Form("Y = [%G, %G]", y0, y1), Form("Y = [%G, %G]", y0, y1), 75, xLow, xUp);
484 }
485
486 vector <TString> fList;
487 if (isMc)
488 fList = fInFiles;
489 else
490 fList = createFilelist();
491 cout << "nFiles# " << fList.size() << endl;
492
493 BmnParticlePairCut* cut = fTargCutsMap.find(fTarget.at(0))->second;
494
495 for (auto it = fList.begin(); it != fList.end(); it++) {
496 if (fNFiles && distance(fList.begin(), it) == fNFiles)
497 break;
498
499 ReadFile(*it, cut, fTrigEffs);
500 }
501
502 gStyle->SetOptStat(0);
503 gStyle->SetTitleFontSize(0.1);
504 gStyle->SetTitleY(1.0);
505 gStyle->SetPaintTextFormat("4.3f");
506
507 Int_t ww = 800;
508 Int_t wh = 800;
509 Int_t nDivs = (nPtBins > nYBins) ? nPtBins : nYBins;
510
511 TCanvas* c = new TCanvas("c", "c", nDivs * ww, 2 * wh);
512 c->Divide(nDivs, 2);
513
514 Int_t iPad = 1;
515
516 TH1F* h = nullptr;
517 for (Int_t iPt = 0; iPt < nPtBins; iPt++) {
518 c->cd(iPad);
519 hSpectraPt[iPt]->Draw("PE1X0");
520 hSpectraPt[iPt]->SetMarkerStyle(20);
521 hSpectraPt[iPt]->SetMarkerSize(2);
522 hSpectraPt[iPt]->SetMarkerColor(kSpring - 6);
523 hSpectraPt[iPt]->SetLineColor(kSpring - 6);
524 hSpectraPt[iPt]->SetLineWidth(1);
525
526 if (!iPt) {
527 hSpectraPt[iPt]->GetXaxis()->SetTitle("M_{(p + #pi^{-})}, GeV/c^{2}");
528 hSpectraPt[iPt]->GetXaxis()->SetTitleOffset(-1);
529 } else
530 hSpectraPt[iPt]->GetXaxis()->SetTitle("");
531 hSpectraPt[iPt]->GetYaxis()->SetTitle("");
532 hSpectraPt[iPt]->GetXaxis()->SetNdivisions(5);
533 hSpectraPt[iPt]->GetYaxis()->SetNdivisions(5);
534 hSpectraPt[iPt]->GetYaxis()->SetLabelOffset(0.01);
535 hSpectraPt[iPt]->GetXaxis()->SetLabelSize(0.06);
536 hSpectraPt[iPt]->GetYaxis()->SetLabelSize(0.06);
537 hSpectraPt[iPt]->GetXaxis()->SetTitleSize(0.05);
538 hSpectraPt[iPt]->GetYaxis()->SetTitleSize(0.05);
539 hSpectraPt[iPt]->GetXaxis()->SetTitleOffset(0.85);
540 hSpectraPt[iPt]->GetYaxis()->SetTitleOffset(1.5);
541 hSpectraPt[iPt]->GetYaxis()->CenterTitle();
542
543 Double_t mean = -1., sigma = -1.;
544 pair <Double_t, Double_t> T = make_pair(-1., -1.);
545 pair <Double_t, Double_t> B = make_pair(-1., -1.);
546
547 h = (TH1F*) hSpectraPt[iPt]->Clone();
548
549 fitSpectrum(h, mean, sigma, T, B);
550
551 delete hSpectraPt[iPt]->GetListOfFunctions()->FindObject("f");
552 delete hSpectraPt[iPt]->GetListOfFunctions()->FindObject("f2");
553
554 TF1* f1 = (TF1*) h->GetListOfFunctions()->FindObject("f1");
555 // f1->SetLineColor(kRed);
556 Double_t dS = TMath::Sqrt(T.second - B.second);
557 Double_t dB = deltaB(f1, fitSpectrum(hSpectraPt[iPt]));
558 TF1* f11 = (TF1*) hSpectraPt[iPt]->GetListOfFunctions()->FindObject("f11");
559 f11->SetLineColor(kRed);
560
561 Double_t errTotRelNom = TMath::Sqrt((dS / (T.second - B.second)) * (dS / (T.second - B.second))
562 + (dB / B.second) * (dB / B.second));
563
564 TLatex *t1 = new TLatex();
565 t1->SetNDC(); //we want to draw this object in the Normalized system [0,1]
566 t1->SetTextSize(.05);
567 t1->DrawLatex(.25, .85, Form("Numb. of #Lambda^{0} = (%d #pm %d) ", Int_t(T.second - B.second), Int_t(errTotRelNom * (T.second - B.second))));
568
569 fSdeltaS_PtBinMap[iPt] = make_pair(Int_t(T.second - B.second), Int_t(errTotRelNom * (T.second - B.second)));
570
571 iPad++;
572 }
573
574 iPad = nDivs + 1;
575
576 for (Int_t iY = 0; iY < nYBins; iY++) {
577 c->cd(iPad);
578 hSpectraY[iY]->Draw("PE1X0");
579 hSpectraY[iY]->SetMarkerStyle(20);
580 hSpectraY[iY]->SetMarkerSize(2);
581 hSpectraY[iY]->SetMarkerColor(kSpring - 6);
582 hSpectraY[iY]->SetLineColor(kSpring - 6);
583 hSpectraY[iY]->SetLineWidth(1);
584 hSpectraY[iY]->GetXaxis()->SetTitle("");
585 hSpectraY[iY]->GetYaxis()->SetTitle("");
586 hSpectraY[iY]->GetXaxis()->SetNdivisions(5);
587 hSpectraY[iY]->GetYaxis()->SetNdivisions(5);
588 hSpectraY[iY]->GetYaxis()->SetLabelOffset(0.01);
589 hSpectraY[iY]->GetXaxis()->SetLabelSize(0.06);
590 hSpectraY[iY]->GetYaxis()->SetLabelSize(0.06);
591 hSpectraY[iY]->GetXaxis()->SetTitleSize(0.05);
592 hSpectraY[iY]->GetYaxis()->SetTitleSize(0.05);
593 hSpectraY[iY]->GetXaxis()->SetTitleOffset(0.85);
594 hSpectraY[iY]->GetYaxis()->SetTitleOffset(1.5);
595 hSpectraY[iY]->GetYaxis()->CenterTitle();
596
597 Double_t mean = -1., sigma = -1.;
598 pair <Double_t, Double_t> T = make_pair(-1., -1.);
599 pair <Double_t, Double_t> B = make_pair(-1., -1.);
600
601 h = (TH1F*) hSpectraY[iY]->Clone();
602
603 fitSpectrum(h, mean, sigma, T, B);
604
605 delete hSpectraY[iY]->GetListOfFunctions()->FindObject("f");
606 delete hSpectraY[iY]->GetListOfFunctions()->FindObject("f2");
607
608 TF1* f1 = (TF1*) h->GetListOfFunctions()->FindObject("f1");
609 Double_t dS = TMath::Sqrt(T.second - B.second);
610 Double_t dB = deltaB(f1, fitSpectrum(hSpectraY[iY]));
611 TF1* f11 = (TF1*) hSpectraY[iY]->GetListOfFunctions()->FindObject("f11");
612 f11->SetLineColor(kRed);
613
614 Double_t errTotRelNom = TMath::Sqrt((dS / (T.second - B.second)) * (dS / (T.second - B.second))
615 + (dB / B.second) * (dB / B.second));
616
617 TLatex *t1 = new TLatex();
618 t1->SetNDC(); //we want to draw this object in the Normalized system [0,1]
619 t1->SetTextSize(.05);
620 t1->DrawLatex(.25, .85, Form("Numb. of #Lambda^{0} = (%d #pm %d) ", Int_t(T.second - B.second), Int_t(errTotRelNom * (T.second - B.second))));
621
622 fSdeltaS_YBinMap[iY] = make_pair(Int_t(T.second - B.second), Int_t(errTotRelNom * (T.second - B.second)));
623
624 iPad++;
625 }
626
627 TString cName = "";
628 if (fTarget.size() < 2)
629 cName = fTarget.at(0);
630 else
631 for (auto tar : fTarget)
632 cName += tar;
633
634 TString prefName = (isMc) ? "MC" : "DATA";
635 c->SaveAs(Form("%s_PtY_%s.pdf", cName.Data(), prefName.Data()));
636}
637
638void BmnLambdaAnalRun7::DrawH(TH1F* h, Double_t mean, Double_t sigma, pair <Double_t, Double_t> T, pair <Double_t, Double_t> B, Int_t si) {
639 h->SetMarkerStyle(20);
640 h->SetMarkerColor(kSpring - 6);
641 h->SetLineColor(kSpring - 6);
642 h->SetLineWidth(1);
643
644 h->GetXaxis()->SetTitle("M_{(p + #pi^{-})}, GeV/c^{2}");
645 h->GetYaxis()->SetTitle("");
646 h->GetXaxis()->SetNdivisions(5);
647 h->GetYaxis()->SetNdivisions(5);
648 h->GetYaxis()->SetLabelOffset(0.01);
649 h->GetXaxis()->SetLabelSize(0.04);
650 h->GetYaxis()->SetLabelSize(0.04);
651 h->GetXaxis()->SetTitleSize(0.05);
652 h->GetYaxis()->SetTitleSize(0.05);
653 h->GetXaxis()->SetTitleOffset(0.85);
654 h->GetYaxis()->SetTitleOffset(1.5);
655 h->GetYaxis()->CenterTitle();
656
657 TLegend *legend = new TLegend(0.3, 0.15, 0.41, 0.35);
658 legend->SetTextFont(72);
659 legend->SetTextSize(0.04);
660
661 legend->AddEntry("", Form("Mass = %.4f", mean), 0);
662 legend->AddEntry("", Form("Sigma = %.4f", sigma), 0);
663
664 legend->AddEntry("", Form("Numb. of #Lambda^{0} = %d, (%d)", Int_t(T.first - B.first), Int_t(T.second - B.second)), 0);
665 legend->AddEntry("", Form("S / B = %4.3f, (%4.3f)", (T.first - B.first) / B.first, (T.second - B.second) / B.second), 0);
666
667 legend->SetTextSize(0.05);
668 legend->SetLineColor(0);
669 legend->Draw();
670
671 if (si) {
672 TLatex *t1 = new TLatex();
673 t1->SetNDC(); //we want to draw this object in the Normalized system [0,1]
674 t1->SetTextSize(.05);
675
676 BmnParticlePairCut* cut = fTargCutsMap.find(fTarget.at(0))->second;
677
678 t1->DrawLatex(.5, .65, Form("DCA0 = %G cm", cut->dca0()));
679 t1->DrawLatex(.5, .7, Form("DCA1 = %G cm", cut->dca1()));
680 t1->DrawLatex(.5, .75, Form("DCA2 = %G cm", cut->dca2()));
681 t1->DrawLatex(.5, .8, Form("DCA12 = %G cm", cut->dca12()));
682 t1->DrawLatex(.5, .85, Form("PATH = %G cm", cut->path()));
683 }
684}
@ iY
const Float_t d
Z-ccordinate of the first GEM-station.
Definition BmnMwpcHit.cxx:7
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition P4_F32vec4.h:30
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition P4_F32vec4.h:31
map< TString, BmnParticlePairCut * > fTargCutsMap
void doTargetAnal(TString target)
map< Int_t, pair< Double_t, Double_t > > fPtBinMap
vector< TString > createFilelist()
map< Int_t, pair< Double_t, Double_t > > fYBinMap
Double_t deltaB(TF1 *f, TFitResultPtr fitRes)
vector< TString > fInFiles
void ReadFile(TString, BmnParticlePairCut *cut0=nullptr, TClonesArray *triggEffInfo=nullptr, Double_t pathMin=0., Double_t pathMax=0.)
map< Int_t, pair< Double_t, Double_t > > fPathBins
TFitResultPtr fitSpectrum(TH1F *)
vector< TString > fTarget