34 TString dirname=
"Method_RuleFit";
38 TDirectory* dir = (TDirectory*)file->
Get(dirname );
43 while ((key = (TKey*)next())) {
45 if (!
gROOT->GetClass(key->GetClassName())->InheritsFrom(
"TDirectory"))
continue;
47 TDirectory* rfdir = (TDirectory*)key->ReadObj();
48 TDirectory* vardir = rfdir;
49 TDirectory* corrdir = rfdir;
52 TIter keyIter(&titles);
64 if (vardir==0)
return;
65 if (corrdir==0)
return;
67 const TString rfName = rfdir->
GetName();
68 const TString maintitle = rfName +
" : Rule Importance, 2D";
69 const TString rfNameOpt =
"_RF2D_";
73 "rulevisCorr_gaussdecorr" };
74 const TString outputName = outfname[
type]+
"_"+rfdir->
GetName();
93 if (valmax>rfmax) rfmax = valmax;
94 if (valmin<rfmin) rfmin = valmin;
101 cout <<
"ERROR: no RF2D plots found..." << endl;
106 Double_t targetrange = maxrange - minrange;
108 const Int_t nContours = 100;
112 for (
Int_t i=0; i<nContours; i++) {
113 contourLevels[i] = rfmin+dcl*
Double_t(i);
121 Int_t noPlots = (noVars*(noVars+1)/2) - noVars;
132 xPad = 1; yPad = 1; width = 500; height = 0.7*width;
break;
134 xPad = 2; yPad = 1; width = 600; height = 0.7*width;
break;
136 xPad = 3; yPad = 1; width = 900; height = 0.4*width;
break;
138 xPad = 2; yPad = 2; width = 600; height = width;
break;
140 xPad = 3; yPad = 2; width = 800; height = 0.7*width;
break;
142 Int_t noPad = xPad * yPad ;
145 const Int_t noCanvas = 1 + (
Int_t)((noPlots - 0.001)/noPad);
146 TCanvas **
c =
new TCanvas*[noCanvas];
147 for (
Int_t ic=0; ic<noCanvas; ic++)
c[ic] = 0;
150 Int_t countCanvas = 0;
160 while ((key = (TKey*)next())) {
165 TH2F* sig = (TH2F*)key->
ReadObj();
171 if ((
c[countCanvas]==NULL) || (countPad>noPad)) {
172 TString cname(
"rulecorr");
173 cname += countCanvas + 1;
176 c[countCanvas] =
new TCanvas( cname, maintitle,
177 countCanvas*50+200, countCanvas*20, width, height );
179 c[countCanvas]->Divide(xPad,yPad);
183 TPad *cPad = (TPad *)(
c[countCanvas]->GetPad(countPad));
184 c[countCanvas]->cd(countPad);
188 TString bgname = hname;
190 TKey* hkey = corrdir->
GetKey(bgname);
191 TH2F* bgd = (TH2F*)hkey->
ReadObj();
193 cout <<
"ERROR!!! couldn't find background histo for" << hname << endl;
200 TString rfname = hname;
202 TKey *hrfkey = rfdir->
GetKey(rfname);
203 TH2F* hrf2 = (TH2F*)hrfkey->
ReadObj();
213 hrf2->
SetContour(nContours,&contourLevels[0]);
225 title.ReplaceAll(
"signal",
"");
235 hrf2->
Draw(
"colz ah");
237 if (countPad==2) sc = 1.3;
241 sig->
Scale(1.0/smax);
243 sig->
Draw(
"same cont3");
246 bgd->
Scale(1.0/smax);
248 bgd->
Draw(
"same cont3");
255 sig->
Draw(
"sameaxis");
267 legend->
AddEntry(bgd,
"Background",
"F");
268 legend->
Draw(
"same");
276 if (countPad > noPad) {
277 c[countCanvas]->Update();
286 if (countPad <= noPad) {
287 c[countCanvas]->Update();
288 TString fname =
TString::Format(
"plots/%s_c%i", outfname[type].Data(), countCanvas+1 );
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 void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Float_t GetLeftMargin() const
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
Float_t GetTopMargin() const
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Describe directory structure in memory.
virtual Bool_t cd()
Change current directory to "this" directory.
virtual TKey * GetKey(const char *, Short_t=9999) const
virtual TList * GetListOfKeys() const
void SetTitle(const char *title) override
Change/set the title.
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
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)
virtual void SetContour(Int_t nlevels, const Double_t *levels=nullptr)
Set the number and values of contour levels.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
virtual TH2 * Rebin2D(Int_t nxgroup=2, Int_t nygroup=2, const char *newname="")
Rebin this histogram grouping nxgroup/nygroup bins along the xaxis/yaxis together.
virtual const char * GetClassName() const
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.
void SetMargin(Float_t margin)
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
void Update() override
Update pad.
virtual void SetBorderSize(Int_t bordersize=4)
Sets the border size of the TPave box and shadow.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
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
UInt_t GetListOfTitles(TDirectory *rfdir, TList &titles)
TKey * NextKey(TIter &keyIter, TString className)
TFile * OpenFile(const TString &fin)
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
void imgconv(TCanvas *c, const TString &fname)
void rulevisCorr(TString fin="TMVA.root", TMVAGlob::TypeOfPlot type=TMVAGlob::kNorm, bool useTMVAStyle=kTRUE)