61 class EfficiencyPlotWrapper {
72 EfficiencyPlotWrapper(
TString classname);
91 EfficiencyPlotWrapper::EfficiencyPlotWrapper(
TString classname)
99 fy0H = 1 - fy0H + fdyH + 0.07;
104 fClassname = classname;
105 fCanvas = newEfficiencyCanvas(classname);
106 fLegend = newEfficiencyLegend();
119 if (fColor == 5 || fColor == 10 || fColor == 11) {
138 void EfficiencyPlotWrapper::addLegendEntry(
TString methodTitle,
TGraph *graph)
140 fLegend->AddEntry(graph, methodTitle,
"l");
143 fLegend->SetY2(fy0H + dyH_local);
152 TCanvas *EfficiencyPlotWrapper::newEfficiencyCanvas(
TString className)
156 TCanvas *c =
new TCanvas(canvas_name, canvas_title, 200, 0, 650, 500);
162 TString xtit =
"Signal Efficiency";
163 TString ytit =
"Background Rejection (1 - eff)";
164 TString ftit =
Form(
"Background Rejection vs Signal Efficiency %s", className.
Data());
170 TH2F *frame =
new TH2F(
Form(
"%s_%s", className.
Data(),
"frame"), ftit, 500, x1, x2, 500, y1, y2);
182 TLegend *EfficiencyPlotWrapper::newEfficiencyLegend()
208 if (file ==
nullptr) {
209 std::cout <<
"ERROR: filename \"" << filename_input <<
"\" is not found.";
228 if (plotType != EEfficiencyPlotType::kRejBvsEffS) {
229 std::cout <<
"Error: For multiclass, only rejB vs effS is currently implemented.";
233 TString graphNameRef =
"rejBvsS";
234 std::map<TString, EfficiencyPlotWrapper *> classCanvasMap;
239 cout <<
"ups .. no methods found in to plot ROC curve for ... give up" << endl;
243 TIter next(&methods);
247 while ((key = (
TKey *)next())) {
253 TIter nextTitle(&titles);
272 TString classname = hname(index + 1, hname.
Length() - (index + 1));
274 EfficiencyPlotWrapper *plotWrapper;
279 plotWrapper = classCanvasMap.at(classname);
281 plotWrapper =
new EfficiencyPlotWrapper(classname);
282 classCanvasMap.emplace(classname.
Data(), plotWrapper);
285 plotWrapper->addGraph(h);
286 plotWrapper->addLegendEntry(methodTitle, h);
virtual const char * GetName() const
Returns name of object.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual TList * GetListOfKeys() const
This class displays a legend box (TPaveText) containing several legend entries.
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad...
TFile * OpenFile(const TString &fin)
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
Short_t Min(Short_t a, Short_t b)
void SetMargin(Float_t margin)
TKey * NextKey(TIter &keyIter, TString className)
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
void efficienciesMulticlass(TString dataset, TString filename_input="TMVAMulticlass.root", EEfficiencyPlotType plotType=EEfficiencyPlotType::kRejBvsEffS, Bool_t useTMVAStyle=kTRUE)
static const double x2[5]
void GetMethodTitle(TString &name, TKey *ikey)
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
void Initialize(Bool_t useTMVAStyle=kTRUE)
tomato 2-D histogram with a float per channel (see TH1 documentation)}
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
char * Form(const char *fmt,...)
virtual TDirectory * GetDirectory(const char *apath, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory named "apath".
static const double x1[5]
UInt_t GetListOfMethods(TList &methods, TDirectory *dir=0)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Describe directory structure in memory.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void plotEfficienciesMulticlass(EEfficiencyPlotType plotType=EEfficiencyPlotType::kRejBvsEffS, TDirectory *BinDir=0)
virtual TObject * ReadObj()
To read a TObject* from the file.
A Graph is a graphics object made of two arrays X and Y with npoints each.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F
const char * Data() const
UInt_t GetListOfTitles(TDirectory *rfdir, TList &titles)
virtual void SetHeader(const char *header="", Option_t *option="")
Sets the header, which is the "title" that appears at the top of the legend.