16 #ifndef RooStats_NeymanConstruction
20 #ifndef RooStats_RooStatsUtils
24 #ifndef RooStats_PointSetInterval
45 using namespace RooFit;
46 using namespace RooStats;
60 fAdaptiveSampling(
false),
61 fAdditionalNToysFactor(1.),
62 fSaveBeltToFile(
false),
90 oocoutI(f,
Contents) <<
"NeymanConstruction saving ConfidenceBelt to file SamplingDistributions.root" << endl;
91 f =
new TFile(
"SamplingDistributions.root",
"recreate");
102 "points in interval",
131 Double_t upperEdgeOfAcceptance, upperEdgeMinusSigma, upperEdgePlusSigma;
132 Double_t lowerEdgeOfAcceptance, lowerEdgeMinusSigma, lowerEdgePlusSigma;
133 Int_t additionalMC=0;
151 totalMC = (
Int_t) tmc;
161 additionalMC = 2*totalMC;
167 oocoutE((
TObject*)0,
Eval) <<
"Neyman Construction: error generating sampling distribution" << endl;
170 totalMC=samplingDist->
GetSize();
176 upperEdgeOfAcceptance =
178 sigma, upperEdgePlusSigma);
181 sigma, upperEdgeMinusSigma);
184 lowerEdgeOfAcceptance =
186 sigma, lowerEdgePlusSigma);
189 sigma, lowerEdgeMinusSigma);
192 <<
"total MC = " << totalMC
193 <<
" this test stat = " << thisTestStatistic << endl
194 <<
" upper edge -1sigma = " << upperEdgeMinusSigma
195 <<
", upperEdge = "<<upperEdgeOfAcceptance
196 <<
", upper edge +1sigma = " << upperEdgePlusSigma << endl
197 <<
" lower edge -1sigma = " << lowerEdgeMinusSigma
198 <<
", lowerEdge = "<<lowerEdgeOfAcceptance
199 <<
", lower edge +1sigma = " << lowerEdgePlusSigma << endl;
201 (thisTestStatistic <= upperEdgeOfAcceptance &&
202 thisTestStatistic > upperEdgeMinusSigma)
203 || (thisTestStatistic >= upperEdgeOfAcceptance &&
204 thisTestStatistic < upperEdgePlusSigma)
205 || (thisTestStatistic <= lowerEdgeOfAcceptance &&
206 thisTestStatistic > lowerEdgeMinusSigma)
207 || (thisTestStatistic >= lowerEdgeOfAcceptance &&
208 thisTestStatistic < lowerEdgePlusSigma)
209 ) && (totalMC < 100./
fSize)
216 oocoutE((
TObject*)0,
Eval) <<
"Neyman Construction: error generating sampling distribution" << endl;
220 lowerEdgeOfAcceptance =
222 upperEdgeOfAcceptance =
230 lowerEdgeOfAcceptance,
231 upperEdgeOfAcceptance);
238 <<
" total MC = " << samplingDist->
GetSize()
239 <<
" this test stat = " << thisTestStatistic << endl;
244 ooccoutP(samplingDist,
Eval) <<
"[" << lowerEdgeOfAcceptance <<
", "
245 << upperEdgeOfAcceptance <<
"] " <<
" in interval = " <<
246 (thisTestStatistic >= lowerEdgeOfAcceptance && thisTestStatistic <= upperEdgeOfAcceptance)
250 if(thisTestStatistic >= lowerEdgeOfAcceptance && thisTestStatistic <= upperEdgeOfAcceptance) {
253 pointsInInterval->add(*point);
259 samplingDist->
Write();
260 string tmpName =
"hist_";
261 tmpName+=samplingDist->
GetName();
262 TH1F*
h =
new TH1F(tmpName.c_str(),
"",500,0.,5.);
273 oocoutI(pointsInInterval,
Eval) << npass <<
" points in interval" << endl;
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
virtual void SetParametersForTestStat(const RooArgSet &)=0
TestStatSampler * fTestStatSampler
Double_t InverseCDF(Double_t pvalue)
get the inverse of the Cumulative distribution function
Short_t Min(Short_t a, Short_t b)
Int_t GetSize() const
size of samples
ClassImp(TIterator) Bool_t TIterator return false
Compare two iterator objects.
const std::vector< Double_t > & GetSamplingDistribution() const
Get test statistics values.
void AddAcceptanceRegion(RooArgSet &, AcceptanceRegion region, Double_t cl=-1., Double_t leftside=-1.)
virtual SamplingDistribution * AppendSamplingDistribution(RooArgSet &allParameters, SamplingDistribution *last, Int_t additionalMC)
TIterator * createIterator(Bool_t dir=kIterForward) const
Double_t getVal(const RooArgSet *set=0) const
virtual SamplingDistribution * GetSamplingDistribution(RooArgSet ¶msOfInterest)=0
virtual ~NeymanConstruction()
default constructor if(fOwnsWorkspace && fWS) delete fWS; if(fConfBelt) delete fConfBelt; ...
ClassImp(RooStats::NeymanConstruction)
RooAbsData & fData
size of the test (eg. specified rate of Type I error)
RooRealVar represents a fundamental (non-derived) real valued object.
virtual const RooArgSet * get() const
virtual Int_t numEntries() const
ModelConfig & fModel
data set
virtual const char * GetName() const
Returns name of object.
virtual PointSetInterval * GetInterval() const
Main interface to get a ConfInterval (will be a PointSetInterval)
RooAbsData is the common abstract base class for binned and unbinned datasets.
ToyMCSampler is an implementation of the TestStatSampler interface.
RooDataSet is a container class to hold unbinned data.
This class simply holds a sampling distribution of some test statistic.
PointSetInterval is a concrete implementation of the ConfInterval interface.
NeymanConstruction is a concrete implementation of the NeymanConstruction interface that...
Mother of all ROOT objects.
virtual Double_t EvaluateTestStatistic(RooAbsData &data, RooArgSet ¶msOfInterest)=0
Double_t fAdditionalNToysFactor
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return NULL if not existing)
Double_t fLeftSideFraction
RooAbsData * fPointsToTest
ConfidenceBelt * fConfBelt