83 fTestStatSampler(nullptr),
84 fPointsToTest(nullptr),
87 fAdaptiveSampling(false),
88 fAdditionalNToysFactor(1.),
89 fSaveBeltToFile(false),
116 oocoutI(
f,
Contents) <<
"NeymanConstruction saving ConfidenceBelt to file SamplingDistributions.root" << endl;
117 f =
new TFile(
"SamplingDistributions.root",
"recreate");
128 "points in interval",
157 double upperEdgeOfAcceptance, upperEdgeMinusSigma, upperEdgePlusSigma;
158 double lowerEdgeOfAcceptance, lowerEdgeMinusSigma, lowerEdgePlusSigma;
159 Int_t additionalMC=0;
177 totalMC = (
Int_t) tmc;
187 additionalMC = 2*totalMC;
193 oocoutE(
nullptr,
Eval) <<
"Neyman Construction: error generating sampling distribution" << endl;
196 totalMC=samplingDist->
GetSize();
202 upperEdgeOfAcceptance =
204 sigma, upperEdgePlusSigma);
207 sigma, upperEdgeMinusSigma);
210 lowerEdgeOfAcceptance =
212 sigma, lowerEdgePlusSigma);
215 sigma, lowerEdgeMinusSigma);
218 <<
"total MC = " << totalMC
219 <<
" this test stat = " << thisTestStatistic << endl
220 <<
" upper edge -1sigma = " << upperEdgeMinusSigma
221 <<
", upperEdge = "<<upperEdgeOfAcceptance
222 <<
", upper edge +1sigma = " << upperEdgePlusSigma << endl
223 <<
" lower edge -1sigma = " << lowerEdgeMinusSigma
224 <<
", lowerEdge = "<<lowerEdgeOfAcceptance
225 <<
", lower edge +1sigma = " << lowerEdgePlusSigma << endl;
227 (thisTestStatistic <= upperEdgeOfAcceptance &&
228 thisTestStatistic > upperEdgeMinusSigma)
229 || (thisTestStatistic >= upperEdgeOfAcceptance &&
230 thisTestStatistic < upperEdgePlusSigma)
231 || (thisTestStatistic <= lowerEdgeOfAcceptance &&
232 thisTestStatistic > lowerEdgeMinusSigma)
233 || (thisTestStatistic >= lowerEdgeOfAcceptance &&
234 thisTestStatistic < lowerEdgePlusSigma)
235 ) && (totalMC < 100./
fSize)
242 oocoutE(
nullptr,
Eval) <<
"Neyman Construction: error generating sampling distribution" << endl;
246 lowerEdgeOfAcceptance =
248 upperEdgeOfAcceptance =
256 lowerEdgeOfAcceptance,
257 upperEdgeOfAcceptance);
262 <<
" total MC = " << samplingDist->
GetSize()
263 <<
" this test stat = " << thisTestStatistic << endl;
265 for (
auto const *myarg : static_range_cast<RooRealVar *> (*point)){
266 ooccoutP(samplingDist,
Eval) << myarg->GetName() <<
"=" << myarg->getVal() <<
" ";
268 ooccoutP(samplingDist,
Eval) <<
"[" << lowerEdgeOfAcceptance <<
", "
269 << upperEdgeOfAcceptance <<
"] " <<
" in interval = " <<
270 (thisTestStatistic >= lowerEdgeOfAcceptance && thisTestStatistic <= upperEdgeOfAcceptance)
274 if(thisTestStatistic >= lowerEdgeOfAcceptance && thisTestStatistic <= upperEdgeOfAcceptance) {
277 pointsInInterval->
add(*point);
283 samplingDist->
Write();
284 string tmpName =
"hist_";
285 tmpName+=samplingDist->
GetName();
286 TH1F*
h =
new TH1F(tmpName.c_str(),
"",500,0.,5.);
287 for(
int ii=0; ii<samplingDist->
GetSize(); ++ii){
297 oocoutI(pointsInInterval,
Eval) << npass <<
" points in interval" << endl;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
Abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooDataSet is a container class to hold unbinned data.
void add(const RooArgSet &row, double weight, double weightError)
Add one ore more rows of data.
void AddAcceptanceRegion(RooArgSet &, AcceptanceRegion region, double cl=-1., double leftside=-1.)
add after creating a region
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return nullptr if not existing)
NeymanConstruction is a concrete implementation of the NeymanConstruction interface that,...
bool fAdaptiveSampling
controls use of adaptive sampling algorithm
RooAbsData * fPointsToTest
double fSize
size of the test (eg. specified rate of Type I error)
PointSetInterval * GetInterval() const override
Main interface to get a ConfInterval (will be a PointSetInterval)
ConfidenceBelt * fConfBelt
~NeymanConstruction() override
default constructor if(fOwnsWorkspace && fWS) delete fWS; if(fConfBelt) delete fConfBelt;
bool fSaveBeltToFile
controls use if ConfidenceBelt should be saved to a TFile
RooAbsData & fData
data set
NeymanConstruction(RooAbsData &data, ModelConfig &model)
NeymanConstruction();.
double fAdditionalNToysFactor
give user ability to ask for more toys
bool fCreateBelt
controls use if ConfidenceBelt should be saved to a TFile
TestStatSampler * fTestStatSampler
PointSetInterval is a concrete implementation of the ConfInterval interface.
This class simply holds a sampling distribution of some test statistic.
Int_t GetSize() const
size of samples
double InverseCDF(double pvalue)
get the inverse of the Cumulative distribution function
const std::vector< double > & GetSamplingDistribution() const
Get test statistics values.
virtual void SetParametersForTestStat(const RooArgSet &)=0
specify the values of parameters used when evaluating test statistic
virtual double EvaluateTestStatistic(RooAbsData &data, RooArgSet ¶msOfInterest)=0
Main interface to evaluate the test statistic on a dataset.
virtual SamplingDistribution * GetSamplingDistribution(RooArgSet ¶msOfInterest)=0
Main interface to get a ConfInterval, pure virtual.
ToyMCSampler is an implementation of the TestStatSampler interface.
virtual SamplingDistribution * AppendSamplingDistribution(RooArgSet &allParameters, SamplingDistribution *last, Int_t additionalMC)
Extended interface to append to sampling distribution more samples.
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
1-D histogram with a float per channel (see TH1 documentation)}
const char * GetName() const override
Returns name of object.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Namespace for the RooStats classes.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.