3void BmnLambdaAnalRun7::targetListsByCutsEstablished(set <TString>& commonCuts, set <TString>& uniqueCuts) {
6 vector <TString> targets;
7 targets.push_back(it0->first);
16 TString tar1 = it1->first;
20 targets.push_back(tar1);
23 if (targets.size() > 1) {
24 for (
auto it2 : targets)
25 commonCuts.insert(it2);
27 uniqueCuts.insert(targets.at(0));
33 if (fTrigEffData.size())
36 set <TString> commonCuts;
37 set <TString> uniqueCuts;
39 targetListsByCutsEstablished(commonCuts, uniqueCuts);
41 cout <<
"Targets with the same cuts ..." << endl;
42 for (
auto it : commonCuts)
46 cout <<
"Targets with unique cuts ..." << endl;
47 for (
auto it : uniqueCuts)
51 TH1F* hSpectraAll =
new TH1F(
"massSpectrumAll",
"massSpectrumAll", 75,
xLow,
xUp);
54 TCanvas*
d =
new TCanvas(
"d",
"d", 1200, 1200);
68 cout <<
"nFiles# " << fList.size() << endl;
73 for (
auto it = fList.begin(); it != fList.end(); it++) {
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.);
95 TCanvas* c =
new TCanvas(
"c",
"c", 800, 600);
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.);
105 gStyle->SetOptStat(0);
108 hSpectraAll->Draw(
"PE1X0");
112 targs += it.first +
" ";
114 hSpectraAll->SetTitle(Form(
"Invariant mass: #Lambda^{0} #rightarrow #pi^{-} + p (%s)", targs.Data()));
115 DrawH(hSpectraAll, mean, sigma, T, B, commonCuts.size());
117 c->SaveAs(
"allTargets.pdf");
118 d->SaveAs(
"allTargets_sepView.pdf");
128 if (!(fMcList.size() && fDataList.size()))
134void BmnLambdaAnalRun7::doTargetAnalPath() {
138 if (fTrigEffData.size())
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;
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);
153 Double_t y0 =
fYBinMap.find(
iY)->second.first;
154 Double_t y1 =
fYBinMap.find(
iY)->second.second;
156 hSpectraY[
iY] =
new TH1F(Form(
"Y = [%G, %G]", y0, y1), Form(
"Y = [%G, %G]", y0, y1), 75,
xLow,
xUp);
161 vector <vector < TString >> lists
166 map <Int_t, vector < TH1F >> pathBinsPt[2];
167 map <Int_t, vector < TH1F >> pathBinsY[2];
170 for (
size_t iList = 0; iList < lists.size(); iList++) {
175 for (Int_t iPt = 0; iPt <
nPtBins; iPt++)
182 for (
auto dst = lists.at(iList).begin(); dst != lists.at(iList).end(); dst++) {
186 ReadFile(*dst, cut, fTrigEffs, path->second.first, path->second.second);
191 for (Int_t iPt = 0; iPt <
nPtBins; iPt++)
193 pathBinsPt[iList][distance(
fPathBins.begin(), path)] = tmp;
199 pathBinsY[iList][distance(
fPathBins.begin(), path)] = tmp;
203 vector <SdeltaS> data;
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.);
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;
215 for (Int_t iPt = 0; iPt <
nPtBins; iPt++) {
216 TH1F* hPt = &vec.at(iPt);
218 h = (TH1F*) hPt->Clone();
222 delete hPt->GetListOfFunctions()->FindObject(
"f");
223 delete hPt->GetListOfFunctions()->FindObject(
"f2");
225 TF1* f1 = (TF1*) h->GetListOfFunctions()->FindObject(
"f1");
227 Double_t dS = TMath::Sqrt(T.second - B.second);
232 Double_t errTotRelNom = TMath::Sqrt((dS / (T.second - B.second)) * (dS / (T.second - B.second))
233 + (dB / B.second) * (dB / B.second));
236 ss.
dSet = (iList) ?
"DATA" :
"MC";
239 ss.
s = Int_t(T.second - B.second);
240 ss.
ds = Int_t(errTotRelNom * (T.second - B.second));
242 data.emplace_back(std::move(ss));
246 for (
auto pathBin : pathBinsY[iList]) {
247 Int_t bin = pathBin.first;
248 vector <TH1F> vec = pathBin.second;
250 TH1F* hY = &vec.at(
iY);
252 h = (TH1F*) hY->Clone();
256 delete hY->GetListOfFunctions()->FindObject(
"f");
257 delete hY->GetListOfFunctions()->FindObject(
"f2");
259 TF1* f1 = (TF1*) h->GetListOfFunctions()->FindObject(
"f1");
261 Double_t dS = TMath::Sqrt(T.second - B.second);
266 Double_t errTotRelNom = TMath::Sqrt((dS / (T.second - B.second)) * (dS / (T.second - B.second))
267 + (dB / B.second) * (dB / B.second));
270 ss.
dSet = (iList) ?
"DATA" :
"MC";
273 ss.
s = Int_t(T.second - B.second);
274 ss.
ds = Int_t(errTotRelNom * (T.second - B.second));
276 data.emplace_back(std::move(ss));
282 const Int_t nSets = 2;
285 for (Int_t iSet = 0; iSet < nSets; iSet++)
286 for (Int_t iPt = 0; iPt <
nPtBins; iPt++) {
291 Double_t xMin =
fPathBins.begin()->second.first;
292 Double_t xMax =
fPathBins.rbegin()->second.second;
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);
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();
307 for (Int_t iSet = 0; iSet < nSets; iSet++)
313 Double_t xMin =
fPathBins.begin()->second.first;
314 Double_t xMax =
fPathBins.rbegin()->second.second;
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);
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();
330 TString dSample = it.dSet;
334 Int_t path = it.pathBin;
340 pathPt[dSample.Contains(
"MC") ? 0 : 1][pt]->SetBinContent(path + 1, s);
341 pathPt[dSample.Contains(
"MC") ? 0 : 1][pt]->SetBinError(path + 1, 0);
345 pathY[dSample.Contains(
"MC") ? 0 : 1][y]->SetBinContent(path + 1, s);
346 pathY[dSample.Contains(
"MC") ? 0 : 1][y]->SetBinError(path + 1, 0);
350 gStyle->SetOptStat(0);
351 gStyle->SetTitleFontSize(0.1);
352 gStyle->SetTitleY(1.0);
353 gStyle->SetPaintTextFormat(
"4.3f");
359 TCanvas* c =
new TCanvas(
"c",
"c", nDivs * ww, 2 * wh);
364 for (Int_t iPt = 0; iPt <
nPtBins; iPt++) {
365 c->cd(iPad)->SetLeftMargin(.16);
368 TH1F* hMc = pathPt[0][iPt];
369 TH1F* hData = pathPt[1][iPt];
373 for (Int_t iBin = 1; iBin < hMc->GetNbinsX() + 1; iBin++)
374 mcSum += hMc->GetBinContent(iBin);
377 Double_t dataSum = 0.;
378 for (Int_t iBin = 1; iBin < hData->GetNbinsX() + 1; iBin++)
379 dataSum += hData->GetBinContent(iBin);
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));
385 Double_t max0 = pathPt[0][iPt]->GetMaximum();
386 Double_t max1 = pathPt[1][iPt]->GetMaximum();
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));
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);
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);
409 c->cd(iPad)->SetLeftMargin(.16);
412 TH1F* hMc = pathY[0][
iY];
413 TH1F* hData = pathY[1][
iY];
417 for (Int_t iBin = 1; iBin < hMc->GetNbinsX() + 1; iBin++)
418 mcSum += hMc->GetBinContent(iBin);
421 Double_t dataSum = 0.;
422 for (Int_t iBin = 1; iBin < hData->GetNbinsX() + 1; iBin++)
423 dataSum += hData->GetBinContent(iBin);
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));
428 Double_t max0 = pathY[0][
iY]->GetMaximum();
429 Double_t max1 = pathY[1][
iY]->GetMaximum();
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));
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);
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);
449 c->SaveAs(
"nLambdaPathBins.pdf");
455 for (
auto tar : targets)
461void BmnLambdaAnalRun7::doTargetAnal() {
465 if (fTrigEffData.size())
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;
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);
480 Double_t y0 =
fYBinMap.find(
iY)->second.first;
481 Double_t y1 =
fYBinMap.find(
iY)->second.second;
483 hSpectraY[
iY] =
new TH1F(Form(
"Y = [%G, %G]", y0, y1), Form(
"Y = [%G, %G]", y0, y1), 75,
xLow,
xUp);
486 vector <TString> fList;
491 cout <<
"nFiles# " << fList.size() << endl;
495 for (
auto it = fList.begin(); it != fList.end(); it++) {
502 gStyle->SetOptStat(0);
503 gStyle->SetTitleFontSize(0.1);
504 gStyle->SetTitleY(1.0);
505 gStyle->SetPaintTextFormat(
"4.3f");
511 TCanvas* c =
new TCanvas(
"c",
"c", nDivs * ww, 2 * wh);
517 for (Int_t iPt = 0; iPt <
nPtBins; iPt++) {
527 hSpectraPt[iPt]->GetXaxis()->SetTitle(
"M_{(p + #pi^{-})}, GeV/c^{2}");
528 hSpectraPt[iPt]->GetXaxis()->SetTitleOffset(-1);
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);
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.);
551 delete hSpectraPt[iPt]->GetListOfFunctions()->FindObject(
"f");
552 delete hSpectraPt[iPt]->GetListOfFunctions()->FindObject(
"f2");
554 TF1* f1 = (TF1*) h->GetListOfFunctions()->FindObject(
"f1");
556 Double_t dS = TMath::Sqrt(T.second - B.second);
558 TF1* f11 = (TF1*)
hSpectraPt[iPt]->GetListOfFunctions()->FindObject(
"f11");
559 f11->SetLineColor(kRed);
561 Double_t errTotRelNom = TMath::Sqrt((dS / (T.second - B.second)) * (dS / (T.second - B.second))
562 + (dB / B.second) * (dB / B.second));
564 TLatex *t1 =
new TLatex();
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))));
569 fSdeltaS_PtBinMap[iPt] = make_pair(Int_t(T.second - B.second), Int_t(errTotRelNom * (T.second - B.second)));
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.);
605 delete hSpectraY[
iY]->GetListOfFunctions()->FindObject(
"f");
606 delete hSpectraY[
iY]->GetListOfFunctions()->FindObject(
"f2");
608 TF1* f1 = (TF1*) h->GetListOfFunctions()->FindObject(
"f1");
609 Double_t dS = TMath::Sqrt(T.second - B.second);
611 TF1* f11 = (TF1*)
hSpectraY[
iY]->GetListOfFunctions()->FindObject(
"f11");
612 f11->SetLineColor(kRed);
614 Double_t errTotRelNom = TMath::Sqrt((dS / (T.second - B.second)) * (dS / (T.second - B.second))
615 + (dB / B.second) * (dB / B.second));
617 TLatex *t1 =
new TLatex();
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))));
622 fSdeltaS_YBinMap[
iY] = make_pair(Int_t(T.second - B.second), Int_t(errTotRelNom * (T.second - B.second)));
634 TString prefName = (
isMc) ?
"MC" :
"DATA";
635 c->SaveAs(Form(
"%s_PtY_%s.pdf", cName.Data(), prefName.Data()));
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);
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();
657 TLegend *legend =
new TLegend(0.3, 0.15, 0.41, 0.35);
658 legend->SetTextFont(72);
659 legend->SetTextSize(0.04);
661 legend->AddEntry(
"", Form(
"Mass = %.4f", mean), 0);
662 legend->AddEntry(
"", Form(
"Sigma = %.4f", sigma), 0);
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);
667 legend->SetTextSize(0.05);
668 legend->SetLineColor(0);
672 TLatex *t1 =
new TLatex();
674 t1->SetTextSize(.05);
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()));
const Float_t d
Z-ccordinate of the first GEM-station.
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
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