32 using namespace RooStats;
48 fNullModel(&nullModel),
50 fTestStatSampler(sampler),
59 altModel.GetSnapshot());
61 fDefaultSampler =
new ToyMCSampler(*fDefaultTestStat, 1000);
62 fTestStatSampler = fDefaultSampler;
71 void HypoTestCalculatorGeneric::SetupSampler(
const ModelConfig& model)
const {
72 fNullModel->LoadSnapshot();
73 fTestStatSampler->SetObservables(*fNullModel->GetObservables());
74 fTestStatSampler->SetParametersForTestStat(*fNullModel->GetParametersOfInterest());
78 fTestStatSampler->SetSamplingDistName(model.
GetName());
79 fTestStatSampler->SetPdf(*model.
GetPdf());
87 HypoTestCalculatorGeneric::~HypoTestCalculatorGeneric() {
88 if(fDefaultSampler)
delete fDefaultSampler;
89 if(fDefaultTestStat)
delete fDefaultTestStat;
104 const_cast<ModelConfig*
>(fNullModel)->GuessObsAndNuisance(*fData);
105 const_cast<ModelConfig*
>(fAltModel)->GuessObsAndNuisance(*fData);
107 const RooArgSet * nullSnapshot = fNullModel->GetSnapshot();
108 if(nullSnapshot ==
NULL) {
114 if(CheckHook() != 0) {
119 if (!fTestStatSampler || !fTestStatSampler->GetTestStatistic() ) {
125 RooArgSet *nullParams = fNullModel->GetPdf()->getParameters(*fData);
126 RooArgSet *altParams = fAltModel->GetPdf()->getParameters(*fData);
128 RooArgSet *bothParams = fNullModel->GetPdf()->getParameters(*fData);
129 bothParams->
add(*altParams,
false);
143 if (!allTS)
return 0;
147 obsTestStat = firstTS->
getVal();
153 obsTestStat = fTestStatSampler->EvaluateTestStatistic(*const_cast<RooAbsData*>(fData), nullP);
160 *bothParams = *saveAll;
165 SetupSampler(*fNullModel);
166 RooArgSet paramPointNull(*fNullModel->GetParametersOfInterest());
167 if(PreNullHook(¶mPointNull, obsTestStat) != 0) {
184 *bothParams = *saveAll;
187 SetupSampler(*fAltModel);
188 RooArgSet paramPointAlt(*fAltModel->GetParametersOfInterest());
189 if(PreAltHook(¶mPointAlt, obsTestStat) != 0) {
198 unsigned int prevSeed = 0;
199 if (fAltToysSeed > 0) {
222 string resultname =
"HypoTestCalculator_result";
239 *bothParams = *saveAll;
253 void HypoTestCalculatorGeneric::UseSameAltToys() {
virtual const char * GetTitle() const
Returns title of object.
void SetAltDistribution(SamplingDistribution *alt)
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
void SetFitInfo(RooDataSet *d)
TestStatSampler is an interface class for a tools which produce RooStats SamplingDistributions.
HypoTestResult is a base class for results from hypothesis tests.
static UInt_t integer(UInt_t max, TRandom *generator=randomGenerator())
Return an integer uniformly distributed from [0,n-1].
virtual void SetSeed(UInt_t seed=0)
Set the random generator seed.
const std::vector< Double_t > & GetSamplingDistribution() const
Get test statistics values.
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return NULL if not existing)
virtual RooArgList * EvaluateAllTestStatistics(RooAbsData &data, const RooArgSet &poi)
Common base class for the Hypothesis Test Calculators.
void LoadSnapshot() const
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Double_t getVal(const RooArgSet *set=0) const
RooRealVar represents a fundamental (non-derived) real valued object.
void SetAllTestStatisticsData(const RooArgList *tsd)
void SetAltDetailedOutput(RooDataSet *d)
virtual const char * GetName() const
Returns name of object.
RooAbsData is the common abstract base class for binned and unbinned datasets.
ToyMCSampler is an implementation of the TestStatSampler interface.
RooDataSet is a container class to hold unbinned data.
void SetTestStatisticData(const Double_t tsd)
This class simply holds a sampling distribution of some test statistic.
TestStatistic that returns the ratio of profiled likelihoods.
virtual void add(const RooArgSet &row, Double_t weight=1.0, Double_t weightError=0)
Add a data point, with its coordinates specified in the 'data' argset, to the data set...
void SetPValueIsRightTail(Bool_t pr)
RooAbsArg * at(Int_t idx) const
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
ClassImp(RooStats::HypoTestCalculatorGeneric) using namespace RooStats
Same purpose as HybridCalculatorOriginal, but different implementation.
Mother of all ROOT objects.
void SetNullDetailedOutput(RooDataSet *d)
virtual RooDataSet * GetSamplingDistributions(RooArgSet ¶mPoint)
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event 'index'.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set.
void SetNullDistribution(SamplingDistribution *null)