122 "Adjusted number of toys to number of bins of nuisance parameters: " <<
fNToys << endl;
245 bool goodConfig =
true;
271 if (!allTS)
return 0;
284 std::unique_ptr<RooArgSet> parForTS(poi.
snapshot());
292 if (saveAll) *allVars = *saveAll;
310 if(
r == NULL ||
r->numEntries() == 0) {
333 <<
"Bad COnfiguration in ToyMCSampler "
342 <<
"Adaptive sampling in ToyMCSampler is not supported for parallel runs."
388 <<
"Bad COnfiguration in ToyMCSampler "
411 if ( i% 500 == 0 && i>0 ) {
420 Double_t valueFirst = -999.0, weight = 1.0;
429 return dynamic_cast<const RooAbsCategory*>(arg) != nullptr;
431 oocoutE((
TObject*)
nullptr,
Generation) <<
"ToyMCSampler: Generated toy data didn't contain a category variable, although"
432 " a simultaneous PDF is in use. To generate events for a simultaneous PDF, all components need to be"
433 " extended. Otherwise, the number of events to generate per component cannot be determined." << std::endl;
442 valueFirst = firstTS->getVal();
447 if(valueFirst != valueFirst) {
456 if(weight >= 0.) toysInTails += weight;
457 else toysInTails += 1.;
501 for (
int i=0; i < nCat; ++i){
513 list<RooArgSet*>::iterator oiter =
_obsList.begin();
514 list<RooAbsPdf::GenSpec*>::iterator giter =
_gsList.begin();
515 for (list<RooAbsPdf*>::iterator iter =
_pdfList.begin(); iter !=
_pdfList.end(); ++iter, ++giter, ++oiter) {
518 **oiter = *tmp->
get(0);
553 *allVars = paramPoint;
583 RooArgSet allVarsMinusParamPoint(*allVars);
598 *allVars = *saveVars;
620 int events = forceEvents;
651 <<
"ToyMCSampler: Error : pdf is not extended and number of events per toy is zero"
700 last->
Add(newSamples);
725 std::list<RooArgSet*>::iterator oiter =
_obsList.begin();
726 for (std::list<RooAbsPdf::GenSpec*>::iterator giter =
_gsList.begin(); giter !=
_gsList.end(); ++giter, ++oiter) {
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Return the observables of this pdf given a set of observables.
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
virtual const char * getCurrentLabel() const
Return label string of current state.
Int_t numTypes(const char *=0) const
Return number of types defined (in range named rangeName if rangeName!=0)
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents.
const_iterator end() const
RooAbsArg * first() const
const_iterator begin() const
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
RooAbsData is the common abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
virtual Double_t weight() const =0
virtual Int_t numEntries() const
GenSpec * prepareMultiGen(const RooArgSet &whatVars, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none())
Prepare GenSpec configuration object for efficient generation of multiple datasets from identical spe...
Bool_t canBeExtended() const
RooDataSet * generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none())
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events from this p.d.f for use in extended likelihood calculations.
virtual 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.
RooCategory is an object to represent discrete states.
virtual Bool_t setIndex(Int_t index, bool printError=true) override
Set value by specifying the index code of the desired state.
RooDataSet is a container class to hold unbinned data.
virtual const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
static RooMsgService & instance()
Return reference to singleton instance.
StreamConfig & getStream(Int_t id)
static Double_t infinity()
Return internal infinity representation.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
RooRealVar represents a variable that can be changed from the outside.
void setBins(Int_t nBins, const char *name=0)
Create a uniform binning under name 'name' for this variable.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
const RooAbsCategoryLValue & indexCat() const
RooAbsPdf * getPdf(const char *catName) const
Return the p.d.f associated with the given index category name.
This class is designed to aid in the construction of RooDataSets and RooArgSets, particularly those n...
void AppendArgSet(const RooAbsCollection *aset, TString prefix="")
For each variable in aset, prepend prefix to its name and add to the internal store.
RooDataSet * GetAsDataSet(TString name, TString title)
Returns all detailed output as a dataset.
const RooArgList * GetAsArgList() const
void CommitSet(double weight=1.0)
Commit to the result RooDataSet.
RooWorkspace & GetWorkspace(void) const
Int_t GetNExperiments(void) const
const char * GetHost(void) const
Bool_t GetShowGui(void) const
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
RooAbsPdf::GenSpec * _gs3
GenSpec #2.
std::list< RooAbsPdf::GenSpec * > _gsList
std::string fSamplingDistName
virtual void GenerateGlobalObservables(RooAbsPdf &pdf) const
Double_t fAdaptiveLowLimit
virtual RooDataSet * GetSamplingDistributionsSingleWorker(RooArgSet ¶mPoint)
This is the main function for serial runs.
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 RooAb...
std::unique_ptr< const RooArgSet > fParametersForTestStat
RooAbsPdf::GenSpec * _gs2
GenSpec #1.
virtual SamplingDistribution * AppendSamplingDistribution(RooArgSet &allParameters, SamplingDistribution *last, Int_t additionalMC)
Extended interface to append to sampling distribution more samples.
NuisanceParametersSampler * fNuisanceParametersSampler
const RooArgSet * fObservables
Double_t fAdaptiveHighLimit
virtual RooArgList * EvaluateAllTestStatistics(RooAbsData &data, const RooArgSet &poi)
Evaluate all test statistics, returning result and any detailed output.
virtual RooDataSet * GetSamplingDistributions(RooArgSet ¶mPoint)
Use for serial and parallel runs.
Bool_t CheckConfig(void)
only checks, no guessing/determination (do this in calculators, e.g.
static Bool_t fgAlwaysUseMultiGen
GenSpec #4.
virtual RooAbsData * GenerateToyData(RooArgSet ¶mPoint, RooAbsPdf &pdf) const
virtual void AddTestStatistic(TestStatistic *t=NULL)
const RooArgSet * fNuisancePars
std::list< RooArgSet * > _obsList
static void SetAlwaysUseMultiGen(Bool_t flag)
Bool_t fExpectedNuisancePar
std::vector< TestStatistic * > fTestStatistics
ToyMCSampler()
Proof constructor. Do not use.
virtual void ClearCache()
clear the cache obtained from the pdf used for speeding the toy and global observables generation nee...
Bool_t fGenerateAutoBinned
RooAbsPdf::GenSpec * _gs4
GenSpec #3.
ProofConfig * fProofConfig
const RooDataSet * fProtoData
virtual SamplingDistribution * GetSamplingDistribution(RooArgSet ¶mPoint)
std::list< RooAbsPdf * > _pdfList
TString fGenerateBinnedTag
RooAbsPdf::GenSpec * _gs1
RooAbsPdf * fPriorNuisance
ToyMCStudy is an implementation of RooAbsStudy for toy Monte Carlo sampling.
void SetToyMCSampler(ToyMCSampler &t)
void SetParamPoint(const RooArgSet ¶mPoint)
void SetRandomSeed(unsigned int seed)
RooStudyManager is a utility class to manage studies that consist of repeated applications of generat...
void runProof(Int_t nExperiments, const char *proofHost="", Bool_t showGui=kTRUE)
Open PROOF-Lite session.
The RooWorkspace is a persistable container for RooFit projects.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual const char * GetTitle() const
Returns title of object.
virtual UInt_t Integer(UInt_t imax)
Returns a random integer uniformly distributed on the interval [ 0, imax-1 ].
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_t flag=kTRUE)
RooCmdArg ProtoData(const RooDataSet &protoData, Bool_t randomizeOrder=kFALSE, Bool_t resample=kFALSE)
RooCmdArg AutoBinned(Bool_t flag=kTRUE)
RooCmdArg NumEvents(Int_t numEvents)
RooCmdArg GenBinned(const char *tag)
RooCmdArg ExpectedData(Bool_t flag=kTRUE)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Namespace for the RooStats classes.
void removeTopic(RooFit::MsgTopic oldTopic)
static void output(int code)