73using std::endl, std::string;
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;
158 double upperEdgeMinusSigma;
159 double upperEdgePlusSigma;
160 double lowerEdgeOfAcceptance;
161 double lowerEdgeMinusSigma;
162 double lowerEdgePlusSigma;
163 Int_t additionalMC=0;
181 totalMC = (
Int_t) tmc;
191 additionalMC = 2*totalMC;
197 oocoutE(
nullptr,
Eval) <<
"Neyman Construction: error generating sampling distribution" << endl;
200 totalMC=samplingDist->
GetSize();
206 upperEdgeOfAcceptance =
208 sigma, upperEdgePlusSigma);
211 sigma, upperEdgeMinusSigma);
214 lowerEdgeOfAcceptance =
216 sigma, lowerEdgePlusSigma);
219 sigma, lowerEdgeMinusSigma);
222 <<
"total MC = " << totalMC
223 <<
" this test stat = " << thisTestStatistic << endl
224 <<
" upper edge -1sigma = " << upperEdgeMinusSigma
225 <<
", upperEdge = "<<upperEdgeOfAcceptance
226 <<
", upper edge +1sigma = " << upperEdgePlusSigma << endl
227 <<
" lower edge -1sigma = " << lowerEdgeMinusSigma
228 <<
", lowerEdge = "<<lowerEdgeOfAcceptance
229 <<
", lower edge +1sigma = " << lowerEdgePlusSigma << endl;
231 (thisTestStatistic <= upperEdgeOfAcceptance &&
232 thisTestStatistic > upperEdgeMinusSigma)
233 || (thisTestStatistic >= upperEdgeOfAcceptance &&
234 thisTestStatistic < upperEdgePlusSigma)
235 || (thisTestStatistic <= lowerEdgeOfAcceptance &&
236 thisTestStatistic > lowerEdgeMinusSigma)
237 || (thisTestStatistic >= lowerEdgeOfAcceptance &&
238 thisTestStatistic < lowerEdgePlusSigma)
239 ) && (totalMC < 100./
fSize)
246 oocoutE(
nullptr,
Eval) <<
"Neyman Construction: error generating sampling distribution" << endl;
250 lowerEdgeOfAcceptance =
252 upperEdgeOfAcceptance =
260 lowerEdgeOfAcceptance,
261 upperEdgeOfAcceptance);
266 <<
" total MC = " << samplingDist->
GetSize()
267 <<
" this test stat = " << thisTestStatistic << endl;
270 ooccoutP(samplingDist,
Eval) << myarg->GetName() <<
"=" << myarg->getVal() <<
" ";
272 ooccoutP(samplingDist,
Eval) <<
"[" << lowerEdgeOfAcceptance <<
", "
273 << upperEdgeOfAcceptance <<
"] " <<
" in interval = " <<
274 (thisTestStatistic >= lowerEdgeOfAcceptance && thisTestStatistic <= upperEdgeOfAcceptance)
278 if(thisTestStatistic >= lowerEdgeOfAcceptance && thisTestStatistic <= upperEdgeOfAcceptance) {
281 pointsInInterval->
add(*point);
287 samplingDist->
Write();
288 string tmpName =
"hist_";
289 tmpName+=samplingDist->
GetName();
290 TH1F h{tmpName.c_str(),
"",500,0.,5.};
291 for(
int ii=0; ii<samplingDist->
GetSize(); ++ii){
300 oocoutI(pointsInInterval,
Eval) << npass <<
" points in interval" << endl;
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
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.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Container class to hold unbinned data.
void add(const RooArgSet &row, double weight, double weightError)
Add one ore more rows of data.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
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.
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 file, usually with extension .root, that stores data and code in the form of serialized objects in ...
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.