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