Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef ROOT_TMVA_ROCCalc
0002 #define ROOT_TMVA_ROCCalc
0003 
0004 #include "RtypesCore.h"
0005 
0006 class TList;
0007 class TTree;
0008 class TString;
0009 class TH1;
0010 class TH1D;
0011 class TH2;
0012 class TH2F;
0013 class TSpline;
0014 
0015 namespace TMVA {
0016 
0017    class MsgLogger;
0018 
0019 
0020    class ROCCalc {
0021 
0022    public:
0023       ROCCalc(TH1* mvaS, TH1* mvaB);
0024 
0025       ~ROCCalc();
0026 
0027 
0028       TH1D* GetROC();
0029       // return the signal eff for a given backgr. efficiency
0030       Double_t GetEffSForEffBof(Double_t effBref, Double_t &effSerr);
0031       // return the cut value
0032       Double_t GetSignalReferenceCut(){return fSignalCut;}
0033       // return the area under the ROC curve
0034       Double_t GetROCIntegral();
0035       // return the statistical significance as function of the mva cut value
0036       TH1* GetSignificance( Int_t nStot, Int_t nBtot);
0037       TH1* GetPurity(Int_t nStot, Int_t nBtot);
0038 
0039       void ApplySignalAndBackgroundStyle( TH1* sig, TH1* bkg, TH1* any = nullptr );
0040 
0041       TH1* GetMvaSpdf(){return fmvaSpdf;}
0042       TH1* GetMvaBpdf(){return fmvaBpdf;}
0043 
0044       //false if is found some error in mvaS or mvaB
0045       Bool_t GetStatus(){return fStatus;}
0046       void ResetStatus(){fStatus=kTRUE;}
0047 
0048    private:
0049       Double_t        Root(Double_t);
0050       Double_t        GetEffForRoot( Double_t theCut );
0051       Int_t           fMaxIter;  ///< maximum number of iterations
0052       Double_t        fAbsTol;   ///< absolute tolerance deviation
0053 
0054       Bool_t          fStatus; ///< false if is found some error in mvaS or mvaB
0055 
0056       UInt_t          fNbins;
0057       Bool_t          fUseSplines;
0058 
0059       TH1*            fmvaS, *fmvaB;       ///< the input mva distributions
0060       TH1*            fmvaSpdf, *fmvaBpdf;       ///< the normalized (and rebinned) input mva distributions
0061       Float_t         fXmin, fXmax;       ///< min and max of the mva distribution
0062       Double_t        fNevtS;             ///< number of signal events (used in error calculation)
0063       Int_t           fCutOrientation;    ///< +1 if larger mva value means more signal like, -1 otherwise
0064       TSpline*        fSplS, *fSplB;
0065       TSpline*        fSplmvaCumS, *fSplmvaCumB;  ///< spline of cumulated mva distributions
0066       TSpline*        fSpleffBvsS;
0067       TH1*            fmvaScumul, *fmvaBcumul;
0068       Int_t           fnStot, fnBtot;
0069       TH1*            fSignificance;
0070       TH1*            fPurity;
0071       TH1D*           effBvsS;
0072       TH1D*           rejBvsS;
0073       TH1D*           inveffBvsS;
0074 
0075       Double_t        fSignalCut;  ///< MVA cut value for last demanded background rejection or signal efficiency
0076 
0077       mutable MsgLogger* fLogger;   //! message logger
0078       MsgLogger& Log() const { return *fLogger; }
0079 
0080    };
0081 }
0082 #endif