141 std::cout <<
"Could not locate directory '" << dataset <<
"/InputVariables_Id' in file: " << fin << std::endl;
159 cout <<
"ups .. no methods found in to plot ROC curve for ... give up" << endl;
163 TIter next(&methods);
167 while ((key = (
TKey *)next())) {
173 TIter nextTitle(&titles);
197 rocCurves.push_back(std::make_tuple(methodTitle, classname,
h));
219 for (
auto &item : rocCurves) {
221 TString methodTitle = std::get<0>(item);
222 TString classname = std::get<1>(item);
229 }
catch (
const std::out_of_range &) {
230 cout <<
TString::Format(
"ERROR: Class %s discovered among plots but was not found by TMVAMulticlassGui. Skipping.",
263 if (plotType != EEfficiencyPlotType::kRejBvsEffS) {
264 std::cout <<
"For multiclass, only rejB vs effS is currently implemented.";
270 if (file ==
nullptr) {
271 std::cout <<
"ERROR: filename \"" << filename_input <<
"\" is not found.";
279 TString graphNameRef =
"_rejBvsS_";
282 for (
auto &classname : classnames) {
286 classCanvasMap.emplace(classname.
Data(), plotWrapper);
292 for (
auto const &item : classCanvasMap) {
293 auto plotWrapper = item.second;
306 std::cout <<
"--- Running Roc1v1Gui for input file: " << fin << std::endl;
311 TString title =
"1v1 ROC curve comparison";
318 for (
auto &classname : classnames) {
328 gROOT->SaveContext();
359 if (file ==
nullptr) {
360 std::cout <<
"ERROR: filename \"" << fin <<
"\" is not found.";
366 for (
auto &classname : classnames) {
368 if (classname == baseClassname) {
375 classCanvasMap.emplace(classname.
Data(), plotWrapper);
381 for (
auto const &item : classCanvasMap) {
382 auto plotWrapper = item.second;
421 graph->SetLineWidth(3);
470 TString xtit =
"Signal Efficiency";
471 TString ytit =
"Background Rejection (1 - eff)";
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
Note: This file assumes a certain structure on the input file.
EfficiencyPlotWrapper(TString name, TString title, TString dataset, size_t i)
Private class EfficiencyPlotWrapper - Implementation.
void addLegendEntry(TString methodTitle, TGraph *graph)
WARNING: Uses the current color, thus the correct call ordering is: plotWrapper->addGraph(....
TCanvas * newEfficiencyCanvas(TString name, TString title, size_t i)
Helper to create new Canvas.
TLegend * newEfficiencyLegend()
Helper to create new legend.
Int_t addGraph(TGraph *graph)
Adds a new graph to the plot.
void save()
Saves the current state of the plot to disk.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
void Update() override
Update canvas pad buffers.
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
void Show()
Show control bar.
void AddButton(TControlBarButton *button)
Add button.
void SetTextColor(const char *colorName)
Sets text color for control bar buttons, e.g.:
TDirectory * GetDirectory(const char *apath, Bool_t printError=false, const char *funcname="GetDirectory") override
Find a directory named "apath".
Describe directory structure in memory.
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory using apath.
virtual TList * GetListOfKeys() const
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
A TGraph is an object made of two arrays X and Y with npoints each.
1-D histogram with a float per channel (see TH1 documentation)
virtual void SetMaximum(Double_t maximum=-1111)
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual void SetMinimum(Double_t minimum=-1111)
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual TObject * ReadObj()
To read a TObject* from the file.
This class displays a legend box (TPaveText) containing several legend entries.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
void Draw(Option_t *option="") override
Draw this legend with its current attributes.
virtual void SetHeader(const char *header="", Option_t *option="")
Sets the header, which is the "title" that appears at the top of the legend.
void Paint(Option_t *option="") override
Paint this legend with its current attributes.
void SetMargin(Float_t margin)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
void SetY2(Double_t y2) override
Set the Y2 value.
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
std::vector< std::tuple< TString, TString, TGraph * > > roccurvelist_t
std::map< TString, EfficiencyPlotWrapper * > classcanvasmap_t
UInt_t GetListOfTitles(TDirectory *rfdir, TList &titles)
void Initialize(Bool_t useTMVAStyle=kTRUE)
TKey * NextKey(TIter &keyIter, TString className)
void GetMethodTitle(TString &name, TKey *ikey)
TFile * OpenFile(const TString &fin)
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
UInt_t GetListOfMethods(TList &methods, TDirectory *dir=nullptr)
std::vector< TString > GetClassNames(TDirectory *dir)
void imgconv(TCanvas *c, const TString &fname)
create variable transformations
roccurvelist_t getRocCurves(TDirectory *binDir, TString methodPrefix, TString graphNameRef)
void efficienciesMulticlass1vs1(TString dataset, TString fin)
std::vector< TString > getclassnames(TString dataset, TString fin)
void plotEfficienciesMulticlass1vs1(TString dataset, TString fin, TString baseClassname)
void plotEfficienciesMulticlass1vsRest(TString dataset, EEfficiencyPlotType plotType=EEfficiencyPlotType::kRejBvsEffS, TString filename_input="TMVAMulticlass.root")
void plotEfficienciesMulticlass(roccurvelist_t rocCurves, classcanvasmap_t classCanvasMap)
void efficienciesMulticlass1vsRest(TString dataset, TString filename_input="TMVAMulticlass.root", EEfficiencyPlotType plotType=EEfficiencyPlotType::kRejBvsEffS, Bool_t useTMVAStyle=kTRUE)
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.