12#ifndef ROOSTATS_ToyMCImportanceSampler
13#define ROOSTATS_ToyMCImportanceSampler
41 virtual RooAbsData*
GenerateToyData(std::vector<double>& weights, std::vector<double>& nullNLLs, std::vector<double>& impNLLs)
const;
49 oocoutE(
nullptr,InputArguments) <<
"Index out of range. Requested index: "<<i<<
66 if(
p ==
nullptr && s ==
nullptr ) {
67 oocoutI(
nullptr,InputArguments) <<
"Neither density nor snapshot given. Doing nothing." << std::endl;
70 if(
p ==
nullptr &&
fPdf ==
nullptr ) {
71 oocoutE(
nullptr,InputArguments) <<
"No density given, but snapshot is there. Aborting." << std::endl;
75 if(
p ==
nullptr )
p =
fPdf;
87 if(
p ==
nullptr && s ==
nullptr ) {
88 oocoutI(
nullptr,InputArguments) <<
"Neither density nor snapshot nor test statistic given. Doing nothing." << std::endl;
94 if( s ) s = (
const RooArgSet*)s->snapshot();
108 oocoutE(
nullptr,InputArguments) <<
"Cannot use SetPdf() when already multiple null densities are specified. Please use AddNullDensity()." << std::endl;
116 oocoutI(
nullptr,InputArguments) <<
"Overwriting snapshot for the only defined null density." << std::endl;
120 oocoutE(
nullptr,InputArguments) <<
"Cannot use SetParametersForTestStat() when already multiple null densities are specified. Please use AddNullDensity()." << std::endl;
141 double poiValueForBackground = 0.0
147 double nStdDevOverlap = 0.5,
148 double poiValueForBackground = 0.0
177 mutable std::vector<std::unique_ptr<RooAbsReal>>
fNullNLLs;
178 mutable std::vector<std::unique_ptr<RooAbsReal>>
fImpNLLs;
#define ClassDefOverride(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
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
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Abstract base class for binned and unbinned datasets.
Abstract interface for all probability density functions.
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.
Variable that can be changed from the outside.
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
ToyMCImportanceSampler is an extension of the ToyMCSampler for Importance Sampling.
void AddImportanceDensity(RooAbsPdf *p, const RooArgSet *s)
For importance sampling with multiple densities/snapshots: This is used to check the current Likeliho...
std::vector< const RooArgSet * > fImportanceSnapshots
void SetExpIncreasingNumToysPerDensity(void)
~ToyMCImportanceSampler() override
RooDataSet * GetSamplingDistributionsSingleWorker(RooArgSet ¶mPoint) override
overwrite GetSamplingDistributionsSingleWorker(paramPoint) with a version that loops over nulls and i...
RooAbsData * GenerateToyData(RooArgSet ¶mPoint, double &weight) const override
std::vector< const RooArgSet * > fNullSnapshots
void SetDensityToGenerateFromByIndex(unsigned int i, bool fromNull=false)
specifies the pdf to sample from
virtual void SetConditionalObservables(const RooArgSet &set)
set the conditional observables which will be used when creating the NLL so the pdf's will not be nor...
ToyMCImportanceSampler(TestStatistic &ts, Int_t ntoys)
std::vector< RooAbsPdf * > fImportanceDensities
toysStrategies fToysStrategy
std::vector< std::unique_ptr< RooAbsReal > > fImpNLLs
!
void SetEqualNumToysPerDensity(void)
ToyMCImportanceSampler()=default
Proof constructor. Do not use.
std::vector< std::unique_ptr< RooAbsReal > > fNullNLLs
!
unsigned int fIndexGenDensity
void SetPdf(RooAbsPdf &pdf) override
overwrite from ToyMCSampler
void SetReuseNLL(bool r=true)
void SetApplyVeto(bool b=true)
When set to true, this sets the weight of all toys to zero that do not have the largest likelihood un...
void SetParametersForTestStat(const RooArgSet &nullpoi) override
overwrite from ToyMCSampler
int CreateImpDensitiesForOnePOIAdaptively(RooAbsPdf &pdf, const RooArgSet &allPOI, RooRealVar &poi, double nStdDevOverlap=0.5, double poiValueForBackground=0.0)
poi has to be fitted beforehand. This function expects this to be the muhat value.
void AddNullDensity(RooAbsPdf *p, const RooArgSet *s=nullptr)
The pdf can be nullptr in which case the density from SetPdf() is used.
void ClearCache() override
helper method for clearing the cache
RooArgSet fConditionalObs
set of conditional observables
std::vector< RooAbsPdf * > fNullDensities
support multiple null densities
int CreateNImpDensitiesForOnePOI(RooAbsPdf &pdf, const RooArgSet &allPOI, RooRealVar &poi, int n, double poiValueForBackground=0.0)
n is the number of importance densities
ToyMCSampler is an implementation of the TestStatSampler interface.
void SetParametersForTestStat(const RooArgSet &nullpoi) override
Set the Pdf, add to the workspace if not already there.
std::unique_ptr< const RooArgSet > fParametersForTestStat
RooAbsPdf * fPdf
densities, snapshots, and test statistics to reweight to
virtual RooAbsData * GenerateToyData(RooArgSet ¶mPoint, RooAbsPdf &pdf) const
generates toy data without weight
void SetPdf(RooAbsPdf &pdf) override
Set the Pdf, add to the workspace if not already there.
Namespace for the RooStats classes.
@ EXPONENTIALTOYDISTRIBUTION