30 ClassImp(RooStats::HybridCalculator);
32 using namespace RooStats;
37 int HybridCalculator::CheckHook(
void)
const {
39 if( fPriorNuisanceNull && (!fNullModel->GetNuisanceParameters() || fNullModel->GetNuisanceParameters()->getSize() == 0) ) {
40 oocoutE((TObject*)0,InputArguments) <<
"HybridCalculator - Nuisance PDF has been specified, but is unaware of which parameters are the nuisance parameters. Must set nuisance parameters in the Null ModelConfig." << endl;
43 if( fPriorNuisanceAlt && (!fAltModel->GetNuisanceParameters() || fAltModel->GetNuisanceParameters()->getSize() == 0) ) {
44 oocoutE((TObject*)0,InputArguments) <<
"HybridCalculator - Nuisance PDF has been specified, but is unaware of which parameters are the nuisance parameters. Must set nuisance parameters in the Alt ModelConfig" << endl;
53 int HybridCalculator::PreNullHook(RooArgSet* ,
double obsTestStat)
const {
58 if(fPriorNuisanceNull) {
60 fTestStatSampler->SetPriorNuisance(fPriorNuisanceNull);
62 fNullModel->GetNuisanceParameters() == NULL ||
63 fNullModel->GetNuisanceParameters()->getSize() == 0
65 oocoutI((TObject*)0,InputArguments)
66 <<
"HybridCalculator - No nuisance parameters specified for Null model and no prior forced. "
67 <<
"Case is reduced to simple hypothesis testing with no uncertainty." << endl;
69 oocoutI((TObject*)0,InputArguments) <<
"HybridCalculator - Using uniform prior on nuisance parameters (Null model)." << endl;
76 ToyMCSampler *toymcs =
dynamic_cast<ToyMCSampler*
>(GetTestStatSampler());
78 oocoutI((TObject*)0,InputArguments) <<
"Using a ToyMCSampler. Now configuring for Null." << endl;
81 if(fNToysNull >= 0) toymcs->SetNToys(fNToysNull);
85 oocoutI((TObject*)0,InputArguments) <<
"Adaptive Sampling" << endl;
86 if(GetTestStatSampler()->GetTestStatistic()->PValueIsRightTail()) {
87 toymcs->SetToysRightTail(fNToysNullTail, obsTestStat);
89 toymcs->SetToysLeftTail(fNToysNullTail, obsTestStat);
92 toymcs->SetToysBothTails(0, 0, obsTestStat);
95 GetNullModel()->LoadSnapshot();
103 int HybridCalculator::PreAltHook(RooArgSet* ,
double obsTestStat)
const {
107 if(fPriorNuisanceAlt){
109 fTestStatSampler->SetPriorNuisance(fPriorNuisanceAlt);
111 fAltModel->GetNuisanceParameters()==NULL ||
112 fAltModel->GetNuisanceParameters()->getSize()==0
114 oocoutI((TObject*)0,InputArguments)
115 <<
"HybridCalculator - No nuisance parameters specified for Alt model and no prior forced. "
116 <<
"Case is reduced to simple hypothesis testing with no uncertainty." << endl;
118 oocoutI((TObject*)0,InputArguments) <<
"HybridCalculator - Using uniform prior on nuisance parameters (Alt model)." << endl;
125 ToyMCSampler *toymcs =
dynamic_cast<ToyMCSampler*
>(GetTestStatSampler());
127 oocoutI((TObject*)0,InputArguments) <<
"Using a ToyMCSampler. Now configuring for Alt." << endl;
130 if(fNToysAlt >= 0) toymcs->SetNToys(fNToysAlt);
134 oocoutI((TObject*)0,InputArguments) <<
"Adaptive Sampling" << endl;
135 if(GetTestStatSampler()->GetTestStatistic()->PValueIsRightTail()) {
136 toymcs->SetToysLeftTail(fNToysAltTail, obsTestStat);
138 toymcs->SetToysRightTail(fNToysAltTail, obsTestStat);
141 toymcs->SetToysBothTails(0, 0, obsTestStat);