Go to the documentation of this file.
16 #include <boost/assign/list_of.hpp>
18 using boost::assign::list_of;
23 using std::stringstream;
29 (histName.find(
"_Eff_") != string::npos)
40 + NumberToString<Double_t>(efficiency, 1) +
")";
45 Int_t nofEvents = hm->
H1(
"hen_EventNo_ClusteringQa")->GetEntries();
47 return split[3] +
" ("
48 + NumberToString<Double_t>(hm->
H1(histName)->GetEntries() / nofEvents,
64 Out() <<
"Number of events: "
65 <<
HM()->
H1(
"hen_EventNo_ClusteringQa")->GetEntries() << endl;
74 vector<TH1*> histos =
HM()->
H1Vector(
"hno_NofObjects_.+_Event");
75 Int_t nofHistos = histos.size();
77 R()->
TableBegin(
"Number of objects per event", list_of(
"Name")(
"Value"));
78 for (Int_t iHist = 0; iHist < nofHistos; iHist++) {
79 string cellName =
Split(histos[iHist]->GetName(),
'_')[2];
81 list_of(cellName)(NumberToString<Int_t>(histos[iHist]->GetMean())));
108 DrawH1ByPattern(
"hpa_.*(Digi|Cluster|Hit)_NofPointsIn(Digi|Cluster|Hit)_H1");
109 DrawH2ByPattern(
"hpa_.*(Digi|Cluster|Hit)_NofPointsIn(Digi|Cluster|Hit)_H2",
134 const string& detName,
135 const string& parameter) {
136 if (!
HM()->Exists(
"hno_NofObjects_" + detName +
"Points_" + parameter))
139 GetReportName() +
"_NofObjects_" + detName +
"_" + parameter;
141 CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
144 vector<string> labels = list_of(
"Points")(
"Digis")(
"Clusters")(
"Hits");
145 vector<TH1*> histos =
146 list_of(
HM()->
H1(
"hno_NofObjects_" + detName +
"Points_" + parameter))(
147 HM()->
H1(
"hno_NofObjects_" + detName +
"Digis_" + parameter))(
148 HM()->
H1(
"hno_NofObjects_" + detName +
"Clusters_" + parameter));
149 if (
HM()->
Exists(
"hno_NofObjects_" + detName +
"PixelHits_" + parameter))
151 HM()->
H1(
"hno_NofObjects_" + detName +
"PixelHits_" + parameter));
152 else if (
HM()->
Exists(
"hno_NofObjects_" + detName +
"StrawHits_" + parameter))
154 HM()->
H1(
"hno_NofObjects_" + detName +
"StrawHits_" + parameter));
155 else if (
HM()->
Exists(
"hno_NofObjects_" + detName +
"Hits_" + parameter))
157 HM()->
H1(
"hno_NofObjects_" + detName +
"Hits_" + parameter));
162 if (!(
HM()->Exists(
"hrp_" + detName +
"_ResidualX_H2")
163 &&
HM()->Exists(
"hrp_" + detName +
"_ResidualY_H2")
164 &&
HM()->Exists(
"hrp_" + detName +
"_ResidualT_H2")
165 &&
HM()->Exists(
"hrp_" + detName +
"_PullX_H2")
166 &&
HM()->Exists(
"hrp_" + detName +
"_PullY_H2")
167 &&
HM()->Exists(
"hrp_" + detName +
"_PullT_H2")))
170 list_of(
"ResidualX")(
"ResidualY")(
"ResidualT")(
"PullX")(
"PullY")(
"PullT");
171 Int_t nofCanvases = par.size();
172 for (Int_t iCanvas = 0; iCanvas < nofCanvases; iCanvas++) {
173 string histName =
"hrp_" + detName +
"_" + par[iCanvas] +
"_H2";
174 TH2* hist =
HM()->
H2(histName);
175 string canvasName =
GetReportName() +
"_" + histName +
"_station";
177 CreateCanvas(canvasName.c_str(), canvasName.c_str(), 1600, 900);
179 Int_t nofColumns = 5;
180 Int_t nofRows = (nofBins / nofColumns) + ((nofBins % 5 == 0) ? 0 : 1);
181 canvas->Divide(nofColumns, nofRows);
183 std::cout << nofBins <<
" " << nofColumns <<
" " << nofRows << std::endl;
184 for (Int_t iBin = 1; iBin <= nofBins; iBin++) {
186 ss << histName <<
"_" << iBin <<
"_py";
187 TH1* projY = hist->ProjectionY(ss.str().c_str(), iBin, iBin);
188 projY->SetNameTitle(ss.str().c_str(), ss.str().c_str());
189 projY->SetXTitle(par[iCanvas].c_str());
190 projY->SetYTitle(
"Yield");
203 if (histAcc->Integral() == 0 || histRec->Integral() == 0) {
206 return scale * Double_t(histRec->Integral())
207 / Double_t(histAcc->Integral());
212 Int_t nofEvents =
HM()->
H1(
"hen_EventNo_ClusteringQa")->GetEntries();
224 "hpa_.*(Digi|Cluster|Hit)_NofPointsIn(Digi|Cluster|Hit)_.*");
226 "hpa_.*(Digi|Cluster|Hit)_NofPointsIn(Digi|Cluster|Hit)_H1");
228 "hpa_.*(Digi|Cluster|Hit)_NofPointsIn(Digi|Cluster|Hit)_H2");
245 histo3->Divide(histo1, histo2, 1., 1.,
"B");
246 histo3->Scale(scale);
252 vector<TH1*> effHistos =
HM()->
H1Vector(
"hhe_.+_" + eff +
"_.+");
253 Int_t nofEffHistos = effHistos.size();
254 for (Int_t iHist = 0; iHist < nofEffHistos; iHist++) {
255 TH1* effHist = effHistos[iHist];
256 string effHistName = effHist->GetName();
262 effHist->SetMinimum(0.);
263 effHist->SetMaximum(100.);
virtual std::string TableBegin(const std::string &caption, const std::vector< std::string > &colNames) const =0
Return string with table open tag.
TCanvas * CreateCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
Create canvas and put it to vector of TCanvases. Canvases created with this function will be automati...
Bool_t Exists(const std::string &name) const
Check existence of histogram in manager.
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
void ShrinkEmptyBinsH2ByPattern(const std::string &pattern)
Shrink empty bins in H2.
void ScaleByPattern(const std::string &pattern, Double_t scale)
Scale histograms which name matches specified pattern.
string DefaultAccAndRecLabelFormatter(const string &histName, const CbmHistManager *hm)
virtual std::string DocumentBegin() const =0
Return string with open tags for document.
string FindAndReplace(const string &name, const string &oldSubstr, const string &newSubstr)
virtual std::string TableRow(const std::vector< std::string > &row) const =0
Return string with table row tags.
void ShrinkEmptyBinsH1ByPattern(const std::string &pattern)
Shrink empty bins in H1.
Simulation report for clustering QA.
virtual std::string DocumentEnd() const =0
Return string with close tags of the document.
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
string DefaultHitEfficiencyLabelFormatter(const string &histName, const CbmHistManager *hm)
const std::string & GetReportName() const
const CbmReportElement * R() const
Accessor to CbmReportElement object. User has to write the report using available tags from CbmReport...
virtual ~CbmLitClusteringQaReport()
Destructor.
string PrintNofObjects() const
Print number of objects table.
Helper functions for drawing 1D and 2D histograms and graphs.
Abstract class for basic report elements (headers, tables, images etc.).
void SetReportName(const std::string &name)
void NormalizeToIntegralByPattern(const std::string &pattern)
Normalize histograms to integral which name matches specified pattern.
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 PrintCanvases() const
Print images created from canvases in the report.
void DivideHistos(TH1 *histo1, TH1 *histo2, TH1 *histo3, Double_t scale)
virtual std::string TableEnd() const =0
Return string with table close tag.
CbmLitClusteringQaReport()
Constructor.
void CalculateEfficiencyHistos(const string &acc, const string &rec, const string &eff)
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
void DrawH1ByPattern(const std::string &histNamePattern)
Select by pattern TH1 histograms and draw each histogram on separate canvas.
void DrawResidualsAndPulls(const string &detName)
void DrawH2ByPattern(const std::string &histNamePattern, HistScale logx=kLinear, HistScale logy=kLinear, HistScale logz=kLinear, const std::string &drawOpt="")
Select by pattern TH2 histograms and draw each histogram on separate canvas.
void DrawNofObjectsHistograms(const string &detName, const string ¶meter)
Simulation report for clustering QA.
std::vector< TH1 * > H1Vector(const std::string &pattern) const
Return vector of pointers to TH1 histogram.
CbmHistManager * HM() const
Return pointer to Histogram manager.
virtual void Draw()
Inherited from CbmSimulationReport.
static Double_t CalcEfficiency(const TH1 *histRec, const TH1 *histAcc, Double_t scale)
Base class for simulation reports.
std::ostream & Out() const
All text output goes to this stream.
virtual void Create()
Inherited from CbmSimulationReport.
virtual std::string Title(int size, const std::string &title) const =0
Return string with title.
std::string NumberToString(const T &value, int precision=1)
void ScaleAndShrinkHistograms()
vector< string > Split(const string &name, char delimiter)