19 if (Nevt <0) Nevt=1000000;
26 cout <<
"error could not find jobs" << endl;
37 if (debug) cout <<
"found targets " << nTargets<<endl;
39 for (
Int_t itrgt = 0 ; itrgt < nTargets; itrgt++){
40 if (debug) cout <<
"loop targets " << itrgt<<endl;
42 TString ytit =
"Average Quadratic Deviation";
43 TString ftit = ytit +
" versus " + xtit +
Form(
" for target %d",itrgt);
44 c =
new TCanvas(
Form(
"c%d",itrgt), ftit , 50+20*itrgt, 10*itrgt, 750, 650 );
53 TString hNameRef(
Form(
"regression_average_devs_target%d",itrgt));
55 const Int_t maxMethods = 100;
71 mvaNames[nMethods]=methodTitle;
72 if (debug) cout <<
"--- Found directory for method: " << methodTitle << endl;
75 while ( (histKey = (
TKey*)keyIt()) ) {
76 if (histKey->ReadObj()->InheritsFrom(
"TH1F") ){
77 TString s(histKey->ReadObj()->GetName());
78 if( !s.Contains(
"Quadr_Dev") )
continue;
79 if( !s.Contains(Form(
"target_%d_",itrgt)))
continue;
81 if( !s.Contains(
"best90perc") && s.Contains(
"train")) ihist=0;
82 if( s.Contains(
"best90perc") && s.Contains(
"train")) ihist=1;
83 if( !s.Contains(
"best90perc") && s.Contains(
"test")) ihist=2;
84 if( s.Contains(
"best90perc") && s.Contains(
"test")) ihist=3;
85 if (debug) cout <<
"using histogram" << s <<
", ihist="<<ihist<<endl;
89 x[ihist][nMethods] = nMethods+0.44+0.12*ihist;
90 ex[ihist][nMethods] = 0.001;
91 mymax= m[ihist][nMethods] > mymax ? m[ihist][nMethods] : mymax;
92 mymin= m[ihist][nMethods] < mymin ? m[ihist][nMethods] : mymin;
93 if (debug) cout <<
"m"<< ihist <<
"="<<m[ihist][nMethods]<<endl;
98 TH1F* haveragedevs=
new TH1F(
Form(
"haveragedevs%d",itrgt),ftit,nMethods,0.,nMethods);
110 xmin = xmin > 0.? xmin : 0.;
111 if (mymin > 1.e-20 &&
log10(mymax/mymin)>1.5){
113 cout <<
"--- result differ significantly using log scale for display of regression results"<< endl;
118 Float_t x0L = 0.03, y0H = 0.91;
119 Float_t dxL = 0.457-x0L, dyH = 0.14;
128 cout <<
"Training: Average Deviation between target " << itrgt <<
" and estimate" << endl;
129 cout <<
Form(
"%-15s%-15s%-15s",
"Method",
"Average Dev.",
"trunc. Aver.(90%)") <<endl;
130 for (
int i=0;i<nMethods;i++){
131 cout <<
Form(
"%-15s:%#10.3g%#10.3g",
132 (
const char*)mvaNames[i], m[0][i],m[1][i])<<endl;
137 cout <<
"Testing: Average Deviation between target " << itrgt <<
" and estimate" << endl;
138 cout <<
Form(
"%-15s%-15s%-15s",
"Method",
"Average Dev.",
"trunc. Aver.(90%)") <<endl;
139 for (
int i=0;i<nMethods;i++){
140 cout <<
Form(
"%-15s:%#10.3g%#10.3g",
141 (
const char*)mvaNames[i], m[2][i],m[3][i])<<endl;
148 haveragedevs->
SetYTitle(
"Deviation from target");
149 haveragedevs->
Draw();
155 graphTrainAv->
Draw(
"P");
160 graphTruncTrainAv->
Draw(
"P");
165 graphTestAv->
Draw(
"P");
170 graphTruncTestAv->
Draw(
"P");
171 legend->
AddEntry(graphTrainAv,
TString(
"Training Sample, Average Deviation"),
"p");
172 legend->
AddEntry(graphTruncTrainAv,
TString(
"Training Sample, truncated Average Dev. (best 90%)"),
"p");
173 legend->
AddEntry(graphTestAv,
TString(
"Test Sample, Average Deviation"),
"p");
174 legend->
AddEntry(graphTruncTestAv,
TString(
"Test Sample, truncated Average Dev. (best 90%)"),
"p");
181 legHeader.
DrawLatex(xheader, yheader,
"Average Deviation = (#sum (_{ } f_{MVA} - f_{target})^{2} )^{1/2}");
188 TString fname =
"plots/" + hNameRef;
void regression_averagedevs(TString fin, Int_t Nevt=-1, Bool_t useTMVAStyle=kTRUE)
virtual void SetTickx(Int_t value=1)
void imgconv(TCanvas *c, const TString &fname)
virtual void SetMaximum(Double_t maximum=-1111)
This class displays a legend box (TPaveText) containing several legend entries.
virtual TList * GetListOfKeys() const
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
TFile * OpenFile(const TString &fin)
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
TH1F * DrawFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, const char *title="")
Draw an empty pad frame with X and Y axis.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual void SetMinimum(Double_t minimum=-1111)
1-D histogram with a float per channel (see TH1 documentation)}
virtual void SetYTitle(const char *title)
void SetMargin(Float_t margin)
virtual Double_t GetEntries() const
return the current number of entries
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
TFrame * GetFrame()
Get frame.
Int_t GetNumberOfTargets(TDirectory *dir)
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
To draw Mathematical Formula.
virtual void SetMarkerColor(Color_t mcolor=1)
void GetMethodTitle(TString &name, TKey *ikey)
TLatex * DrawLatex(Double_t x, Double_t y, const char *text)
Make a copy of this object with the new parameters And copy object attributes.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual void SetBorderSize(Short_t bordersize)
virtual void SetTextAlign(Short_t align=11)
virtual Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
void Initialize(Bool_t useTMVAStyle=kTRUE)
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetFillColor(Color_t fcolor)
virtual void SetTicky(Int_t value=1)
UInt_t GetListOfJobs(TFile *file, TList &jobdirs)
char * Form(const char *fmt,...)
virtual void SetMarkerStyle(Style_t mstyle=1)
void plot_logo(Float_t v_scale=1.0, Float_t skew=1.0)
Double_t GetRMS(Int_t axis=1) const
virtual void SetMarkerSize(Size_t msize=1)
virtual Int_t GetSize() const
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
Describe directory structure in memory.
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
virtual void SetXTitle(const char *title)
A TGraphErrors is a TGraph with error bars.
virtual void SetTextSize(Float_t tsize=1)
virtual void Update()
Update canvas pad buffers.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
virtual void SetLogy(Int_t value=1)
Set Lin/Log scale for Y.