13#ifndef ROOSTATS_ToyMCSampler
14#define ROOSTATS_ToyMCSampler
36 class DetailedOutputAggregator;
95 oocoutI(
nullptr,InputArguments) <<
"No test statistic given. Doing nothing." << std::endl;
105 if(
fExpectedNuisancePar)
oocoutE(
nullptr,InputArguments) <<
"ToyMCSampler: using expected nuisance parameters but ignoring weight. Use GetSamplingDistribution(paramPoint, weight) instead." << std::endl;
151 auto params = std::make_unique<RooArgSet>();
182 oocoutE(
nullptr,InputArguments) <<
"Cannot set test statistic for this index." << std::endl;
284 mutable std::vector<std::unique_ptr<RooArgSet>>
_obsList;
285 mutable std::vector<std::unique_ptr<RooAbsPdf::GenSpec>>
_gsList;
286 mutable std::unique_ptr<RooAbsPdf::GenSpec>
_gs1;
287 mutable std::unique_ptr<RooAbsPdf::GenSpec>
_gs2;
288 mutable std::unique_ptr<RooAbsPdf::GenSpec>
_gs3;
289 mutable std::unique_ptr<RooAbsPdf::GenSpec>
_gs4;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define ClassDefOverride(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Abstract base class for binned and unbinned datasets.
Abstract interface for all probability density functions.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Container class to hold unbinned data.
static constexpr double infinity()
Return internal infinity representation.
This class is designed to aid in the construction of RooDataSets and RooArgSets, particularly those n...
Holds configuration options for proof and proof-lite.
This class simply holds a sampling distribution of some test statistic.
TestStatSampler is an interface class for a tools which produce RooStats SamplingDistributions.
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
ToyMCSampler is an implementation of the TestStatSampler interface.
const RooArgSet * fGlobalObservables
double ConfidenceLevel() const override
Get the Confidence level for the test.
void SetProofConfig(ProofConfig *pc=nullptr)
calling with argument or nullptr deactivates proof
virtual void SetNToys(const Int_t ntoy)
void SetParametersForTestStat(const RooArgSet &nullpoi) override
Set the Pdf, add to the workspace if not already there.
void SetProtoData(const RooDataSet *d)
void SetPriorNuisance(RooAbsPdf *pdf) override
How to randomize the prior. Set to nullptr to deactivate randomization.
std::string fSamplingDistName
name of the model
virtual void GenerateGlobalObservables(RooAbsPdf &pdf) const
generate global observables
virtual RooDataSet * GetSamplingDistributionsSingleWorker(RooArgSet ¶mPoint)
This is the main function for serial runs.
std::string GetSamplingDistName(void)
std::unique_ptr< const RooArgSet > fParametersForTestStat
virtual SamplingDistribution * AppendSamplingDistribution(RooArgSet &allParameters, SamplingDistribution *last, Int_t additionalMC)
Extended interface to append to sampling distribution more samples.
NuisanceParametersSampler * fNuisanceParametersSampler
!
void SetObservables(const RooArgSet &o) override
specify the observables in the dataset (needed to evaluate the test statistic)
void Initialize(RooAbsArg &, RooArgSet &, RooArgSet &) override
Common Initialization.
std::unique_ptr< RooAbsPdf::GenSpec > _gs4
! GenSpec #4
const RooArgSet * fObservables
double fAdaptiveHighLimit
void SetConfidenceLevel(double cl) override
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
double fToysInTails
minimum no of toys in tails for adaptive sampling (taking weights into account, therefore double) Def...
virtual TestStatistic * GetTestStatistic(unsigned int i) const
void SetToysBothTails(double toys, double low_threshold, double high_threshold)
virtual RooArgList * EvaluateAllTestStatistics(RooAbsData &data, const RooArgSet &poi)
Evaluate all test statistics, returning result and any detailed output.
RooAbsPdf * fPdf
densities, snapshots, and test statistics to reweight to
void SetToysRightTail(double toys, double threshold)
SamplingDistribution * GetSamplingDistribution(RooArgSet ¶mPoint) override
main interface
void SetMaxToys(double t)
This option forces a maximum number of total toys.
std::unique_ptr< RooAbsPdf::GenSpec > _gs1
! GenSpec #1
virtual RooDataSet * GetSamplingDistributions(RooArgSet ¶mPoint)
Use for serial and parallel runs.
void SetGenerateBinnedTag(const char *binnedTag="")
name of the tag for individual components to be generated binned (=> see RooFit::GenBinned() option)
virtual void AddTestStatistic(TestStatistic *t=nullptr)
The pdf can be nullptr in which case the density from SetPdf() is used.
virtual RooAbsData * GenerateToyData(RooArgSet ¶mPoint, RooAbsPdf &pdf) const
generates toy data without weight
bool fExpectedNuisancePar
whether to use expectation values for nuisance parameters (ie Asimov data set)
bool fUseMultiGen
Use PrepareMultiGen?
std::unique_ptr< RooAbsPdf::GenSpec > _gs2
! GenSpec #2
const RooArgSet * fNuisancePars
void SetTestStatistic(TestStatistic *t) override
Set the TestStatistic (want the argument to be a function of the data & parameter points.
virtual Int_t GetNToys(void)
void SetNuisanceParameters(const RooArgSet &np) override
specify the nuisance parameters (eg. the rest of the parameters)
std::unique_ptr< RooAbsPdf::GenSpec > _gs3
! GenSpec #3
std::vector< TestStatistic * > fTestStatistics
virtual void SetTestStatistic(TestStatistic *testStatistic, unsigned int i)
Set the TestStatistic (want the argument to be a function of the data & parameter points.
Int_t fNEvents
number of events per toy (may be ignored depending on settings)
ToyMCSampler()
Proof constructor. Do not use.
double fAdaptiveLowLimit
tails
std::unique_ptr< RooArgSet > _allVars
!
std::unique_ptr< RooAbsData > Generate(RooAbsPdf &pdf, RooArgSet &observables, const RooDataSet *protoData=nullptr, int forceEvents=0) const
helper for GenerateToyData
static void SetAlwaysUseMultiGen(bool flag)
void SetPdf(RooAbsPdf &pdf) override
Set the Pdf, add to the workspace if not already there.
std::vector< RooAbsPdf * > _pdfList
! We don't own those objects
void SetGenerateBinned(bool binned=true)
control to use bin data generation (=> see RooFit::AllBinned() option)
TestStatistic * GetTestStatistic(void) const override
Get the TestStatistic.
Int_t fNToys
number of toys to generate
void SetToysLeftTail(double toys, double threshold)
virtual void SetExpectedNuisancePar(bool i=true)
void SetGlobalObservables(const RooArgSet &o) override
specify the conditional observables
virtual double EvaluateTestStatistic(RooAbsData &data, RooArgSet &nullPOI, int i)
Main interface to evaluate the test statistic on a dataset.
virtual void ClearCache()
helper method for clearing the cache
double EvaluateTestStatistic(RooAbsData &data, RooArgSet &nullPOI) override
Main interface to evaluate the test statistic on a dataset.
void SetGenerateAutoBinned(bool autoBinned=true)
set auto binned generation (=> see RooFit::AutoBinned() option)
bool CheckConfig(void)
Checks for sufficient information to do a GetSamplingDistribution(...).
ProofConfig * fProofConfig
!
virtual void SetNEventsPerToy(const Int_t nevents)
Forces the generation of exactly n events even for extended PDFs.
std::vector< std::unique_ptr< RooArgSet > > _obsList
!
virtual RooAbsData * GenerateToyData(RooArgSet ¶mPoint, double &weight) const
static bool fgAlwaysUseMultiGen
Use PrepareMultiGen always.
double fMaxToys
maximum no of toys (taking weights into account, therefore double)
void SetUseMultiGen(bool flag)
const RooDataSet * fProtoData
in dev
void SetSamplingDistName(const char *name) override
Set the name of the sampling distribution used for plotting.
virtual RooAbsData * GenerateToyData(RooArgSet ¶mPoint) const
TString fGenerateBinnedTag
std::vector< std::unique_ptr< RooAbsPdf::GenSpec > > _gsList
!
RooAbsPdf * fPriorNuisance
prior pdf for nuisance parameters
void SetTestSize(double size) override
set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
virtual void SetAsimovNuisancePar(bool i=true)
Namespace for the RooStats classes.