|
ATLAS Offline Software
|
#include <MSVtxPlotComparison.h>
|
std::vector< std::string > | m_datapaths {} |
|
std::vector< std::string > | m_labels {} |
|
bool | m_makeRatioPlots {} |
|
TString | m_plotdir {} |
|
TString | m_plotdir_truthVtx {} |
|
TString | m_plotdir_recoVtx {} |
|
TString | m_plotdir_recoVtxHits {} |
|
TString | m_plotdir_vtxResiduals {} |
|
TString | m_plotdir_inputObjects {} |
|
TString | m_plotdir_vtxEfficiency {} |
|
TString | m_plotdir_vtxFakeRate {} |
|
std::unique_ptr< TFile > | m_output_file {nullptr} |
|
std::unique_ptr< TCanvas > | m_c {nullptr} |
|
const Int_t | m_kP10Blue = TColor::GetColor("#3f90da") |
|
const Int_t | m_kP10Yellow = TColor::GetColor("#ffa90e") |
|
const Int_t | m_kP10Red = TColor::GetColor("#bd1f01") |
|
const Int_t | m_kP10Grey = TColor::GetColor("#832db6") |
|
const Int_t | m_kP10Violet = TColor::GetColor("#a96b59") |
|
const Int_t | m_kP10Brown = TColor::GetColor("#94a4a2") |
|
const Int_t | m_kP10Orange = TColor::GetColor("#e76300") |
|
const Int_t | m_kP10Green = TColor::GetColor("#b9ac70") |
|
const Int_t | m_kP10Ash = TColor::GetColor("#717581") |
|
const Int_t | m_kP10Cyan = TColor::GetColor("#92dadd") |
|
const std::array< Int_t, 10 > | m_colors {m_kP10Blue, m_kP10Yellow, m_kP10Red, m_kP10Grey, m_kP10Violet, m_kP10Brown, m_kP10Orange, m_kP10Green, m_kP10Ash, m_kP10Cyan} |
|
|
static constexpr std::array | m_markers {kOpenCircle, kOpenSquare, kOpenTriangleUp, kOpenDiamond, kOpenStar, kOpenTriangleDown, kOpenDoubleDiamond, kOpenCrossX} |
|
Definition at line 37 of file MSVtxPlotComparison.h.
◆ MSVtxPlotComparison()
MSVtxPlotComparison::MSVtxPlotComparison |
( |
const std::vector< std::string > & |
datapaths, |
|
|
const std::vector< std::string > & |
labels, |
|
|
const std::string & |
pltdir |
|
) |
| |
◆ ~MSVtxPlotComparison()
MSVtxPlotComparison::~MSVtxPlotComparison |
( |
| ) |
|
|
virtualdefault |
◆ drawRatio()
void MSVtxPlotComparison::drawRatio |
( |
TGraphAsymmErrors * |
ratio, |
|
|
TGraphAsymmErrors * |
denomErrNorm, |
|
|
const TString & |
xlabel, |
|
|
const TAxis * |
plotXaxis, |
|
|
const TAxis * |
plotYaxis, |
|
|
double |
axisRescaling |
|
) |
| |
|
private |
Definition at line 403 of file MSVtxPlotComparison.cxx.
407 TMultiGraph*
mg =
new TMultiGraph();
413 ratio->SetMarkerSize(0.5);
416 denomErrNorm->SetFillColorAlpha(
m_colors[0], 0.3);
417 denomErrNorm->SetFillStyle(1001);
418 mg->Add(denomErrNorm,
"2");
424 mg->GetXaxis()->ImportAttributes(plotXaxis);
425 mg->GetXaxis()->SetLimits(plotXaxis->GetXmin(), plotXaxis->GetXmax());
426 mg->GetXaxis()->SetTitle(xlabel);
427 mg->GetXaxis()->SetTitleSize(axisRescaling*plotXaxis->GetTitleSize());
428 mg->GetXaxis()->SetTickLength(axisRescaling*plotXaxis->GetTickLength());
429 mg->GetXaxis()->SetLabelSize(axisRescaling*plotXaxis->GetLabelSize());
431 mg->GetYaxis()->SetRangeUser(-0.2, 2.2);
433 mg->GetYaxis()->SetTitleOffset(0.5);
434 mg->GetYaxis()->SetTitleSize(axisRescaling*plotYaxis->GetTitleSize());
435 mg->GetYaxis()->SetLabelSize(axisRescaling*plotYaxis->GetLabelSize());
438 const std::vector<double> vlines{1.};
439 for (
double height : vlines) {
440 TLine*
l =
new TLine(
mg->GetXaxis()->GetXmin(), height,
mg->GetXaxis()->GetXmax(), height);
◆ drawTHStack()
void MSVtxPlotComparison::drawTHStack |
( |
std::unique_ptr< PlotInfo< THStack >> & |
hstackInfo | ) |
|
|
private |
◆ drawTHStackPlot()
void MSVtxPlotComparison::drawTHStackPlot |
( |
std::unique_ptr< PlotInfo< THStack >> & |
hstackInfo | ) |
|
|
private |
Definition at line 142 of file MSVtxPlotComparison.cxx.
149 hstackInfo->plot->Draw(
"nostack");
151 const TString
name(hstackInfo->plot->GetName());
152 double maxy_factor{1.4};
158 hstackInfo->plot->SetMaximum(maxy_factor*hstackInfo->maxy);
160 hstackInfo->plot->GetXaxis()->SetTitle(hstackInfo->xlabel);
161 hstackInfo->plot->GetYaxis()->SetTitle(hstackInfo->ylabel);
163 hstackInfo->legend->Draw();
167 hstackInfo->plot->Write();
◆ drawTHStackRatioPlot()
void MSVtxPlotComparison::drawTHStackRatioPlot |
( |
std::unique_ptr< PlotInfo< THStack >> & |
hstackInfo | ) |
|
|
private |
Definition at line 175 of file MSVtxPlotComparison.cxx.
180 double x1{0.},
x2{1.};
181 double y1{0.3},
y2{1.};
183 TPad* padPlot =
new TPad(
"padPlot",
"padPlot",
x1,
y1,
x2,
y2);
184 TPad* padRatio =
new TPad(
"padRatio",
"padRatio",
x1, 0.,
x2,
y1-
gap);
188 padPlot->SetBottomMargin(0);
191 TString xlabel_original = hstackInfo->xlabel;
192 hstackInfo->xlabel = TString(
"");
195 hstackInfo->plot->GetYaxis()->ChangeLabel(1, -1, -1, -1, -1, -1,
" ");
198 padRatio->SetTopMargin(0);
199 padRatio->SetBottomMargin(0.45);
203 std::vector<TH1*>
hists{};
204 for(TObject *
obj : *(hstackInfo->plot->GetHists()))
hists.push_back((TH1*)
obj);
207 drawRatio(
ratio, denomErrNorm, xlabel_original, hstackInfo->plot->GetXaxis(), hstackInfo->plot->GetYaxis(), axisRescaling);
◆ drawTMultigraph()
void MSVtxPlotComparison::drawTMultigraph |
( |
std::unique_ptr< PlotInfo< TMultiGraph >> & |
mgInfo | ) |
|
|
private |
◆ drawTMultigraphPlot()
void MSVtxPlotComparison::drawTMultigraphPlot |
( |
std::unique_ptr< PlotInfo< TMultiGraph >> & |
mgInfo | ) |
|
|
private |
Definition at line 294 of file MSVtxPlotComparison.cxx.
300 mgInfo->plot->Draw(
"AP");
302 mgInfo->plot->GetYaxis()->SetRangeUser(0, 1.4*mgInfo->maxy);
304 mgInfo->plot->GetXaxis()->SetTitle(mgInfo->xlabel);
305 mgInfo->plot->GetYaxis()->SetTitle(mgInfo->ylabel);
307 mgInfo->legend->Draw();
308 const TString
name(mgInfo->plot->GetName());
314 mgInfo->plot->Write();
◆ drawTMultigraphRatioPlot()
void MSVtxPlotComparison::drawTMultigraphRatioPlot |
( |
std::unique_ptr< PlotInfo< TMultiGraph >> & |
mgInfo | ) |
|
|
private |
Definition at line 320 of file MSVtxPlotComparison.cxx.
325 double x1{0.},
x2{1.};
326 double y1{0.3},
y2{1.};
328 TPad* padPlot =
new TPad(
"padPlot",
"padPlot",
x1,
y1,
x2,
y2);
329 TPad* padRatio =
new TPad(
"padRatio",
"padRatio",
x1, 0.,
x2,
y1-
gap);
333 padPlot->SetBottomMargin(0);
336 TString xlabel_original = mgInfo->xlabel;
337 mgInfo->xlabel = TString(
"");
340 mgInfo->plot->GetYaxis()->ChangeLabel(1, -1, -1, -1, -1, -1,
" ");
344 padRatio->SetTopMargin(0);
345 padRatio->SetBottomMargin(0.45);
350 for(TObject *
obj : *(mgInfo->plot->GetListOfGraphs()))
efficiencies.push_back((TGraphAsymmErrors*)
obj);
353 drawRatio(
ratio, denomErrNorm, xlabel_original, mgInfo->plot->GetXaxis(), mgInfo->plot->GetYaxis(), axisRescaling);
◆ getNormalisedGraph()
TGraphAsymmErrors * MSVtxPlotComparison::getNormalisedGraph |
( |
const TGraphAsymmErrors * |
graph | ) |
|
|
private |
Definition at line 496 of file MSVtxPlotComparison.cxx.
498 TGraphAsymmErrors* graphErrNorm =
new TGraphAsymmErrors();
499 for (Int_t
i=0;
i<graph->GetN(); ++
i){
500 if (graph->GetPointY(
i) == 0)
continue;
501 graphErrNorm->AddPoint(graph->GetPointX(
i), 1.);
502 graphErrNorm->SetPointError(
i, graph->GetErrorXlow(
i), graph->GetErrorXhigh(
i), graph->GetErrorYlow(
i)/graph->GetPointY(
i), graph->GetErrorYhigh(
i)/graph->GetPointY(
i));
503 graphErrNorm->SetPoint(
i, graph->GetPointX(
i), 1.);
◆ getPointIdx()
Int_t MSVtxPlotComparison::getPointIdx |
( |
const TGraphAsymmErrors * |
graph, |
|
|
double |
x |
|
) |
| |
|
private |
Definition at line 487 of file MSVtxPlotComparison.cxx.
490 Double_t *xs = graph->GetX();
491 for (Int_t
i=0;
i<graph->GetN(); ++
i)
if (std::abs(xs[
i]-
x) <= 1
e-6)
return i;
◆ getRatio() [1/2]
TGraphAsymmErrors * MSVtxPlotComparison::getRatio |
( |
const TGraphAsymmErrors * |
num, |
|
|
const TGraphAsymmErrors * |
denom |
|
) |
| |
|
private |
Definition at line 381 of file MSVtxPlotComparison.cxx.
383 TGraphAsymmErrors*
ratio =
new TGraphAsymmErrors();
386 for (Int_t
i=0;
i<
denom->GetN(); ++
i){
387 if (
denom->GetPointY(
i) <= 0.0)
continue;
389 if (num_idx < 0)
continue;
391 Double_t ratio_val =
num->GetPointY(num_idx)/
denom->GetPointY(
i);
392 Double_t error_low =
num->GetErrorYlow(num_idx)/
denom->GetPointY(
i);
393 Double_t error_up =
num->GetErrorYhigh(num_idx)/
denom->GetPointY(
i);
396 ratio->SetPointError(
ratio->GetN()-1,
denom->GetErrorXlow(
i),
denom->GetErrorXhigh(
i), error_low, error_up);
◆ getRatio() [2/2]
TGraphAsymmErrors * MSVtxPlotComparison::getRatio |
( |
const TH1 * |
num, |
|
|
const TH1 * |
denom |
|
) |
| |
|
private |
◆ getTHStackPlotInfo()
Definition at line 97 of file MSVtxPlotComparison.cxx.
100 const TString
name(
h->GetName());
101 TString xlabel(
h->GetXaxis()->GetTitle());
102 TString ylabel(
h->GetYaxis()->GetTitle());
105 auto hstack = std::make_unique<THStack>(
name,
name);
113 std::unique_ptr<TFile>
file(TFile::Open(TString(
m_datapaths[
i]+
"Histograms.root"),
"read"));
114 TH1*
h =
static_cast<TH1*
>(
file->Get(
name));
122 maxy =
h->GetMaximum() > maxy ?
h->GetMaximum() : maxy;
125 return std::make_unique<PlotInfo<THStack>>(std::move(hstack),
legend, maxy, xlabel, ylabel);
◆ getTHStackplotpath()
const TString MSVtxPlotComparison::getTHStackplotpath |
( |
const TString & |
name | ) |
|
|
private |
◆ getTMultigraphPlotInfo()
Definition at line 242 of file MSVtxPlotComparison.cxx.
245 const TString
name(
h->GetName());
248 const TString xlabel(
h->GetPaintedGraph()->GetXaxis()->GetTitle());
249 const TString ylabel(
h->GetPaintedGraph()->GetYaxis()->GetTitle());
253 auto mg = std::make_unique<TMultiGraph>(
name,
name);
261 std::unique_ptr<TFile>
file(TFile::Open(TString(
m_datapaths[
i]+
"Histograms.root"),
"read"));
262 TEfficiency*
h =
static_cast<TEfficiency*
>(
file->Get(
name));
267 h->SetMarkerSize(0.5);
271 TGraphAsymmErrors*
g =
h->GetPaintedGraph();
278 return std::make_unique<PlotInfo<TMultiGraph>>(std::move(
mg),
legend, maxy, xlabel, ylabel);
◆ getTMultigraphplotpath()
const TString MSVtxPlotComparison::getTMultigraphplotpath |
( |
const TString & |
name | ) |
|
|
private |
◆ ignorePlot()
Bool_t MSVtxPlotComparison::ignorePlot |
( |
TKey * |
key | ) |
|
|
private |
◆ isTEfficiency()
Bool_t MSVtxPlotComparison::isTEfficiency |
( |
const TClass * |
objectClass | ) |
|
|
private |
◆ isTH1()
Bool_t MSVtxPlotComparison::isTH1 |
( |
const TClass * |
objectClass | ) |
|
|
private |
Definition at line 452 of file MSVtxPlotComparison.cxx.
454 Bool_t isfromTH1 = objectClass->InheritsFrom(
"TH1");
455 Bool_t isNotTH2 = !objectClass->InheritsFrom(
"TH2");
456 Bool_t isNotTHStack = !objectClass->InheritsFrom(
"THStack");
457 return isfromTH1 && isNotTH2 && isNotTHStack;
◆ makeComparison()
void MSVtxPlotComparison::makeComparison |
( |
| ) |
|
Definition at line 26 of file MSVtxPlotComparison.cxx.
34 std::unique_ptr<TFile> file_0(TFile::Open(TString(
m_datapaths[0]+
"Histograms.root"),
"read"));
35 TIter keyIter(file_0->GetListOfKeys());
39 while ((
key = (TKey*)keyIter())) {
40 TClass *objectClass = gROOT->GetClass(
key->GetClassName());
◆ makeSinglePad()
void MSVtxPlotComparison::makeSinglePad |
( |
| ) |
|
|
private |
◆ makeTEfficiencyComparison()
void MSVtxPlotComparison::makeTEfficiencyComparison |
( |
TKey * |
key | ) |
|
|
private |
◆ makeTH1Comparison()
void MSVtxPlotComparison::makeTH1Comparison |
( |
TKey * |
key | ) |
|
|
private |
◆ setPlotStyle()
void MSVtxPlotComparison::setPlotStyle |
( |
| ) |
|
|
private |
Definition at line 70 of file MSVtxPlotComparison.cxx.
71 gROOT->SetStyle(
"ATLAS");
72 TStyle* plotStyle = gROOT->GetStyle(
"ATLAS");
73 plotStyle->SetOptTitle(0);
74 plotStyle->SetHistLineWidth(1.);
◆ setup()
void MSVtxPlotComparison::setup |
( |
| ) |
|
|
private |
◆ m_c
std::unique_ptr<TCanvas> MSVtxPlotComparison::m_c {nullptr} |
|
private |
◆ m_colors
const std::array<Int_t, 10> MSVtxPlotComparison::m_colors {m_kP10Blue, m_kP10Yellow, m_kP10Red, m_kP10Grey, m_kP10Violet, m_kP10Brown, m_kP10Orange, m_kP10Green, m_kP10Ash, m_kP10Cyan} |
|
private |
◆ m_datapaths
std::vector<std::string> MSVtxPlotComparison::m_datapaths {} |
|
private |
◆ m_kP10Ash
const Int_t MSVtxPlotComparison::m_kP10Ash = TColor::GetColor("#717581") |
|
private |
◆ m_kP10Blue
const Int_t MSVtxPlotComparison::m_kP10Blue = TColor::GetColor("#3f90da") |
|
private |
◆ m_kP10Brown
const Int_t MSVtxPlotComparison::m_kP10Brown = TColor::GetColor("#94a4a2") |
|
private |
◆ m_kP10Cyan
const Int_t MSVtxPlotComparison::m_kP10Cyan = TColor::GetColor("#92dadd") |
|
private |
◆ m_kP10Green
const Int_t MSVtxPlotComparison::m_kP10Green = TColor::GetColor("#b9ac70") |
|
private |
◆ m_kP10Grey
const Int_t MSVtxPlotComparison::m_kP10Grey = TColor::GetColor("#832db6") |
|
private |
◆ m_kP10Orange
const Int_t MSVtxPlotComparison::m_kP10Orange = TColor::GetColor("#e76300") |
|
private |
◆ m_kP10Red
const Int_t MSVtxPlotComparison::m_kP10Red = TColor::GetColor("#bd1f01") |
|
private |
◆ m_kP10Violet
const Int_t MSVtxPlotComparison::m_kP10Violet = TColor::GetColor("#a96b59") |
|
private |
◆ m_kP10Yellow
const Int_t MSVtxPlotComparison::m_kP10Yellow = TColor::GetColor("#ffa90e") |
|
private |
◆ m_labels
std::vector<std::string> MSVtxPlotComparison::m_labels {} |
|
private |
◆ m_makeRatioPlots
bool MSVtxPlotComparison::m_makeRatioPlots {} |
|
private |
◆ m_markers
constexpr std::array MSVtxPlotComparison::m_markers {kOpenCircle, kOpenSquare, kOpenTriangleUp, kOpenDiamond, kOpenStar, kOpenTriangleDown, kOpenDoubleDiamond, kOpenCrossX} |
|
staticconstexprprivate |
◆ m_output_file
std::unique_ptr<TFile> MSVtxPlotComparison::m_output_file {nullptr} |
|
private |
◆ m_plotdir
TString MSVtxPlotComparison::m_plotdir {} |
|
private |
◆ m_plotdir_inputObjects
TString MSVtxPlotComparison::m_plotdir_inputObjects {} |
|
private |
◆ m_plotdir_recoVtx
TString MSVtxPlotComparison::m_plotdir_recoVtx {} |
|
private |
◆ m_plotdir_recoVtxHits
TString MSVtxPlotComparison::m_plotdir_recoVtxHits {} |
|
private |
◆ m_plotdir_truthVtx
TString MSVtxPlotComparison::m_plotdir_truthVtx {} |
|
private |
◆ m_plotdir_vtxEfficiency
TString MSVtxPlotComparison::m_plotdir_vtxEfficiency {} |
|
private |
◆ m_plotdir_vtxFakeRate
TString MSVtxPlotComparison::m_plotdir_vtxFakeRate {} |
|
private |
◆ m_plotdir_vtxResiduals
TString MSVtxPlotComparison::m_plotdir_vtxResiduals {} |
|
private |
The documentation for this class was generated from the following files:
list efficiencies
translate the station name indices into the string staiton name
TGraphAsymmErrors * getNormalisedGraph(const TGraphAsymmErrors *graph)
Bool_t isTEfficiency(const TClass *objectClass)
Bool_t ignorePlot(TKey *key)
double getMaxy(const TGraphAsymmErrors *graph, double current_max)
void drawTMultigraph(std::unique_ptr< PlotInfo< TMultiGraph >> &mgInfo)
std::unique_ptr< TCanvas > m_c
void makeTH1Comparison(TKey *key)
void drawTMultigraphPlot(std::unique_ptr< PlotInfo< TMultiGraph >> &mgInfo)
void makeTEfficiencyComparison(TKey *key)
Bool_t isTH1(const TClass *objectClass)
TString m_plotdir_inputObjects
void drawATLASlabel(const char *text, double x, double y, double textsize)
def gap(flags, cells_name, *args, **kw)
TString m_plotdir_recoVtxHits
std::vector< std::string > m_labels
void drawDetectorRegionLabel(const char *name, const char *customlabel, double x, double y, double textsize)
static constexpr std::array m_markers
const std::array< Int_t, 10 > m_colors
TString m_plotdir_vtxFakeRate
void drawDetectorBoundaryLines(const char *bin_var, double y_max)
void drawTHStackRatioPlot(std::unique_ptr< PlotInfo< THStack >> &hstackInfo)
void drawTHStackPlot(std::unique_ptr< PlotInfo< THStack >> &hstackInfo)
TString m_plotdir_vtxResiduals
TLegend * makeLegend(double lower_x, double lower_y, double upper_x, double upper_y, double textsize)
std::unique_ptr< MSVtxPlotComparison::PlotInfo< TMultiGraph > > getTMultigraphPlotInfo(TEfficiency *h)
std::unique_ptr< TFile > m_output_file
Int_t getPointIdx(const TGraphAsymmErrors *graph, double x)
TString m_plotdir_recoVtx
std::unique_ptr< MSVtxPlotComparison::PlotInfo< THStack > > getTHStackPlotInfo(const TH1 *h)
TString m_plotdir_vtxEfficiency
void drawTHStack(std::unique_ptr< PlotInfo< THStack >> &hstackInfo)
void drawTMultigraphRatioPlot(std::unique_ptr< PlotInfo< TMultiGraph >> &mgInfo)
void drawRatio(TGraphAsymmErrors *ratio, TGraphAsymmErrors *denomErrNorm, const TString &xlabel, const TAxis *plotXaxis, const TAxis *plotYaxis, double axisRescaling)
TString m_plotdir_truthVtx
const TString getTMultigraphplotpath(const TString &name)
TGraphAsymmErrors * getRatio(const TH1 *num, const TH1 *denom)
const TString getTHStackplotpath(const TString &name)
std::vector< std::string > m_datapaths