File indexing completed on 2025-12-16 10:29:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOSTATS_RatioOfProfiledLikelihoodsTestStat
0012 #define ROOSTATS_RatioOfProfiledLikelihoodsTestStat
0013
0014
0015 #include "Rtypes.h"
0016
0017 #include "RooStats/TestStatistic.h"
0018
0019 #include "RooStats/ProfileLikelihoodTestStat.h"
0020
0021
0022 namespace RooStats {
0023
0024 class RatioOfProfiledLikelihoodsTestStat: public TestStatistic {
0025
0026 public:
0027
0028 RatioOfProfiledLikelihoodsTestStat(RooAbsPdf& nullPdf, RooAbsPdf& altPdf,
0029 const RooArgSet* altPOI=nullptr) :
0030 fNullProfile(nullPdf),
0031 fAltProfile(altPdf),
0032 fSubtractMLE(true),
0033 fDetailedOutputEnabled(false),
0034 fDetailedOutput(nullptr)
0035 {
0036
0037
0038 if (altPOI) {
0039 fAltPOI = (RooArgSet*) altPOI->snapshot();
0040 } else {
0041 fAltPOI = new RooArgSet();
0042 }
0043 }
0044
0045
0046 ~RatioOfProfiledLikelihoodsTestStat(void) override {
0047 if(fAltPOI) delete fAltPOI;
0048 if(fDetailedOutput) delete fDetailedOutput;
0049 }
0050
0051
0052
0053
0054
0055
0056 double ProfiledLikelihood(RooAbsData& data, RooArgSet& poi, RooAbsPdf& pdf);
0057
0058
0059 double Evaluate(RooAbsData& data, RooArgSet& nullParamsOfInterest) override;
0060
0061 virtual void EnableDetailedOutput( bool e=true ) {
0062 fDetailedOutputEnabled = e;
0063 fNullProfile.EnableDetailedOutput(fDetailedOutputEnabled);
0064 fAltProfile.EnableDetailedOutput(fDetailedOutputEnabled);
0065 }
0066
0067 static void SetAlwaysReuseNLL(bool flag);
0068
0069 void SetReuseNLL(bool flag) {
0070 fNullProfile.SetReuseNLL(flag);
0071 fAltProfile.SetReuseNLL(flag);
0072 }
0073
0074 void SetMinimizer(const char* minimizer){
0075 fNullProfile.SetMinimizer(minimizer);
0076 fAltProfile.SetMinimizer(minimizer);
0077 }
0078 void SetStrategy(Int_t strategy){
0079 fNullProfile.SetStrategy(strategy);
0080 fAltProfile.SetStrategy(strategy);
0081 }
0082 void SetTolerance(double tol){
0083 fNullProfile.SetTolerance(tol);
0084 fAltProfile.SetTolerance(tol);
0085 }
0086 void SetPrintLevel(Int_t printLevel){
0087 fNullProfile.SetPrintLevel(printLevel);
0088 fAltProfile.SetPrintLevel(printLevel);
0089 }
0090
0091
0092
0093 void SetConditionalObservables(const RooArgSet& set) override {
0094 fNullProfile.SetConditionalObservables(set);
0095 fAltProfile.SetConditionalObservables(set);
0096 }
0097
0098
0099
0100 void SetGlobalObservables(const RooArgSet& set) override {
0101 fNullProfile.SetGlobalObservables(set);
0102 fAltProfile.SetGlobalObservables(set);
0103 }
0104
0105
0106
0107
0108
0109 const RooArgSet* GetDetailedOutput(void) const override {
0110 return fDetailedOutput;
0111 }
0112
0113
0114
0115
0116 const TString GetVarName() const override { return "log(L(#mu_{1},#hat{#nu}_{1}) / L(#mu_{0},#hat{#nu}_{0}))"; }
0117
0118
0119
0120 void SetSubtractMLE(bool subtract){fSubtractMLE = subtract;}
0121
0122 private:
0123
0124 ProfileLikelihoodTestStat fNullProfile;
0125 ProfileLikelihoodTestStat fAltProfile;
0126
0127 RooArgSet* fAltPOI;
0128 bool fSubtractMLE;
0129 static bool fgAlwaysReuseNll ;
0130
0131 bool fDetailedOutputEnabled;
0132 RooArgSet* fDetailedOutput;
0133
0134 ClassDefOverride(RatioOfProfiledLikelihoodsTestStat,0)
0135 };
0136
0137 }
0138
0139
0140 #endif