CbmRoot
Loading...
Searching...
No Matches
LmvmDrawAll.cxx
Go to the documentation of this file.
1/* Copyright (C) 2011-2021 UGiessen, JINR-LIT
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Elena Lebedeva, Andrey Lebedev, Semen Lebedev [committer] */
4
5#include "LmvmDrawAll.h"
6
7#include "CbmDrawHist.h"
8#include "CbmHistManager.h"
9#include "CbmUtils.h"
10
11#include "Logger.h"
12
13#include "TCanvas.h"
14#include "TClass.h"
15#include "TEllipse.h"
16#include "TF1.h"
17#include "TFile.h"
18#include "TGraph.h"
19#include "TH1.h"
20#include "TH1D.h"
21#include "TH2D.h"
22#include "TKey.h"
23#include "TLatex.h"
24#include "TLine.h"
25#include "TMath.h"
26#include "TStyle.h"
27#include "TSystem.h"
28#include "TText.h"
29#include <TLegend.h>
30
31#include <iomanip>
32#include <iostream>
33#include <string>
34
35#include "LmvmDef.h"
36#include "LmvmUtils.h"
37
38using namespace std;
39using namespace Cbm;
40
41LmvmHist* LmvmDrawAll::H(ELmvmSignal signal) { return fH[static_cast<int>(signal)]; }
42
43void LmvmDrawAll::DrawHistFromFile(const string& fileInmed, const string& fileQgp, const string& fileOmega,
44 const string& filePhi, const string& fileOmegaD, const string& outputDir,
45 bool useMvd)
46{
48 fOutputDir = outputDir;
49 fUseMvd = useMvd;
50
51 // order in vector is important, see ELmvmSignal enum.
52 vector<string> fileNames {fileInmed, fileQgp, fileOmega, filePhi, fileOmegaD};
53
54 TFile* oldFile = gFile;
55 TDirectory* oldDir = gDirectory;
56
57 fH.resize(fHMean.fNofSignals);
58 for (size_t i = 0; i < fH.size(); i++) {
59 fH[i] = new LmvmHist();
60 TFile* file = new TFile(fileNames[i].c_str());
61 fH[i]->fHM.ReadFromFile(file);
62 int nofEvents = (int) fH[i]->H1("hEventNumber")->GetEntries();
63 LOG(info) << "Signal:" << fHMean.fSignalNames[i] << " nofEvents:" << nofEvents << endl;
64 }
65
67 CalcCutEffRange(0.0, 0.2);
68 CalcCutEffRange(0.2, 0.6);
69 CalcCutEffRange(0.6, 1.2);
81 InvestigateMisid(); // TODO: move some procedures in here into seperate methods?
85 DrawPurity();
87 DrawTofM2();
91 SaveHist();
93
95 gFile = oldFile;
96 gDirectory = oldDir;
97}
98
100{
101 int nofEvents = 0;
102 for (ELmvmSignal sig : fHMean.fSignals) {
103 nofEvents += H(sig)->H1("hEventNumber")->GetEntries();
104 }
105 return nofEvents;
106}
107
108template<class T>
109void LmvmDrawAll::CreateMeanHist(const string& name, int nofEvents, int nofRebins)
110{
111 for (ELmvmSignal sig : fHMean.fSignals) {
112 if (static_cast<int>(sig) == 0) fHMean.fHM.Add(name, static_cast<T*>(H(sig)->GetObject(name)->Clone()));
113 else
114 static_cast<T*>(fHMean.GetObject(name))->Add(static_cast<T*>(H(sig)->GetObject(name)->Clone()));
115 }
116 static_cast<T*>(fHMean.GetObject(name))->Scale(1. / (double) nofEvents);
117 if (nofRebins > 1) {
118 static_cast<T*>(fHMean.GetObject(name))->Rebin(nofRebins);
119 double binWidth = static_cast<T*>(fHMean.GetObject(name))->GetBinWidth(1);
120 static_cast<T*>(fHMean.GetObject(name))->Scale(1. / binWidth);
121 }
122}
123
125{
126 int nofEvents = GetNofTotalEvents();
127
128 // Global Track Loop
129 for (const string& ptcl : fHMean.fGTrackNames) {
130 CreateMeanHist<TH1D>("hMom_gTracks_" + ptcl, nofEvents);
131 CreateMeanHist<TH1D>("hPtY_gTracks_" + ptcl, nofEvents);
132 CreateMeanHist<TH1D>("hTofM2_gTracks_" + ptcl, nofEvents);
133 /*CreateMeanHist<TH2D>("hIndexStsRich_" + ptcl, nofEvents);
134 CreateMeanHist<TH2D>("hIndexStsTrd_" + ptcl, nofEvents);
135 CreateMeanHist<TH2D>("hIndexStsTof_" + ptcl, nofEvents);*/
136 CreateMeanHist<TH2D>("hRichRingTrackDist_gTracks_" + ptcl, nofEvents);
137 CreateMeanHist<TH2D>("hMatchId_gTracks_" + ptcl, nofEvents);
138 CreateMeanHist<TH2D>("hTofM2Calc_gTracks_" + ptcl, nofEvents);
139
140 for (const string& cat : {"trueid", "misid", "truematch", "mismatch"}) {
141 CreateMeanHist<TH2D>("hTofHitXY_" + cat + "_" + ptcl, nofEvents);
142 CreateMeanHist<TH2D>("hTofPointXY_" + cat + "_" + ptcl, nofEvents);
143 CreateMeanHist<TH1D>("hTofHitPointDist_" + cat + "_" + ptcl, nofEvents);
144 CreateMeanHist<TH2D>("hTofTimeVsMom_gTracks_" + cat + "_" + ptcl, nofEvents);
145 CreateMeanHist<TH2D>("hTofHitTrackDist_gTracks_" + cat + "_" + ptcl, nofEvents);
146 }
147
148 for (const string& cat : {"all", "complete"}) {
149 CreateMeanHist<TH1D>("hNofMismatches_gTracks_" + cat + "_" + ptcl, nofEvents);
150 CreateMeanHist<TH1D>("hNofMismatchedTrackSegments_" + cat + "_" + ptcl, nofEvents);
151 for (const string& match : {"truematch", "mismatch"}) {
152 for (const string& det : {"rich", "trd", "tof"}) {
153 CreateMeanHist<TH1D>("hChi2_" + match + "_" + cat + "_" + det + "_" + ptcl, nofEvents);
154 }
155 }
156 }
157 } // fGTrackNames
158
159 // Candidate Loop
160 for (const string& ptcl : fHMean.fCandNames) {
161 CreateMeanHist<TH2D>("hTofPileHitXY_" + ptcl, nofEvents);
162 CreateMeanHist<TH2D>("hTofPilePointXY_" + ptcl, nofEvents);
163 CreateMeanHist<TH1D>("hTofPileHitPointDist_" + ptcl, nofEvents);
164 CreateMeanHist<TH1D>("hTofPilePty_cands_" + ptcl, nofEvents);
165 CreateMeanHist<TH2D>("hTofTimeVsMom_cands_" + ptcl, nofEvents);
166 CreateMeanHist<TH2D>("hTofHitTrackDist_cands_" + ptcl, nofEvents);
167
168 for (auto step : fHMean.fAnaSteps) {
169 CreateMeanHist<TH1D>(fHMean.GetName("hMom_cands_" + ptcl, step), nofEvents);
170 CreateMeanHist<TH1D>(fHMean.GetName("hMomRatio_cands_" + ptcl, step), nofEvents);
171 CreateMeanHist<TH1D>(fHMean.GetName("hMomRatioVsMom_cands_" + ptcl, step), 1);
172 CreateMeanHist<TH2D>(fHMean.GetName("hPtY_cands_" + ptcl, step), nofEvents);
173 CreateMeanHist<TH2D>(fHMean.GetName("hTofM2_cands_" + ptcl, step), nofEvents);
174 CreateMeanHist<TH2D>(fHMean.GetName("hRichRingTrackDist_cands_" + ptcl, step), nofEvents);
175 } // steps
176
177 for (const string& cat : {"gTracks", "cands"}) {
178 CreateMeanHist<TH1D>("hBetaMom_" + cat + "_" + ptcl, nofEvents);
179 }
180
181
182 for (const string det : {"sts", "rich", "trd", "tof"}) {
183 CreateMeanHist<TH2D>("hChi2VsMom_" + det + "_" + ptcl, nofEvents);
184 CreateMeanHist<TH2D>("hTofTimeVsChi2_" + det + "_" + ptcl, nofEvents);
185 }
186
187 for (const string det : {"StsRich", "StsTrd", "RichTrd"}) {
188 CreateMeanHist<TH2D>("hChi2Comb_" + det + "_" + ptcl, nofEvents);
189 }
190
191
192 } // fCandNames
193
194 // Step Loop
195 for (auto step : fHMean.fAnaSteps) {
196 for (auto src : {ELmvmSrc::Bg, ELmvmSrc::Eta, ELmvmSrc::Pi0}) {
197 CreateMeanHist<TH1D>(fHMean.GetName("hMinv", src, step), nofEvents, fRebMinv);
198 CreateMeanHist<TH1D>(fHMean.GetName("hMinv_urqmdAll", src, step), nofEvents, fRebMinv);
199 CreateMeanHist<TH1D>(fHMean.GetName("hMinv_urqmdEl", src, step), nofEvents, fRebMinv);
200 CreateMeanHist<TH2D>(fHMean.GetName("hMinvPt", src, step), nofEvents);
201 }
202
203 for (const string& comb : {"PM", "PP", "MM"}) {
204 for (const string& cat : {"", "_urqmdEl", "_urqmdAll"}) {
205 for (const string& ev : {"_sameEv", "_mixedEv"}) {
206 CreateMeanHist<TH1D>(fHMean.GetName("hMinvComb" + comb + cat + ev, step), nofEvents, fRebMinv);
207 }
208 }
209 }
210
211 CreateMeanHist<TH1D>(fHMean.GetName("hPionSupp_idEl", step), nofEvents);
212 CreateMeanHist<TH1D>(fHMean.GetName("hPionSupp_pi", step), nofEvents);
213 CreateMeanHist<TH2D>(fHMean.GetName("hCandPdgVsMom", step), nofEvents);
214 CreateMeanHist<TH1D>(fHMean.GetName("hTofPilePdgs_cands", step), nofEvents);
215 CreateMeanHist<TH1D>(fHMean.GetName("hVertexXZ_misidTof", step), nofEvents);
216 CreateMeanHist<TH1D>(fHMean.GetName("hVertexYZ_misidTof", step), nofEvents);
217 CreateMeanHist<TH1D>(fHMean.GetName("hVertexXY_misidTof", step), nofEvents);
218 CreateMeanHist<TH1D>(fHMean.GetName("hVertexRZ_misidTof", step), nofEvents);
219 } // steps
220
221 string hBgSrc = "hMinvBgSource2_elid_";
222 for (const string& pair : {"gg", "pipi", "pi0pi0", "oo", "gpi", "gpi0", "go", "pipi0", "pio", "pi0o"}) {
223 string hPairFull = hBgSrc + pair;
224 CreateMeanHist<TH1D>(hPairFull, nofEvents, fRebMinv);
225 }
226
227 for (const string& cat : {"true", "misid"}) {
228 for (size_t iP = 4; iP < fHMean.fCandNames.size(); iP++) {
229 CreateMeanHist<TH1D>("hMom_" + fHMean.fCandNames[iP] + "_" + cat, nofEvents);
230 CreateMeanHist<TH1D>("hPtY_" + fHMean.fCandNames[iP] + "_" + cat, nofEvents);
231 CreateMeanHist<TH1D>("hTofM2_" + fHMean.fCandNames[iP] + "_" + cat, nofEvents);
232 }
233 }
234
235 for (const string& det : {"rich", "trd", "tof"}) {
236 for (const string& cat : {"all", "complete"}) {
237 CreateMeanHist<TH2D>("hPdgVsMom_gTracks_" + det + "_" + cat, nofEvents);
238 }
239 }
240
241 for (const string& cat : {"El", "Bg"}) {
242 CreateMeanHist<TH2D>("hAnnRichVsMomPur_" + cat, nofEvents);
243 CreateMeanHist<TH2D>("hTrdElLikePur_" + cat, nofEvents);
244 }
245
246 CreateMeanHist<TH1D>("hBetaMom_allGTracks", nofEvents);
247 CreateMeanHist<TH1D>("hTofPilePdgs_gTracks", nofEvents);
248 CreateMeanHist<TH2D>("hVertexGTrackRZ", nofEvents);
249}
250
251TH1D* LmvmDrawAll::GetCocktailMinvH1(const string& name, ELmvmAnaStep step)
252{
253 return GetCocktailMinv<TH1D>(name, step);
254}
255
256template<class T>
257T* LmvmDrawAll::GetCocktailMinv(const string& name, ELmvmAnaStep step)
258{
259 T* sEta = dynamic_cast<T*>(fHMean.GetObject(fHMean.GetName(name, ELmvmSrc::Eta, step)));
260 T* sPi0 = dynamic_cast<T*>(fHMean.GetObject(fHMean.GetName(name, ELmvmSrc::Pi0, step)));
261
262 T* cocktail = nullptr;
263 for (ELmvmSignal signal : fHMean.fSignals) {
264 string nameFull = fHMean.GetName(name, ELmvmSrc::Signal, step);
265 T* sHist = dynamic_cast<T*>(H(signal)->GetObject(nameFull)->Clone());
266 int nofEvents = (int) H(signal)->H1("hEventNumber")->GetEntries();
267 sHist->Scale(1. / nofEvents);
268 // Rebinning only for 1D histograms
269 if (dynamic_cast<T*>(fHMean.GetObject(fHMean.GetName(name, ELmvmSrc::Eta, step)))->GetDimension() == 1) {
270 double binWidth = sEta->GetBinWidth(1);
271 sHist->Rebin(fRebMinv);
272 sHist->Scale(1. / binWidth);
273 }
274 if (cocktail == nullptr) cocktail = sHist;
275 else
276 cocktail->Add(sHist);
277 }
278 cocktail->Add(sEta);
279 cocktail->Add(sPi0);
280
281 return cocktail;
282}
283
285{
286 TH1D* inmed = new TH1D("inmed", "inmed; M_{ee} [GeV/c^{2}]; Scale Value", 3400., 0., 3.4);
287 TH1D* qgp = new TH1D("qgp", "qgp; M_{ee} [GeV/c^{2}]; Scale Value", 3400., 0., 3.4);
288 for (int iB = 1; iB <= 3400; iB++) {
289 double binCenter = inmed->GetBinCenter(iB);
290 double sInmed = LmvmUtils::GetMassScaleInmed(binCenter);
291 double sQgp = LmvmUtils::GetMassScaleQgp(binCenter);
292 inmed->SetBinContent(iB, sInmed);
293 qgp->SetBinContent(iB, sQgp);
294 }
295 fHMean.fHM.CreateCanvas("MinvScaleValues", "MinvScaleValues", 2400, 800);
296 DrawH1({inmed, qgp}, {"inmed", "QGP"}, kLinear, kLog, true, 0.7, 0.7, 0.9, 0.9, "hist");
297
298 TH1D* inmed2 = (TH1D*) inmed->Clone();
299 TH1D* qgp2 = (TH1D*) qgp->Clone();
300 inmed2->GetXaxis()->SetRangeUser(1., 1.1);
301 qgp2->GetXaxis()->SetRangeUser(1., 1.1);
302 inmed2->GetYaxis()->SetRangeUser(3e-3, 5e-1);
303 qgp2->GetYaxis()->SetRangeUser(3e-3, 5e-1);
304
305 fHMean.fHM.CreateCanvas("MinvScaleValues2", "MinvScaleValues2", 2400, 800);
306 DrawH1({inmed2, qgp2}, {"inmed", "QGP"}, kLinear, kLog, true, 0.7, 0.7, 0.9, 0.9, "p");
307}
308
309void LmvmDrawAll::DrawSignificance(TH2D* hEl, TH2D* hBg, const string& name, double minZ, double maxZ,
310 const string& option)
311{
312 string hElProjName = name + "_yProjEl";
313 string hBgProjName = name + "_yProjBg";
314 TH1D* el = hEl->ProjectionY(hElProjName.c_str(), 1, hEl->GetXaxis()->GetNbins(), "");
315 TH1D* bg = hBg->ProjectionY(hBgProjName.c_str(), 1, hBg->GetXaxis()->GetNbins(), "");
316 TH2D* rat = (TH2D*) hEl->Clone();
317 rat->Divide(hBg);
318
319 const string hName = name + "_sign";
320 const string cName = "Significance/" + name;
321
322 TH1D* sign = fHMean.CreateSignificanceH1(el, bg, hName.c_str(), option);
323 TCanvas* c = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 2400, 1600);
324 c->Divide(3, 2);
325 c->cd(1);
326 DrawH2(hEl, kLinear, kLinear, kLog, "colz");
327 hEl->GetZaxis()->SetRangeUser(minZ, maxZ);
328 DrawTextOnPad("Electrons", 0.25, 0.9, 0.75, 0.99);
329 c->cd(2);
330 DrawH2(hBg, kLinear, kLinear, kLog, "colz");
331 hBg->GetZaxis()->SetRangeUser(minZ, maxZ);
332 DrawTextOnPad("Other", 0.25, 0.9, 0.75, 0.99);
333 c->cd(3);
334 DrawH2(rat, kLinear, kLinear, kLog, "colz");
335 DrawTextOnPad("Ratio Electrons/Other", 0.2, 0.9, 0.8, 0.99);
336 c->cd(4);
337 DrawH1({el, bg}, {"Electrons", "Other"}, kLinear, kLog, true, 0.75, 0.75, 0.91, 0.91);
338 DrawTextOnPad("Yield / Event", 0.25, 0.9, 0.75, 0.99);
339 c->cd(5);
340 DrawH1(sign, kLinear, kLinear, "hist");
341 double maxX = -999999.;
342 double maxY = -999999.;
343 for (int iB = 1; iB <= sign->GetNbinsX(); iB++) {
344 if (option == "right" && sign->GetBinContent(iB) >= maxY) {
345 maxX = sign->GetBinCenter(iB);
346 maxY = sign->GetBinContent(iB);
347 }
348 if (option == "left" && sign->GetBinContent(iB) > maxY) {
349 maxX = sign->GetBinCenter(iB);
350 maxY = sign->GetBinContent(iB);
351 }
352 }
353 DrawTextOnPad("max. at: " + Cbm::NumberToString(maxX, 1), 0.55, 0.2, 0.85, 0.5);
354 DrawTextOnPad("Significance", 0.25, 0.9, 0.75, 0.99);
355}
356
358 DrawSignificancesAll() // TODO: implement automatization to seperate electrons from not-electrons in gTracks and cands
359{
360 // RICH ANN and Electron Likelihood
361 {
362 for (const string& hist : {"hAnnRichVsMomPur", "hTrdElLikePur"}) {
363 TH2D* el = fHMean.H2Clone(hist + "_El");
364 TH2D* bg = fHMean.H2Clone(hist + "_Bg");
365 DrawSignificance(el, bg, hist, 1e-9, 1e-3, "left");
366 }
367 }
368
369 // X2 in TRD (filled after ElID step)
370 {
371 TH2D* el = fHMean.H2Clone("hChi2VsMom_trd_plutoEl+");
372 el->Add(fHMean.H2("hChi2VsMom_trd_plutoEl-"));
373
374 TH2D* bg = fHMean.H2Clone("hChi2VsMom_trd_pion+");
375 for (size_t iP = 2; iP < fHMean.fCandNames.size(); iP++) { // consider UrQMD-electrons as "BG"
376 string ptcl = fHMean.fCandNames[iP];
377 string hName1 = "hChi2VsMom_trd_" + ptcl;
378 bg->Add(fHMean.H2(hName1.c_str()));
379 }
380
381 DrawSignificance(el, bg, "hChi2VsMom_trd", 1e-9, 1e-3, "right");
382 }
383
384 // Time in ToF (filled after ElID step)
385 {
386 TH2D* el = fHMean.H2Clone("hTofTimeVsMom_cands_plutoEl+");
387 TH2D* bg = fHMean.H2Clone("hTofTimeVsMom_cands_pion+");
388
389 for (size_t iP = 1; iP < fHMean.fCandNames.size(); iP++) {
390 string hName = "hTofTimeVsMom_cands_" + fHMean.fCandNames[iP];
391 if (iP <= 3) el->Add(fHMean.H2(hName.c_str()));
392 else if (iP == 4)
393 continue;
394 else
395 bg->Add(fHMean.H2(hName.c_str()));
396 }
397
398 DrawSignificance(el, bg, "hTofTimeVsMom", 1e-9, 1e-2, "right");
399 }
400
401 // Hit-Track-Distance in ToF (filled after ElID step)
402 {
403 TH2D* el = fHMean.H2Clone("hTofHitTrackDist_cands_plutoEl+");
404 TH2D* bg = fHMean.H2Clone("hTofHitTrackDist_cands_pion+");
405
406 for (size_t iP = 1; iP < fHMean.fCandNames.size(); iP++) {
407 string hName = "hTofHitTrackDist_cands_" + fHMean.fCandNames[iP];
408 if (iP <= 1) el->Add(fHMean.H2(hName.c_str())); // consider UrQMD-electrons as "BG"
409 else if (iP == 4)
410 continue;
411 else
412 bg->Add(fHMean.H2(hName.c_str()));
413 }
414
415 DrawSignificance(el, bg, "hTofHitTrackDist", 1e-9, 1e-2, "right");
416 }
417}
418
420{
421 TCanvas* c = fHMean.fHM.CreateCanvas("Vertex/globalTrackRZ", "Vertex/globalTrackRZ", 1600, 800);
422 c->Divide(2, 1);
423 c->cd(1);
424 TH2D* h = fHMean.H2Clone("hVertexGTrackRZ");
425 h->GetYaxis()->SetRangeUser(0., 50);
426 h->GetZaxis()->SetRangeUser(1e-7, 10);
427 DrawH2(h, kLinear, kLinear, kLog, "colz");
428 c->cd(2);
429 TH2D* h2 = fHMean.H2Clone("hVertexGTrackRZ");
430 h2->GetXaxis()->SetRangeUser(-49., -39.);
431 h2->GetYaxis()->SetRangeUser(0., 10.);
432 h2->GetZaxis()->SetRangeUser(1e-7, 10);
433 DrawH2(h2, kLinear, kLinear, kLog, "colz");
434}
435
437{
438 //double min = 1e-7;
439 //double max = 2e-3;
440 double minD = 1e-7;
441 double maxD = 2e-2;
442
443 /*TCanvas* c = fHMean.fHM.CreateCanvas("ToF/point-hit-dist_gTracks", "ToF/point-hit-dist_gTracks", 2400, 2400); // TODO: do these as loop for pile and not-pile histograms
444 c->Divide(4, 4);
445 int i = 1;
446 for (const string& ptcl : fHMean.fGTrackNames) {
447 c->cd(i++);
448 string hName = "hTofHitPointDist_" + ptcl;
449 TH1D* h = fHMean.H1Clone(hName.c_str());
450 h->Fit("gaus", "Q", "", 0., 2.);
451 h->GetYaxis()->SetRangeUser(minD, maxD);
452 DrawH1(h, kLinear, kLog, "hist");
453 DrawTextOnPad(fHMean.fGTrackLatex[i-2], 0.25, 0.9, 0.75, 0.999);
454 TF1* func = h->GetFunction("gaus");
455 double mean = (func != nullptr) ? func->GetParameter("Mean") : 0.;
456 DrawTextOnPad("mean: " + Cbm::NumberToString(mean, 2), 0.2, 0.65, 0.6, 0.89);
457 }
458
459 for (const string& ptcl : fHMean.fGTrackNames) {
460 TCanvas* c2 = fHMean.fHM.CreateCanvas("ToF/HitXY/" + ptcl, "ToF/HitXY/" + ptcl, 2400, 800);
461 c2->Divide(3,1);
462 c2->cd(1);
463 TH2D* point = fHMean.H2Clone("hTofPointXY_" + ptcl);
464 point->GetZaxis()->SetRangeUser(min, max);
465 DrawH2(point, kLinear, kLinear, kLog, "colz");
466 DrawTextOnPad("ToF Points", 0.3, 0.9, 0.7, 0.99);
467 c2->cd(2);
468 TH2D* hit = fHMean.H2Clone("hTofHitXY_" + ptcl);
469 hit->GetZaxis()->SetRangeUser(min, max);
470 DrawH2(hit, kLinear, kLinear, kLog, "colz");
471 DrawTextOnPad("ToF Hits", 0.3, 0.9, 0.7, 0.99);
472 c2->cd(3);
473 TH1D* dist = fHMean.H1Clone("hTofHitPointDist_" + ptcl);
474 dist->GetYaxis()->SetRangeUser(minD, maxD);
475 dist->Fit("gaus", "Q", "", 0., 2.);
476 DrawH1(dist, kLinear, kLog, "hist");
477 DrawTextOnPad("Distance Hit-Point", 0.3, 0.9, 0.7, 0.99);
478 TF1* func = dist->GetFunction("gaus");
479 double mean = (func != nullptr) ? func->GetParameter("Mean") : 0.;
480 DrawTextOnPad("mean: " + Cbm::NumberToString(mean, 1), 0.2, 0.65, 0.5, 0.89);
481 }*/
482
483 // draw only for particles in ToF pile that are identified as electrons in ToF
484 double minH = 2e-6;
485 double maxH = 1e-4;
486
487 TCanvas* c3 = fHMean.fHM.CreateCanvas("ToF/HitXY/MisidsInTofPile/point-hit-dist_all",
488 "ToF/HitXY/MisidsInTofPile/point-hit-dist_all", 2400, 1600);
489 c3->Divide(3, 2);
490 int iC = 1;
491 for (size_t iP = 4; iP < fHMean.fCandNames.size(); iP++) { // only draw for not-electrons
492 c3->cd(iC++);
493 string ptcl = fHMean.fCandNames[iP];
494 string hName = "hTofPileHitPointDist_" + ptcl;
495 TH1D* h = fHMean.H1Clone(hName.c_str());
496 h->GetYaxis()->SetRangeUser(minD, maxD);
497 h->Fit("gaus", "Q", "", 0., 2.);
498 DrawH1(h, kLinear, kLog, "hist");
499 DrawTextOnPad(fHMean.fCandLatex[iP], 0.4, 0.9, 0.54, 0.99);
500 TF1* func = h->GetFunction("gaus");
501 double mean = (func != nullptr) ? func->GetParameter("Mean") : 0.;
502 DrawTextOnPad("mean: " + Cbm::NumberToString(mean, 2), 0.2, 0.65, 0.6, 0.89);
503 }
504
505 for (size_t iP = 4; iP < fHMean.fCandNames.size(); iP++) { // only draw for not-electrons
506 string ptcl = fHMean.fCandNames[iP];
507 TCanvas* c4 =
508 fHMean.fHM.CreateCanvas("ToF/HitXY/MisidsInTofPile/" + ptcl, "ToF/HitXY/MisidsInTofPile/" + ptcl, 2400, 800);
509 c4->Divide(3, 1);
510 c4->cd(1);
511 TH2D* hit = fHMean.H2Clone("hTofPileHitXY_" + ptcl);
512 hit->GetZaxis()->SetRangeUser(minH, maxH);
513 DrawH2(hit, kLinear, kLinear, kLog, "colz");
514 DrawTextOnPad("ToF Hits", 0.3, 0.9, 0.7, 0.99);
515 c4->cd(2);
516 TH2D* point = fHMean.H2Clone("hTofPilePointXY_" + ptcl);
517 point->GetZaxis()->SetRangeUser(minH, maxH);
518 DrawH2(point, kLinear, kLinear, kLog, "colz");
519 DrawTextOnPad("ToF Points", 0.3, 0.9, 0.7, 0.99);
520 c4->cd(3);
521 TH1D* dist = fHMean.H1Clone("hTofPileHitPointDist_" + ptcl);
522 dist->Fit("gaus", "Q", "", 0., 2.);
523 dist->GetYaxis()->SetRangeUser(minD, maxD);
524 DrawH1(dist, kLinear, kLog, "hist");
525 DrawTextOnPad("Distance Hit-Point", 0.3, 0.9, 0.7, 0.99);
526 TF1* func = dist->GetFunction("gaus");
527 double mean = (func != nullptr) ? func->GetParameter("Mean") : 0.;
528 DrawTextOnPad("mean: " + Cbm::NumberToString(mean, 1), 0.2, 0.65, 0.5, 0.89);
529 }
530}
531
533{
534 double min = 1e-5;
535 double max = 10;
536 for (const string& cat : {"gTracks", "cands"}) {
537 for (size_t i = 0; i < fHMean.fCandNames.size(); i++) {
538 string cName = "BetaMom/" + cat + "/" + fHMean.fCandNames[i];
539 string hName = "hBetaMom_" + cat + "_" + fHMean.fCandNames[i];
540 fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 800, 800);
541 TH2D* h = fHMean.H2Clone(hName.c_str());
542 h->GetZaxis()->SetRangeUser(min, max);
543 DrawH2(h, kLinear, kLinear, kLog, "colz");
544 DrawTextOnPad((fHMean.fCandLatex[i]).c_str(), 0.25, 0.9, 0.75, 0.999);
545 }
546 }
547 fHMean.fHM.CreateCanvas("BetaMom/gTracks/all", "BetaMom/gTracks/all", 800, 800);
548 TH2D* h = fHMean.H2Clone("hBetaMom_allGTracks");
549 h->GetZaxis()->SetRangeUser(min, max);
550 DrawH2(h, kLinear, kLinear, kLog, "colz");
551}
552
554{
555 for (const string& pi : {"Px", "Py", "Pz"}) {
556 string cName = "MomDistPluto/" + pi;
557 TCanvas* c = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 2400, 1600);
558 c->Divide(3, 2);
559 int i = 1;
560 for (ELmvmSignal signal : fHMean.fSignals) {
561 c->cd(i++);
562 string hName = "hMom" + pi;
563 TH1D* ep = H(signal)->H1Clone((hName + "+_signal_mc").c_str());
564 TH1D* em = H(signal)->H1Clone((hName + "-_signal_mc").c_str());
565 double bW = ep->GetBinWidth(1);
566 ep->Scale(1. / (H(signal)->H1("hEventNumber")->GetEntries() * bW));
567 em->Scale(1. / (H(signal)->H1("hEventNumber")->GetEntries() * bW));
568 ep->GetYaxis()->SetTitle("1/N dN/dP [GeV/c]^{-1}");
569 DrawH1({ep, em}, {"e^{+}", "e^{-}"}, kLinear, kLog, true, 0.75, 0.75, 0.91, 0.91);
570 DrawTextOnPad(fHMean.fSignalNames[static_cast<int>(signal)].c_str(), 0.23, 0.8, 0.48, 0.89);
571 }
572 }
573}
574
576{
577 // draw momentum of all global tracks
578 fHMean.DrawAllGTracks(1, "hMom/gTracks", "hMom_gTracks", {""}, {""}, 1e-7, 10.);
579
580 // draw momentum for misidentified and not-misidentified particles (from global tracks)
581 {
582 double min = 5e-8;
583 double max = 10;
584 TCanvas* c = fHMean.fHM.CreateCanvas("hMom/misid_vs_True", "hMom/misid_vs_True", 2400, 1600);
585 c->Divide(3, 2);
586 int iC = 1;
587 for (size_t iP = 4; iP < fHMean.fCandNames.size(); iP++) { // only draw for not-electrons
588 c->cd(iC++);
589 string ptcl = fHMean.fCandNames[iP];
590 TH1D* hMis = fHMean.H1Clone("hMom_" + ptcl + "_misid");
591 TH1D* hTrue = fHMean.H1Clone("hMom_" + ptcl + "_true");
592 hMis->GetYaxis()->SetRangeUser(min, max);
593 hTrue->GetYaxis()->SetRangeUser(min, max);
594 DrawH1({hTrue, hMis}, {"not misidentified", "misidentified as electron"}, kLinear, kLog, true, 0.55, 0.8, 0.95,
595 0.91, "hist");
596 DrawTextOnPad(fHMean.fCandLatex[iP], 0.4, 0.9, 0.54, 0.99);
597 }
598 }
599}
600
602{
603 TH1D* mc = fHMean.H1Clone("hMom_cands_" + fHMean.fCandNames[0], ELmvmAnaStep::Mc);
604 mc->Add(fHMean.H1("hMom_cands_" + fHMean.fCandNames[1], ELmvmAnaStep::Mc));
605
606 TH1D* elid = fHMean.H1Clone("hMom_cands_" + fHMean.fCandNames[0], ELmvmAnaStep::ElId);
607 elid->Add(fHMean.H1("hMom_cands_" + fHMean.fCandNames[1], ELmvmAnaStep::ElId));
608 elid->Divide(mc);
609
610 TH1D* gamma = fHMean.H1Clone("hMom_cands_" + fHMean.fCandNames[0], ELmvmAnaStep::GammaCut);
611 gamma->Add(fHMean.H1("hMom_cands_" + fHMean.fCandNames[1], ELmvmAnaStep::GammaCut));
612 gamma->Divide(mc);
613
614 TH1D* tt = fHMean.H1Clone("hMom_cands_" + fHMean.fCandNames[0], ELmvmAnaStep::TtCut);
615 tt->Add(fHMean.H1("hMom_cands_" + fHMean.fCandNames[1], ELmvmAnaStep::TtCut));
616 tt->Divide(mc);
617
618 TH1D* pt = fHMean.H1Clone("hMom_cands_" + fHMean.fCandNames[0], ELmvmAnaStep::PtCut);
619 pt->Add(fHMean.H1("hMom_cands_" + fHMean.fCandNames[1], ELmvmAnaStep::PtCut));
620 pt->Divide(mc);
621
622 fHMean.fHM.CreateCanvas("CutEff_signal", "CutEff_signal", 900, 900);
623 elid->GetYaxis()->SetTitle("Efficiency");
624 DrawH1({elid, gamma, tt, pt}, {"El-ID", "Gamma cut", "TT cut", "P_{t} cut"}, kLinear, kLinear, true, 0.6, 0.75, 0.95,
625 0.91, "hist");
626 DrawTextOnPad("Signal Efficiency", 0.3, 0.9, 0.7, 0.99);
627}
628
630{
631 for (auto step : {ELmvmAnaStep::Mc, ELmvmAnaStep::Acc}) {
632 TH1D* elidMc = fHMean.H1Clone("hPionSupp_pi", step);
633 elidMc->Divide(fHMean.H1("hPionSupp_idEl", ELmvmAnaStep::ElId));
634
635 TH1D* gammaMc = fHMean.H1Clone("hPionSupp_pi", step);
636 gammaMc->Divide(fHMean.H1("hPionSupp_idEl", ELmvmAnaStep::GammaCut));
637
638 TH1D* ttMc = fHMean.H1Clone("hPionSupp_pi", step);
639 ttMc->Divide(fHMean.H1("hPionSupp_idEl", ELmvmAnaStep::TtCut));
640
641 TH1D* ptMc = fHMean.H1Clone("hPionSupp_pi", step);
642 ptMc->Divide(fHMean.H1("hPionSupp_idEl", ELmvmAnaStep::PtCut));
643
644 string text = fHMean.fAnaStepNames[static_cast<int>(step)];
645 fHMean.fHM.CreateCanvas("PionSuppression_" + text, "PionSuppression_" + text, 900, 900);
646 elidMc->GetYaxis()->SetTitle("Pion Suppression");
647 DrawH1({elidMc, gammaMc, ttMc, ptMc}, {"El-ID", "Gamma cut", "TT cut", "P_{t} cut"}, kLinear, kLog, true, 0.7, 0.8,
648 0.95, 0.91, "hist");
649 DrawTextOnPad("Pion Suppression (norm. to " + text + ")", 0.25, 0.88, 0.75, 0.99);
650 }
651}
652
654{
655 // for all global tracks
656 {
657 TH2D* hEl = fHMean.H2Clone("hTofM2_gTracks_" + fHMean.fGTrackNames[0]);
658 for (size_t iP = 1; iP < 4; iP++) {
659 string hName = "hTofM2_gTracks_" + fHMean.fGTrackNames[iP];
660 hEl->Add(fHMean.H2(hName.c_str()));
661 }
662 TH2D* hBg = fHMean.H2Clone("hTofM2_gTracks_" + fHMean.fGTrackNames[4]);
663 for (size_t iP = 5; iP < fHMean.fGTrackNames.size(); iP++) {
664 string hName = "hTofM2_gTracks_" + fHMean.fGTrackNames[iP];
665 hBg->Add(fHMean.H2(hName.c_str()));
666 }
667
668 double minX = 0.;
669 double maxX = 2.5;
670 double minY = -0.05;
671 double maxY = 0.05;
672 double minZ = 1e-8;
673 double maxZ = 1;
674 vector<TLine*> lines {new TLine(0., 0.01, 1.3, 0.01), new TLine(1.3, 0.01, 2.5, 0.022)}; // set by hand
675 TCanvas* c = fHMean.fHM.CreateCanvas("ToF/Purity/gTracks", "ToF/Purity/gTracks", 1600,
676 800); // TODO: check: is this all gTracks?
677 c->Divide(2, 1);
678 c->cd(1);
679 hEl->GetXaxis()->SetRangeUser(minX, maxX);
680 hEl->GetYaxis()->SetRangeUser(minY, maxY);
681 hEl->GetZaxis()->SetRangeUser(minZ, maxZ);
682 DrawH2(hEl, kLinear, kLinear, kLog, "colz");
683 DrawTextOnPad("Electrons", 0.35, 0.89, 0.65, 0.99);
684 for (size_t i = 0; i < lines.size(); i++) {
685 lines[i]->SetLineWidth(2.);
686 lines[i]->Draw();
687 }
688 c->cd(2);
689 hBg->GetXaxis()->SetRangeUser(minX, maxX);
690 hBg->GetYaxis()->SetRangeUser(minY, maxY);
691 hBg->GetZaxis()->SetRangeUser(minZ, maxZ);
692 DrawH2(hBg, kLinear, kLinear, kLog, "colz");
693 DrawTextOnPad("Other", 0.35, 0.89, 0.65, 0.99);
694 for (size_t i = 0; i < lines.size(); i++) {
695 lines[i]->SetLineWidth(2.);
696 lines[i]->Draw();
697 }
698 }
699
700 // for candidates
701 {
702 double minX = 0.;
703 double maxX = 2.5;
704 double minY = -0.05;
705 double maxY = 0.05;
706 double minZ = 1e-8;
707 double maxZ = 10;
708 vector<TLine*> lines {new TLine(0., 0.01, 1.3, 0.01), new TLine(1.3, 0.01, 2.5, 0.022)}; // set by hand
709
710 for (auto step : fHMean.fAnaSteps) {
711 TH2D* hEl = fHMean.H2Clone(("hTofM2_cands_" + fHMean.fCandNames[0]), step);
712 for (size_t iP = 1; iP < 4; iP++) {
713 string hName = "hTofM2_cands_" + fHMean.fCandNames[iP] + "_" + fHMean.fAnaStepNames[static_cast<int>(step)];
714 hEl->Add(fHMean.H2(hName.c_str()));
715 }
716 TH2D* hBg = fHMean.H2Clone(("hTofM2_cands_" + fHMean.fCandNames[4]), step);
717 for (size_t iP = 5; iP < fHMean.fCandNames.size(); iP++) {
718 string hName = "hTofM2_cands_" + fHMean.fCandNames[iP] + "_" + fHMean.fAnaStepNames[static_cast<int>(step)];
719 hBg->Add(fHMean.H2(hName.c_str()));
720 }
721 string cName = "ToF/Purity/" + fHMean.fAnaStepNames[static_cast<int>(step)];
722 TCanvas* c = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 1600, 800);
723 c->Divide(2, 1);
724 c->cd(1);
725 hEl->GetXaxis()->SetRangeUser(minX, maxX);
726 hEl->GetYaxis()->SetRangeUser(minY, maxY);
727 hEl->GetZaxis()->SetRangeUser(minZ, maxZ);
728 DrawH2(hEl, kLinear, kLinear, kLog, "colz");
729 DrawTextOnPad("Electrons (" + fHMean.fAnaStepNames[static_cast<int>(step)] + ")", 0.3, 0.89, 0.6, 0.99);
730 for (size_t i = 0; i < lines.size(); i++) {
731 lines[i]->SetLineWidth(2.);
732 lines[i]->Draw();
733 }
734 c->cd(2);
735 hBg->GetXaxis()->SetRangeUser(minX, maxX);
736 hBg->GetYaxis()->SetRangeUser(minY, maxY);
737 hBg->GetZaxis()->SetRangeUser(minZ, maxZ);
738 DrawH2(hBg, kLinear, kLinear, kLog, "colz");
739 DrawTextOnPad("Other (" + fHMean.fAnaStepNames[static_cast<int>(step)] + ")", 0.3, 0.89, 0.55, 0.99);
740 for (size_t i = 0; i < lines.size(); i++) {
741 lines[i]->SetLineWidth(2.);
742 lines[i]->Draw();
743 }
744 }
745 }
746}
747
749{
750 double x[200], y[200];
751 int n = 200;
752 double m = 511e-6;
753 double m2 = m * m;
754 double p = 6;
755 double p2 = p * p;
756 for (int i = 0; i < n; i++) {
757 x[i] = 0.02 * i;
758 double counter =
759 std::sqrt(2 * m2 * TMath::Exp(2 * x[i]) - m2 * TMath::Exp(4 * x[i]) + 4 * p2 * TMath::Exp(2 * x[i]) - m2);
760 double denom = std::sqrt(1 + 2 * TMath::Exp(2 * x[i]) + TMath::Exp(4 * x[i]));
761 double r = counter / denom;
762 y[i] = r;
763 }
764 auto pLine = new TGraph(n, x, y); // draw momentum line into Pt-Y histogram
765
766 for (const string& cat : {"hPtY", "hTofM2"}) {
767 // draw all global tracks seperate for diff. particles
768 {
769 double min = 1e-8;
770 double max = 10;
771 string cName = cat + "/globalTracks/all";
772 TCanvas* c = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 2400, 2400);
773 c->Divide(4, 4);
774 int i = 1;
775 for (auto ptcl : fHMean.fGTrackNames) {
776 c->cd(i++);
777 string hName = cat + "_gTracks_" + ptcl;
778 TH2D* h = fHMean.H2Clone(hName.c_str());
779 h->GetZaxis()->SetRangeUser(min, max);
780 DrawH2(h, kLinear, kLinear, kLog, "colz");
781 DrawTextOnPad(fHMean.fGTrackLatex[i - 2], 0.25, 0.9, 0.75, 0.999);
782 if (cat == "hPtY") pLine->Draw("C");
783 }
784 }
785
786 // draw zoomed in TofM2
787 {
788 if (cat == "hTofM2") {
789 double min = 1e-8;
790 double max = 10;
791 string cName = cat + "/globalTracks/all_zoom";
792 TCanvas* c = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 2400, 2400);
793 c->Divide(4, 4);
794 int i = 1;
795 for (auto ptcl : fHMean.fGTrackNames) {
796 c->cd(i++);
797 string hName = cat + "_gTracks_" + ptcl;
798 TH2D* h = fHMean.H2Clone(hName.c_str());
799 h->GetXaxis()->SetRangeUser(0., 2.5);
800 h->GetYaxis()->SetRangeUser(-0.05, 0.05);
801 h->GetZaxis()->SetRangeUser(min, max);
802 DrawH2(h, kLinear, kLinear, kLog, "colz");
803 DrawTextOnPad(fHMean.fGTrackLatex[i - 2], 0.25, 0.9, 0.75, 0.999);
804 }
805 }
806 }
807
808 // draw misidentified and not-misidentified particles and ratio of both (all from global tracks)
809 {
810 double min = (cat == "hPtY") ? 1e-7 : 1e-8;
811 double max = (cat == "hPtY") ? 10 : 10;
812 for (size_t iP = 4; iP < fHMean.fCandNames.size(); iP++) { // only draw for not-electrons
813 string ptcl = fHMean.fCandNames[iP];
814 string cName = cat + "/candidates/" + ptcl + "_misid";
815 TCanvas* c = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 2400, 800);
816 c->Divide(3, 1);
817 c->cd(1);
818 TH2D* hTrue = fHMean.H2Clone(cat + "_" + ptcl + "_true");
819 if (cat == "hTofM2") {
820 hTrue->GetXaxis()->SetRangeUser(0., 2.5);
821 hTrue->GetYaxis()->SetRangeUser(-0.05, 0.05);
822 }
823 hTrue->GetZaxis()->SetRangeUser(min, max);
824 DrawH2(hTrue, kLinear, kLinear, kLog, "colz");
825 DrawTextOnPad(fHMean.fCandLatex[iP] + " (not misidentified)", 0.2, 0.9, 0.75, 0.99);
826 if (cat == "hPtY") pLine->Draw("C");
827
828 c->cd(2);
829 TH2D* hMis = fHMean.H2Clone(cat + "_" + ptcl + "_misid");
830 if (cat == "hTofM2") {
831 hMis->GetXaxis()->SetRangeUser(0., 2.5);
832 hMis->GetYaxis()->SetRangeUser(-0.05, 0.05);
833 }
834 hMis->GetZaxis()->SetRangeUser(min, max);
835 DrawH2(hMis, kLinear, kLinear, kLog, "colz");
836 DrawTextOnPad(fHMean.fCandLatex[iP] + " (misidentified as electron)", 0.15, 0.9, 0.75, 0.99);
837 if (cat == "hPtY") pLine->Draw("C");
838
839 c->cd(3);
840 TH2D* hRat = fHMean.H2Clone(cat + "_" + ptcl + "_misid");
841 hRat->Divide(hTrue);
842 if (cat == "hTofM2") {
843 hRat->GetXaxis()->SetRangeUser(0., 2.5);
844 hRat->GetYaxis()->SetRangeUser(-0.05, 0.05);
845 }
846 hRat->GetZaxis()->SetRangeUser(1e-5, 1); // TODO: check best min value
847 hRat->GetZaxis()->SetTitle("Ratio #misid./#not misid.");
848 DrawH2(hRat, kLinear, kLinear, kLog, "colz");
849 DrawTextOnPad(fHMean.fCandLatex[iP] + ": Ratio #misid./#not misid.", 0.1, 0.9, 0.6, 0.99);
850 if (cat == "hPtY") pLine->Draw("C");
851 }
852 }
853
854 // draw misidentified candidates for each step
855 {
856 double min = (cat == "hPtY") ? 2e-8 : 2e-8;
857 double max = (cat == "hPtY") ? 5e-3 : 5e-3;
858 for (size_t iP = 4; iP < fHMean.fCandNames.size(); iP++) {
859 string ptcl = fHMean.fCandNames[iP];
860 string cName = cat + "/candidates/" + ptcl + "_misid_steps";
861 TCanvas* cPty = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 1800, 1800);
862 cPty->Divide(3, 3);
863 int i = 1;
864 for (auto step : fHMean.fAnaSteps) {
865 if (step < ELmvmAnaStep::ElId) continue;
866 cPty->cd(i++);
867 string hName = cat + "_cands_" + ptcl;
868 TH2D* h = fHMean.H2Clone(hName.c_str(), step);
869 if (cat == "hTofM2") {
870 h->GetXaxis()->SetRangeUser(0., 2.5);
871 h->GetYaxis()->SetRangeUser(-0.05, 0.05);
872 }
873 h->GetZaxis()->SetRangeUser(min, max);
874 DrawH2(h, kLinear, kLinear, kLog, "colz");
876 if (cat == "hPtY") pLine->Draw("C");
877 }
878 }
879 }
880 } // cat: "hPtY", "hTofM2"
881}
882
884{
885 // draw particles that occur in "ToF Pile"
886 vector<string> xLabel = {"e^{-}_{PLUTO}",
887 "e^{+}_{PLUTO}",
888 "e^{-}_{UrQMD_prim}",
889 "e^{+}_{UrQMD_prim}",
890 "e^{-}_{UrQMD_sec}",
891 "e^{+}_{UrQMD_sec}",
892 "#pi^{+}",
893 "#pi^{-}",
894 "p",
895 "K^{+}",
896 "K^{-}",
897 "o."};
898 double max = 3;
899 double min = 1e-5;
900 TCanvas* cTofPile = fHMean.fHM.CreateCanvas("ToF/TofPilePids", "ToF/TofPilePids", 1800, 1800);
901 cTofPile->Divide(4, 4);
902
903 cTofPile->cd(1);
904 TH1D* h0 = fHMean.H1Clone("hTofPilePdgs_gTracks");
905 for (size_t iL = 0; iL < xLabel.size(); iL++) {
906 h0->GetXaxis()->SetBinLabel(iL + 1, xLabel[iL].c_str());
907 }
908 h0->GetYaxis()->SetRangeUser(min, max);
909 DrawH1(h0, kLinear, kLog, "hist");
910 DrawTextOnPad("Global Tracks", 0.35, 0.9, 0.65, 0.999);
911
912 int i = 2;
913 for (auto step : fHMean.fAnaSteps) {
914 cTofPile->cd(i++);
915 TH1D* h = fHMean.H1Clone("hTofPilePdgs_cands", step);
916 for (size_t iL = 0; iL < xLabel.size(); iL++) {
917 h->GetXaxis()->SetBinLabel(iL + 1, xLabel[iL].c_str());
918 }
919 h->GetYaxis()->SetRangeUser(min, max);
920 DrawH1(h, kLinear, kLog, "hist");
922 }
923}
924
926{
927 // Misidentified Particles vs. Momentum
928 {
929 vector<string> yLabel = {"e^{#pm}_{PLUTO}", "e^{#pm}_{UrQMD}", "#pi^{#pm}", "p", "K^{+}", "o."};
930 for (ELmvmAnaStep step : fHMean.fAnaSteps) {
931 if (step == ELmvmAnaStep::Mc || step == ELmvmAnaStep::Acc) continue;
932 string cName = "Purity/purity_" + fHMean.fAnaStepNames[static_cast<int>(step)];
933 string hName = "hCandPdgVsMom_" + fHMean.fAnaStepNames[static_cast<int>(step)];
934 fHMean.fHM.CreateCanvas(cName, cName, 800, 600);
935 TH2D* h = fHMean.H2Clone(hName);
936 h->GetZaxis()->SetRangeUser(5e-7, 1e-2);
937 DrawH2(h, kLinear, kLinear, kLog, "colz");
938 for (size_t y = 1; y <= yLabel.size(); y++) {
939 h->GetYaxis()->SetBinLabel(y, yLabel[y - 1].c_str());
940 }
941 double nEl = h->Integral(1, h->GetXaxis()->GetNbins(), 2, 2); // do not count PLUTO particles
942 double purity = (nEl / h->Integral(1, h->GetXaxis()->GetNbins(), 2, h->GetYaxis()->GetNbins())) * 100;
943 DrawTextOnPad("Purity: " + Cbm::NumberToString(purity, 1) + " %", 0.1, 0.9, 0.45, 0.99);
944 }
945 }
946
947 // Purity vs. Momentum after ElID step
948 {
949 int nBins = fHMean.H2("hCandPdgVsMom_elid")->GetXaxis()->GetNbins();
950 double xMin = fHMean.H2("hCandPdgVsMom_elid")->GetXaxis()->GetXmin();
951 double xMax = fHMean.H2("hCandPdgVsMom_elid")->GetXaxis()->GetXmax();
952 TH1D* purity = new TH1D("purity_Mom", "purity_Mom; P [GeV/c]; Purity [%]", nBins, xMin, xMax);
953 for (int i = 1; i <= purity->GetNbinsX(); i++) {
954 double nEl = fHMean.H2("hCandPdgVsMom", ELmvmAnaStep::ElId)->GetBinContent(i, 2);
955 double nAll = fHMean.H2("hCandPdgVsMom", ELmvmAnaStep::ElId)
956 ->Integral(i, i, 2, fHMean.H2("hCandPdgVsMom_elid")->GetYaxis()->GetNbins());
957 double val = (nAll != 0) ? 100 * nEl / nAll : 0.;
958 purity->SetBinContent(i, val);
959 }
960 purity->Rebin(5);
961 purity->Scale(1. / 5.);
962 fHMean.fHM.CreateCanvas("Purity/purityVsMom_elid", "Purity/purityVsMom_elid", 800, 800);
963 DrawH1(purity, kLinear, kLinear, "p");
964 }
965
966 // Purity seperate for ID Detectors
967 {
968 vector<string> yLabel = {"#pi^{+}", "#pi^{-}", "p", "K^{+}", "K^{-}", "o."};
969 double min = 1e-7;
970 double max = 10;
971
972 TH2D* rich1 = fHMean.H2Clone("hPdgVsMom_gTracks_rich_all");
973 TH2D* trd1 = fHMean.H2Clone("hPdgVsMom_gTracks_trd_all");
974 TH2D* tof1 = fHMean.H2Clone("hPdgVsMom_gTracks_tof_all");
975 TH2D* rich2 = fHMean.H2Clone("hPdgVsMom_gTracks_rich_complete");
976 TH2D* trd2 = fHMean.H2Clone("hPdgVsMom_gTracks_trd_complete");
977 TH2D* tof2 = fHMean.H2Clone("hPdgVsMom_gTracks_tof_complete");
978
979 rich1->GetZaxis()->SetRangeUser(min, max);
980 trd1->GetZaxis()->SetRangeUser(min, max);
981 tof1->GetZaxis()->SetRangeUser(min, max);
982 rich2->GetZaxis()->SetRangeUser(min, max);
983 trd2->GetZaxis()->SetRangeUser(min, max);
984 tof2->GetZaxis()->SetRangeUser(min, max);
985
986 for (size_t y = 1; y <= yLabel.size(); y++) {
987 rich1->GetYaxis()->SetBinLabel(y, yLabel[y - 1].c_str());
988 trd1->GetYaxis()->SetBinLabel(y, yLabel[y - 1].c_str());
989 tof1->GetYaxis()->SetBinLabel(y, yLabel[y - 1].c_str());
990 rich2->GetYaxis()->SetBinLabel(y, yLabel[y - 1].c_str());
991 trd2->GetYaxis()->SetBinLabel(y, yLabel[y - 1].c_str());
992 tof2->GetYaxis()->SetBinLabel(y, yLabel[y - 1].c_str());
993 }
994
995 TCanvas* c1 = fHMean.fHM.CreateCanvas("Misid/misid_gTracks_all", "Misid/misid_gTracks_all", 2400, 800);
996 c1->Divide(3, 1);
997 c1->cd(1);
998 DrawH2(rich1, kLinear, kLinear, kLog, "colz");
999 DrawTextOnPad("RICH", 0.25, 0.9, 0.75, 0.999);
1000 DrawPurityHistText(rich1);
1001 c1->cd(2);
1002 DrawH2(trd1, kLinear, kLinear, kLog, "colz");
1003 DrawTextOnPad("TRD", 0.25, 0.9, 0.75, 0.999);
1004 DrawPurityHistText(trd1);
1005 c1->cd(3);
1006 DrawH2(tof1, kLinear, kLinear, kLog, "colz");
1007 DrawTextOnPad("ToF", 0.25, 0.9, 0.75, 0.999);
1008 DrawPurityHistText(tof1);
1009
1010 TCanvas* c2 = fHMean.fHM.CreateCanvas("Misid/misid_gTracks_complete", "Misid/misid_gTracks_complete", 2400, 800);
1011 c2->Divide(3, 1);
1012 c2->cd(1);
1013 DrawH2(rich2, kLinear, kLinear, kLog, "colz");
1014 DrawTextOnPad("RICH", 0.25, 0.9, 0.75, 0.999);
1015 DrawPurityHistText(rich2);
1016
1017 c2->cd(2);
1018 DrawH2(trd2, kLinear, kLinear, kLog, "colz");
1019 DrawTextOnPad("TRD", 0.25, 0.9, 0.75, 0.999);
1020 DrawPurityHistText(trd2);
1021
1022 c2->cd(3);
1023 DrawH2(tof2, kLinear, kLinear, kLog, "colz");
1024 DrawTextOnPad("ToF", 0.25, 0.9, 0.75, 0.999);
1025 DrawPurityHistText(tof2);
1026 }
1027}
1028
1030{
1031 int nX = h->GetXaxis()->GetNbins();
1032
1033 double xMin = 0.4;
1034 double xMax = 0.75;
1035 double piP = h->Integral(1, nX, 1, 1);
1036 double piM = h->Integral(1, nX, 2, 2);
1037 double p = h->Integral(1, nX, 3, 3);
1038 double KP = h->Integral(1, nX, 4, 4);
1039 double KM = h->Integral(1, nX, 5, 5);
1040 double o = h->Integral(1, nX, 6, 6);
1041
1042 DrawTextOnPad("#pi^{+}: " + Cbm::NumberToString(piP, 1) + " /Ev", xMin, 0.12, xMax, 0.3);
1043 DrawTextOnPad("#pi^{-}: " + Cbm::NumberToString(piM, 1) + " /Ev", xMin, 0.28, xMax, 0.37);
1044 DrawTextOnPad("p: " + Cbm::NumberToString(p, 1) + " /Ev", xMin, 0.43, xMax, 0.48);
1045 DrawTextOnPad("K^{+}: " + Cbm::NumberToString(KP, 1) + " /Ev", xMin, 0.53, xMax, 0.65);
1046 DrawTextOnPad("K^{-}: " + Cbm::NumberToString(KM, 1) + " /Ev", xMin, 0.66, xMax, 0.76);
1047 DrawTextOnPad("o.: " + Cbm::NumberToString(o, 1) + " /Ev", xMin, 0.77, xMax, 0.9);
1048}
1049
1051{
1052 DrawMomentum();
1055 DrawChi2();
1056
1057 // Connection between Misidentification and Mismatches
1058 {
1059 vector<string> xLabel = {"0", "1", "2", "3"};
1060 vector<string> yLabel = {"true-ID", "mis-ID"};
1061 fHMean.DrawAllGTracks(2, "hMatchId_gTracks", "hMatchId_gTracks", {xLabel}, {yLabel}, 1e-7, 1e3);
1062 }
1063
1064 // RICH: Ring-Track Distance
1065 fHMean.DrawAllGTracks(2, "hRichRingTrackDist/gTracks_all", "hRichRingTrackDist_gTracks", {""}, {""}, 1e-7,
1066 1e-2); // TODO: move this anywhere else?
1067 fHMean.DrawAllCandsAndSteps(2, "hRichRingTrackDist/", "hRichRingTrackDist_cands", {""}, {""}, 1e-7, 1e-2);
1068
1069 // ToF
1070 {
1071 double minXY = 1e-6;
1072 double maxXY = 1e-3;
1073 double minD = 3e-6;
1074 double maxD = 3e-1;
1075 for (const string& cat : {"trueid", "misid", "truematch", "mismatch"}) {
1076 fHMean.DrawAllGTracks(2, "ToF/HitTrackDist/HitPointDist_" + cat, "hTofHitTrackDist_gTracks_" + cat, {""}, {""},
1077 1e-9, 1.);
1078 fHMean.DrawAllGTracks(2, "ToF/HitXY/PointXY_" + cat, "hTofPointXY_" + cat, {""}, {""}, minXY, maxXY);
1079 fHMean.DrawAllGTracks(2, "ToF/HitXY/HitXY_" + cat, "hTofHitXY_" + cat, {""}, {""}, minXY, maxXY);
1080 fHMean.DrawAllGTracks(1, "ToF/HitXY/HitPointDist_" + cat, "hTofHitPointDist_" + cat, {""}, {""}, minD, maxD);
1081 }
1082 fHMean.DrawAllCands(2, "ToF/Time/HitTrackDist_cands", "hTofHitTrackDist_cands", {""}, {""}, 1e-9, 1.);
1083 fHMean.DrawAllCands(2, "ToF/Time/TimeVsMom_", "hTofTimeVsMom_cands", {""}, {""}, 1e-9, 1e-2);
1084 fHMean.DrawAllGTracks(2, "ToF/Time/IdAndMatch", "hTofM2Calc_gTracks", {""},
1085 {"true-ID", "mis-ID", "truematch", "mismatch"}, 1e-9, 10);
1086
1087 TCanvas* c1 = fHMean.fHM.CreateCanvas("ToF/HitXY/HitPointDist_all", "ToF/HitXY/HitPointDist_all", 2400, 2400);
1088 c1->Divide(4, 4);
1089 int iC = 1;
1090 for (size_t iP = 0; iP < fHMean.fGTrackNames.size(); iP++) {
1091 c1->cd(iC++);
1092 string hName = (iP <= 3) ? "hTofHitPointDist_trueid_" + fHMean.fGTrackNames[iP]
1093 : "hTofHitPointDist_misid_" + fHMean.fGTrackNames[iP];
1094 string text = (iP <= 3) ? "true-ID" : "mis-ID";
1095 TH1D* h = fHMean.H1Clone(hName);
1096 h->GetYaxis()->SetRangeUser(minD, maxD);
1097 h->Fit("gaus", "Q", "", 0., 2.);
1098 DrawH1(h, kLinear, kLog, "hist");
1099 DrawTextOnPad(text, 0.5, 0.7, 0.8, 0.9);
1100 DrawTextOnPad(fHMean.fGTrackLatex[iP], 0.25, 0.9, 0.75, 0.99);
1101 TF1* func = h->GetFunction("gaus");
1102 double mean = (func != nullptr) ? func->GetParameter("Mean") : 0.;
1103 DrawTextOnPad("mean: " + Cbm::NumberToString(mean, 2), 0.2, 0.65, 0.6, 0.89);
1104 }
1105 }
1106
1107 // draw chi2 of true-matched vs. mismatched
1108 for (const string& match : {"truematch", "mismatch"}) {
1109 for (const string& cat : {"all", "complete"}) {
1110 for (const string& det : {"rich", "trd", "tof"}) {
1111 string cName = "hChi2/" + match + "_" + det + "_" + cat;
1112 string hName = "hChi2_" + match + "_" + cat + "_" + det;
1113 fHMean.DrawAllGTracks(1, cName, hName, {""}, {""}, 2e-7, 10);
1114 }
1115 }
1116 }
1117
1118 // draw vertex of ToF-misidentifications
1119 {
1120 double min = 1e-7;
1121 for (auto step : fHMean.fAnaSteps) {
1122 string cName = "ToF/Vertex/tofMisid_" + fHMean.fAnaStepNames[static_cast<int>(step)];
1123 vector<TH2D*> xyz {fHMean.H2("hVertexXZ_misidTof", step), fHMean.H2("hVertexYZ_misidTof", step),
1124 fHMean.H2("hVertexXY_misidTof", step)};
1125
1126 TCanvas* c = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 1800, 600);
1127 c->Divide(3, 1);
1128 for (size_t i = 0; i < xyz.size(); i++) {
1129 c->cd(i + 1);
1130 DrawH2(xyz[i]);
1131 xyz[i]->SetMinimum(min);
1132 gPad->SetLogz(true);
1133 }
1134
1135 TCanvas* cZoom = fHMean.fHM.CreateCanvas((cName + "_zoom").c_str(), (cName + "_zoom").c_str(), 1800, 600);
1136 cZoom->Divide(3, 1);
1137 for (size_t i = 0; i < xyz.size(); i++) {
1138 TH2D* hZoom = (TH2D*) xyz[i]->Clone();
1139 cZoom->cd(i + 1);
1140 if (i == 2) {
1141 hZoom->GetXaxis()->SetRangeUser(-10., 10.);
1142 hZoom->GetYaxis()->SetRangeUser(-10., 10.);
1143 }
1144 else {
1145 hZoom->GetXaxis()->SetRangeUser(fZ - 1., fZ + 10.);
1146 hZoom->GetYaxis()->SetRangeUser(-10., 10.);
1147 }
1148 DrawH2(hZoom);
1149 hZoom->SetMinimum(min);
1150 gPad->SetLogz(true);
1151 }
1152
1153 fHMean.fHM.CreateCanvas((cName + "_RZ").c_str(), (cName + "_RZ").c_str(), 900, 900);
1154 TH2D* hRZ = fHMean.H2Clone("hVertexRZ_misidTof", step);
1155 hRZ->SetMinimum(min);
1156 DrawH2(hRZ, kLinear, kLinear, kLog);
1157 }
1158 }
1159
1160 // draw RICH/TRD/ToF index vs. STS index
1161 /*{
1162 for (const string& det : {"Rich", "Trd", "Tof"}) {
1163 string cName = "hIndex/" + det;
1164 string hName = "hIndexSts" + det;
1165 fHMean.DrawAllGTracks(2, cName, hName, {""}, {""}, 1e-7, 2e-3);
1166 }
1167 }*/
1168
1169 double minMism = 1e-4;
1170 double maxMism = 100.;
1171
1172 vector<string> xLabelDet = {"STS_{all}", "RICH_{all}", "RICH_{mis}", "TRD_{all}",
1173 "TRD_{mis}", "ToF_{all}", "ToF_{mis}"};
1174 fHMean.DrawAllGTracks(1, "Mismatches/hNofMismatches_all", "hNofMismatches_gTracks_all", xLabelDet, {""}, minMism,
1175 maxMism);
1176 fHMean.DrawAllGTracks(1, "Mismatches/hNofMismatches_complete", "hNofMismatches_gTracks_complete", xLabelDet, {""},
1177 minMism, maxMism);
1178
1179 vector<string> xLabelSeg = {"0", "1", "2", "3"};
1180 fHMean.DrawAllGTracks(1, "Mismatches/hNofMismatchedTrackSegments_all", "hNofMismatchedTrackSegments_all", xLabelSeg,
1181 {""}, minMism, maxMism);
1182 fHMean.DrawAllGTracks(1, "Mismatches/hNofMismatchedTrackSegments_complete", "hNofMismatchedTrackSegments_complete",
1183 xLabelSeg, {""}, minMism, maxMism);
1184}
1185
1187{
1188 double min = 1e-9;
1189 double max = 5e-3;
1190 for (const string det : {"sts", "rich", "trd", "tof"}) {
1191 fHMean.DrawAllCands(2, "hChi2/Detectors/hChi2VsMom_" + det, "hChi2VsMom_" + det, {""}, {""}, min, max);
1192 fHMean.DrawAllCands(2, "hChi2/Detectors/hTofTimeVsChi2_" + det, "hTofTimeVsChi2_" + det, {""}, {""}, min, max);
1193 }
1194
1195 for (const string det : {"StsRich", "StsTrd", "RichTrd"}) {
1196 fHMean.DrawAllCands(2, "hChi2/Detectors/hChi2Comb" + det, "hChi2Comb_" + det, {""}, {""}, min, max);
1197 }
1198}
1199
1201{
1202 for (const ELmvmAnaStep step : fHMean.fAnaSteps) {
1203 if (step < ELmvmAnaStep::ElId) continue;
1204 string cName = "Minv/" + fHMean.fAnaStepNames[static_cast<int>(step)];
1205 fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 1000, 1000);
1206 DrawMinv(step);
1208 }
1209}
1210
1212{
1213 TH1D* bg = fHMean.H1Clone("hMinv", ELmvmSrc::Bg, step);
1214 TH1D* pi0 = fHMean.H1Clone("hMinv", ELmvmSrc::Pi0, step);
1215 TH1D* eta = fHMean.H1Clone("hMinv", ELmvmSrc::Eta, step);
1216 TH1D* cocktail = GetCocktailMinvH1("hMinv", step);
1217 TH1D* sbg = static_cast<TH1D*>(bg->Clone());
1218 sbg->Add(cocktail);
1219 TH1D* cb = fHMean.H1Clone("hMinvCombBg", step);
1220 double binWidth = bg->GetBinWidth(1);
1221
1222 vector<TH1D*> sHists(fHMean.fNofSignals);
1223 for (ELmvmSignal signal : fHMean.fSignals) {
1224 TH1D* sHist = H(signal)->H1Clone("hMinv", ELmvmSrc::Signal, step);
1225 sHist->Scale(1. / H(signal)->H1("hEventNumber")->GetEntries());
1226 sHist->Rebin(fRebMinv);
1227 sHist->Scale(1. / binWidth);
1228 sHists[static_cast<int>(signal)] = sHist;
1229 }
1230
1231 vector<LmvmDrawMinvData> drawData;
1232 if (step != ELmvmAnaStep::Mc) {
1233 drawData.emplace_back(sbg, kBlack, kBlack, 1, -1, "Cocktail+BG");
1234 drawData.emplace_back(bg, kGray, kBlack, 1, 3001, "Background");
1235 }
1236
1237 drawData.emplace_back(pi0, kGreen - 3, kGreen + 3, 2, -1, "#pi^{0} #rightarrow #gammae^{+}e^{-}");
1238 drawData.emplace_back(eta, kRed - 4, kRed + 2, 2, -1, "#eta #rightarrow #gammae^{+}e^{-}");
1239 drawData.emplace_back(sHists[static_cast<int>(ELmvmSignal::OmegaD)], kCyan + 2, kCyan + 4, 2, -1,
1240 "#omega #rightarrow #pi^{0}e^{+}e^{-}");
1241 drawData.emplace_back(sHists[static_cast<int>(ELmvmSignal::Omega)], kOrange + 7, kOrange + 4, 2, -1,
1242 "#omega #rightarrow e^{+}e^{-}");
1243 drawData.emplace_back(sHists[static_cast<int>(ELmvmSignal::Phi)], kAzure + 2, kAzure + 3, 2, -1,
1244 "#phi #rightarrow e^{+}e^{-}");
1245 drawData.emplace_back(sHists[static_cast<int>(ELmvmSignal::Qgp)], kOrange - 2, kOrange - 3, 4, 3112, "QGP radiation");
1246 drawData.emplace_back(sHists[static_cast<int>(ELmvmSignal::Inmed)], kMagenta - 3, kMagenta - 2, 4, 3018,
1247 "in-medium #rho");
1248 drawData.emplace_back(cocktail, -1, kRed + 2, 4, -1, "Cocktail");
1249 drawData.emplace_back(cb, -1, kCyan + 2, 4, -1, "CB");
1250
1251 double min = std::numeric_limits<Double_t>::max();
1252 double max = std::numeric_limits<Double_t>::min();
1253 TH1D* h0 = nullptr;
1254 TLegend* leg = new TLegend(0.7, 0.57, 0.99, 0.97);
1255 for (size_t i = 0; i < drawData.size(); i++) {
1256 const auto& d = drawData[i];
1257 d.fH->GetYaxis()->SetLabelSize(0.05);
1258
1259 if (d.fFillColor != -1) d.fH->SetFillColor(d.fFillColor);
1260 if (d.fFillStyle != -1) d.fH->SetFillStyle(d.fFillStyle);
1261 leg->AddEntry(d.fH, d.fLegend.c_str(), "f");
1262 DrawH1(d.fH, kLinear, kLinear, (h0 == nullptr) ? "hist" : "hist,same", d.fLineColor, d.fLineWidth, 0);
1263 if (h0 == nullptr) h0 = d.fH;
1264 min = 1e-9;
1265 max = std::max(d.fH->GetMaximum(), max);
1266 }
1267 if (min == 0.) min = std::min(1e-4, max * 1e-7);
1268 if (h0 != nullptr) h0->SetMinimum(min);
1269 if (h0 != nullptr) h0->SetMaximum(1.1 * max);
1270
1271 leg->SetFillColor(kWhite);
1272 leg->Draw();
1273 gPad->SetLogy(true);
1274}
1275
1277{
1278 // draw ratio P_rec/P_MC
1279 {
1280 for (const string& cat : {"", "_zoom", "_zoom2"}) {
1281 string cName = "hMom/precisionReco/mom_ratioRecOverMc" + cat;
1282 TCanvas* c = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 1800, 1800);
1283 c->Divide(3, 3);
1284 int i = 1;
1285 for (auto step : fHMean.fAnaSteps) {
1286 if (step < ELmvmAnaStep::ElId) continue;
1287 vector<TH1*> hists;
1288 vector<string> legend;
1289 c->cd(i++);
1290 for (size_t iP = 0; iP < fHMean.fCandNames.size(); iP++) {
1291 TH1D* h = fHMean.H1Clone("hMomRatio_cands_" + fHMean.fCandNames[iP], step);
1292 if (cat == "_zoom") h->GetXaxis()->SetRangeUser(0.9, 1.1);
1293 if (cat == "_zoom2") h->GetXaxis()->SetRangeUser(7., 7.5);
1294 hists.push_back(h);
1295 legend.push_back((fHMean.fCandLatex[iP]).c_str());
1296 }
1297 DrawH1(hists, legend, kLinear, kLog, true, 0.8, 0.65, 0.99, 0.99, "hist");
1299 }
1300 }
1301 }
1302
1303 // draw ratio P_rec/P_MC vs P
1304 {
1306 double min = 0.5;
1307 double max = 1.5;
1308 TCanvas* c = fHMean.fHM.CreateCanvas("hMom/precisionReco/mom_ratioRecOverMcVsMom",
1309 "hMom/precisionReco/mom_ratioRecOverMcVsMom", 2700, 1800);
1310 c->Divide(4, 3);
1311 int i = 1;
1312 for (auto ptcl : fHMean.fCandNames) {
1313 int iL = i - 1;
1314 c->cd(i++);
1315 string hName = "hMomRatioVsMom_cands_" + ptcl;
1316 TH2D* h = fHMean.H2Clone(hName.c_str(), step);
1317 h->GetYaxis()->SetRangeUser(min, max);
1318 DrawH2(h, kLinear, kLinear, kLog, "colz");
1319 string text = fHMean.fCandLatex[iL] + ", " + fHMean.fAnaStepLatex[static_cast<int>(step)];
1320 DrawTextOnPad(text.c_str(), 0.25, 0.9, 0.75, 0.999);
1321 }
1322 }
1323}
1324
1326{
1327 // variable binning
1328 TH1D* h = fHMean.H1("hMinv", ELmvmSrc::Bg, ELmvmAnaStep::Mc); // template for values
1329 double ChangeValue = 1.2;
1330 int f = 2; // factor larger/smaller binsize
1331 int binChange = h->GetXaxis()->FindBin(ChangeValue);
1332 double bW = h->GetXaxis()->GetBinWidth(1);
1333 const int nBins = (int) binChange + (h->GetNbinsX() - binChange) / f;
1334 vector<double> binEdges(nBins + 1, 0.);
1335
1336 for (int iB = 1; iB <= nBins; iB++) {
1337 binEdges[iB] = (iB < binChange) ? binEdges[iB - 1] + bW : binEdges[iB - 1] + f * bW;
1338 }
1339 binEdges[nBins + 1] = h->GetBinCenter(h->GetNbinsX()) + bW / f;
1340
1341 int nofInmed = H(ELmvmSignal::Inmed)->H1("hEventNumber")->GetEntries();
1342 int nofQgp = H(ELmvmSignal::Qgp)->H1("hEventNumber")->GetEntries();
1343 int nofOmega = H(ELmvmSignal::Omega)->H1("hEventNumber")->GetEntries();
1344 int nofOmegaD = H(ELmvmSignal::OmegaD)->H1("hEventNumber")->GetEntries();
1345 int nofPhi = H(ELmvmSignal::Phi)->H1("hEventNumber")->GetEntries();
1346
1347 for (auto step : fHMean.fAnaSteps) {
1348 if (step < ELmvmAnaStep::ElId) continue;
1349 TH1D* h_npm = new TH1D("h_npm", "h_npm", nBins, binEdges.data());
1350 TH1D* h_bc = new TH1D("h_bc", "h_bc", nBins, binEdges.data());
1351 TH1D* h_coc = new TH1D("h_coc", "h_coc", nBins, binEdges.data());
1352 TH1D* h_eta = new TH1D("h_eta", "h_eta", nBins, binEdges.data());
1353 TH1D* h_pi0 = new TH1D("h_pi0", "h_pi0", nBins, binEdges.data());
1354 TH1D* h_inmed = new TH1D("h_inmed", "h_inmed", nBins, binEdges.data());
1355 TH1D* h_qgp = new TH1D("h_qgp", "h_qgp", nBins, binEdges.data());
1356 TH1D* h_omega = new TH1D("h_omega", "h_omega", nBins, binEdges.data());
1357 TH1D* h_omegaD = new TH1D("h_omegaD", "h_omegaD", nBins, binEdges.data());
1358 TH1D* h_phi = new TH1D("h_phi", "h_phi", nBins, binEdges.data());
1359
1360 TH1D* hInmed0 = H(ELmvmSignal::Inmed)->H1Clone("hMinv", ELmvmSrc::Signal, step);
1361 TH1D* hQgp0 = H(ELmvmSignal::Qgp)->H1Clone("hMinv", ELmvmSrc::Signal, step);
1362 TH1D* hOmega0 = H(ELmvmSignal::Omega)->H1Clone("hMinv", ELmvmSrc::Signal, step);
1363 TH1D* hOmegaD0 = H(ELmvmSignal::OmegaD)->H1Clone("hMinv", ELmvmSrc::Signal, step);
1364 TH1D* hPhi0 = H(ELmvmSignal::Phi)->H1Clone("hMinv", ELmvmSrc::Signal, step);
1365
1366 hInmed0->Rebin(fRebMinv);
1367 hQgp0->Rebin(fRebMinv);
1368 hOmega0->Rebin(fRebMinv);
1369 hOmegaD0->Rebin(fRebMinv);
1370 hPhi0->Rebin(fRebMinv);
1371
1372 hInmed0->Scale(1. / (nofInmed * bW));
1373 hQgp0->Scale(1. / (nofQgp * bW));
1374 hOmega0->Scale(1. / (nofOmega * bW));
1375 hOmegaD0->Scale(1. / (nofOmegaD * bW));
1376 hPhi0->Scale(1. / (nofPhi * bW));
1377
1378 for (int iB = 1; iB <= h->GetNbinsX(); iB++) {
1379 if (iB < binChange) {
1380 h_npm->SetBinContent(iB, fHMean.H1("hMinvCombPM_sameEv", step)->GetBinContent(iB));
1381 h_bc->SetBinContent(iB, fHMean.H1("hMinvCombBg", step)->GetBinContent(iB));
1382 h_coc->SetBinContent(iB, GetCocktailMinvH1("hMinv", step)->GetBinContent(iB));
1383 h_eta->SetBinContent(iB, fHMean.H1("hMinv", ELmvmSrc::Eta, step)->GetBinContent(iB));
1384 h_pi0->SetBinContent(iB, fHMean.H1("hMinv", ELmvmSrc::Pi0, step)->GetBinContent(iB));
1385 h_inmed->SetBinContent(iB, hInmed0->GetBinContent(iB));
1386 h_qgp->SetBinContent(iB, hQgp0->GetBinContent(iB));
1387 h_omega->SetBinContent(iB, hOmega0->GetBinContent(iB));
1388 h_omegaD->SetBinContent(iB, hOmegaD0->GetBinContent(iB));
1389 h_phi->SetBinContent(iB, hPhi0->GetBinContent(iB));
1390 }
1391 else {
1392 int iB2 = (int) binChange + (iB - binChange) / f;
1393 h_npm->SetBinContent(iB2,
1394 h_npm->GetBinContent(iB2) + fHMean.H1("hMinvCombPM_sameEv", step)->GetBinContent(iB) / f);
1395 h_bc->SetBinContent(iB2, h_bc->GetBinContent(iB2) + fHMean.H1("hMinvCombBg", step)->GetBinContent(iB) / f);
1396 h_coc->SetBinContent(iB2, h_coc->GetBinContent(iB2) + GetCocktailMinvH1("hMinv", step)->GetBinContent(iB) / f);
1397 h_eta->SetBinContent(iB2, h_eta->GetBinContent(iB2)
1398 + fHMean.H1("hMinv", ELmvmSrc::Eta, step)->GetBinContent(iB) / f);
1399 h_pi0->SetBinContent(iB2, h_pi0->GetBinContent(iB2)
1400 + fHMean.H1("hMinv", ELmvmSrc::Pi0, step)->GetBinContent(iB) / f);
1401 h_inmed->SetBinContent(iB2, h_inmed->GetBinContent(iB2) + hInmed0->GetBinContent(iB) / f);
1402 h_qgp->SetBinContent(iB2, h_qgp->GetBinContent(iB2) + hQgp0->GetBinContent(iB) / f);
1403 h_omega->SetBinContent(iB2, h_omega->GetBinContent(iB2) + hOmega0->GetBinContent(iB) / f);
1404 h_omegaD->SetBinContent(iB2, h_omegaD->GetBinContent(iB2) + hOmegaD0->GetBinContent(iB) / f);
1405 h_phi->SetBinContent(iB2, h_phi->GetBinContent(iB2) + hPhi0->GetBinContent(iB) / f);
1406 }
1407 }
1408
1409 // set errors
1410 int nEv = GetNofTotalEvents();
1411 for (int iB = 1; iB <= h_npm->GetNbinsX(); iB++) {
1412 double bW2 = h_npm->GetBinLowEdge(iB + 1) - h_npm->GetBinLowEdge(iB);
1413 //cout << "iB = " << iB << " | bW2 = " << bW2 << endl;
1414 h_npm->SetBinError(iB, std::sqrt(h_npm->GetBinContent(iB) * bW2 * nEv) / (bW2 * nEv));
1415 h_bc->SetBinError(iB, std::sqrt(h_bc->GetBinContent(iB) * bW2 * nEv) / (bW2 * nEv));
1416 }
1417
1418 TH1D* h_sum = (TH1D*) h_eta->Clone();
1419 h_sum->Add(h_pi0);
1420 h_sum->Add(h_inmed);
1421 h_sum->Add(h_qgp);
1422 h_sum->Add(h_omega);
1423 h_sum->Add(h_omegaD);
1424 h_sum->Add(h_phi);
1425
1426 TH1D* h_sum2 = (TH1D*) h_sum->Clone();
1427
1428 fHMean.SetOptH1(h_npm, "#font[52]{M}_{ee} [GeV/#font[52]{c}^{2}]",
1429 "1/N_{ev} dN/d#font[52]{M}_{ee} [GeV/#font[52]{c}^{2}]^{-1}", 510, 21, 1.3, kPink, "marker");
1430 fHMean.SetOptH1(h_bc, "#font[52]{M}_{ee} [GeV/#font[52]{c}^{2}]",
1431 "1/N_{ev} dN/d#font[52]{M}_{ee} [GeV/#font[52]{c}^{2}]^{-1}", 510, 22, 1.3, kBlue - 2, "marker");
1432 fHMean.SetOptH1(h_sum, "#font[52]{M}_{ee} [GeV/#font[52]{c}^{2}]",
1433 "1/N_{ev} dN/d#font[52]{M}_{ee} [GeV/#font[52]{c}^{2}]^{-1}", 510, 20, 1.1, kBlack, "marker");
1434
1435 fHMean.SetOptH1(h_sum2, "", "", 510, 1, 1, kBlack, "line");
1436 fHMean.SetOptH1(h_eta, "", "", 510, 1, 1, kBlue + 2, "line");
1437 fHMean.SetOptH1(h_pi0, "", "", 510, 1, 1, kAzure - 4, "line");
1438 fHMean.SetOptH1(h_inmed, "", "", 510, 1, 1, kPink, "line");
1439 fHMean.SetOptH1(h_qgp, "", "", 510, 1, 1, kOrange, "line");
1440 fHMean.SetOptH1(h_omega, "", "", 510, 1, 1, kGreen + 1, "line");
1441 fHMean.SetOptH1(h_omegaD, "", "", 510, 1, 1, kGreen + 3, "line");
1442 fHMean.SetOptH1(h_phi, "", "", 510, 1, 1, kMagenta + 2, "line");
1443
1444 //h_npm->GetXaxis()->SetRangeUser(0.,2.);
1445 h_npm->GetYaxis()->SetRangeUser(1e-9, 10);
1446
1447 string cName = "MinvOfficialStyle/minv_" + fHMean.fAnaStepNames[static_cast<int>(step)];
1448 TCanvas* can = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 900, 918);
1449 fHMean.SetOptCanvas(can);
1450 can->SetLogy();
1451 can->cd();
1452
1453 h_npm->Draw("peist");
1454 h_bc->Draw("peistsame");
1455 h_sum->Draw("phistsame");
1456
1457 h_sum2->Draw("histsame");
1458 h_eta->Draw("histsame");
1459 h_pi0->Draw("histsame");
1460 h_inmed->Draw("histsame");
1461 h_qgp->Draw("histsame");
1462 h_omega->Draw("histsame");
1463 h_omegaD->Draw("histsame");
1464 h_phi->Draw("histsame");
1465
1466 vector<LmvmLegend> legend3;
1467 legend3.emplace_back(h_npm, "N^{#pm}_{same}", "p");
1468 legend3.emplace_back(h_bc, "CB_{calc}", "p");
1469 legend3.emplace_back(h_sum, "MC Cocktail", "p");
1470
1471 vector<LmvmLegend> legend8;
1472 legend8.emplace_back(h_sum2, "MC Cocktail", "l");
1473 legend8.emplace_back(h_eta, "#eta#rightarrow#gammae^{+}e^{-}", "l");
1474 legend8.emplace_back(h_pi0, "#pi^{0}#rightarrow#gammae^{+}e^{-}", "l");
1475 legend8.emplace_back(h_omegaD, "#omega#rightarrow#pi^{0}e^{+}e^{-}", "l");
1476 legend8.emplace_back(h_omega, "#omega#rightarrowe^{+}e^{-}", "l");
1477 legend8.emplace_back(h_phi, "#phi#rightarrowe^{+}e^{-}", "l");
1478 legend8.emplace_back(h_inmed, "Rapp in-medium SF", "l");
1479 legend8.emplace_back(h_qgp, "Rapp QGP", "l");
1480
1481 fHMean.SetLegend(legend3, 0.035, 0.37, 0.64, 0.57, 0.77);
1482 fHMean.SetLegend(legend8, 0.025, 0.66, 0.57, 0.82, 0.87);
1483
1484 TLatex* tex = new TLatex(0.15, 2.5, "CBM Simulations");
1485 tex->SetTextColor(1); //kAzure+6);
1486 tex->SetTextSize(0.035);
1487 tex->SetTextFont(42);
1488 tex->Draw();
1489 TLatex* tex2 = new TLatex(0.15, 0.7, "0 fm Au+Au, #sqrt{s_{NN}}=4.1 GeV");
1490 tex2->SetTextColor(1); //kAzure+6);
1491 tex2->SetTextSize(0.035);
1492 tex2->SetTextFont(42);
1493 tex2->Draw();
1494
1495 /*delete h_npm;
1496 delete h_bc;
1497 delete h_coc;
1498 delete h_eta;
1499 delete h_pi0;
1500 delete h_inmed;
1501 delete h_qgp;
1502 delete h_omega;
1503 delete h_omegaD;
1504 delete h_phi;
1505 delete h_sum;
1506 delete h_sum2;*/
1507 } // steps
1508}
1509
1511{
1512 TH1D* gg = fHMean.H1Clone("hMinvBgSource2_elid_gg");
1513 TH1D* pipi = fHMean.H1Clone("hMinvBgSource2_elid_pipi");
1514 TH1D* pi0pi0 = fHMean.H1Clone("hMinvBgSource2_elid_pi0pi0");
1515 TH1D* oo = fHMean.H1Clone("hMinvBgSource2_elid_oo");
1516 TH1D* gpi = fHMean.H1Clone("hMinvBgSource2_elid_gpi");
1517 TH1D* gpi0 = fHMean.H1Clone("hMinvBgSource2_elid_gpi0");
1518 TH1D* go = fHMean.H1Clone("hMinvBgSource2_elid_go");
1519 TH1D* pipi0 = fHMean.H1Clone("hMinvBgSource2_elid_pipi0");
1520 TH1D* pio = fHMean.H1Clone("hMinvBgSource2_elid_pio");
1521 TH1D* pi0o = fHMean.H1Clone("hMinvBgSource2_elid_pi0o");
1522
1523 TH1D* physBg = fHMean.H1Clone("hMinvBgSource2_elid_gg");
1524 physBg->Add(fHMean.H1("hMinvBgSource2_elid_gpi0"));
1525 physBg->Add(fHMean.H1("hMinvBgSource2_elid_pi0pi0"));
1526
1527 TH1D* cPi = fHMean.H1Clone("hMinvBgSource2_elid_pipi");
1528 cPi->Add(fHMean.H1Clone("hMinvBgSource2_elid_gpi"));
1529 cPi->Add(fHMean.H1Clone("hMinvBgSource2_elid_pipi0"));
1530 cPi->Add(fHMean.H1Clone("hMinvBgSource2_elid_pio"));
1531
1532 TH1D* rest = fHMean.H1Clone("hMinvBgSource2_elid_oo");
1533 rest->Add(fHMean.H1Clone("hMinvBgSource2_elid_go"));
1534 rest->Add(fHMean.H1Clone("hMinvBgSource2_elid_pi0o"));
1535
1536
1537 //physBg->SetMinimum(1e-6);
1538 //physBg->SetMaximum(1e-2);
1539
1540 vector<LmvmDrawMinvData> drawData;
1541
1542 drawData.emplace_back(gpi0, kBlack, kBlack, 1, -1, "#gamma - #pi^{0}");
1543 drawData.emplace_back(pi0pi0, kGray + 1, kGray + 1, 1, -1, "#pi^{0} - #pi^{0}");
1544 drawData.emplace_back(gg, kCyan + 2, kCyan + 4, 2, -1, "#gamma - #gamma");
1545 drawData.emplace_back(pipi0, kGreen - 3, kGreen + 3, 2, -1, "#pi^{#pm}_{misid} - #pi^{0}");
1546 drawData.emplace_back(pi0o, kRed - 4, kRed + 2, 1, -1, "#pi^{0} - o.");
1547 drawData.emplace_back(gpi, kOrange + 7, kOrange + 4, 2, -1, "#gamma - #pi^{#pm}_{misid}");
1548 drawData.emplace_back(go, kAzure + 2, kAzure + 3, 2, -1, "#gamma - o.");
1549 drawData.emplace_back(pipi, kOrange - 2, kOrange - 3, 4, 3112, "#pi^{#pm}_{misid} - #pi^{#pm}_{misid}");
1550 drawData.emplace_back(pio, kMagenta - 3, kMagenta - 2, 4, 3018, "#pi^{#pm}_{misid} - o.");
1551 drawData.emplace_back(oo, -1, kRed + 2, 4, -1, "o. - o.");
1552
1553 string cName = "minvBgSrc/minvBgSrc";
1554 fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 1000, 1000);
1555
1556 TH1D* h0 = nullptr;
1557 TLegend* leg = new TLegend(0.65, 0.55, 0.95, 0.95);
1558 for (size_t i = 0; i < drawData.size(); i++) {
1559 const auto& d = drawData[i];
1560 d.fH->GetYaxis()->SetLabelSize(0.05);
1561
1562 if (d.fFillColor != -1) d.fH->SetFillColor(d.fFillColor);
1563 if (d.fFillStyle != -1) d.fH->SetFillStyle(d.fFillStyle);
1564 leg->AddEntry(d.fH, d.fLegend.c_str(), "f");
1565 DrawH1(d.fH, kLinear, kLinear, (h0 == nullptr) ? "hist" : "hist,same", d.fLineColor, d.fLineWidth, 0);
1566 if (h0 == nullptr) h0 = d.fH;
1567 }
1568
1569 leg->SetFillColor(kWhite);
1570 leg->Draw();
1571 gPad->SetLogy(true);
1572
1573 fHMean.fHM.CreateCanvas((cName + "_misidPi").c_str(), (cName + "_misidPi").c_str(), 1000, 1000);
1574 DrawH1({physBg, cPi, rest}, {"Phys. BG", "BG w. misid. #pi^{#pm}", "Rest"}, kLinear, kLog, true, 0.7, 0.8, 0.95, 0.91,
1575 "p");
1576
1577
1578 //check if all bg pair combinations are considered
1579 TH1D* bgRat = static_cast<TH1D*>(physBg->Clone());
1580 bgRat->Add(cPi);
1581 bgRat->Add(rest);
1582
1583 int nBins = bgRat->GetNbinsX();
1584 for (int i = 1; i <= nBins; i++) {
1585 if (fHMean.H1("hMinv", ELmvmSrc::Bg, ELmvmAnaStep::ElId)->GetBinContent(i) == 0) bgRat->SetBinContent(i, 2);
1586 else {
1587 double r = bgRat->GetBinContent(i) / fHMean.H1("hMinv", ELmvmSrc::Bg, ELmvmAnaStep::ElId)->GetBinContent(i);
1588 bgRat->SetBinContent(i, r);
1589 }
1590 }
1591
1592 bgRat->SetMinimum(0.9);
1593 bgRat->SetMaximum(2.1);
1594
1595 fHMean.fHM.CreateCanvas((cName + "_compWithBg").c_str(), (cName + "_compWithBg").c_str(), 800, 800);
1596 DrawH1(bgRat, kLinear, kLinear, "hist");
1597}
1598
1600{
1601 for (const ELmvmAnaStep step : fHMean.fAnaSteps) {
1602 string name = fHMean.GetName("minvPt/lmvmAll_minvPt", step);
1603 fHMean.fHM.CreateCanvas(name.c_str(), name.c_str(), 1000, 1000);
1604 DrawH2(GetCocktailMinv<TH2D>("hMinvPt", step), kLinear, kLinear, kLog, "colz");
1605 }
1606}
1607
1609{
1610 string folder = "CombinatorialBackground/";
1611 string folderUAll = folder + "UrQMD/All/";
1612 string folderUEl = folder + "UrQMD/Electrons/";
1613
1614 // Draw PM, MM, PP in one plot
1615 {
1616 for (const string& cat : {"", "_urqmdEl", "_urqmdAll"}) {
1617 for (const string& ev : {"sameEv", "mixedEv"}) {
1618 string cName = (cat == "_urqmdAll") ? folderUAll + "PairYields_" + ev
1619 : (cat == "_urqmdEl") ? folderUEl + "PairYields_" + ev
1620 : folder + "PairYields_" + ev;
1621 TCanvas* c = fHMean.fHM.CreateCanvas(cName.c_str(), cName.c_str(), 1800, 1800);
1622 c->Divide(3, 3);
1623 int i = 1;
1624 for (auto step : fHMean.fAnaSteps) {
1625 if (step < ELmvmAnaStep::ElId) continue;
1626 c->cd(i++);
1627 TH1D* pp = fHMean.H1Clone("hMinvCombPP" + cat + "_" + ev, step);
1628 TH1D* mm = fHMean.H1Clone("hMinvCombMM" + cat + "_" + ev, step);
1629 TH1D* pm = fHMean.H1Clone("hMinvCombPM" + cat + "_" + ev, step);
1630 pm->GetYaxis()->SetTitle("Yield");
1631 if (ev == "sameEv") pm->GetYaxis()->SetRangeUser(1e-6, 2e-2);
1632 DrawH1({pm, pp, mm}, {"e+e-", "e+e+", "e-e-"}, kLinear, kLog, true, 0.85, 0.7, 0.99, 0.99, "HIST");
1634 }
1635 }
1636 }
1637 }
1638
1639 // draw MM/PP ratio for same events
1640 {
1641 for (const string& cat : {"", "_urqmdEl"}) {
1642 string cName = (cat == "_urqmdEl") ? folderUEl : folder;
1643 TCanvas* c = fHMean.fHM.CreateCanvas(cName + "RatioMMPP_same", cName + "RatioMMPP_same", 1800, 1800);
1644 c->Divide(3, 3);
1645 int i = 1;
1646 for (auto step : fHMean.fAnaSteps) {
1647 if (step < ELmvmAnaStep::ElId) continue;
1648 c->cd(i++);
1649 TH1D* pp = fHMean.H1Clone("hMinvCombPP" + cat + "_sameEv", step);
1650 TH1D* mm = fHMean.H1Clone("hMinvCombMM" + cat + "_sameEv", step);
1651 mm->Divide(pp);
1652 mm->GetYaxis()->SetTitle("Ratio e^{-}e^{-}/e^{+}e^{+}");
1653 DrawH1(mm, kLinear, kLinear, "hist");
1655 }
1656 }
1657 }
1658
1659 //Draw Geometric Mean for same and mixed (mixed normalized)
1660 {
1661 for (const string& cat : {"", "_urqmdEl", "_urqmdAll"}) {
1662 string cName = (cat == "_urqmdAll") ? folderUAll : (cat == "_urqmdEl") ? folderUEl : folder;
1663 TCanvas* c = fHMean.fHM.CreateCanvas(cName + "geomMean", cName + "geomMean", 1800, 1800);
1664 c->Divide(3, 3);
1665 int i = 1;
1666 for (auto step : fHMean.fAnaSteps) {
1667 if (step < ELmvmAnaStep::ElId) continue;
1668 c->cd(i++);
1669 TH1D* same = fHMean.H1Clone("hMinvCombGeom" + cat + "_sameEv", step);
1670 TH1D* mixed = fHMean.H1Clone("hMinvCombGeom" + cat + "_mixedEv", step);
1671 int minBin = same->FindBin(0.4);
1672 int maxBin = same->FindBin(0.7);
1673 double scale = same->Integral(minBin, maxBin) / mixed->Integral(minBin, maxBin);
1674 mixed->Scale(scale);
1675 same->GetXaxis()->SetTitle("M_{ee} [GeV/c^{2}]");
1676 same->SetMinimum(1e-8);
1677 mixed->SetMinimum(1e-8);
1678 DrawH1({same, mixed}, {"geom. mean (same)", "geom. mean (mixed)"}, kLinear, kLog, true, 0.52, 0.8, 0.99, 0.99,
1679 "p");
1681 }
1682 }
1683 }
1684
1685 // Draw k factor
1686 { // draw all three k factors in one histo // TODO: keep this or next method or both?
1688 fHMean.fHM.CreateCanvas(folder + "k_all", folder + "k_all", 1800, 1800);
1689 TH1D* kAll = fHMean.H1Clone("hMinvCombK", step);
1690 TH1D* kUAll = fHMean.H1Clone("hMinvCombK_urqmdAll", step);
1691 TH1D* kUEl = fHMean.H1Clone("hMinvCombK_urqmdEl", step);
1692 DrawH1({kAll, kUAll, kUEl}, {"k (all)", "k (UrQMD all)", "k (UrQMD El"}, kLinear, kLinear, true, 0.65, 0.8, 0.99,
1693 0.95, "p");
1694 kAll->GetYaxis()->SetTitle("k Factor");
1695 kAll->GetYaxis()->SetRangeUser(0.8, 1.2);
1697 }
1698
1699 // Compare N+-, BG+Coc, BG and CB after ElID step
1700 {
1702
1703 for (const string& cat : {"", "_urqmdEl", "_urqmdAll"}) {
1704 string cName = (cat == "_urqmdAll") ? folderUAll : (cat == "_urqmdEl") ? folderUEl : folder;
1705 TCanvas* c = fHMean.fHM.CreateCanvas(cName + "N+-VsBgCoc", cName + "N+-VsBgCoc", 1800, 900);
1706 c->Divide(2, 1);
1707 TH1D* npm = fHMean.H1Clone("hMinvCombPM" + cat + "_sameEv", step);
1708 TH1D* cb = fHMean.H1Clone("hMinvCombBg" + cat, step);
1709 TH1D* bg = fHMean.H1Clone("hMinv" + cat, ELmvmSrc::Bg, step);
1710 TH1D* cocktail = GetCocktailMinvH1("hMinv" + cat, step);
1711 TH1D* sbg = static_cast<TH1D*>(bg->Clone());
1712 sbg->Add(cocktail);
1713 TH1D* ratS = (TH1D*) npm->Clone();
1714 ratS->Divide(sbg);
1715 TH1D* ratB = (TH1D*) cb->Clone();
1716 ratB->Divide(bg);
1717 c->cd(1);
1718 npm->GetYaxis()->SetRangeUser(1e-6, 2e-2);
1719 DrawH1({npm, sbg, cb, bg}, {"N^{+-}_{same}", "BG + Cocktail", "CB_{calc}", "Background"}, kLinear, kLog, true,
1720 0.7, 0.7, 0.99, 0.95, "p");
1722 c->cd(2);
1723 ratS->GetYaxis()->SetTitle("Ratio");
1724 ratS->GetYaxis()->SetRangeUser(0., 2.);
1725 ratB->GetYaxis()->SetRangeUser(0., 2.);
1726 DrawH1({ratS, ratB}, {"N^{+-}_{same} / BG+Coc", "CB_{calc} / BG"}, kLinear, kLinear, true, 0.7, 0.8, 0.99, 0.95,
1727 "p");
1728 }
1729 }
1730
1731 // Draw Ratios N+-/CocBg and CB/BG for all three categories
1732 {
1734
1735 TH1D* rsAll = fHMean.H1Clone("hMinvCombPM_sameEv", step);
1736 TH1D* rsUAll = fHMean.H1Clone("hMinvCombPM_urqmdAll_sameEv", step);
1737 TH1D* rsUEl = fHMean.H1Clone("hMinvCombPM_urqmdEl_sameEv", step);
1738
1739 TH1D* cbgAll = GetCocktailMinvH1("hMinv", step);
1740 cbgAll->Add(fHMean.H1("hMinv", ELmvmSrc::Bg, step));
1741 TH1D* cbgUAll = GetCocktailMinvH1("hMinv_urqmdAll", step);
1742 cbgUAll->Add(fHMean.H1("hMinv_urqmdAll", ELmvmSrc::Bg, step));
1743 TH1D* cbgUEl = GetCocktailMinvH1("hMinv_urqmdEl", step);
1744 cbgUEl->Add(fHMean.H1("hMinv_urqmdEl", ELmvmSrc::Bg, step));
1745
1746 rsAll->Divide(cbgAll);
1747 rsUAll->Divide(cbgUAll);
1748 rsUEl->Divide(cbgUEl);
1749
1750 TH1D* rbAll = fHMean.H1Clone("hMinvCombBg", step);
1751 TH1D* rbUAll = fHMean.H1Clone("hMinvCombBg_urqmdAll", step);
1752 TH1D* rbUEl = fHMean.H1Clone("hMinvCombBg_urqmdEl", step);
1753
1754 rbAll->Divide(fHMean.H1("hMinv", ELmvmSrc::Bg, step));
1755 rbUAll->Divide(fHMean.H1("hMinv_urqmdAll", ELmvmSrc::Bg, step));
1756 rbUEl->Divide(fHMean.H1("hMinv_urqmdEl", ELmvmSrc::Bg, step));
1757
1758 rsAll->GetYaxis()->SetTitle("N^{+-}_{same} / BG+Coc");
1759 rsAll->GetYaxis()->SetRangeUser(0., 2.);
1760 rbAll->GetYaxis()->SetTitle("CB_{calc} / BG");
1761 rbAll->GetYaxis()->SetRangeUser(0., 2.);
1762
1763 TCanvas* c = fHMean.fHM.CreateCanvas(folder + "CbVsMc_ratio", folder + "CbVsMc_ratio", 1800, 900);
1764 c->Divide(2, 1);
1765 c->cd(1);
1766 DrawH1({rsAll, rsUAll, rsUEl}, {"UrQMD + PLUTO", "UrQMD", "UrQMD electrons"}, kLinear, kLinear, true, 0.55, 0.78,
1767 0.99, 0.95, "hist");
1769 c->cd(2);
1770 DrawH1({rbAll, rbUAll, rbUEl}, {"UrQMD + PLUTO", "UrQMD", "UrQMD electrons"}, kLinear, kLinear, true, 0.55, 0.78,
1771 0.99, 0.95, "hist");
1773 }
1774
1775 // Draw common CB vs. CB from pure UrQMD electrons
1776 {
1777 TCanvas* c = fHMean.fHM.CreateCanvas(folder + "CbVsUrqmdCb", folder + "CbVsUrqmdCb", 1800, 1800);
1778 c->Divide(3, 3);
1779 int i = 1;
1780 for (auto step : fHMean.fAnaSteps) {
1781 if (step < ELmvmAnaStep::ElId) continue;
1782 c->cd(i++);
1783 TH1D* cb = fHMean.H1Clone("hMinvCombBg", step);
1784 TH1D* cbU = fHMean.H1Clone("hMinvCombBg_urqmdEl", step);
1785 DrawH1({cb, cbU}, {"B_{C}", "B_{C} from UrQMD electrons"}, kLinear, kLog, true, 0.55, 0.8, 0.99, 0.95);
1787 }
1788 }
1789
1790 //Draw Combinatorial Signal with N+-same, CB, Cocktail
1791 {
1792 for (const string& cat : {"", "_urqmdEl", "_urqmdAll"}) {
1793 string cName = (cat == "_urqmdEl") ? folderUEl : (cat == "_urqmdAll") ? folderUAll : folder;
1794 TCanvas* c = fHMean.fHM.CreateCanvas(cName + "CbVsInput_Npm", cName + "CbVsInput_Npm", 1800, 1800);
1795 c->Divide(3, 3);
1796 int i = 1;
1797 for (auto step : fHMean.fAnaSteps) {
1798 if (step < ELmvmAnaStep::ElId) continue;
1799 c->cd(i++);
1800 TH1D* pmSame = fHMean.H1Clone("hMinvCombPM" + cat + "_sameEv", step);
1801 TH1D* combBg = fHMean.H1Clone("hMinvCombBg" + cat, step);
1802 TH1D* combSignalNpm = fHMean.H1Clone("hMinvCombSignalNpm" + cat, step);
1803 TH1D* cocktail = GetCocktailMinvH1("hMinv" + cat, step);
1804 pmSame->SetMaximum(1e-2);
1805 pmSame->SetMinimum(4e-9);
1806 DrawH1({pmSame, combBg, combSignalNpm, cocktail},
1807 {"N_{same}^{+-}", "B_{c}", "Signal (N_{same}^{+-} - B_{c})", "Cocktail"}, kLinear, kLog, true, 0.53,
1808 0.75, 0.99, 0.92, "p");
1810 }
1811 }
1812 }
1813
1814 //Draw Combinatorial Signal from Cocktail+BG
1815 {
1816 for (const string& cat : {"", "_urqmdEl", "_urqmdAll"}) {
1817 string cName = (cat == "_urqmdEl") ? folderUEl : (cat == "_urqmdAll") ? folderUAll : folder;
1818 TCanvas* c = fHMean.fHM.CreateCanvas(cName + "CbVsInput_cocBg", cName + "CbVsInput_cocBg", 1800, 1800);
1819 c->Divide(3, 3);
1820 int i = 1;
1821 for (auto step : fHMean.fAnaSteps) {
1822 if (step < ELmvmAnaStep::ElId) continue;
1823 c->cd(i++);
1824 TH1D* sbg2 = fHMean.H1Clone("hMinv" + cat, ELmvmSrc::Bg, step);
1825 sbg2->Add(GetCocktailMinvH1("hMinv" + cat, step));
1826 TH1D* combBg = fHMean.H1Clone("hMinvCombBg" + cat, step);
1827 TH1D* sBgSignal = fHMean.H1Clone("hMinvCombSignalMc" + cat, step);
1828 sbg2->SetMaximum(2e-2);
1829 sbg2->SetMinimum(4e-9);
1830 TH1D* cocktail = GetCocktailMinvH1("hMinv" + cat, step);
1831 DrawH1({sbg2, combBg, sBgSignal, cocktail}, {"Cocktail + BG", "B_{C}", "Signal (Cock+BG - B_{C})", "Cocktail"},
1832 kLinear, kLog, true, 0.53, 0.72, 0.99, 0.92, "p");
1834 }
1835 }
1836 }
1837}
1838
1840{
1841 vector<TH1*> hists;
1843 TH1D* bg = fHMean.H1Clone("hMinv", ELmvmSrc::Bg, step);
1844 TH1D* cocktail = GetCocktailMinvH1("hMinv", step);
1845 TH1D* cocktailOverBg = fHMean.CreateHByClone<TH1D>("hMinv_bg", "hMinvCocktailOverBg", step);
1846 cocktailOverBg->GetYaxis()->SetTitle("Cocktail/Background");
1847 cocktailOverBg->Divide(cocktail, bg, 1., 1., "B");
1848 hists.push_back(cocktailOverBg);
1849 }
1850
1851 fHMean.fHM.CreateCanvas("lmvmAll_minvCocktailOverBg", "lmvmAll_minvCocktailOverBg", 1000, 1000);
1852 DrawH1(hists, {"Without Pt cut", "With Pt cut"}, kLinear, kLog, true, 0.6, 0.85, 0.99, 0.99, "hist");
1853}
1854
1856{
1857 if (fOutputDir != "") {
1858 gSystem->mkdir(fOutputDir.c_str(), true);
1859 TFile* f = TFile::Open(string(fOutputDir + "/draw_all_hist.root").c_str(), "RECREATE");
1861 f->Close();
1862 }
1863}
1864
1866{
1867 for (ELmvmAnaStep step : fHMean.fAnaSteps) {
1868 for (const string& cat : {"", "_urqmdEl", "_urqmdAll"}) { // common CB or from pure UrQMD (all or electrons)
1869 if (step < ELmvmAnaStep::ElId) continue;
1870
1871 // Geometric mean
1872 for (const string& ev : {"_sameEv", "_mixedEv"}) {
1873 TH1D* pp = fHMean.H1Clone("hMinvCombPP" + cat + ev, step);
1874 TH1D* mm = fHMean.H1Clone("hMinvCombMM" + cat + ev, step);
1875 TH1D* geom = fHMean.CreateHByClone<TH1D>("hMinvCombMM" + cat + ev, "hMinvCombGeom" + cat + ev, step);
1876
1877 for (int i = 1; i <= geom->GetNbinsX(); i++) {
1878 double cpp = pp->GetBinContent(i);
1879 double cmm = mm->GetBinContent(i);
1880 double content = std::sqrt(cpp * cmm);
1881 geom->SetBinContent(i, content);
1882 }
1883 }
1884
1885 // calculate k factor
1886 TH1D* k = fHMean.CreateHByClone<TH1D>("hMinvCombPM" + cat + "_mixedEv", "hMinvCombK" + cat, step);
1887 k->Divide(fHMean.H1("hMinvCombGeom" + cat + "_mixedEv", step));
1888 k->Scale(0.5);
1889
1890 // calculate combinatorial BG from same (<= 0.3 GeV) and mixed (> 0.3 GeV) events data
1891 // at first, calculate norm. factor between same and mixed events in 300 - 1000 MeV/c2 interval
1892 TH1D* hGeomSame = fHMean.H1("hMinvCombGeom" + cat + "_sameEv", step);
1893 TH1D* hGeomMixed = fHMean.H1("hMinvCombGeom" + cat + "_mixedEv", step);
1894 int minBin = hGeomSame->FindBin(0.3);
1895 int maxBin = hGeomSame->FindBin(1.0);
1896 double normGM = hGeomSame->Integral(minBin, maxBin) / hGeomMixed->Integral(minBin, maxBin);
1897
1898 // combinatorial BG
1899 TH1D* hBc = fHMean.CreateHByClone<TH1D>("hMinvCombGeom" + cat + "_sameEv", "hMinvCombBg" + cat, step);
1900 for (int i = 0; i <= hBc->GetNbinsX(); i++) {
1901 double val = (i <= minBin) ? 2 * fHMean.H1("hMinvCombK" + cat, step)->GetBinContent(i)
1902 * fHMean.H1("hMinvCombGeom" + cat + "_sameEv", step)->GetBinContent(i)
1903 : normGM * fHMean.H1("hMinvCombPM" + cat + "_mixedEv", step)->GetBinContent(i);
1904 hBc->SetBinContent(i, val);
1905 }
1906
1907 // calculate signal from CB subtraction
1908 // from 'N+-same': Signal = N+-same - B_{C}
1909 TH1D* hSigNpm = fHMean.CreateHByClone<TH1D>("hMinvCombPM" + cat + "_sameEv", "hMinvCombSignalNpm" + cat, step);
1910 hSigNpm->Add(fHMean.H1("hMinvCombBg" + cat, step), -1.);
1911
1912 // from MC 'Cocktail + BG': Signal = Coc+BG - B_{C}
1913 TH1D* hSigCoc = fHMean.CreateHByClone<TH1D>("hMinv" + cat + "_bg", "hMinvCombSignalMc" + cat, step);
1914 hSigCoc->Add(GetCocktailMinvH1("hMinv" + cat, step));
1915 hSigCoc->Add(fHMean.H1("hMinvCombBg" + cat, step), -1.);
1916
1917 // calculate errors via error propagation formula
1918 int nofEvents = GetNofTotalEvents();
1919 double bW = fHMean.H1("hMinvCombPM" + cat + "_sameEv", step)->GetBinWidth(1);
1920 int nofBins = fHMean.H1("hMinvCombPM" + cat + "_sameEv", step)->GetNbinsX();
1921 for (int i = 1; i <= nofBins; i++) {
1922 //s_ for same, m_ for mixed
1923 double s_pm = fHMean.H1("hMinvCombPM" + cat + "_sameEv", step)->GetBinContent(i) * nofEvents * bW;
1924 double s_pp = fHMean.H1("hMinvCombPP" + cat + "_sameEv", step)->GetBinContent(i) * nofEvents * bW;
1925 double s_mm = fHMean.H1("hMinvCombMM" + cat + "_sameEv", step)->GetBinContent(i) * nofEvents * bW;
1926 double m_pm = fHMean.H1("hMinvCombPM" + cat + "_mixedEv", step)->GetBinContent(i) * nofEvents * bW;
1927 double m_pp = fHMean.H1("hMinvCombPP" + cat + "_mixedEv", step)->GetBinContent(i) * nofEvents * bW;
1928 double m_mm = fHMean.H1("hMinvCombMM" + cat + "_mixedEv", step)->GetBinContent(i) * nofEvents * bW;
1929
1930 // derivatives of B_{C} w.r. to according value
1931 double d_m_pm = std::sqrt(s_pp * s_mm / (m_pp * m_mm));
1932 double d_m_pp = -0.5 * m_pm * m_mm * std::sqrt(s_pp * s_mm) / (std::pow(std::sqrt(m_pp * m_mm), 3));
1933 double d_m_mm = -0.5 * m_pm * m_pp * std::sqrt(s_pp * s_mm) / (std::pow(std::sqrt(m_pp * m_mm), 3));
1934 double d_s_pp = 0.5 * m_pm * s_mm / std::sqrt(m_pp * m_mm * s_pp * s_mm);
1935 double d_s_mm = 0.5 * m_pm * s_pp / std::sqrt(m_pp * m_mm * s_pp * s_mm);
1936
1937 // contributions to error propagation
1938 double f_m_pm = std::pow(d_m_pm * std::sqrt(m_pm), 2);
1939 double f_m_pp = std::pow(d_m_pp * std::sqrt(m_pp), 2);
1940 double f_m_mm = std::pow(d_m_mm * std::sqrt(m_mm), 2);
1941 double f_s_pp = std::pow(d_s_pp * std::sqrt(s_pp), 2);
1942 double f_s_mm = std::pow(d_s_mm * std::sqrt(s_mm), 2);
1943
1944 // final error propagation values
1945 double errorBc = std::sqrt(f_m_pm + f_m_pp + f_m_mm + f_s_pp + f_s_mm) / (nofEvents * bW);
1946 double errorBc2 = normGM * std::sqrt(m_pm) / (nofEvents * bW); // for range > 0.3 GeV
1947 double errorSig = std::sqrt(s_pm + std::pow(errorBc, 2)) / (nofEvents * bW);
1948 double errorSig2 = std::sqrt(s_pm + std::pow(errorBc2, 2)) / (nofEvents * bW);
1949
1950 if (i <= minBin) fHMean.H1("hMinvCombBg" + cat, step)->SetBinError(i, errorBc);
1951 if (i > minBin) fHMean.H1("hMinvCombBg" + cat, step)->SetBinError(i, errorBc2);
1952 if (i <= minBin) fHMean.H1("hMinvCombSignalNpm" + cat, step)->SetBinError(i, errorSig);
1953 if (i > minBin) fHMean.H1("hMinvCombSignalNpm" + cat, step)->SetBinError(i, errorSig2);
1954 if (i <= minBin) fHMean.H1("hMinvCombSignalMc" + cat, step)->SetBinError(i, errorSig);
1955 if (i > minBin) fHMean.H1("hMinvCombSignalMc" + cat, step)->SetBinError(i, errorSig2);
1956 } // error calculation
1957 } // cat ("" or "_urqmdEl")
1958 } // steps
1959}
1960
1961void LmvmDrawAll::CalcCutEffRange(double minMinv, double maxMinv)
1962{
1963 stringstream ss1;
1964 ss1 << "hCutEff_" << minMinv << "to" << maxMinv;
1965 fHMean.CreateH1(ss1.str() + "_bg", "Analysis step", "Efficiency [%]", fHMean.fNofAnaSteps, 0, fHMean.fNofAnaSteps);
1966 fHMean.CreateH1(ss1.str() + "_s", "Analysis step", "Efficiency [%]", fHMean.fNofAnaSteps, 0, fHMean.fNofAnaSteps);
1967 TH1D* hS = fHMean.H1(ss1.str() + "_s");
1968 TH1D* hBg = fHMean.H1(ss1.str() + "_bg");
1969 int x = 1;
1970 TH1D* cocktail = GetCocktailMinvH1("hMinv", ELmvmAnaStep::ElId);
1971 int binMin = cocktail->FindBin(minMinv);
1972 int binMax = cocktail->FindBin(maxMinv);
1973 double sIntElId = cocktail->Integral(binMin, binMax);
1974 double bgIntElId = fHMean.H1("hMinv", ELmvmSrc::Bg, ELmvmAnaStep::ElId)->Integral(binMin, binMax);
1975 for (ELmvmAnaStep step : fHMean.fAnaSteps) {
1976 if (step < ELmvmAnaStep::ElId) continue;
1977 if (!fUseMvd && (step == ELmvmAnaStep::Mvd1Cut || step == ELmvmAnaStep::Mvd2Cut)) continue;
1978
1979 double effS = 100. * GetCocktailMinvH1("hMinv", step)->Integral(binMin, binMax) / sIntElId;
1980 double effB = 100. * fHMean.H1("hMinv", ELmvmSrc::Bg, step)->Integral(binMin, binMax) / bgIntElId;
1981
1982 hBg->GetXaxis()->SetBinLabel(x, fHMean.fAnaStepLatex[static_cast<int>(step)].c_str());
1983 hBg->SetBinContent(x, effB);
1984 hS->SetBinContent(x, effS);
1985 x++;
1986 }
1987
1988 hBg->GetXaxis()->SetLabelSize(0.06);
1989 hBg->GetXaxis()->SetRange(1, x - 1);
1990 hS->GetXaxis()->SetRange(1, x - 1);
1991
1992 stringstream ss;
1993 ss << "lmvmAll_cutEff_" << minMinv << "to" << maxMinv;
1994 fHMean.fHM.CreateCanvas(ss.str(), ss.str(), 1000, 1000);
1995 DrawH1({hBg, hS}, {"BG", "Cocktail"}, kLinear, kLinear, true, 0.75, 0.85, 1.0, 1.0, "hist");
1996 hBg->SetLineWidth(4);
1997 hS->SetLineWidth(4);
1998 hBg->SetMinimum(1);
1999 hBg->SetMaximum(110);
2000
2001 stringstream ss2;
2002 ss2 << minMinv << "<M [GeV/c^2]<" << maxMinv;
2003 TText* t = new TText(0.5, hBg->GetMaximum() + 5, ss2.str().c_str());
2004 t->Draw();
2005}
2006
2007TH1D* LmvmDrawAll::SBgRange(double minMinv, double maxMinv)
2008{
2009 stringstream ss;
2010 ss << "hSBgRatio_" << minMinv << "to" << maxMinv;
2011 fHMean.CreateH1(ss.str(), "Analysis step", "Cocktail/BG", fHMean.fNofAnaSteps, 0, fHMean.fNofAnaSteps);
2012 TH1D* hSBg = fHMean.H1(ss.str());
2013 hSBg->GetXaxis()->SetLabelSize(0.06);
2014 int x = 1;
2015 TH1D* cocktail = GetCocktailMinvH1("hMinv", ELmvmAnaStep::ElId);
2016 int binMin = cocktail->FindBin(minMinv);
2017 int binMax = cocktail->FindBin(maxMinv);
2018 for (ELmvmAnaStep step : fHMean.fAnaSteps) {
2019 if (step < ELmvmAnaStep::ElId) continue;
2020 if (!fUseMvd && (step == ELmvmAnaStep::Mvd1Cut || step == ELmvmAnaStep::Mvd2Cut)) continue;
2021
2022 double intS = 100. * GetCocktailMinvH1("hMinv", step)->Integral(binMin, binMax);
2023 double intBg = 100. * fHMean.H1("hMinv", ELmvmSrc::Bg, step)->Integral(binMin, binMax);
2024 double sbg = intS / intBg;
2025
2026 hSBg->GetXaxis()->SetBinLabel(x, fHMean.fAnaStepLatex[static_cast<int>(step)].c_str());
2027 hSBg->SetBinContent(x, sbg);
2028 x++;
2029 }
2030 hSBg->GetXaxis()->SetRange(1, x - 1);
2031 return hSBg;
2032}
2033
2035{
2036 TH1D* h1 = SBgRange(0.0, 0.2);
2037 TH1D* h2 = SBgRange(0.2, 0.6);
2038 TH1D* h3 = SBgRange(0.6, 1.2);
2039
2040 fHMean.fHM.CreateCanvas("lmvmAll_sBgRatio_Ranges", "lmvmAll_sBgRatio_Ranges", 1000, 1000);
2041 DrawH1({h1, h2, h3}, {"0.0<M [GeV/c^{2}]<0.2", "0.2<M [GeV/c^{2}]<0.6", "0.6<M [GeV/c^{2}]<1.2"}, kLinear, kLog, true,
2042 0.25, 0.83, 0.75, 0.99, "hist");
2043
2044 h1->SetMinimum(0.9 * std::min({h1->GetMinimum(), h2->GetMinimum(), h3->GetMinimum()}));
2045 h1->SetMaximum(1.1 * std::max({h1->GetMaximum(), h2->GetMaximum(), h3->GetMaximum()}));
2046 h1->SetLineWidth(4);
2047 h2->SetLineWidth(4);
2048 h3->SetLineWidth(4);
2049
2050 TH1D* h4 = SBgRange(0.5, 0.6);
2051 fHMean.fHM.CreateCanvas("lmvmAll_sBgRatio_Range05to06", "lmvmAll_sBgRatio_Range05to06", 1000, 1000);
2052 DrawH1(h4, kLinear, kLinear);
2053 h4->SetLineWidth(4);
2054}
2055
2057{
2058 TCanvas* cFit = fHMean.fHM.CreateCanvas("lmvmAll_signalFit", "lmvmAll_signalFit", 1000, 1000);
2059 ofstream resultFile(fOutputDir + "/lmvmAll_results.txt");
2060 for (auto signal : fHMean.fSignals) {
2061 string signalName = fHMean.fSignalNames[static_cast<int>(signal)];
2062 fHMean.CreateH1("hSBgRatio_" + signalName, "Analysis steps", "S/BG", fHMean.fNofAnaSteps, 0, fHMean.fNofAnaSteps);
2063 TH1D* hSBg = fHMean.H1("hSBgRatio_" + signalName);
2064 hSBg->GetXaxis()->SetLabelSize(0.06);
2065 hSBg->SetLineWidth(4);
2066 int x = 1;
2067 for (ELmvmAnaStep step : fHMean.fAnaSteps) {
2068 if (step < ELmvmAnaStep::ElId) continue;
2069 if (!fUseMvd && (step == ELmvmAnaStep::Mvd1Cut || step == ELmvmAnaStep::Mvd2Cut)) continue;
2070 cFit->cd();
2071 LmvmSBgResultData result = CalculateSBgResult(signal, step);
2072
2073 hSBg->GetXaxis()->SetBinLabel(x, fHMean.fAnaStepLatex[static_cast<int>(step)].c_str());
2074 if (result.fSBgRatio < 1000.) hSBg->SetBinContent(x, result.fSBgRatio);
2075 x++;
2076 resultFile << signalName << " " << fHMean.fAnaStepNames[static_cast<int>(step)] << " " << result.fSignallEff
2077 << " " << result.fSBgRatio << " " << result.fFitMean << " " << result.fFitSigma;
2078 }
2079 hSBg->GetXaxis()->SetRange(1, x - 1);
2080 fHMean.fHM.CreateCanvas("lmvmAll_sBgRatio_" + signalName, "lmvmAll_sBgRatio_" + signalName, 1000, 1000);
2081 DrawH1(hSBg);
2082 hSBg->SetLineWidth(4);
2083 }
2084 resultFile.close();
2085}
2086
2088{
2089 TH1D* s = H(signal)->H1("hMinv", ELmvmSrc::Signal, step);
2090 TH1D* bg = H(signal)->H1("hMinv", ELmvmSrc::Bg, step);
2091
2092 if (s->GetEntries() < 10) return LmvmSBgResultData(0., 0., 0., 0.);
2093
2094 TH1D* sClone = static_cast<TH1D*>(s->Clone());
2095 if (signal == ELmvmSignal::Phi) sClone->Fit("gaus", "Q", "", 0.95, 1.05);
2096 else if (signal == ELmvmSignal::Omega)
2097 sClone->Fit("gaus", "Q", "", 0.69, 0.81);
2098 else
2099 sClone->Fit("gaus", "Q");
2100
2101 TF1* func = sClone->GetFunction("gaus");
2102 double mean = (func != nullptr) ? func->GetParameter("Mean") : 0.;
2103 double sigma = (func != nullptr) ? func->GetParameter("Sigma") : 0.;
2104 int minInd = s->FindBin(mean - 2. * sigma);
2105 int maxInd = s->FindBin(mean + 2. * sigma);
2106
2107 double sumSignal = 0.;
2108 double sumBg = 0.;
2109 for (int i = minInd + 1; i <= maxInd - 1; i++) {
2110 sumSignal += s->GetBinContent(i);
2111 sumBg += bg->GetBinContent(i);
2112 }
2113 double sbg = (sumBg != 0.) ? sumSignal / sumBg : 0.;
2114
2115 double eff = 100. * H(signal)->H1("hPtYPairSignal", step)->GetEntries()
2116 / H(signal)->H1("hPtYPairSignal", ELmvmAnaStep::Mc)->GetEntries();
2117
2118 return LmvmSBgResultData(sbg, eff, mean, sigma);
2119}
2120
2122{
2123 cout << "Images output dir:" << fOutputDir << endl;
2124 fHMean.fHM.SaveCanvasToImage(fOutputDir, "png"); // fHM[0]->SaveCanvasToImage(fOutputDir, "eps;png");
2125}
2126
void DrawTextOnPad(const string &text, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void SetDefaultDrawStyle()
void DrawH1(TH1 *hist, HistScale logx, HistScale logy, const string &drawOpt, Int_t color, Int_t lineWidth, Int_t lineStyle, Int_t markerSize, Int_t markerStyle)
void DrawH2(TH2 *hist, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
Helper functions for drawing 1D and 2D histograms and graphs.
@ kLinear
Definition CbmDrawHist.h:69
@ kLog
Definition CbmDrawHist.h:68
Histogram manager.
friend fscal max(fscal x, fscal y)
friend fscal min(fscal x, fscal y)
ELmvmSignal
Definition LmvmDef.h:62
ELmvmAnaStep
Definition LmvmDef.h:34
ClassImp(LmvmDrawAll)
const double pi
Generates beam ions for transport simulation.
TCanvas * CreateCanvas(const std::string &name, const std::string &title, Int_t width, Int_t height)
Create and draw TCanvas and store pointer to it.
void SaveCanvasToImage(const std::string &outputDir, const std::string &options="png,eps")
Save all stored canvases to images.
void Add(const std::string &name, TNamed *object)
Add new named object to manager.
LmvmHist * H(ELmvmSignal signal)
void DrawMinv(ELmvmAnaStep step)
void DrawMinvOfficialStyle()
Draw invariant mass spectra in official style.
void SBgRangeAll()
Draw S/BG vs plots for different mass ranges.
void DrawMinvBgSourcesAll()
void DrawHistFromFile(const std::string &fileInmed, const std::string &fileQgp, const std::string &fileOmega, const std::string &filePhi, const std::string &fileOmegaD, const std::string &outputDir="", bool useMvd=false)
TH1D * SBgRange(double minMinv, double maxMinv)
Create S/BG vs cuts for specified invariant mass range.
void DrawBetaMomSpectra()
void DrawSBgResults()
Draw properties of misidentified particles in comparison with not-misidentified.
void DrawMinvCombBgAndSignal()
Draw invariant mass spectra for all signal types for specified analysis step with BG reduced by combi...
void DrawSBgVsMinv()
Draw S/Bg vs minv.
void CalcCombBGHistos()
Calculate combinatorial BG contribution.
int GetNofTotalEvents()
void CreateMeanHist(const std::string &name, int nofEvents, int nofRebins=-1)
void DrawMomentum()
void DrawPionSuppression()
void DrawSignificancesAll()
void DrawMomRecoPrecision()
T * GetCocktailMinv(const std::string &name, ELmvmAnaStep step)
void DrawPtYAndTofM2Elid()
std::vector< LmvmHist * > fH
Definition LmvmDrawAll.h:37
void DrawSignificance(TH2D *hEl, TH2D *hBg, const std::string &name, double minZ, double maxZ, const std::string &option)
std::string fOutputDir
Definition LmvmDrawAll.h:42
void DrawTofHitXY()
void DrawMomPluto()
void DrawPurityHistText(TH2D *h)
void DrawMinvPtAll()
void SaveCanvasToImage()
Save all created canvases to images.
TH1D * GetCocktailMinvH1(const std::string &name, ELmvmAnaStep step)
void DrawCutEffSignal()
LmvmHist fHMean
Definition LmvmDrawAll.h:38
void InvestigateMisid()
Draw properties of misidentified particles.
void DrawPurity()
void CreateMeanHistAll()
void SaveHist()
Save histograms for the study report.
void DrawTofPilePids()
void CalcCutEffRange(double minMinv, double maxMinv)
Calculate cut efficiency in specified invariant mass region.
void DrawGTrackVertex()
LmvmSBgResultData CalculateSBgResult(ELmvmSignal signal, ELmvmAnaStep step)
void DrawMinvScaleValues()
void CreateH1(const std::string &name, const std::string &axisX, const std::string &axisY, double nBins, double min, double max)
static const std::vector< std::string > fCandNames
Definition LmvmHist.h:57
static const std::vector< std::string > fAnaStepLatex
Definition LmvmHist.h:35
TH1D * CreateSignificanceH1(TH1D *s, TH1D *bg, const std::string &name, const std::string &option)
Definition LmvmHist.cxx:325
void DrawAllGTracks(int dim, const std::string &cName, const std::string &hName, std::vector< std::string > xLabel, std::vector< std::string > yLabel, double min, double max)
Definition LmvmHist.cxx:391
CbmHistManager fHM
Definition LmvmHist.h:165
void DrawAllCands(int dim, const std::string &cName, const std::string &hName, std::vector< std::string > xLabel, std::vector< std::string > yLabel, double min, double max)
Definition LmvmHist.cxx:404
TH2D * H2Clone(const std::string &name)
Definition LmvmHist.h:119
TH2D * H2(const std::string &name)
Definition LmvmHist.h:110
void SetOptH1(TH1D *hist, TString xAxisTitle, TString yAxisTitle, Int_t Ndevision, Int_t style, Float_t size, Int_t color, std::string opt="")
Definition LmvmHist.cxx:218
static const int fNofSignals
Definition LmvmHist.h:37
static const std::vector< ELmvmSignal > fSignals
Definition LmvmHist.h:42
void DrawAllCandsAndSteps(int dim, const std::string &cName, const std::string &hName, std::vector< std::string > xLabel, std::vector< std::string > yLabel, double min, double max)
Definition LmvmHist.cxx:417
void SetOptCanvas(TCanvas *canvas)
Definition LmvmHist.cxx:262
static const std::vector< std::string > fCandLatex
Definition LmvmHist.h:59
std::string GetName(const std::string &name, ELmvmAnaStep step)
static const std::vector< std::string > fGTrackNames
Definition LmvmHist.h:50
static const std::vector< std::string > fGTrackLatex
Definition LmvmHist.h:53
static const std::vector< ELmvmAnaStep > fAnaSteps
Definition LmvmHist.h:29
static const std::vector< std::string > fSignalNames
Definition LmvmHist.h:41
static const int fNofAnaSteps
Definition LmvmHist.h:31
T * CreateHByClone(const std::string &name, const std::string &newName)
Definition LmvmHist.h:84
TH1D * H1Clone(const std::string &name)
Definition LmvmHist.h:118
TNamed * GetObject(const std::string &name)
Definition LmvmHist.h:107
TH1D * H1(const std::string &name)
Definition LmvmHist.h:109
static const std::vector< std::string > fAnaStepNames
Definition LmvmHist.h:33
void SetLegend(std::vector< LmvmLegend >, double textsize, double x1, double y1, double x2, double y2)
Definition LmvmHist.cxx:288
void WriteToFile()
Definition LmvmHist.cxx:477
static void DrawAnaStepOnPad(ELmvmAnaStep step)
Definition LmvmHist.cxx:488
double fSignallEff
Definition LmvmDef.h:121
static double GetMassScaleQgp(double minv)
static double GetMassScaleInmed(double minv)
std::string NumberToString(const T &value, int precision=1)
Definition CbmUtils.h:34
Hash for CbmL1LinkKey.