88 fAdaptiveSampling(false),
89 fAdditionalNToysFactor(1.),
90 fSaveBeltToFile(false),
117 oocoutI(
f,
Contents) <<
"NeymanConstruction saving ConfidenceBelt to file SamplingDistributions.root" << endl;
118 f =
new TFile(
"SamplingDistributions.root",
"recreate");
129 "points in interval",
158 Double_t upperEdgeOfAcceptance, upperEdgeMinusSigma, upperEdgePlusSigma;
159 Double_t lowerEdgeOfAcceptance, lowerEdgeMinusSigma, lowerEdgePlusSigma;
160 Int_t additionalMC=0;
178 totalMC = (
Int_t) tmc;
188 additionalMC = 2*totalMC;
194 oocoutE((
TObject*)0,
Eval) <<
"Neyman Construction: error generating sampling distribution" << endl;
197 totalMC=samplingDist->
GetSize();
203 upperEdgeOfAcceptance =
205 sigma, upperEdgePlusSigma);
208 sigma, upperEdgeMinusSigma);
211 lowerEdgeOfAcceptance =
213 sigma, lowerEdgePlusSigma);
216 sigma, lowerEdgeMinusSigma);
219 <<
"total MC = " << totalMC
220 <<
" this test stat = " << thisTestStatistic << endl
221 <<
" upper edge -1sigma = " << upperEdgeMinusSigma
222 <<
", upperEdge = "<<upperEdgeOfAcceptance
223 <<
", upper edge +1sigma = " << upperEdgePlusSigma << endl
224 <<
" lower edge -1sigma = " << lowerEdgeMinusSigma
225 <<
", lowerEdge = "<<lowerEdgeOfAcceptance
226 <<
", lower edge +1sigma = " << lowerEdgePlusSigma << endl;
228 (thisTestStatistic <= upperEdgeOfAcceptance &&
229 thisTestStatistic > upperEdgeMinusSigma)
230 || (thisTestStatistic >= upperEdgeOfAcceptance &&
231 thisTestStatistic < upperEdgePlusSigma)
232 || (thisTestStatistic <= lowerEdgeOfAcceptance &&
233 thisTestStatistic > lowerEdgeMinusSigma)
234 || (thisTestStatistic >= lowerEdgeOfAcceptance &&
235 thisTestStatistic < lowerEdgePlusSigma)
236 ) && (totalMC < 100./
fSize)
243 oocoutE((
TObject*)0,
Eval) <<
"Neyman Construction: error generating sampling distribution" << endl;
247 lowerEdgeOfAcceptance =
249 upperEdgeOfAcceptance =
257 lowerEdgeOfAcceptance,
258 upperEdgeOfAcceptance);
265 <<
" total MC = " << samplingDist->
GetSize()
266 <<
" this test stat = " << thisTestStatistic << endl;
271 ooccoutP(samplingDist,
Eval) <<
"[" << lowerEdgeOfAcceptance <<
", "
272 << upperEdgeOfAcceptance <<
"] " <<
" in interval = " <<
273 (thisTestStatistic >= lowerEdgeOfAcceptance && thisTestStatistic <= upperEdgeOfAcceptance)
277 if(thisTestStatistic >= lowerEdgeOfAcceptance && thisTestStatistic <= upperEdgeOfAcceptance) {
280 pointsInInterval->
add(*point);
286 samplingDist->
Write();
287 string tmpName =
"hist_";
288 tmpName+=samplingDist->
GetName();
289 TH1F*
h =
new TH1F(tmpName.c_str(),
"",500,0.,5.);
290 for(
int ii=0; ii<samplingDist->
GetSize(); ++ii){
300 oocoutI(pointsInInterval,
Eval) << npass <<
" points in interval" << endl;
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
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)
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)