Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:32:33

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       /// Get a pointer to the signal Pdf as an histogram.
0042       /// The histogram is owned by the ROCCalc instance, so it will only live as long as the ROCCalc.
0043       /// If you want a new histogram object that you manage yourself, please use `GetMvaSpdf()->Clone()`.
0044       TH1* GetMvaSpdf(){return fmvaSpdf;}
0045       /// Get a pointer to the background  Pdf as a histogram.
0046       /// The histogram is owned by the ROCCalc instance, so it will only live as long as the ROCCalc.
0047       /// If you want a new histogram object that you manage yourself, please use `GetMvaBpdf()->Clone()`.
0048       TH1* GetMvaBpdf(){return fmvaBpdf;}
0049 
0050       //false if is found some error in mvaS or mvaB
0051       Bool_t GetStatus(){return fStatus;}
0052       void ResetStatus(){fStatus=kTRUE;}
0053 
0054    private:
0055       Double_t        Root(Double_t);
0056       Double_t        GetEffForRoot( Double_t theCut );
0057       Int_t           fMaxIter;  ///< maximum number of iterations
0058       Double_t        fAbsTol;   ///< absolute tolerance deviation
0059 
0060       Bool_t          fStatus; ///< false if is found some error in mvaS or mvaB
0061 
0062       UInt_t          fNbins;
0063       Bool_t          fUseSplines;
0064 
0065       TH1*            fmvaS, *fmvaB;       ///< the input mva distributions
0066       TH1*            fmvaSpdf, *fmvaBpdf;       ///< the normalized (and rebinned) input mva distributions
0067       Float_t         fXmin, fXmax;       ///< min and max of the mva distribution
0068       Double_t        fNevtS;             ///< number of signal events (used in error calculation)
0069       Int_t           fCutOrientation;    ///< +1 if larger mva value means more signal like, -1 otherwise
0070       TSpline*        fSplS, *fSplB;
0071       TSpline*        fSplmvaCumS, *fSplmvaCumB;  ///< spline of cumulated mva distributions
0072       TSpline*        fSpleffBvsS;
0073       TH1*            fmvaScumul, *fmvaBcumul;
0074       Int_t           fnStot, fnBtot;
0075       TH1*            fSignificance;
0076       TH1*            fPurity;
0077       TH1D*           effBvsS;
0078       TH1D*           rejBvsS;
0079       TH1D*           inveffBvsS;
0080 
0081       Double_t        fSignalCut;  ///< MVA cut value for last demanded background rejection or signal efficiency
0082 
0083       mutable MsgLogger* fLogger;   //! message logger
0084       MsgLogger& Log() const { return *fLogger; }
0085 
0086    };
0087 }
0088 #endif