KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVDataQualityAuditReportMaker.h
1#ifndef __KVDATAQUALITYAUDITREPORTMAKER_H
2#define __KVDATAQUALITYAUDITREPORTMAKER_H
3
4#include "KVBase.h"
5#include "KVDataQualityAudit.h"
6#include "TGraph.h"
7#include <THStack.h>
8#include <TMultiGraph.h>
38public:
48 struct telescope {
50 telescope(const TString& name, const KVDataQualityAudit* audit)
51 : this_telescope{audit->GetTelescope(name)}
52 {
53 if (!this_telescope) std::cerr << "Requested telescope not found in audit: " << name << std::endl;
54 }
59 element operator[](int Z) const
60 {
61 return get_element(Z);
62 }
63 element get_element(int Z) const
64 {
66 }
72 };
73
74private:
75 const KVDataQualityAudit* fAudit{nullptr};
76 void init_colors(int ncols = 100);
77public:
79 : KVBase("KVDataQualityReportMaker", "Produce graphs and histograms from KVDataQualityAudit")
80 {
82 }
84 : KVBase(audit_name)
85 {
89 fAudit = dynamic_cast<KVDataQualityAudit*>(gDirectory->Get(audit_name));
91 else MakeZombie();
92 }
94 : KVBase(audit->GetName(), audit->GetTitle()), fAudit(audit)
95 {
97 }
99
100 telescope operator[](const TString& name) const
101 {
102 return telescope(name, fAudit);
103 }
104
105 static TGraph* FormatGraph(TGraph*, Color_t = 0, Marker_t = 0);
106 static TH1F* FormatHisto(TH1F*, Color_t = 0);
107
109 {
110 return fAudit;
111 }
112
113 template<typename TelescopeIndexFunction>
114 TGraph* get_mean_Z_for_telescopes(TSeqCollection* idtels, TelescopeIndexFunction F, Marker_t marker_style = 20) const
115 {
120
121 auto gr = ::new TGraph;
122 gr->SetTitle("Mean Z vs. telescope number");
123 KVIDTelescope* idt;
124 TIter next(idtels);
125 while ((idt = (KVIDTelescope*)next())) {
126 auto t = fAudit->GetTelescope(idt->GetName());
127 if (t) gr->SetPoint(gr->GetN(), F(idt), t->get_mean_Z());
128 }
129 return FormatGraph(gr, 0, marker_style);
130 }
131 template<typename TelescopeIndexFunction>
132 TGraph* get_max_Z_for_telescopes(TSeqCollection* idtels, TelescopeIndexFunction F, Marker_t marker_style = 20) const
133 {
138
139 auto gr = ::new TGraph;
140 gr->SetTitle("Max Z vs. telescope number");
141 KVIDTelescope* idt;
142 TIter next(idtels);
143 while ((idt = (KVIDTelescope*)next())) {
144 auto t = fAudit->GetTelescope(idt->GetName());
145 if (t) gr->SetPoint(gr->GetN(), F(idt), t->get_max_Z());
146 }
147 return FormatGraph(gr, 0, marker_style);
148 }
149 template<typename TelescopeIndexFunction>
150 TGraph* get_max_Z_with_isotopes_for_telescopes(TSeqCollection* idtels, TelescopeIndexFunction F, Marker_t marker_style = 20) const
151 {
156
157 auto gr = ::new TGraph;
158 gr->SetTitle("Max Z with isotopes vs. telescope number");
159 KVIDTelescope* idt;
160 TIter next(idtels);
161 while ((idt = (KVIDTelescope*)next())) {
162 auto t = fAudit->GetTelescope(idt->GetName());
163 if (t) gr->SetPoint(gr->GetN(), F(idt), t->get_max_Z_with_isotopes());
164 }
165 return FormatGraph(gr, 0, marker_style);
166 }
167 template<typename TelescopeIndexFunction>
168 TGraph* get_min_Z_for_telescopes(TSeqCollection* idtels, TelescopeIndexFunction F, Marker_t marker_style = 20) const
169 {
174
175 auto gr = ::new TGraph;
176 gr->SetTitle("Min Z vs. telescope number");
177 KVIDTelescope* idt;
178 TIter next(idtels);
179 while ((idt = (KVIDTelescope*)next())) {
180 auto t = fAudit->GetTelescope(idt->GetName());
181 if (t) gr->SetPoint(gr->GetN(), F(idt), t->get_min_Z());
182 }
183 return FormatGraph(gr, 0, marker_style);
184 }
185 template<typename TelescopeIndexFunction>
186 TGraph* get_mean_A_for_telescopes(TSeqCollection* idtels, TelescopeIndexFunction F, Marker_t marker_style = 20) const
187 {
192
193 auto gr = ::new TGraph;
194 gr->SetTitle("Mean A vs. telescope number");
195 KVIDTelescope* idt;
196 TIter next(idtels);
197 while ((idt = (KVIDTelescope*)next())) {
198 auto t = fAudit->GetTelescope(idt->GetName());
199 if (t) gr->SetPoint(gr->GetN(), F(idt), t->get_mean_A());
200 }
201 return FormatGraph(gr, 0, marker_style);
202 }
203 template<typename TelescopeIndexFunction>
204 TGraph* get_max_A_for_telescopes(TSeqCollection* idtels, TelescopeIndexFunction F, Marker_t marker_style = 20) const
205 {
210
211 auto gr = ::new TGraph;
212 gr->SetTitle("Max A vs. telescope number");
213 KVIDTelescope* idt;
214 TIter next(idtels);
215 while ((idt = (KVIDTelescope*)next())) {
216 auto t = fAudit->GetTelescope(idt->GetName());
217 if (t) gr->SetPoint(gr->GetN(), F(idt), t->get_max_A());
218 }
219 return FormatGraph(gr, 0, marker_style);
220 }
221
222 template<typename TelescopeIndexFunction>
223 TGraph* get_min_A_for_telescopes(TSeqCollection* idtels, TelescopeIndexFunction F, Marker_t marker_style = 20) const
224 {
229
230 auto gr = ::new TGraph;
231 gr->SetTitle("Min A vs. telescope number");
232 KVIDTelescope* idt;
233 TIter next(idtels);
234 while ((idt = (KVIDTelescope*)next())) {
235 auto t = fAudit->GetTelescope(idt->GetName());
236 if (t) gr->SetPoint(gr->GetN(), F(idt), t->get_min_A());
237 }
238 return FormatGraph(gr, 0, marker_style);
239 }
240
241 ClassDef(KVDataQualityAuditReportMaker, 1) //Produce graphs and histograms from KVDataQualityAudit
242};
243
244#endif
#define e(i)
short Color_t
short Marker_t
#define ClassDef(name, id)
#define gDirectory
char name[80]
Base class for KaliVeda framework.
Definition KVBase.h:142
Produce graphs and histograms from KVDataQualityAudit.
TGraph * get_mean_Z_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
TGraph * get_min_A_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
TGraph * get_max_Z_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
TGraph * get_min_Z_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
TGraph * get_mean_A_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
TGraph * get_max_Z_with_isotopes_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
static TGraph * FormatGraph(TGraph *, Color_t=0, Marker_t=0)
provide uniform style for all graphs
KVDataQualityAuditReportMaker(const KVDataQualityAudit *audit)
static TH1F * FormatHisto(TH1F *, Color_t=0)
provide uniform style for all histos
KVDataQualityAuditReportMaker(const TString &audit_name)
TGraph * get_max_A_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
telescope operator[](const TString &name) const
const KVDataQualityAudit * GetAudit() const
const element & GetElement(int Z) const
Audit of experimental data identification and calibrations.
idtelescope * GetTelescope(const TString &tel_name) const
Base class for all detectors or associations of detectors in array which can identify charged particl...
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Int_t GetN() const
void SetTitle(const char *title="") override
virtual void SetTitle(const char *title="")
const char * GetName() const override
const char * GetTitle() const override
void MakeZombie()
const Int_t n
TGraphErrors * gr
#define F(x, y, z)
const KVDataQualityAudit::element * this_element
element(const std::string &n, const KVDataQualityAudit::element &e)
TGraph * get_isotope_thresholds_by_Z_mev_per_nuc(Color_t color=0) const
telescope(const TString &name, const KVDataQualityAudit *audit)