183 |
|
|
184 |
|
} |
185 |
|
|
186 |
< |
vector<float> compute_one_upper_limit(float mceff,float mcefferr, int ibin, string mcjzb, string plotfilename, bool doexpected, int flipped) { |
186 |
> |
vector<float> compute_one_upper_limit(float mceff,float mcefferr, int ibin, string mcjzb, string plotfilename, bool doexpected, int flipped, bool doasymptotic=false) { |
187 |
|
float sigma95=-9.9,sigma95A=-9.9; |
188 |
|
/* |
189 |
|
USAGE OF ROOSTATS_CL95 |
228 |
|
|
229 |
|
if(flipped==0) dout << "Calling limit capsule instead of calling : CL95(" << luminosity << "," << lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << Npred[ibin] << "," << Nprederr[ibin] << "," << Nobs[ibin] << "," << false << "," << nuisancemodel<< ") " << endl; |
230 |
|
if(flipped>0) dout << "Calling limit capsule instead of calling : CL95(" << luminosity << "," << lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << flippedNpred[ibin] << "," << flippedNprederr[ibin] << "," << flippedNobs[ibin] << "," << false << "," << nuisancemodel<< ") " << endl; |
231 |
+ |
|
232 |
+ |
stringstream command; |
233 |
+ |
if(flipped==0) command << PlottingSetup::cbafbasedir << "/DistributedModelCalculations/Limits/TimedLimitCapsule.exec " << repname.str() << " " << luminosity << " " << luminosity*lumiuncert << " " << mceff << " " << mcefferr << " " << Npred[ibin] << " " << Nprederr[ibin] << " " << Nobs[ibin] << " " << -1 << " " << PlottingSetup::basedirectory << "/" << plotfilename << " " << doexpected << " " << doasymptotic; |
234 |
+ |
if(flipped>0) command << PlottingSetup::cbafbasedir << "/DistributedModelCalculations/Limits/TimedLimitCapsule.exec " << repname.str() << " " << luminosity << " " << luminosity*lumiuncert << " " << mceff << " " << mcefferr << " " << flippedNpred[ibin] << " " << flippedNprederr[ibin] << " " << flippedNobs[ibin] << " " << -1 << " " << PlottingSetup::basedirectory << "/" << plotfilename << " " << doexpected<< " " << doasymptotic; |
235 |
+ |
|
236 |
+ |
dout << command.str() << endl; |
237 |
|
|
238 |
< |
stringstream command; |
239 |
< |
if(flipped==0) command << PlottingSetup::cbafbasedir << "/DistributedModelCalculations/Limits/TimedLimitCapsule.exec " << repname.str() << " " << luminosity << " " << luminosity*lumiuncert << " " << mceff << " " << mcefferr << " " << Npred[ibin] << " " << Nprederr[ibin] << " " << Nobs[ibin] << " " << -1 << " " << PlottingSetup::basedirectory << "/" << plotfilename << " " << doexpected; |
240 |
< |
if(flipped>0) command << PlottingSetup::cbafbasedir << "/DistributedModelCalculations/Limits/TimedLimitCapsule.exec " << repname.str() << " " << luminosity << " " << luminosity*lumiuncert << " " << mceff << " " << mcefferr << " " << flippedNpred[ibin] << " " << flippedNprederr[ibin] << " " << flippedNobs[ibin] << " " << -1 << " " << PlottingSetup::basedirectory << "/" << plotfilename << " " << doexpected; |
241 |
< |
dout << command.str() << endl; |
242 |
< |
|
237 |
< |
int retval = 256; |
238 |
< |
int attempts=0; |
239 |
< |
while(!(retval==0||attempts>=3)) {//try up to 3 times |
238 |
> |
if(doasymptotic) write_warning(__FUNCTION__, "DOING ASYMPTOTIC LIMIT!"); |
239 |
> |
|
240 |
> |
int retval = 256; |
241 |
> |
int attempts=0; |
242 |
> |
while(!(retval==0||attempts>=3)) {//try up to 3 times |
243 |
|
attempts++; |
244 |
|
dout << "Starting limit calculation (TimedLimitCapsule) now : Attempt " << attempts << endl; |
245 |
|
retval=gSystem->Exec(command.str().c_str()); |
258 |
|
remove(repname.str().c_str()); |
259 |
|
sigma95=limres.observed; |
260 |
|
|
258 |
– |
|
261 |
|
///------------------------------------------ < /NEW > ---------------------------------------------------------- |
262 |
|
vector<float> sigmas; |
263 |
|
sigmas.push_back(sigma95); |
275 |
|
}//end of mc efficiency is ok |
276 |
|
} |
277 |
|
|
278 |
< |
void compute_upper_limits_from_counting_experiment(vector<vector<float> > uncertainties,vector<float> jzbcuts, string mcjzb, bool doexpected, int flipped) { |
278 |
> |
vector<float> compute_upper_limits_from_counting_experiment(vector<vector<float> > uncertainties,vector<float> jzbcuts, string mcjzb, bool doexpected, int flipped) { |
279 |
|
dout << "Doing counting experiment ... " << endl; |
280 |
|
vector<vector<string> > limits; |
281 |
|
vector<vector<float> > vlimits; |
387 |
|
} |
388 |
|
allresults.Print(); |
389 |
|
|
390 |
+ |
//--------------------------------------------- |
391 |
+ |
|
392 |
+ |
vector<float> lowestULs; |
393 |
+ |
for(int isample=0;isample<signalsamples.collection.size();isample++) { |
394 |
+ |
float lowestUL=-1; |
395 |
+ |
for(int icut=0;icut<jzbcuts.size();icut++) { |
396 |
+ |
float currUL=Round((vlimits[isample][2*icut]),3); |
397 |
+ |
if(currUL>0) { |
398 |
+ |
if(lowestUL<0) lowestUL=currUL; |
399 |
+ |
if(currUL<lowestUL) lowestUL=currUL; |
400 |
+ |
} |
401 |
+ |
lowestULs.push_back(lowestUL); |
402 |
+ |
} |
403 |
+ |
} |
404 |
|
|
405 |
+ |
//--------------------------------------------- |
406 |
+ |
return lowestULs; |
407 |
|
} |
408 |
|
|
409 |
|
|