34 const Int_t width = 600;
40 Int_t countCanvas = 0;
45 while ((key = (
TKey*)next())) {
47 if (!
TString(key->GetName()).BeginsWith(
"Method_"))
continue;
48 if (!
gROOT->GetClass(key->GetClassName())->InheritsFrom(
"TDirectory"))
continue;
57 while ((titkey = (
TKey*)keyIt())) {
59 if (!
gROOT->GetClass(titkey->GetClassName())->InheritsFrom(
"TDirectory"))
continue;
65 cout <<
"--- Found directory for method: " << methodName <<
"::" << methodTitle << endl;
66 TString hname =
"MVA_" + methodTitle;
67 for(
UInt_t icls = 0; icls < classnames.size(); ++icls){
70 std::vector<TString>::iterator classiter = classnames.
begin();
71 for(; classiter!=classnames.end(); ++classiter){
73 +
"_prob_for_" + *classiter);
76 cout <<
":\t mva distribution not available (this is normal for Cut classifier)" << endl;
84 ((
TH1*)hists.
First())->SetTitle(
Form(
"TMVA response for classifier: %s", methodTitle.
Data() ));
88 TString ctitle = ((htype == kMVAType) ?
89 Form(
"TMVA response for class %s %s", classnames.at(icls).Data(),methodTitle.
Data()) :
90 Form(
"TMVA comparison for class %s %s", classnames.at(icls).Data(),methodTitle.
Data())) ;
92 c =
new TCanvas(
Form(
"canvas%d", countCanvas+1), ctitle,
93 countCanvas*50+200, countCanvas*20, width, (
Int_t)width*0.78 );
103 if(((
TH1*)hists[i])->GetMaximum() > histmax)
104 histmax = ((
TH1*)hists[i])->GetMaximum();
111 Float_t maxMult = (htype == kCompareType) ? 1.3 : 1.2;
120 frame->
GetXaxis()->
SetTitle( methodTitle +
" response for "+classnames.at(icls));
134 classiter = classnames.begin();
142 legend->
Draw(
"same");
147 ((
TH1*)hists[i])->Draw(
"histsame");
149 ((
TH1*)hists[i])->GetYaxis()->SetTitle( ytit );
154 if (htype == kCompareType) {
158 classiter = classnames.begin();
159 for(; classiter!=classnames.end(); ++classiter){
161 +
"_prob_for_" + *classiter);
164 cout <<
":\t comparison histogram for overtraining check not available!" << endl;
175 classiter = classnames.begin();
177 legend2->
AddEntry(((
TH1*)othists[i]),*classiter+
" (training sample)",
"P");
180 legend2->
Draw(
"same");
185 if(((
TH1*)othists[i])->GetMaximum() > histmax)
186 histmax = ((
TH1*)othists[i])->GetMaximum();
191 Int_t col = ((
TH1*)hists[i])->GetLineColor();
192 ((
TH1*)othists[i])->SetMarkerSize( 0.7 );
193 ((
TH1*)othists[i])->SetMarkerStyle( 20 );
194 ((
TH1*)othists[i])->SetMarkerColor( col );
195 ((
TH1*)othists[i])->SetLineWidth( 1 );
196 ((
TH1*)othists[i])->Draw(
"e1same");
199 ymax = histmax*maxMult;
205 ((
TH1*)hists[i])->SetLineWidth( 1 );
211 cout <<
"--- Perform Kolmogorov-Smirnov tests" << endl;
212 cout <<
"--- Goodness of consistency for class " << classnames.at(icls)<< endl;
215 Float_t kol = ((
TH1*)hists[j])->KolmogorovTest(((
TH1*)othists[j]),
"X");
216 cout << classnames.at(j) <<
": " << kol << endl;
229 frame->
Draw(
"sameaxis");
252 else if (htype == kCompareType)
TMVAGlob::imgconv( c,
Form(
"%s/plots/overtrain_%s_%s",dataset.
Data(),classnames.at(icls).Data(), methodTitle.
Data()) );
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
void imgconv(TCanvas *c, const TString &fname)
Float_t GetLeftMargin() const
virtual TList * GetListOfKeys() const
This class displays a legend box (TPaveText) containing several legend entries.
virtual void SetLimits(Double_t xmin, Double_t xmax)
virtual TVirtualPad * GetPad(Int_t subpadnumber) const
Get a pointer to subpadnumber of this pad.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
TFile * OpenFile(const TString &fin)
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
std::vector< TString > GetClassNames(TDirectory *dir)
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
void NormalizeHist(TH1 *h)
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
UInt_t GetListOfKeys(TList &keys, TString inherits, TDirectory *dir=0)
void SetMargin(Float_t margin)
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
void GetMethodTitle(TString &name, TKey *ikey)
Book space in a file, create I/O buffers, to fill them, (un)compress them.
void SetMultiClassStyle(TObjArray *hists)
TObject * First() const
Return the object in the first slot.
std::string GetMethodName(TCppMethod_t)
void Initialize(Bool_t useTMVAStyle=kTRUE)
virtual void Draw(Option_t *option="")
Draw this histogram with options.
tomato 2-D histogram with a float per channel (see TH1 documentation)}
Int_t GetEntriesFast() const
char * Form(const char *fmt,...)
void plot_logo(Float_t v_scale=1.0, Float_t skew=1.0)
virtual TDirectory * GetDirectory(const char *apath, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory named "apath".
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
Describe directory structure in memory.
Mother of all ROOT objects.
Float_t GetTopMargin() const
virtual void Update()
Update canvas pad buffers.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F
Float_t GetRightMargin() const
virtual void SetBorderSize(Int_t bordersize=4)
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
void mvasMulticlass(TString dataset, TString fin="TMVAMulticlass.root", HistType htype=kMVAType, Bool_t useTMVAStyle=kTRUE)
const char * Data() const