ROOT » ROOFIT » ROOSTATS » RooStats::ToyMCSampler

class RooStats::ToyMCSampler: public RooStats::TestStatSampler

Function Members (Methods)

virtual voidAddTestStatistic(RooStats::TestStatistic* t = __null)
virtual RooStats::SamplingDistribution*AppendSamplingDistribution(RooArgSet& allParameters, RooStats::SamplingDistribution* last, Int_t additionalMC)
static TClass*Class()
virtual Double_tConfidenceLevel() const
virtual RooArgList*EvaluateAllTestStatistics(RooAbsData& data, const RooArgSet& poi)
virtual Double_tEvaluateTestStatistic(RooAbsData& data, RooArgSet& nullPOI)
virtual Double_tEvaluateTestStatistic(RooAbsData& data, RooArgSet& nullPOI, int i)
virtual voidGenerateGlobalObservables(RooAbsPdf& pdf) const
virtual RooAbsData*GenerateToyData(RooArgSet& paramPoint) const
virtual RooAbsData*GenerateToyData(RooArgSet& paramPoint, RooAbsPdf& pdf) const
virtual RooAbsData*GenerateToyData(RooArgSet& paramPoint, double& weight) const
virtual RooAbsData*GenerateToyData(RooArgSet& paramPoint, double& weight, RooAbsPdf& pdf) const
virtual Int_tGetNToys()
virtual RooStats::SamplingDistribution*GetSamplingDistribution(RooArgSet& paramPoint)
virtual RooDataSet*GetSamplingDistributions(RooArgSet& paramPoint)
virtual RooDataSet*GetSamplingDistributionsSingleWorker(RooArgSet& paramPoint)
virtual RooStats::TestStatistic*GetTestStatistic() const
virtual RooStats::TestStatistic*GetTestStatistic(unsigned int i) const
virtual voidInitialize(RooAbsArg&, RooArgSet&, RooArgSet&)
virtual TClass*IsA() const
RooStats::ToyMCSampler&operator=(const RooStats::ToyMCSampler&)
static voidSetAlwaysUseMultiGen(Bool_t flag)
virtual voidSetAsimovNuisancePar(Bool_t i = kTRUE)
virtual voidSetConfidenceLevel(Double_t cl)
virtual voidSetExpectedNuisancePar(Bool_t i = kTRUE)
voidSetGenerateAutoBinned(Bool_t autoBinned = kTRUE)
voidSetGenerateBinned(bool binned = true)
voidSetGenerateBinnedTag(const char* binnedTag = "")
virtual voidSetGlobalObservables(const RooArgSet& o)
voidSetMaxToys(Double_t t)
virtual voidSetNEventsPerToy(const Int_t nevents)
virtual voidSetNToys(const Int_t ntoy)
virtual voidSetNuisanceParameters(const RooArgSet& np)
virtual voidSetObservables(const RooArgSet& o)
virtual voidSetParametersForTestStat(const RooArgSet& nullpoi)
virtual voidSetPdf(RooAbsPdf& pdf)
virtual voidSetPriorNuisance(RooAbsPdf* pdf)
voidSetProofConfig(RooStats::ProofConfig* pc = __null)
voidSetProtoData(const RooDataSet* d)
virtual voidSetSamplingDistName(const char* name)
virtual voidSetTestSize(Double_t size)
virtual voidSetTestStatistic(RooStats::TestStatistic* t)
virtual voidSetTestStatistic(RooStats::TestStatistic* testStatistic, unsigned int i)
voidSetToysBothTails(Double_t toys, Double_t low_threshold, Double_t high_threshold)
voidSetToysLeftTail(Double_t toys, Double_t threshold)
voidSetToysRightTail(Double_t toys, Double_t threshold)
voidSetUseMultiGen(Bool_t flag)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
RooStats::TestStatSamplerRooStats::TestStatSampler::TestStatSampler(const RooStats::TestStatSampler&)
RooStats::ToyMCSamplerToyMCSampler(const RooStats::ToyMCSampler&)
RooStats::ToyMCSamplerToyMCSampler(RooStats::TestStatistic& ts, Int_t ntoys)
virtual voidClearCache()
const RooArgList*EvaluateAllTestStatistics(RooAbsData& data, const RooArgSet& poi, RooStats::DetailedOutputAggregator& detOutAgg)
RooAbsData*Generate(RooAbsPdf& pdf, RooArgSet& observables, const RooDataSet* protoData = __null, int forceEvents = 0) const

Data Members

RooAbsPdf::GenSpec*_gs1! GenSpec #1
RooAbsPdf::GenSpec*_gs2! GenSpec #2
RooAbsPdf::GenSpec*_gs3! GenSpec #3
RooAbsPdf::GenSpec*_gs4! GenSpec #4
Bool_tfExpectedNuisanceParwhether to use expectation values for nuisance parameters (ie Asimov data set)
const RooArgSet*fGlobalObservables
Int_tfNEventsnumber of events per toy (may be ignored depending on settings)
Int_tfNToysnumber of toys to generate
const RooArgSet*fNuisancePars
const RooArgSet*fObservables
const RooArgSet*fParametersForTestStat
RooAbsPdf*fPdfmodel (can be alt or null)
RooAbsPdf*fPriorNuisanceprior pdf for nuisance parameters
const RooDataSet*fProtoDatain dev
stringfSamplingDistNamename of the model
Bool_tfUseMultiGenUse PrepareMultiGen?
static Bool_tfgAlwaysUseMultiGenUse PrepareMultiGen always

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

void SetAlwaysUseMultiGen(Bool_t flag)
{ fgAlwaysUseMultiGen = flag ; }
 Proof constructor. Do not use.
ToyMCSampler(RooStats::TestStatistic& ts, Int_t ntoys)
Bool_t CheckConfig(void)
 only checks, no guessing/determination (do this in calculators,
 e.g. using ModelConfig::GuessObsAndNuisance(...))
RooArgList* EvaluateAllTestStatistics(RooAbsData& data, const RooArgSet& poi)
 Evaluate all test statistics, returning result and any detailed output.
 PDF parameter values are saved in case they are modified by
 TestStatistic::Evaluate (eg. SimpleLikelihoodRatioTestStat).
const RooArgList* EvaluateAllTestStatistics(RooAbsData& data, const RooArgSet& poi, RooStats::DetailedOutputAggregator& detOutAgg)
SamplingDistribution* GetSamplingDistribution(RooArgSet& paramPoint)
RooDataSet* GetSamplingDistributions(RooArgSet& paramPoint)
 Use for serial and parallel runs.
RooDataSet* GetSamplingDistributionsSingleWorker(RooArgSet& paramPoint)
 This is the main function for serial runs. It is called automatically
 from inside GetSamplingDistribution when no ProofConfig is given.
 You should not call this function yourself. This function should
 be used by ToyMCStudy on the workers (ie. when you explicitly want
 a serial run although ProofConfig is present).
void GenerateGlobalObservables(RooAbsPdf& pdf) const
RooAbsData* GenerateToyData(RooArgSet& paramPoint, double& weight, RooAbsPdf& pdf) const
 This method generates a toy data set for the given parameter point taking
 global observables into account.
 The values of the generated global observables remain in the pdf's variables.
 They have to have those values for the subsequent evaluation of the
 test statistics.
RooAbsData* Generate(RooAbsPdf& pdf, RooArgSet& observables, const RooDataSet* protoData = __null, int forceEvents = 0) const
 This is the generate function to use in the context of the ToyMCSampler
 instead of the standard RooAbsPdf::generate(...).
 It takes into account whether the number of events is given explicitly
 or whether it should use the expected number of events. It also takes
 into account the option to generate a binned data set (ie RooDataHist).
SamplingDistribution* AppendSamplingDistribution(RooArgSet& allParameters, RooStats::SamplingDistribution* last, Int_t additionalMC)
void ClearCache()
 clear the cache obtained from the pdf used for speeding the toy and global observables generation
 needs to be called every time the model pdf (fPdf) changes
void SetUseMultiGen(Bool_t flag)
{ fUseMultiGen = flag ; }
void AddTestStatistic(RooStats::TestStatistic* t = __null)
 The pdf can be NULL in which case the density from SetPdf()
 is used. The snapshot and TestStatistic is also optional.
RooAbsData* GenerateToyData(RooArgSet& paramPoint, RooAbsPdf& pdf) const
 generates toy data
   without weight
return GenerateToyData(paramPoint, weight, pdf)
RooAbsData* GenerateToyData(RooArgSet& paramPoint) const
   with weight
{ return GenerateToyData(paramPoint,*fPdf); }
Double_t EvaluateTestStatistic(RooAbsData& data, RooArgSet& nullPOI, int i)
 Main interface to evaluate the test statistic on a dataset
Double_t EvaluateTestStatistic(RooAbsData& data, RooArgSet& nullPOI)
{ return EvaluateTestStatistic( data,nullPOI, 0 ); }
TestStatistic* GetTestStatistic(unsigned int i) const
TestStatistic* GetTestStatistic(unsigned int i) const
{ return GetTestStatistic(0); }
Double_t ConfidenceLevel() const
{ return 1. - fSize; }
void Initialize(RooAbsArg& , RooArgSet& , RooArgSet& )
{ return fNToys; }
void SetNToys(const Int_t ntoy)
{ fNToys = ntoy; }
void SetNEventsPerToy(const Int_t nevents)
 Forces n events even for extended PDFs. Set NEvents=0 to
 use the Poisson distributed events from the extended PDF.
void SetParametersForTestStat(const RooArgSet& nullpoi)
 Set the Pdf, add to the the workspace if not already there
void SetPdf(RooAbsPdf& pdf)
{ fPdf = &pdf; ClearCache(); }
void SetPriorNuisance(RooAbsPdf* pdf)
 How to randomize the prior. Set to NULL to deactivate randomization.
void SetNuisanceParameters(const RooArgSet& np)
 specify the nuisance parameters (eg. the rest of the parameters)
{ fNuisancePars = &np; }
void SetObservables(const RooArgSet& o)
 specify the observables in the dataset (needed to evaluate the test statistic)
{ fObservables = &o; }
void SetGlobalObservables(const RooArgSet& o)
 specify the conditional observables
void SetTestSize(Double_t size)
 set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
{ fSize = size; }
void SetConfidenceLevel(Double_t cl)
 set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
{ fSize = 1. - cl; }
void SetTestStatistic(RooStats::TestStatistic* testStatistic, unsigned int i)
 Set the TestStatistic (want the argument to be a function of the data & parameter points
void SetTestStatistic(RooStats::TestStatistic* t)
{ return SetTestStatistic(t,0); }
void SetExpectedNuisancePar(Bool_t i = kTRUE)
void SetAsimovNuisancePar(Bool_t i = kTRUE)
void SetGenerateBinned(bool binned = true)
 control to use bin data generation (=> see RooFit::AllBinned() option)
{ fGenerateBinned = binned; }
void SetGenerateBinnedTag(const char* binnedTag = "")
 name of the tag for individual components to be generated binned (=> see RooFit::GenBinned() option)
{ fGenerateBinnedTag = binnedTag; }
void SetGenerateAutoBinned(Bool_t autoBinned = kTRUE)
 set auto binned generation (=> see RooFit::AutoBinned() option)
{ fGenerateAutoBinned = autoBinned; }
void SetSamplingDistName(const char* name)
 Set the name of the sampling distribution used for plotting
{ if(name) fSamplingDistName = name; }
std::string GetSamplingDistName(void)
{ return fSamplingDistName; }
void SetMaxToys(Double_t t)
 This option forces a maximum number of total toys.
{ fMaxToys = t; }
void SetToysLeftTail(Double_t toys, Double_t threshold)
void SetToysRightTail(Double_t toys, Double_t threshold)
void SetToysBothTails(Double_t toys, Double_t low_threshold, Double_t high_threshold)
void SetProofConfig(RooStats::ProofConfig* pc = __null)
 calling with argument or NULL deactivates proof
{ fProofConfig = pc; }
void SetProtoData(const RooDataSet* d)
{ fProtoData = d; }