Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:01

0001 #ifndef mvaeffs__HH
0002 #define mvaeffs__HH
0003 
0004 #include "RQ_OBJECT.h"
0005 #include "TCanvas.h"
0006 #include "TFile.h"
0007 #include "TGLabel.h"
0008 #include "TGNumberEntry.h"
0009 #include "TGWindow.h"
0010 #include "TGaxis.h"
0011 #include "TH1.h"
0012 #include "TIterator.h"
0013 #include "TLatex.h"
0014 #include "TList.h"
0015 
0016 namespace TMVA{
0017 
0018    void mvaeffs(TString dataset, TString fin = "TMVA.root",
0019                 Float_t nSignal = 1000, Float_t nBackground = 1000,
0020                 Bool_t useTMVAStyle = kTRUE, TString formula="S/sqrt(S+B)" );
0021 
0022    // this macro plots the signal and background efficiencies
0023    // as a function of the MVA cut.
0024 
0025 
0026    class MethodInfo : public TNamed {
0027    public:
0028    MethodInfo() :
0029       methodName(""),
0030          methodTitle(""),
0031          sig(nullptr),
0032          bgd(nullptr),
0033          origSigE(nullptr),
0034          origBgdE(nullptr),
0035          sigE(nullptr),
0036          bgdE(nullptr),
0037          purS(nullptr),
0038          sSig(nullptr),
0039          effpurS(nullptr),
0040          canvas(nullptr),
0041          line1(nullptr),
0042          line2(nullptr),
0043          rightAxis(nullptr),
0044          maxSignificance(0),
0045          maxSignificanceErr(0)
0046             {}
0047       virtual ~MethodInfo();
0048 
0049       TString  methodName;
0050       TString  methodTitle;
0051       TH1*     sig;
0052       TH1*     bgd;
0053       TH1*     origSigE;
0054       TH1*     origBgdE;
0055       TH1*     sigE;
0056       TH1*     bgdE;
0057       TH1*     purS;
0058       TH1*     sSig;
0059       TH1*     effpurS;
0060       TCanvas* canvas;
0061       TLatex*  line1;
0062       TLatex*  line2;
0063       TGaxis*  rightAxis;
0064       Double_t maxSignificance;
0065       Double_t maxSignificanceErr;
0066 
0067       void SetResultHists();
0068 
0069       ClassDef(MethodInfo,0);
0070    };
0071 
0072    class StatDialogMVAEffs {
0073 
0074       RQ_OBJECT("StatDialogMVAEffs")
0075 
0076          public:
0077 
0078       StatDialogMVAEffs(TString ds,const TGWindow* p, Float_t ns, Float_t nb);
0079       virtual ~StatDialogMVAEffs();
0080 
0081       void SetFormula(const TString& f) { fFormula = f; }
0082       TString GetFormula();
0083       TString GetFormulaString() { return fFormula; }
0084       TString GetLatexFormula();
0085 
0086       void ReadHistograms(TFile* file);
0087       void UpdateSignificanceHists();
0088       void DrawHistograms();
0089 
0090       void RaiseDialog() { if (fMain) { fMain->RaiseWindow(); fMain->Layout(); fMain->MapWindow(); } }
0091 
0092    private:
0093 
0094       TGMainFrame *fMain;
0095       Float_t fNSignal;
0096       Float_t fNBackground;
0097       TString fFormula;
0098       TString dataset;
0099       TList * fInfoList;
0100 
0101       TGNumberEntry* fSigInput;
0102       TGNumberEntry* fBkgInput;
0103 
0104       TGHorizontalFrame* fButtons;
0105       TGTextButton* fDrawButton;
0106       TGTextButton* fCloseButton;
0107 
0108       Int_t maxLenTitle;
0109 
0110       void UpdateCanvases();
0111 
0112    public:
0113 
0114       // slots
0115       void SetNSignal(); //*SIGNAL*
0116       void SetNBackground(); //*SIGNAL*
0117       void Redraw(); //*SIGNAL*
0118       void Close(); //*SIGNAL*
0119 
0120       // result printing
0121       void PrintResults( const MethodInfo* info );
0122    };
0123 
0124 }
0125 #endif