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 );
50 c->SetTopMargin(0.28);
51 c->SetBottomMargin(0.1);
53 TString hNameRef(
Form(
"regression_average_devs_target%d",itrgt));
55 const Int_t maxMethods = 100;
62 TIter next(&jobDirList);
63 Float_t mymax=0., mymin=std::numeric_limits<float>::max();
71 mvaNames[nMethods]=methodTitle;
72 if (debug) cout <<
"--- Found directory for method: " << methodTitle << endl;
75 while ( (histKey = (
TKey*)keyIt()) ) {
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;
87 m[ihist][nMethods] =
sqrt(
h->GetMean());
88 em[ihist][nMethods] =
h->GetRMS()/(
sqrt(
h->GetEntries())*2.*
h->GetMean());
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);
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;
126 TH1F *hr =
c->DrawFrame(-1.,0.,nMethods+1,
xmax);
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();
150 c->GetFrame()->SetFillColor(21);
151 c->GetFrame()->SetBorderSize(12);
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 = dataset+
"/plots/" + hNameRef;
char * Form(const char *fmt,...)
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Describe directory structure in memory.
virtual TList * GetListOfKeys() const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
A TGraphErrors is a TGraph with error bars.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
1-D histogram with a float per channel (see TH1 documentation)}
virtual void SetXTitle(const char *title)
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetYTitle(const char *title)
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
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.
To draw Mathematical Formula.
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.
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.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
void SetMargin(Float_t margin)
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual const char * GetName() const
Returns name of object.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
const char * Data() const
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
UInt_t GetListOfJobs(TFile *file, TList &jobdirs)
void Initialize(Bool_t useTMVAStyle=kTRUE)
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)
Int_t GetNumberOfTargets(TDirectory *dir)
void imgconv(TCanvas *c, const TString &fname)
void regression_averagedevs(TString dataset, TString fin, Int_t Nevt=-1, Bool_t useTMVAStyle=kTRUE)