31 RooArgSet poi(*mc_s->GetParametersOfInterest());
32 RooRealVar *
r =
dynamic_cast<RooRealVar *
>(poi.first());
34 if ((hint != 0) && (*hint > r->getMin())) {
35 r->setMax(std::min<double>(3*(*hint), r->getMax()));
38 RooStats::ModelConfig modelConfig(*mc_s);
39 modelConfig.SetSnapshot(poi);
41 RooStats::FeldmanCousins
fc(
data, modelConfig);
42 fc.FluctuateNumDataEntries(mc_s->GetPdf()->canBeExtended());
43 fc.UseAdaptiveSampling(
true);
44 fc.SetConfidenceLevel(
cl);
49 if (
verbose > 1)
std::cout <<
"scan in range [" << r->getMin() <<
", " << r->getMax() <<
"]" << std::endl;
50 std::auto_ptr<RooStats::PointSetInterval> fcInterval((RooStats::PointSetInterval *)
fc.GetInterval());
51 if (fcInterval.get() == 0)
return false;
52 if (
verbose > 1) fcInterval->GetParameterPoints()->Print(
"V");
53 RooDataHist* parameterScan = (RooDataHist*)
fc.GetPointsToScan();
56 for(
int i=0;
i<parameterScan->numEntries(); ++
i){
57 const RooArgSet * tmpPoint = parameterScan->get(
i);
58 if (!fcInterval->IsInInterval(*tmpPoint)) found =
i;
62 for(
int i=0;
i<parameterScan->numEntries(); ++
i){
63 const RooArgSet * tmpPoint = parameterScan->get(
i);
64 bool inside = fcInterval->IsInInterval(*tmpPoint);
65 if (inside) found =
i;
66 else if (found != -1)
break;
69 if (
verbose)
std::cout <<
"Points are either all inside or all outside the bound." << std::endl;
73 double fcBefore = (found > -1 ? parameterScan->get(found)->getRealValue(r->GetName()) : r->getMin());
74 double fcAfter = (found < parameterScan->numEntries()-1 ?
75 parameterScan->get(found+1)->getRealValue(r->GetName()) : r->getMax());
76 limit = 0.5*(fcAfter+fcBefore);
77 limitErr = 0.5*(fcAfter-fcBefore);
78 if (
verbose > 0)
std::cout <<
" would be " << r->GetName() <<
" < " <<
limit <<
" +/- "<<limitErr << std::endl;
87 std::cout <<
"\n -- FeldmanCousins++ -- \n";
88 std::cout <<
"Limit: " << r->GetName() << (
lowerLimit_ ?
"> " :
"< ") << limit <<
" +/- " << limitErr <<
" @ " <<
cl * 100 <<
"% CL" << std::endl;
const T & max(const T &a, const T &b)
static float rRelAccuracy_
char data[epos_bytes_allocation]
static float rAbsAccuracy_