23#include <boost/assign/list_inserter.hpp>
24#include <boost/assign/list_of.hpp>
27using boost::assign::list_of;
28using boost::assign::push_back;
42 Out() <<
R()->
Title(0,
"Magnetic field QA") << std::endl;
124 vector<TGraph2D*> graphs2D =
HM()->
G2Vector(
"hfa_" + b +
"_Graph2D_.*");
125 for (UInt_t i = 0; i < graphs2D.size(); i++) {
126 string name = graphs2D[i]->GetName();
127 string canvasName =
GetReportName() +
"_slice_" + b +
"_" + m +
"_at_z_" + Split(name,
'_')[3];
128 TCanvas* canvas =
CreateCanvas(canvasName.c_str(), canvasName.c_str(), 1000, 1000);
129 canvas->Divide(3, 2);
130 TGraph2D* aprGraph =
HM()->
G2(FindAndReplace(name,
"_" + b +
"_",
"_" + b + m +
"_"));
131 TH1* errH1 =
HM()->
H1(FindAndReplace(name,
"_" + b +
"_Graph2D_",
"_" + b +
"Err" + m +
"_H1_"));
132 TH2* errH2 =
HM()->
H2(FindAndReplace(name,
"_" + b +
"_Graph2D_",
"_" + b +
"Err" + m +
"_H2_"));
133 TH1* relErrH1 =
HM()->
H1(FindAndReplace(name,
"_" + b +
"_Graph2D_",
"_" + b +
"RelErr" + m +
"_H1_"));
134 TH2* relErrH2 =
HM()->
H2(FindAndReplace(name,
"_" + b +
"_Graph2D_",
"_" + b +
"RelErr" + m +
"_H2_"));
152 vector<TGraph2D*> graphs2D =
HM()->
G2Vector(
"hfa_Bx_Graph2D_.*");
153 for (UInt_t i = 0; i < graphs2D.size(); i++) {
154 string z = Split(graphs2D[i]->GetName(),
'_')[3];
155 string canvasName =
GetReportName() +
"_" + err +
"_degree_z_" + z;
156 TCanvas* canvas =
CreateCanvas(canvasName.c_str(), canvasName.c_str(), 1000, 1000);
157 canvas->Divide(3, 2);
159 TLegend* l1 =
new TLegend(0.1, 0.1, 0.9, 0.9);
160 l1->SetFillColor(kWhite);
161 l1->SetTextSize(0.1);
163 l1->SetHeader(
"Polynomial degree");
165 Double_t maxBx = std::numeric_limits<Double_t>::min();
166 Double_t maxBy = std::numeric_limits<Double_t>::min();
167 Double_t maxBz = std::numeric_limits<Double_t>::min();
168 Double_t maxMod = std::numeric_limits<Double_t>::min();
169 vector<TH1*> errBx =
HM()->
H1Vector(
"hfa_Bx" + err +
"Apr_H1_" + z +
"_.*");
170 if (errBx.empty())
return;
171 vector<TH1*> errBy(errBx.size());
172 vector<TH1*> errBz(errBx.size());
173 vector<TH1*> errMod(errBx.size());
174 for (UInt_t iP = 0; iP < errBx.size(); iP++) {
175 string name = errBx[iP]->GetName();
177 errBy[iP] =
HM()->
H1(FindAndReplace(name,
"_Bx",
"_By"));
178 errBz[iP] =
HM()->
H1(FindAndReplace(name,
"_Bx",
"_Bz"));
179 errMod[iP] =
HM()->
H1(FindAndReplace(name,
"_Bx",
"_Mod"));
180 string draw_opt = (iP == 0) ?
"" :
"SAME";
194 string degree = Split(name,
'_')[4];
195 l1->AddEntry(errBx[iP], degree.c_str(),
"lp");
197 maxBx = std::max(maxBx, errBx[iP]->GetMaximum());
198 maxBy = std::max(maxBy, errBy[iP]->GetMaximum());
199 maxBz = std::max(maxBz, errBz[iP]->GetMaximum());
200 maxMod = std::max(maxMod, errMod[iP]->GetMaximum());
202 errBx[0]->SetMaximum(1.1 * maxBx);
203 errBy[0]->SetMaximum(1.1 * maxBy);
204 errBz[0]->SetMaximum(1.1 * maxBz);
205 errMod[0]->SetMaximum(1.1 * maxMod);
ClassImp(CbmConverterManager)
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)
void DrawGraph2D(TGraph2D *graph, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
Helper functions for drawing 1D and 2D histograms and graphs.
Abstract class for basic report elements (headers, tables, images etc.).
static Int_t MarkerSize()
TGraph2D * G2(const std::string &name) const
Return pointer to TGraph2D.
std::vector< TGraph2D * > G2Vector(const std::vector< std::string > &names) const
Return vector of pointers to TGraph2D.
std::vector< TH1 * > H1Vector(const std::vector< std::string > &names) const
Return vector of pointers to TH1 histogram.
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
CbmLitFieldApproximationQaReport()
Constructor.
std::string PrintSummaryTable()
Return string with summary table for field QA.
void DrawApr(const std::string &err)
Draw comparison for different polynomial orders for each slice.
virtual ~CbmLitFieldApproximationQaReport()
Destructor.
virtual void Draw()
Inherited from CbmSimulationReport.
virtual void Create()
Inherited from CbmSimulationReport.
void DrawSlices(const std::string &component, const std::string &opt)
Draw canvas with histograms for each approximated slice.
virtual std::string Title(int size, const std::string &title) const =0
Return string with title.
virtual std::string DocumentBegin() const =0
Return string with open tags for document.
virtual std::string DocumentEnd() const =0
Return string with close tags of the document.
std::ostream & Out() const
All text output goes to this stream.
void SetReportName(const std::string &name)
void PrintCanvases() const
Print images created from canvases in the report.
const std::string & GetReportName() const
const CbmReportElement * R() const
Accessor to CbmReportElement object. User has to write the report using available tags from CbmReport...
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...
CbmHistManager * HM() const
Return pointer to Histogram manager.
string FindAndReplace(const string &name, const string &oldSubstr, const string &newSubstr)
vector< string > Split(const string &name, char delimiter)
std::string ToString(const T &value)