21 TCanvas*
c =
new TCanvas(
"c",
"the canvas", 200, 0, 650, 500 );
28 Float_t x0L = 0.107, y0H = 0.899;
29 Float_t dxL = 0.557-x0L, dyH = 0.22;
31 TLegend *legend =
new TLegend( x0L, y0H-dyH, x0L+dxL, y0H );
36 TString xtit =
"Training Step";
39 TString ftit =
"Training History";
41 TString hNameRef =
"TrainingHistory";
47 cout <<
"ups .. no methods found in to plot training history for ... give up" << endl;
50 TIter xnext(&xmethods);
53 while ((xkey = (TKey*)xnext())) {
54 TDirectory * mDir = (TDirectory*)xkey->
ReadObj();
57 if (ninst==0) cout <<
"hmm... sorry, but this printout was supposed to be only to keep the compiler quite.. never supposed to happen :(" << endl;
58 TIter nextTitle(&titles);
62 titDir = (TDirectory *)titkey->
ReadObj();
72 if (
h->GetMaximum() > y2) y2 =
h->GetMaximum()*1.1;
73 if (
h->GetMinimum() < y1) y1 =
h->GetMinimum();
74 if (
h->GetBinLowEdge(0) < x1 ) x1 =
h->GetBinLowEdge(0);
75 if (
h->GetBinLowEdge(
h->GetNbinsX()+1 ) > x2 ) x2 =
h->GetBinLowEdge(
h->GetNbinsX()+1 );
84 if(
gROOT->FindObject(
"frame")!=0)
gROOT->FindObject(
"frame")->Delete();
85 TH2F* frame =
new TH2F(
"frame", ftit, 500, x1, x2, 500, y1, y2 );
100 cout <<
"ups .. no methods found in to plot ROC curve for ... give up" << endl;
104 TIter next(&methods);
107 while ((key = (TKey*)next())) {
108 TDirectory * mDir = (TDirectory*)key->
ReadObj();
111 if (ninst==0) cout <<
"hmm... sorry, but this printout was supposed to be only to keep the compiler quite.. never supposed to happen :(" << endl;
112 TIter nextTitle(&titles);
116 titDir = (TDirectory *)titkey->
ReadObj();
123 TString hname =
h->GetName();
126 h->SetLineColor(color);
127 color++;
if (color == 5 || color == 10 || color == 11)
color++;
137 TListIter hIt(&hists);
140 TH1* histWithLargestInt(0);
141 while ((hist = (TH1*)hIt())!=0) {
142 Double_t integral = hist->Integral(1,hist->FindBin(0.9999));
143 if (integral>largestInt) {
144 largestInt = integral;
145 histWithLargestInt = hist;
148 if (histWithLargestInt == 0) {
149 cout <<
"ERROR - unknown hist \"histWithLargestInt\" --> serious problem in ROOT file" << endl;
152 TString histLabel = TString(histWithLargestInt->GetTitle()).ReplaceAll(
"MVA_",
"");
154 legend->
AddEntry(histWithLargestInt, histLabel,
"l");
155 hists.
Remove(histWithLargestInt);
160 dyH *= (1. + (
Float_t(std::min(10,nmva) - 3.0)/4.0) );
161 legend->
SetY1( y0H - dyH);
164 frame->
Draw(
"sameaxis");
165 legend->
Draw(
"same");
175 TString fname = dataset+
"/plots/" + hNameRef;
176 if (TString(BinDir->
GetName()).Contains(
"multicut")){
177 TString fprepend(BinDir->
GetName());
178 fprepend.ReplaceAll(
"multicutMVA_",
"");
179 fname = dataset+
"plots/" + fprepend +
"_" + hNameRef;
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
TDirectory * GetDirectory(const char *apath, Bool_t printError=false, const char *funcname="GetDirectory") override
Find a directory using apath.
Describe directory structure in memory.
virtual TList * GetListOfKeys() const
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual TObject * ReadObj()
To read a TObject* from the file.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
void Draw(Option_t *option="") override
Draw this box with its current attributes.
virtual void SetHeader(const char *header="", Option_t *option="")
void SetMargin(Float_t margin)
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
virtual const char * GetName() const
Returns name of object.
void SetY1(Double_t y1) override
Set the Y1 value.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
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)
void plot_logo(Float_t v_scale=1.0, Float_t skew=1.0)
TFile * OpenFile(const TString &fin)
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
UInt_t GetListOfMethods(TList &methods, TDirectory *dir=nullptr)
void imgconv(TCanvas *c, const TString &fname)
void plot_training_history(TString dataset, TFile *file, TDirectory *BinDir=nullptr)
void training_history(TString dataset, TString fin="TMVA.root", Bool_t useTMVAStyle=kTRUE)