56 purS =
new TH1F(pname, pname, nbins, low, high);
57 sSig =
new TH1F(ssigname, ssigname, nbins, low, high);
58 effpurS =
new TH1F(epname, epname, nbins, low, high);
67 sigE->SetFillStyle( 0 );
68 bgdE->SetFillStyle( 0 );
69 sSig->SetFillStyle( 0 );
70 sigE->SetLineWidth( 3 );
71 bgdE->SetLineWidth( 3 );
72 sSig->SetLineWidth( 3 );
75 purS->SetFillStyle( 0 );
76 purS->SetLineWidth( 2 );
77 purS->SetLineStyle( 5 );
96 auto replace_vars = [](
TString &
f,
char oldLetter,
char newLetter ) {
97 auto pos =
f.First(oldLetter);
99 if ( ( pos > 0 && !
TString(
f[pos-1]).IsAlpha() ) ||
100 ( pos <
f.Length()-1 && !
TString(
f[pos+1]).IsAlpha() ) )
105 pos =
f.Index(oldLetter,pos2);
110 replace_vars(formula,
'S',
'x');
111 replace_vars(formula,
'B',
'y');
121 f.ReplaceAll(
"(",
"{");
122 f.ReplaceAll(
")",
"}");
123 f.ReplaceAll(
"sqrt",
"#sqrt");
160 fMain->CloseWindow();
213 fMain->SetWindowName(
"Significance");
214 fMain->SetWMPosition(0, 0);
215 fMain->MapSubwindows();
219 fSigInput->Connect(
"ValueSet(Long_t)",
"TMVA::StatDialogMVAEffs",
this,
"SetNSignal()");
220 fBkgInput->Connect(
"ValueSet(Long_t)",
"TMVA::StatDialogMVAEffs",
this,
"SetNBackground()");
224 fDrawButton->Connect(
"Clicked()",
"TMVA::StatDialogMVAEffs",
this,
"Redraw()");
226 fCloseButton->Connect(
"Clicked()",
"TMVA::StatDialogMVAEffs",
this,
"Close()");
258 cout <<
"--- " << setfill(
'=') << setw(str.Length()) <<
"" << setfill(
' ') << endl;
259 cout <<
"--- " << str << endl;
260 cout <<
"--- " << setfill(
'-') << setw(str.Length()) <<
"" << setfill(
' ') << endl;
274 maxSigErr = sig * sqrt( 1./S + 1./(2.*B));
288 cout <<
"--- " << setfill(
'-') << setw(str.Length()) <<
"" << setfill(
' ') << endl << endl;
307 while( (key = (
TKey*)next()) ) {
310 if( !
gROOT->GetClass(key->
GetClassName())->InheritsFrom(
"TDirectory") )
continue;
312 cout <<
"--- Found directory: " << ((
TDirectory*)key->
ReadObj())->GetName() << endl;
318 while((titkey = (
TKey*)keyIt())) {
319 if( !
gROOT->GetClass(titkey->
GetClassName())->InheritsFrom(
"TDirectory") )
continue;
329 cout <<
"--- Classifier: " << info->
methodTitle << endl;
331 info->
sig =
dynamic_cast<TH1*
>(titDir->
Get( hname +
"_S" ));
332 info->
bgd =
dynamic_cast<TH1*
>(titDir->
Get( hname +
"_B" ));
333 info->
origSigE =
dynamic_cast<TH1*
>(titDir->
Get( hname +
"_effS" ));
334 info->
origBgdE =
dynamic_cast<TH1*
>(titDir->
Get( hname +
"_effB" ));
347 Int_t countCanvas = 0;
350 const Int_t width = 600;
360 countCanvas*50+200, countCanvas*20, width,
Int_t(width*0.78) );
386 c->SetRightMargin ( 2.0 );
405 c->GetLeftMargin() + 0.4, 1 -
c->GetTopMargin() + 0.12 );
408 legend1->
AddEntry(info->
bgdE,
"Background efficiency",
"L");
409 legend1->
Draw(
"same");
413 TLegend *legend2=
new TLegend(
c->GetLeftMargin() + 0.4, 1 -
c->GetTopMargin(),
414 1 -
c->GetRightMargin(), 1 -
c->GetTopMargin() + 0.12 );
419 legend2->
Draw(
"same");
451 tl.
DrawLatex( 0.13, 0.77,
"Method Cuts provides a bundle of cut selections, each tuned to a");
452 tl.
DrawLatex(0.13, 0.74,
"different signal efficiency. Shown is the purity for each cut selection.");
483 if (info->
line1 !=0 )
486 if (info->
line2 !=0 ) {
515 TString opt =
TString::Format(
"%%%is: (%%9.8g,%%9.8g) %%9.4f (%%8.3g +-%%6.3g) %%8.7g %%8.7g %%8.4g %%8.4g",
537 if (graphicsClient ==
nullptr && !
gROOT->IsBatch()) {
540 Info(
"mvaeffs",
"GUI is not initialized, because TApplication is not started. Running as in batch mode");
543 Error(
"mvaeffs",
"TApplication is present but TGCLient instance is a nullptr");
549 (graphicsClient) ? graphicsClient->
GetRoot() :
nullptr, nsignal, nbackground);
553 gGui->ReadHistograms(file);
554 gGui->SetFormula(formula);
555 gGui->UpdateSignificanceHists();
556 gGui->DrawHistograms();
557 if (!
gROOT->IsBatch()) gGui->RaiseDialog();
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.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
float Float_t
Float 4 bytes (float).
externTApplication * gApplication
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
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.
void Paint(Option_t *option="") override
Paint canvas.
void Update() override
Update canvas pad buffers.
static Int_t GetColor(const char *hexcolor)
TDirectory * GetDirectory(const char *apath, Bool_t printError=false, const char *funcname="GetDirectory") override
Find a directory using apath.
Describe directory structure in memory.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual TList * GetListOfKeys() const
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
const TGWindow * GetRoot() const
Returns current root (i.e.
static TGClient * Instance()
Returns global gClient (initialize graphics first, if not already done).
A composite frame that layout their children in horizontal way.
This class handles GUI labels.
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
TGNumberEntry is a number entry input widget with up/down buttons.
Yield an action as soon as it is clicked.
ROOT GUI Window base class.
void SetTitleSize(Float_t titlesize)
void SetWmax(Double_t wmax)
void SetLabelColor(Int_t labelcolor)
void SetTitleColor(Int_t titlecolor)
virtual void SetTitle(const char *title="")
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
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 Int_t GetNbinsX() const
virtual void SetMaximum(Double_t maximum=-1111)
void Draw(Option_t *option="") override
Draw this histogram with options.
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 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.
TLatex * DrawLatex(Double_t x, Double_t y, const char *text)
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)
Use the TLine constructor to create a simple line.
Double_t maxSignificanceErr
TString GetFormulaString()
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.
const char * GetName() const override
Returns name of object.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
void Modified(Bool_t flag=true) override
Mark pad modified Will be repainted when TCanvas::Update() will be called next time.
virtual void SetBorderSize(Int_t bordersize=4)
Sets the border size of the TPave box and shadow.
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
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
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)
void Initialize(Bool_t useTMVAStyle=kTRUE)
void GetMethodTitle(TString &name, TKey *ikey)
void SetSignalAndBackgroundStyle(TH1 *sig, TH1 *bkg, TH1 *all=nullptr)
TFile * OpenFile(const TString &fin)
void SetFrameStyle(TH1 *frame, Float_t scale=1.0)
void GetMethodName(TString &name, TKey *mkey)
void imgconv(TCanvas *c, const TString &fname)
void mvaeffs(TString dataset, TString fin="TMVA.root", Float_t nSignal=1000, Float_t nBackground=1000, Bool_t useTMVAStyle=kTRUE, TString formula="S/sqrt(S+B)")