14 #ifndef ROO_MSG_SERVICE 54 if (fIndex >= fNToys) {
60 nuisPoint = *fPoints->get(fIndex++);
61 weight = fPoints->weight();
64 if(fPoints->weight() == 0.0) {
66 NextPoint(nuisPoint, weight);
69 void NuisanceParametersSampler::Refresh() {
75 if (!fPrior || !fParams)
return;
77 if (fPoints)
delete fPoints;
87 TIter it2 = fParams->createIterator();
89 while ((myarg2 = dynamic_cast<RooRealVar*>(it2.
Next()))) {
94 fPoints = fPrior->generate(
100 if(fPoints->numEntries() != fNToys) {
101 fNToys = fPoints->numEntries();
103 "Adjusted number of toys to number of bins of nuisance parameters: " << fNToys << endl;
121 fPoints = fPrior->generate(*fParams, fNToys);
130 void ToyMCSampler::SetAlwaysUseMultiGen(
Bool_t flag) { fgAlwaysUseMultiGen = flag ; }
134 ToyMCSampler::ToyMCSampler() : fSamplingDistName(
"SD"), fNToys(1)
226 bool goodConfig =
true;
251 if (!allTS)
return 0;
272 if (saveAll) *allVars = *saveAll;
312 <<
"Bad COnfiguration in ToyMCSampler " 321 <<
"Adaptive sampling in ToyMCSampler is not supported for parallel runs." 365 <<
"Bad COnfiguration in ToyMCSampler " 389 if ( i% 500 == 0 && i>0 ) {
399 Double_t valueFirst = -999.0, weight = 1.0;
412 valueFirst = firstTS->getVal();
417 if(valueFirst != valueFirst) {
426 if(weight >= 0.) toysInTails += weight;
427 else toysInTails += 1.;
469 for (
int i=0; i < nCat; ++i){
481 list<RooArgSet*>::iterator oiter =
_obsList.begin();
482 list<RooAbsPdf::GenSpec*>::iterator giter =
_gsList.begin();
483 for (list<RooAbsPdf*>::iterator iter =
_pdfList.begin(); iter !=
_pdfList.end(); ++iter, ++giter, ++oiter) {
486 **oiter = *tmp->
get(0);
519 *allVars = paramPoint;
549 RooArgSet allVarsMinusParamPoint(*allVars);
564 *allVars = *saveVars;
586 int events = forceEvents;
618 <<
"ToyMCSampler: Error : pdf is not extended and number of events per toy is zero" 669 last->
Add(newSamples);
696 std::list<RooArgSet*>::iterator oiter =
_obsList.begin();
697 for (std::list<RooAbsPdf::GenSpec*>::iterator giter =
_gsList.begin(); giter !=
_gsList.end(); ++giter, ++oiter) {
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
virtual const char * GetName() const
Returns name of object.
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
virtual SamplingDistribution * GetSamplingDistribution(RooArgSet ¶mPoint)
const char * GetHost(void) const
Bool_t fGenerateAutoBinned
Bool_t GetShowGui(void) const
virtual RooDataSet * GetSamplingDistributions(RooArgSet ¶mPoint)
virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE)
Set value by specifying the index code of the desired state.
RooAbsData * Generate(RooAbsPdf &pdf, RooArgSet &observables, const RooDataSet *protoData=NULL, int forceEvents=0) const
RooAbsPdf::GenSpec * _gs1
RooCmdArg NumEvents(Int_t numEvents)
RooWorkspace & GetWorkspace(void) const
std::string fSamplingDistName
StreamConfig & getStream(Int_t id)
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 idetical spec...
NuisanceParametersSampler * fNuisanceParametersSampler
void removeTopic(RooFit::MsgTopic oldTopic)
static RooMsgService & instance()
Return reference to singleton instance.
const RooArgList * GetAsArgList() const
RooCmdArg Extended(Bool_t flag=kTRUE)
void SetRandomSeed(unsigned int seed)
Double_t fAdaptiveLowLimit
void SetParamPoint(const RooArgSet ¶mPoint)
ToyMCStudy is an implementation of RooAbsStudy for toy Monte Carlo sampling.
Int_t numTypes(const char *=0) const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
TString fGenerateBinnedTag
virtual SamplingDistribution * AppendSamplingDistribution(RooArgSet &allParameters, SamplingDistribution *last, Int_t additionalMC)
virtual RooArgList * EvaluateAllTestStatistics(RooAbsData &data, const RooArgSet &poi)
virtual RooDataSet * GetSamplingDistributionsSingleWorker(RooArgSet ¶mPoint)
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Double_t fAdaptiveHighLimit
void setBins(Int_t nBins, const char *name=0)
void CommitSet(double weight=1.0)
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events from this p.d.f for use in extended likelihood calculations.
RooCmdArg ExpectedData(Bool_t flag=kTRUE)
RooRealVar represents a fundamental (non-derived) real valued object.
std::list< RooArgSet * > _obsList
void AppendArgSet(const RooAbsCollection *aset, TString prefix="")
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
const RooAbsCategoryLValue & indexCat() const
RooAbsArg * first() const
const RooDataSet * fProtoData
Int_t GetNExperiments(void) const
virtual void ClearCache()
ProofConfig * fProofConfig
static Double_t infinity()
Return internal infinity representation.
std::vector< TestStatistic * > fTestStatistics
const RooArgSet * fGlobalObservables
RooStudyManager is a utility class to manage studies that consist of repeated applications of generat...
RooAbsData is the common abstract base class for binned and unbinned datasets.
ToyMCSampler is an implementation of the TestStatSampler interface.
RooCmdArg GenBinned(const char *tag)
void Add(const SamplingDistribution *other)
merge two sampling distributions
RooDataSet * GetAsDataSet(TString name, TString title)
RooDataSet is a container class to hold unbinned data.
This class simply holds a sampling distribution of some test statistic.
RooCategory represents a fundamental (non-derived) discrete value object.
Bool_t canBeExtended() const
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event 'index'.
Namespace for the RooStats classes.
RooAbsPdf::GenSpec * _gs4
GenSpec #3.
RooCmdArg AutoBinned(Bool_t flag=kTRUE)
RooCmdArg ProtoData(const RooDataSet &protoData, Bool_t randomizeOrder=kFALSE, Bool_t resample=kFALSE)
std::list< RooAbsPdf::GenSpec * > _gsList
void SetToyMCSampler(ToyMCSampler &t)
virtual const char * getLabel() const
Return label string of current state.
static Bool_t fgAlwaysUseMultiGen
GenSpec #4.
virtual RooAbsData * GenerateToyData(RooArgSet ¶mPoint, RooAbsPdf &pdf) const
Mother of all ROOT objects.
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooAbsPdf * getPdf(const char *catName) const
Return the p.d.f associated with the given index category name.
const RooArgSet * fObservables
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
const RooArgSet * fParametersForTestStat
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())
Generate a new dataset containing the specified variables with events sampled from our distribution...
RooAbsPdf::GenSpec * _gs3
GenSpec #2.
virtual void GenerateGlobalObservables(RooAbsPdf &pdf) const
RooAbsPdf::GenSpec * _gs2
GenSpec #1.
const RooArgSet * fNuisancePars
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset...
virtual RooDataSet * generateSimGlobal(const RooArgSet &whatVars, Int_t nEvents)
Special generator interface for generation of 'global observables' – for RooStats tools...
Bool_t fExpectedNuisancePar
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
virtual void AddTestStatistic(TestStatistic *t=NULL)
RooAbsPdf * fPriorNuisance
std::list< RooAbsPdf * > _pdfList
The RooWorkspace is a persistable container for RooFit projects.
virtual Int_t numEntries() const
virtual const char * GetTitle() const
Returns title of object.