39 int nVersions =
fpObjDB->GetNofVersions();
40 int iDef =
fpObjDB->GetDefaultID();
43 std::string sOption = opt;
44 for (
auto& ch : sOption) {
45 ch = std::tolower(ch);
47 bool bDrawRatio = sOption.find(
"r") != std::string::npos;
48 bool bDrawDiff = sOption.find(
"d") != std::string::npos;
49 int nPads =
static_cast<int>(bDrawRatio) +
static_cast<int>(bDrawDiff) + 1;
52 std::string sCanvName =
fsBaseName +
"_cmp_canvas";
53 std::string sCanvTitle =
"Comparison result for \"" +
fsBaseName +
"\"";
54 fpCanvas = std::make_shared<TCanvas>(sCanvName.data(), sCanvTitle.data(), 1500, 500);
57 TPad* pPadOrig =
nullptr;
58 TPad* pPadRatio =
nullptr;
59 TPad* pPadDiff =
nullptr;
61 double xPadSize = 1.0 / nPads;
64 pPadOrig =
new TPad(
"p1",
"p1", 0.0, 0.0, xPadSize, 1.0);
65 pPadOrig->SetMargin(0.20, 0.05, 0.20, 0.10);
70 pPadRatio =
new TPad(
"p2",
"p2", xNext, 0.0, xNext + xPadSize, 1.0);
71 pPadRatio->SetMargin(0.20, 0.05, 0.20, 0.10);
77 pPadDiff =
new TPad(
"p3",
"p3", xNext, 0.0, xNext + xPadSize, 1.0);
78 pPadDiff->SetMargin(0.20, 0.05, 0.20, 0.10);
84 const char* titleRatio = Form(
"Ratio to %s",
fpObjDB->GetVersionLabel(iDef).data());
85 const char* titleDiff = Form(
"Difference from %s",
fpObjDB->GetVersionLabel(iDef).data());
86 const char* xAxisTitle =
static_cast<TProfile*
>(
fvpObjects[0])->GetXaxis()->GetTitle();
87 const char* yAxisTitle =
static_cast<TProfile*
>(
fvpObjects[0])->GetYaxis()->GetTitle();
91 auto* pMultiGraphOrig =
new TMultiGraph(
fsBaseName.data(), title);
93 for (
int iV = 0; iV < nVersions; ++iV) {
94 auto* pCopy =
new TGraphAsymmErrors((TH1*)
fvpObjects[iV]);
95 pCopy->SetMarkerStyle(20);
96 pCopy->SetTitle(
fpObjDB->GetVersionLabel(iV).data());
97 pMultiGraphOrig->Add(pCopy,
"P");
99 pMultiGraphOrig->GetXaxis()->SetTitle(xAxisTitle);
100 pMultiGraphOrig->GetYaxis()->SetTitle(yAxisTitle);
101 pMultiGraphOrig->Draw(
"A pmc plc");
102 pPadOrig->BuildLegend();
105 auto* pDefault =
static_cast<TProfile*
>(
fvpObjects[iDef])->ProjectionX();
110 auto* pMultiGraphRatio =
new TMultiGraph((
fsBaseName +
"_ratio").data(), titleRatio);
111 for (
int iV = 0; iV < nVersions; ++iV) {
115 auto* pRatio =
static_cast<TProfile*
>(
fvpObjects[iV])->ProjectionX();
116 auto currErrorLevel = gErrorIgnoreLevel;
117 gErrorIgnoreLevel = kError;
118 auto* pCopy =
new TGraphAsymmErrors(pRatio, pDefault,
"pois");
119 gErrorIgnoreLevel = currErrorLevel;
120 pCopy->SetMarkerStyle(20);
121 pMultiGraphRatio->Add(pCopy,
"P");
128 pMultiGraphRatio->GetXaxis()->SetTitle(xAxisTitle);
129 pMultiGraphRatio->GetYaxis()->SetTitle(
"ratio");
130 pMultiGraphRatio->Draw(
"A pmc plc");
136 auto* pMultiGraphDiff =
new TMultiGraph((
fsBaseName +
"_diff").data(), titleDiff);
137 for (
int iV = 0; iV < nVersions; ++iV) {
141 auto* pDiff =
static_cast<TProfile*
>(
fvpObjects[iV])->ProjectionX();
142 pDiff->Add(pDefault, -1.);
143 auto* pCopy =
new TGraphAsymmErrors(pDiff);
144 pCopy->GetYaxis()->SetTitle(
"difference");
145 pCopy->SetMarkerStyle(20);
146 pMultiGraphDiff->Add(pCopy,
"P");
153 pMultiGraphDiff->GetXaxis()->SetTitle(xAxisTitle);
154 pMultiGraphDiff->GetYaxis()->SetTitle(
"difference");
155 pMultiGraphDiff->Draw(
"A pmc plc");
160 if (pPadRatio) pPadRatio->Draw();
161 if (pPadDiff) pPadDiff->Draw();