49 TString pname =
"purS_" + methodTitle;
50 TString epname =
"effpurS_" + methodTitle;
51 TString ssigname =
"significance_" + methodTitle;
53 sigE = (
TH1*)origSigE->
Clone(
"sigEffi");
54 bgdE = (
TH1*)origBgdE->Clone(
"bgdEffi");
56 Int_t nbins = sigE->GetNbinsX();
57 Double_t low = sigE->GetBinLowEdge(1);
58 Double_t high = sigE->GetBinLowEdge(nbins+1);
59 purS =
new TH1F(pname, pname, nbins, low, high);
60 sSig =
new TH1F(ssigname, ssigname, nbins, low, high);
61 effpurS =
new TH1F(epname, epname, nbins, low, high);
64 sigE->SetTitle(
Form(
"Cut efficiencies for %s classifier", methodTitle.Data()) );
70 sigE->SetFillStyle( 0 );
71 bgdE->SetFillStyle( 0 );
72 sSig->SetFillStyle( 0 );
73 sigE->SetLineWidth( 3 );
74 bgdE->SetLineWidth( 3 );
75 sSig->SetLineWidth( 3 );
78 purS->SetFillStyle( 0 );
79 purS->SetLineWidth( 2 );
80 purS->SetLineStyle( 5 );
81 effpurS->SetFillStyle( 0 );
82 effpurS->SetLineWidth( 2 );
83 effpurS->SetLineStyle( 6 );
88 fNSignal = fSigInput->GetNumber();
93 fNBackground = fBkgInput->GetNumber();
99 auto replace_vars = [](
TString &
f,
char oldLetter,
char newLetter ) {
100 auto pos =
f.First(oldLetter);
101 while(pos !=
kNPOS) {
102 if ( ( pos > 0 && !
TString(
f[pos-1]).IsAlpha() ) ||
108 pos =
f.Index(oldLetter,pos2);
113 replace_vars(formula,
'S',
'x');
114 replace_vars(formula,
'B',
'y');
124 f.ReplaceAll(
"(",
"{");
125 f.ReplaceAll(
")",
"}");
126 f.ReplaceAll(
"sqrt",
"#sqrt");
132 UpdateSignificanceHists();
144 TIter next(fInfoList);
154 fSigInput->Disconnect();
155 fBkgInput->Disconnect();
156 fDrawButton->Disconnect();
157 fCloseButton->Disconnect();
159 fMain->CloseWindow();
215 fSigInput->
Connect(
"ValueSet(Long_t)",
"TMVA::StatDialogMVAEffs",
this,
"SetNSignal()");
216 fBkgInput->
Connect(
"ValueSet(Long_t)",
"TMVA::StatDialogMVAEffs",
this,
"SetNBackground()");
227 if (fInfoList==0)
return;
228 if (fInfoList->First()==0)
return;
234 TIter next(fInfoList);
247 TIter next(fInfoList);
250 if (cname.
Length() > maxLenTitle) maxLenTitle = cname.
Length();
251 TString str =
Form(
"%*s ( #signal, #backgr.) Optimal-cut %s NSig NBkg EffSig EffBkg",
252 maxLenTitle, cname.
Data(), GetFormulaString().Data() );
253 cout <<
"--- " << setfill(
'=') << setw(str.
Length()) <<
"" << setfill(
' ') << endl;
254 cout <<
"--- " << str << endl;
255 cout <<
"--- " << setfill(
'-') << setw(str.
Length()) <<
"" << setfill(
' ') << endl;
268 if (GetFormulaString() ==
"S/sqrt(B)") {
269 maxSigErr = sig *
sqrt( 1./
S + 1./(2.*
B));
281 PrintResults( info );
283 cout <<
"--- " << setfill(
'-') << setw(str.
Length()) <<
"" << setfill(
' ') << endl << endl;
289 TIter next(fInfoList);
297 fInfoList =
new TList;
300 TIter next(
file->GetDirectory(dataset.Data())->GetListOfKeys());
302 while( (key = (
TKey*)next()) ) {
305 if( !
gROOT->GetClass(key->
GetClassName())->InheritsFrom(
"TDirectory") )
continue;
307 cout <<
"--- Found directory: " << ((
TDirectory*)key->
ReadObj())->GetName() << endl;
313 while((titkey = (
TKey*)keyIt())) {
314 if( !
gROOT->GetClass(titkey->
GetClassName())->InheritsFrom(
"TDirectory") )
continue;
324 cout <<
"--- Classifier: " << info->
methodTitle << endl;
326 info->
sig =
dynamic_cast<TH1*
>(titDir->
Get( hname +
"_S" ));
327 info->
bgd =
dynamic_cast<TH1*
>(titDir->
Get( hname +
"_B" ));
328 info->
origSigE =
dynamic_cast<TH1*
>(titDir->
Get( hname +
"_effS" ));
329 info->
origBgdE =
dynamic_cast<TH1*
>(titDir->
Get( hname +
"_effB" ));
333 fInfoList->Add(info);
342 Int_t countCanvas = 0;
348 TIter next(fInfoList);
381 c->SetRightMargin ( 2.0 );
400 c->GetLeftMargin() + 0.4, 1 -
c->GetTopMargin() + 0.12 );
403 legend1->
AddEntry(info->
bgdE,
"Background efficiency",
"L");
404 legend1->
Draw(
"same");
408 TLegend *legend2=
new TLegend(
c->GetLeftMargin() + 0.4, 1 -
c->GetTopMargin(),
409 1 -
c->GetRightMargin(), 1 -
c->GetTopMargin() + 0.12 );
413 legend2->
AddEntry(info->
sSig,GetLatexFormula().Data(),
"L");
414 legend2->
Draw(
"same");
429 info->
line1 = tl.
DrawLatex( 0.15, 0.23,
Form(
"For %1.0f signal and %1.0f background", fNSignal, fNBackground));
430 tl.
DrawLatex( 0.15, 0.19,
"events the maximum "+GetLatexFormula()+
" is");
446 tl.
DrawLatex( 0.13, 0.77,
"Method Cuts provides a bundle of cut selections, each tuned to a");
447 tl.
DrawLatex(0.13, 0.74,
"different signal efficiency. Shown is the purity for each cut selection.");
478 if (info->
line1 !=0 )
479 info->
line1->
SetText( 0.15, 0.23,
Form(
"For %1.0f signal and %1.0f background", fNSignal, fNBackground));
481 if (info->
line2 !=0 ) {
483 info->
line2->
SetText( 0.15, 0.15,
Form(
"%3.2g +- %3.2g when cutting at %3.2g",
496 TString opt =
Form(
"%%%is: (%%9.8g,%%9.8g) %%9.4f %%10.6g %%8.7g %%8.7g %%8.4g %%8.4g",
510 TString opt =
Form(
"%%%is: (%%9.8g,%%9.8g) %%9.4f (%%8.3g +-%%6.3g) %%8.7g %%8.7g %%8.4g %%8.4g",
532 if (graphicsClient ==
nullptr) {
538 StatDialogMVAEffs* gGui =
new StatDialogMVAEffs(dataset,
539 graphicsClient->
GetRoot(), 1000, 1000);
543 gGui->ReadHistograms(
file);
544 gGui->SetFormula(formula);
545 gGui->UpdateSignificanceHists();
546 gGui->DrawHistograms();
include TDocParser_001 C image html pict1_TDocParser_001 png width
char * Form(const char *fmt,...)
virtual Float_t GetTitleSize() const
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
virtual void Paint(Option_t *option="")
Paint canvas.
virtual void Update()
Update canvas pad buffers.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Describe directory structure in memory.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual TList * GetListOfKeys() const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
const TGWindow * GetRoot() const
Returns current root (i.e.
static TGClient * Instance()
Returns global gClient (initialize graphics first, if not already done)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
virtual void MapWindow()
map window
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
virtual void SetLimits(ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
void SetTitleSize(Float_t titlesize)
virtual void SetTitle(const char *title="")
Change the title of the axis.
void SetWmax(Double_t wmax)
void SetLabelColor(Int_t labelcolor)
void SetTitleColor(Int_t titlecolor)
1-D histogram with a float per channel (see TH1 documentation)}
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
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 Int_t GetNbinsX() const
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual Int_t GetMaximumBin() const
Return location of bin with maximum value in the range.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
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)
Double_t maxSignificanceErr
void UpdateSignificanceHists()
TGTextButton * fCloseButton
void ReadHistograms(TFile *file)
virtual ~StatDialogMVAEffs()
void PrintResults(const MethodInfo *info)
TGHorizontalFrame * fButtons
StatDialogMVAEffs(TString ds, const TGWindow *p, Float_t ns, Float_t nb)
TGNumberEntry * fSigInput
TGTextButton * fDrawButton
TString GetLatexFormula()
TGNumberEntry * fBkgInput
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetName() const
Returns name of object.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
void Modified(Bool_t flag=1)
virtual void SetBorderSize(Int_t bordersize=4)
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
const char * Data() const
Bool_t IsAlpha() const
Returns true if all characters in string are alphabetic.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
void Clone(Ssiz_t nc)
Make self a distinct copy with capacity of at least tot, where tot cannot be smaller than the current...
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TStyle objects may be created to define special styles.
void SetLineStyleString(Int_t i, const char *text)
Set line style string using the PostScript convention.
virtual void SetText(Double_t x, Double_t y, const char *text)
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
RooArgSet S(const RooAbsArg &v1)
static constexpr double ns
void Initialize(Bool_t useTMVAStyle=kTRUE)
void GetMethodTitle(TString &name, TKey *ikey)
TFile * OpenFile(const TString &fin)
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
void GetMethodName(TString &name, TKey *mkey)
void SetSignalAndBackgroundStyle(TH1 *sig, TH1 *bkg, TH1 *all=0)
void imgconv(TCanvas *c, const TString &fname)
void mvaeffs(TString dataset, TString fin="TMVA.root", Bool_t useTMVAStyle=kTRUE, TString formula="S/sqrt(S+B)")