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_t upperEdgeOfAcceptance, upperEdgeMinusSigma, upperEdgePlusSigma;
158 Double_t lowerEdgeOfAcceptance, lowerEdgeMinusSigma, lowerEdgePlusSigma;
159 Int_t additionalMC=0;
177 totalMC = (
Int_t) tmc;
187 additionalMC = 2*totalMC;
193 oocoutE((
TObject*)0,
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((
TObject*)0,
Eval) <<
"Neyman Construction: error generating sampling distribution" << endl;
246 lowerEdgeOfAcceptance =
248 upperEdgeOfAcceptance =
256 lowerEdgeOfAcceptance,
257 upperEdgeOfAcceptance);
264 <<
" total MC = " << samplingDist->
GetSize()
265 <<
" this test stat = " << thisTestStatistic << endl;
270 ooccoutP(samplingDist,
Eval) <<
"[" << lowerEdgeOfAcceptance <<
", "
271 << upperEdgeOfAcceptance <<
"] " <<
" in interval = " <<
272 (thisTestStatistic >= lowerEdgeOfAcceptance && thisTestStatistic <= upperEdgeOfAcceptance)
276 if(thisTestStatistic >= lowerEdgeOfAcceptance && thisTestStatistic <= upperEdgeOfAcceptance) {
279 pointsInInterval->
add(*point);
285 samplingDist->
Write();
286 string tmpName =
"hist_";
287 tmpName+=samplingDist->
GetName();
288 TH1F*
h =
new TH1F(tmpName.c_str(),
"",500,0.,5.);
289 for(
int ii=0; ii<samplingDist->
GetSize(); ++ii){
299 oocoutI(pointsInInterval,
Eval) << npass <<
" points in interval" << endl;
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...
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 Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooDataSet is a container class to hold unbinned data.
virtual void add(const RooArgSet &row, Double_t weight=1.0, Double_t weightError=0) override
Add a data point, with its coordinates specified in the 'data' argset, to the data set.
RooRealVar represents a variable that can be changed from the outside.
void AddAcceptanceRegion(RooArgSet &, AcceptanceRegion region, Double_t cl=-1., Double_t leftside=-1.)
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 NULL if not existing)
NeymanConstruction is a concrete implementation of the NeymanConstruction interface that,...
RooAbsData * fPointsToTest
Double_t fAdditionalNToysFactor
ConfidenceBelt * fConfBelt
virtual PointSetInterval * GetInterval() const
Main interface to get a ConfInterval (will be a PointSetInterval)
virtual ~NeymanConstruction()
default constructor if(fOwnsWorkspace && fWS) delete fWS; if(fConfBelt) delete fConfBelt;
Double_t fLeftSideFraction
ModelConfig & fModel
data set
RooAbsData & fData
size of the test (eg. specified rate of Type I error)
NeymanConstruction(RooAbsData &data, ModelConfig &model)
NeymanConstruction();.
TestStatSampler * fTestStatSampler
PointSetInterval is a concrete implementation of the ConfInterval interface.
This class simply holds a sampling distribution of some test statistic.
Double_t InverseCDF(Double_t pvalue)
get the inverse of the Cumulative distribution function
Int_t GetSize() const
size of samples
const std::vector< Double_t > & GetSamplingDistribution() const
Get test statistics values.
virtual Double_t EvaluateTestStatistic(RooAbsData &data, RooArgSet ¶msOfInterest)=0
virtual void SetParametersForTestStat(const RooArgSet &)=0
virtual SamplingDistribution * GetSamplingDistribution(RooArgSet ¶msOfInterest)=0
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 a suite of consecutive data records (TKey instances) with a well defined format.
1-D histogram with a float per channel (see TH1 documentation)}
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual Int_t Write(const char *name=0, 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)