CbmRoot
Loading...
Searching...
No Matches
LmvmDrawAll.h
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], Florian Uhlig, Cornelius Feier-Riesen */
4
5#ifndef LMVM_DRAW_ALL
6#define LMVM_DRAW_ALL
7
8#include "FairRootManager.h"
9#include "LmvmHist.h"
10#include "TObject.h"
11
12#include <map>
13#include <string>
14#include <vector>
15
16class TH1;
17class TH2D;
18class TH1D;
19class TFile;
20class TCanvas;
21class CbmHistManager;
22
23class LmvmDrawAll : public TObject {
24
25 public:
27 virtual ~LmvmDrawAll() { ; }
28
29
30 void DrawHistFromFile(const std::string& fileInmed, const std::string& fileQgp, const std::string& fileOmega,
31 const std::string& filePhi, const std::string& fileOmegaD, const std::string& dataDir = "",
32 bool useMvd = false);
33
34 private:
35 std::string fDataDir;
36 std::string fOutputDir; // output directory for figures
37 std::string fFileName;
38
39 bool fUseMvd; // do you want to draw histograms related to the MVD detector?
40
41 std::vector<LmvmHist*> fH;
45
46 double fRebinMinv; // Rebin for minv histograms
47
48 double fNofSimEvents; // Number of simulated events (analysis)
49 double fNofFastSimEvents; // Number of Fast Simulations (type 'double' because of large value)
50 double fNofFastSimJobs; // Number of jobs of Fast Simulations (for correct scaling)
51
52 // Fast Simulation
53 bool fDoChargeBased = false;
54 bool fDoParticleBased = false;
55
56 // Combinatorial Background (calculated by means of class LmvmEventMix)
59 double
60 fNofEvMixEvents; // Number of events from LmvmEventMix (ideally equal to fNofSimEvents if all jobs finished successfully)
61 double fCbChange = -1.; // Threshold for transition from same to mixed events
62 double fCbNormRangeMin = -1.; // Start point for range in which mixed events are normalised to same events
63 double fCbNormRangeMax = -1.; // End point for range in which mixed events are normalised to same events
64 std::vector<double> fCbNormFactor; // Ratio mixed/same event yields, separate for each step
65
66 template<typename T>
67 T* InitOrFatal(const std::string& name)
68 {
69 FairRootManager* ioman = FairRootManager::Instance();
70 if (ioman == nullptr) LOG(fatal) << "LmvmDrawAll: No FairRootManager!";
71 T* array = static_cast<T*>(ioman->GetObject(name.c_str()));
72 if (array == nullptr) LOG(fatal) << "LmvmDrawAll: No " << name << "object!";
73 return array;
74 }
75
78
79 // Variable bin width
80
87 TH1D* VaryBinWidth(TH1D* h, double nEvents, std::vector<std::pair<double, double>> binValues);
88
96 TH1D* VaryBinWidth(const std::string& option, const std::string& hName, double nEvents,
97 std::vector<std::pair<double, double>> binValues);
98
107 TH1D* VaryBinWidth(const std::string& option, const std::string& hName, ELmvmAnaStep step, double nEvents,
108 std::vector<std::pair<double, double>> binValues);
109
110 TH1D* VaryBinWidth(TH1D* h, std::vector<std::pair<double, double>>
111 binValues); // Same as previous, without nEvents -> Error won't be calculated
112 TH1D* VaryBinWidth(const std::string& option, const std::string& hName,
113 std::vector<std::pair<double, double>> binValues);
114 TH1D* VaryBinWidth(const std::string& option, const std::string& hName, ELmvmAnaStep step,
115 std::vector<std::pair<double, double>> binValues);
116 void CheckVaryBinWidth();
117
118 // Templates for variabel bin width vectors
119 std::vector<std::pair<double, double>> fBwVarOrig = {std::make_pair(2.5, 0.01)}; // 250+2 bins
120 std::vector<std::pair<double, double>> fBwVarReg = {std::make_pair(2.5, 0.1)}; // 25+2 bins
121 std::vector<std::pair<double, double>> fBwVarBg = {std::make_pair(1.5, 0.1), std::make_pair(2.0, 0.25),
122 std::make_pair(2.5, 0.5)}; // 18+2 bins
123 std::vector<std::pair<double, double>> fBwVarBg2 = {std::make_pair(1.5, 0.1), std::make_pair(1.75, 0.25),
124 std::make_pair(2.5, 0.75)}; // 17+2 bins
125 std::vector<std::pair<double, double>> fBwVarBg3 = {std::make_pair(1.6, 0.2), std::make_pair(2.0, 0.4),
126 std::make_pair(2.5, 0.5)}; // 10+2 bins
127 std::vector<std::pair<double, double>> fBwVarBg4 = {std::make_pair(1.6, 0.4), std::make_pair(2.5, 0.9)}; // 5+2 bins
128 std::vector<std::pair<double, double>> fBwVarBg5 = {std::make_pair(1.5, 0.3), std::make_pair(2.5, 1.0)}; // 6+2 bins
129 std::vector<std::pair<double, double>> fBwVarSig = {std::make_pair(0.5, 0.1), std::make_pair(1.1, 0.05),
130 std::make_pair(1.5, 0.2), std::make_pair(2.5, 1.0)}; // 20+2 bins
131 std::vector<std::pair<double, double>> fBwVarSig3 = {std::make_pair(1.1, 0.1), std::make_pair(1.5, 0.2),
132 std::make_pair(2.5, 1.0)}; // 20+2 bins
133 std::vector<std::pair<double, double>> fBwVarSig2 = {std::make_pair(0.5, 0.1), std::make_pair(1.1, 0.05),
134 std::make_pair(1.5, 0.2),
135 std::make_pair(2.5, 0.5)}; // 21+2 bins
136 std::vector<std::pair<double, double>> fBwVarRat = {std::make_pair(1.0, 0.1), std::make_pair(2.0, 0.2),
137 std::make_pair(2.5, 0.5)}; // 16+2 bins
138 std::vector<std::pair<double, double>> fBwVarCock = {std::make_pair(0.75, 0.05), std::make_pair(0.8, 0.01),
139 std::make_pair(0.95, 0.05), std::make_pair(1.05, 0.01),
140 std::make_pair(2.5, 0.05)}; // 62+2 bins
141 std::vector<std::pair<double, double>> fBwVarOmega = {std::make_pair(0.65, 0.05),
142 std::make_pair(2.5, 0.01)}; // 198+2 bins
143 std::vector<std::pair<double, double>> fBwVarPhi = {std::make_pair(0.85, 0.05),
144 std::make_pair(2.5, 0.01)}; // 182+2 bins
145 std::vector<std::vector<std::pair<double, double>>> fBwVarAll = {fBwVarOrig, fBwVarReg, fBwVarBg,
147 std::vector<std::string> fBwVarAllTags = {"bwvOrig", "bwvReg", "bwvBg", "bwvSig", "bwvSig2", "bwvSig3"};
148 int fBwVarCounter = 0.; // to prevent same names for copies of same histograms (needed?)
149
150
151 LmvmHist* H(ELmvmSignal signal);
152
153 template<class T>
154 T* GetCocktailMinv(const std::string& name, ELmvmAnaStep step, bool scaleAll);
155
156 TH1D* GetCocktailMinvH1(const std::string& name, ELmvmAnaStep step, bool scaleAll);
157
163 void CalculateHistErrors(TH1D* h, double nofEvents);
164
172 TH1D* CalculateHistRatioWithErrors(TH1D* hNom, TH1D* hDenom, double nEvNom, double nEvDenom);
173
177 void LoadFastSimHistos();
178
187
188 TH1D* GetCBForNormRange(const std::string hName, ELmvmAnaStep step, double rangeStart, double rangeEnd);
189
193 void CalculateSignal();
194
200 TH1D* GetSignal(ELmvmAnaStep step, std::vector<std::pair<double, double>> bwVar);
201
205 void DrawSBgVsMinv();
206
207 void ChargeSymmetry();
208 void DrawSignal();
209 void DrawSignalCBNormRangeDependent(std::string hName, std::string cName, ELmvmAnaStep step);
210 void DrawNumbers();
211 void DrawMinvAll();
212 void DrawMinv(ELmvmAnaStep step);
213 void DrawMinvPtAll();
215 void DrawBackground();
216 void DrawPtY();
218 void DrawElidCuts();
219 void DrawMomentumUrqmd();
220 void DrawCandProperties();
221 void DrawRichProperties();
223 void DrawRapidity();
224 bool IsCloseTo(double value, double refValue, double tol);
225
226 // Temperature Calculation
227 void DrawTemperature();
228 void DrawTemperatureGraph(TH1D* h, ELmvmAnaStep step, double startfit, double endfit,
229 bool DoCorrectX); // TODO: delete this method if not needed anymore
230 void DrawTemperatureGraph(TH1D* h, ELmvmAnaStep step, double startfit, double endfit);
231 void DrawTemperature(TH1D* h, double startfit, double endfit);
236 void CheckoutTemperatureFitRange(TH1D* h, std::string name);
238 std::vector<double> fParamB; // Parameter for correct x-position in temperature histograms
239 int fTempGraphCounter = 0.; // to prevent same names for copies of same histograms (needed?)
240
241
246
251
252 template<class T>
253 void CreateMeanHist(const std::string& name, int nofRebins = -1); // if nRebin = -1, no rebin
254
255 template<class T>
256 void CreateMeanHistSparse(const std::string& name);
257
258 void CreateMeanHistAll();
259
263 void SaveHist();
264
270 void CalcCutEffRange(double minMinv, double maxMinv);
271
277 TH1D* SBgRange(double minMinv, double maxMinv);
278
282 void SBgRangeAll();
283
287 void InvestigateMisid();
288
289 void DrawPtY(TH2D* hMc, TH2D* h, const std::string cName, double zMin, double zMax);
290 void DrawStudies();
291
292 void DrawBetaMomSpectra();
293
294 void DrawMomPluto();
295
296 void DrawTofM2();
297
298 void DrawGTrackVertex();
299
301 void DrawSignificance(TH2D* hEl, TH2D* hBg, const std::string& name, double minZ, double maxZ,
302 const std::string& option);
303
304 void DrawEfficiency();
306
307
308 void DrawSuppression();
309
310 // investigate misidentifications
311 void DrawMomentum();
314 void DrawPurity();
315 void DrawPurityHistText(TH2D* h);
316 void DrawChi2();
317 void DrawMinvScaleValues();
318 void DrawNofHits();
319 void DrawFastSimHistos();
321 void DrawMultiplicities(TH1D* plus, TH1D* minus, TH1D* plusrandom, TH1D* minusrandom, std::string cName,
322 std::string hText);
324 TH1D* GetSymmetry(TH1D* h);
325 TH1D* GetSymmetry(TH1D* h1, std::string opt1, TH1D* h2, std::string opt2,
326 const std::string& label); // label to prevent same hName for several histos
327 TH1D* GetHalfHisto(TH1D* h, std::string opt, const std::string& label);
328
332
333 void DrawSBgResults();
334
336
340 void SaveCanvasToImage();
341
342 double fZ = -44.; // z-position of target
343
346
347 void CheckMemory(const std::string& text);
348
350};
351
352#endif
ELmvmSignal
Definition LmvmDef.h:62
ELmvmAnaStep
Definition LmvmDef.h:34
Histogram manager.
Data class with information on a STS local track.
std::vector< std::vector< std::pair< double, double > > > fBwVarAll
std::vector< std::pair< double, double > > fBwVarOmega
LmvmHist * H(ELmvmSignal signal)
void DrawMinv(ELmvmAnaStep step)
double fNofEvMixEvents
Definition LmvmDrawAll.h:60
void DrawPtYAndTofM2Misid()
void DrawMinvOfficialStyle()
Draw invariant mass spectra in official style.
void SBgRangeAll()
Draw S/BG vs plots for different mass ranges.
void CreateMeanHistSparse(const std::string &name)
void DrawMultiplicities(TH1D *plus, TH1D *minus, TH1D *plusrandom, TH1D *minusrandom, std::string cName, std::string hText)
void CalculateHistErrors(TH1D *h, double nofEvents)
Calculates errors of (normalized) histograms.
TH1D * GetCocktailMinvH1(const std::string &name, ELmvmAnaStep step, bool scaleAll)
std::string fDataDir
Definition LmvmDrawAll.h:35
TH1D * SBgRange(double minMinv, double maxMinv)
Create S/BG vs cuts for specified invariant mass range.
TH1D * GetHalfHisto(TH1D *h, std::string opt, const std::string &label)
void CheckoutTemperatureParams()
bool fDoParticleBased
Definition LmvmDrawAll.h:54
TH1D * VaryBinWidth(const std::string &option, const std::string &hName, double nEvents, std::vector< std::pair< double, double > > binValues)
Returns histogram with varied bin width.
TH1D * VaryBinWidth(TH1D *h, std::vector< std::pair< double, double > > binValues)
void CheckMemory(const std::string &text)
std::vector< double > fParamB
TH1D * GetCBForNormRange(const std::string hName, ELmvmAnaStep step, double rangeStart, double rangeEnd)
std::vector< std::pair< double, double > > fBwVarRat
TH1D * GetSymmetry(TH1D *h)
double fNofFastSimEvents
Definition LmvmDrawAll.h:49
void DrawLikeSignCorrelations()
TH1D * CalculateHistRatioWithErrors(TH1D *hNom, TH1D *hDenom, double nEvNom, double nEvDenom)
Calculates ratios of histograms with errors.
TH1D * VaryBinWidth(const std::string &option, const std::string &hName, std::vector< std::pair< double, double > > binValues)
std::vector< std::pair< double, double > > fBwVarOrig
void DrawBetaMomSpectra()
void DrawSBgResults()
Draw properties of misidentified particles in comparison with not-misidentified.
void CheckoutAddFunction2()
void DrawMomentumUrqmd()
void CreateMeanHist(const std::string &name, int nofRebins=-1)
int fTempGraphCounter
bool IsCloseTo(double value, double refValue, double tol)
void DrawEfficiency()
void CheckVaryBinWidth()
std::vector< std::pair< double, double > > fBwVarSig
double fNofSimEvents
Definition LmvmDrawAll.h:48
void CalculateSignal()
Calculate Signal from Fast Simulations and Combinatorial Background.
double fCbChange
Definition LmvmDrawAll.h:61
void DrawSBgVsMinv()
Draw S/Bg vs minv.
void DrawSignalCBNormRangeDependent(std::string hName, std::string cName, ELmvmAnaStep step)
TH1D * VaryBinWidth(TH1D *h, double nEvents, std::vector< std::pair< double, double > > binValues)
Main variable bin width method. Returns copy of provided histogram with varied bin width....
TH1D * VaryBinWidth(const std::string &option, const std::string &hName, ELmvmAnaStep step, std::vector< std::pair< double, double > > binValues)
std::vector< std::pair< double, double > > fBwVarBg4
std::vector< std::pair< double, double > > fBwVarBg2
LmvmDrawAll(const LmvmDrawAll &)
double fNofFastSimJobs
Definition LmvmDrawAll.h:50
void DrawMomentum()
void DrawRapidity()
TH1D * VaryBinWidth(const std::string &option, const std::string &hName, ELmvmAnaStep step, double nEvents, std::vector< std::pair< double, double > > binValues)
Returns histogram with varied bin width.
void DrawTemperatureGraph(TH1D *h, ELmvmAnaStep step, double startfit, double endfit, bool DoCorrectX)
void CheckoutTemperatureFitRange(TH1D *h, std::string name)
void DrawSignificancesAll()
void DrawCandProperties()
void DrawMomRecoPrecision()
void DrawBackground()
double fRebinMinv
Definition LmvmDrawAll.h:46
void DrawEfficiencyCorrection()
std::vector< LmvmHist * > fH
Definition LmvmDrawAll.h:41
void CalculateCombBGHistos()
Calculate Combinatorial BG.
void DrawTemperature()
void DrawSignificance(TH2D *hEl, TH2D *hBg, const std::string &name, double minZ, double maxZ, const std::string &option)
int fNofEvMixJobs
Definition LmvmDrawAll.h:57
std::string fOutputDir
Definition LmvmDrawAll.h:36
virtual ~LmvmDrawAll()
Definition LmvmDrawAll.h:27
void CheckoutTemperatureFitRangeAll()
void DrawMomPluto()
void DrawPurityHistText(TH2D *h)
void CheckoutTemperatureParamB()
void ChargeSymmetry()
void CalculateCBFromFastSimEvents()
Calculate Combinatorial BG from Fast Simulations.
void DrawRichProperties()
void DrawBgPairs()
T * InitOrFatal(const std::string &name)
Definition LmvmDrawAll.h:67
void DrawMinvPtAll()
void DrawPtY(TH2D *hMc, TH2D *h, const std::string cName, double zMin, double zMax)
std::vector< std::pair< double, double > > fBwVarBg
void CheckoutTemperatureInitParams()
void DrawFastSimHistos()
void DrawSuppression()
LmvmDrawAll operator=(const LmvmDrawAll &)
void SaveCanvasToImage()
Save all created canvases to images.
void DrawFastSimHistosParticleBased()
void CheckoutAddFunction()
LmvmHist fHEvMix
Definition LmvmDrawAll.h:44
std::vector< std::pair< double, double > > fBwVarSig2
LmvmHist fHFastSim
Definition LmvmDrawAll.h:43
std::string fFileName
Definition LmvmDrawAll.h:37
LmvmHist fHMean
Definition LmvmDrawAll.h:42
void InvestigateMisid()
Draw properties of misidentified particles.
ClassDef(LmvmDrawAll, 1)
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 &dataDir="", bool useMvd=false)
std::vector< double > fCbNormFactor
Definition LmvmDrawAll.h:64
void LoadFastSimHistos()
Load histograms from LmvmFastSim and set related global variabled.
std::vector< std::pair< double, double > > fBwVarPhi
std::vector< std::pair< double, double > > fBwVarCock
std::vector< std::pair< double, double > > fBwVarReg
std::vector< std::string > fBwVarAllTags
void DrawSystematicErrorFsSignal()
TH1D * GetSignal(ELmvmAnaStep step, std::vector< std::pair< double, double > > bwVar)
Returns signal (calc. from Fast Simulations and Comb. Background) with varied bin width and with erro...
void DrawCombinatorialBackground()
Draw invariant mass spectra for all signal types for specified analysis step with BG reduced by combi...
void CreateMeanHistAll()
std::vector< std::pair< double, double > > fBwVarSig3
void DrawElidCuts()
void SaveHist()
Save histograms for the study report.
bool fDoChargeBased
Definition LmvmDrawAll.h:53
std::vector< std::pair< double, double > > fBwVarBg3
void InitialiseCocktailFitParams()
void CalcCutEffRange(double minMinv, double maxMinv)
Calculate cut efficiency in specified invariant mass region.
double fCbNormRangeMax
Definition LmvmDrawAll.h:63
std::vector< std::pair< double, double > > fBwVarBg5
TH1D * GetSymmetry(TH1D *h1, std::string opt1, TH1D *h2, std::string opt2, const std::string &label)
void DrawGTrackVertex()
LmvmSBgResultData CalculateSBgResult(ELmvmSignal signal, ELmvmAnaStep step)
void DrawSignal()
double fCbNormRangeMin
Definition LmvmDrawAll.h:62
void DrawMinvScaleValues()
T * GetCocktailMinv(const std::string &name, ELmvmAnaStep step, bool scaleAll)
void DrawMomentumMisidVsTrue()