118 "Adjusted number of toys to number of bins of nuisance parameters: " <<
fNToys << endl;
150 : fSamplingDistName(
"SD"),
153 fAdaptiveLowLimit(-
RooNumber::infinity()),
154 fAdaptiveHighLimit(
RooNumber::infinity())
163 : fSamplingDistName(
ts.GetVarName().Data()),
166 fAdaptiveLowLimit(-
RooNumber::infinity()),
167 fAdaptiveHighLimit(
RooNumber::infinity())
207 if (!
allTS)
return nullptr;
215 std::unique_ptr<RooArgSet> allVars;
216 std::unique_ptr<RooArgSet>
saveAll;
221 saveAll = std::make_unique<RooArgSet>();
248 oocoutW(
nullptr,
InputArguments) <<
"Multiple test statistics defined, but only one distribution will be returned." << endl;
255 if(
r ==
nullptr ||
r->numEntries() == 0) {
276 <<
"Bad COnfiguration in ToyMCSampler "
285 <<
"Adaptive sampling in ToyMCSampler is not supported for parallel runs."
330 <<
"Bad COnfiguration in ToyMCSampler "
339 std::unique_ptr<RooArgSet>
saveAll{allVars->snapshot()};
353 if ( i% 500 == 0 && i>0 ) {
372 [](
const RooAbsArg *arg) { return dynamic_cast<const RooAbsCategory *>(arg) != nullptr; })) {
374 <<
"ToyMCSampler: Generated toy data didn't contain a category variable, although"
375 " a simultaneous PDF is in use. To generate events for a simultaneous PDF, all components need to be"
376 " extended. Otherwise, the number of events to generate per component cannot be determined."
440 for (
int i=0; i <
nCat; ++i){
453 for (
unsigned int i = 0; i <
_pdfList.size(); ++i) {
466 allVars->assign(*values);
494 oocoutI(
nullptr,
InputArguments) <<
"Cannot use multigen when nuisance parameters vary for every toy" << endl;
506 std::unique_ptr<RooArgSet>
saveVars{allVars->snapshot()};
551 std::unique_ptr<RooAbsData>
data;
583 <<
"ToyMCSampler: Error : pdf is not extended and number of events per toy is zero"
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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 r
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
RooFit::OwningPtr< RooArgSet > getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expression tree)
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
Abstract base class for binned and unbinned datasets.
Abstract interface for all probability density functions.
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
GenSpec * prepareMultiGen(const RooArgSet &whatVars, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={})
Prepare GenSpec configuration object for efficient generation of multiple datasets from identical spe...
RooFit::OwningPtr< RooDataSet > generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={})
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
virtual RooFit::OwningPtr< RooDataSet > generateSimGlobal(const RooArgSet &whatVars, Int_t nEvents)
Special generator interface for generation of 'global observables' – for RooStats tools.
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.
Object to represent discrete states.
Container class to hold unbinned data.
static RooMsgService & instance()
Return reference to singleton instance.
Provides numeric constants used in RooFit.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Variable that can be changed from the outside.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
This class is designed to aid in the construction of RooDataSets and RooArgSets, particularly those n...
RooWorkspace & GetWorkspace(void) const
returns fWorkspace
Int_t GetNExperiments(void) const
return fNExperiments
const char * GetHost(void) const
returns fHost
bool GetShowGui(void) const
return fShowGui
This class simply holds a sampling distribution of some test statistic.
void Add(const SamplingDistribution *other)
merge two sampling distributions
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
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::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
!
std::unique_ptr< RooAbsPdf::GenSpec > _gs4
! GenSpec #4
const RooArgSet * fObservables
double fAdaptiveHighLimit
double fToysInTails
minimum no of toys in tails for adaptive sampling (taking weights into account, therefore double) Def...
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
SamplingDistribution * GetSamplingDistribution(RooArgSet ¶mPoint) override
main interface
std::unique_ptr< RooAbsPdf::GenSpec > _gs1
! GenSpec #1
virtual RooDataSet * GetSamplingDistributions(RooArgSet ¶mPoint)
Use for serial and parallel runs.
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
std::unique_ptr< RooAbsPdf::GenSpec > _gs3
! GenSpec #3
std::vector< TestStatistic * > fTestStatistics
Int_t fNEvents
number of events per toy (may be ignored depending on settings)
ToyMCSampler()
Proof constructor. Do not use.
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)
std::vector< RooAbsPdf * > _pdfList
! We don't own those objects
Int_t fNToys
number of toys to generate
virtual void ClearCache()
helper method for clearing the cache
bool CheckConfig(void)
Checks for sufficient information to do a GetSamplingDistribution(...).
ProofConfig * fProofConfig
!
std::vector< std::unique_ptr< RooArgSet > > _obsList
!
static bool fgAlwaysUseMultiGen
Use PrepareMultiGen always.
double fMaxToys
maximum no of toys (taking weights into account, therefore double)
const RooDataSet * fProtoData
in dev
TString fGenerateBinnedTag
std::vector< std::unique_ptr< RooAbsPdf::GenSpec > > _gsList
!
RooAbsPdf * fPriorNuisance
prior pdf for nuisance parameters
ToyMCStudy is an implementation of RooAbsStudy for toy Monte Carlo sampling.
Utility class to manage studies that consist of repeated applications of generate-and-fit operations ...
Persistable container for RooFit projects.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
RooCmdArg Extended(bool flag=true)
RooCmdArg ProtoData(const RooDataSet &protoData, bool randomizeOrder=false, bool resample=false)
RooCmdArg AutoBinned(bool flag=true)
RooCmdArg NumEvents(Int_t numEvents)
RooCmdArg GenBinned(const char *tag)
RooCmdArg ExpectedData(bool flag=true)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Namespace for the RooStats classes.