169 |
|
} |
170 |
|
|
171 |
|
vector<float> compute_one_upper_limit(float mceff,float mcefferr, int ibin, string mcjzb, bool doobserved=false) { |
172 |
< |
float sigma95=0.0,sigma95A=0.0; |
172 |
> |
float sigma95=-9.9,sigma95A=-9.9; |
173 |
|
int nuisancemodel=1; |
174 |
+ |
if(mceff<=0) { |
175 |
+ |
write_warning(__FUNCTION__,"Cannot compute upper limit in this configuration as the efficiency is negative:"); |
176 |
+ |
dout << "mc efficiency=" << mceff << " +/- " << mcefferr; |
177 |
+ |
vector<float> sigmas; |
178 |
+ |
sigmas.push_back(-1); |
179 |
+ |
sigmas.push_back(-1); |
180 |
+ |
return sigmas; |
181 |
+ |
} else { |
182 |
|
dout << "Now calling : CL95(" << luminosity << "," << lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << Npred[ibin] << "," << Nprederr[ibin] << "," << Nobs[ibin] << "," << false << "," << nuisancemodel<< ") " << endl; |
183 |
|
sigma95 = CL95(luminosity, lumiuncert*luminosity, mceff, mcefferr, Npred[ibin], Nprederr[ibin], Nobs[ibin], false, nuisancemodel); |
184 |
|
if(doobserved) { |
189 |
|
sigmas.push_back(sigma95); |
190 |
|
sigmas.push_back(sigma95A); |
191 |
|
return sigmas; |
192 |
+ |
} |
193 |
|
} |
194 |
|
|
195 |
|
void compute_upper_limits_from_counting_experiment(vector<vector<float> > uncertainties,vector<float> jzbcuts, string mcjzb, bool doobserved) { |
210 |
|
float staterr=uncertainties[isample*jzbcuts.size()+ibin][2]; |
211 |
|
float systerr=uncertainties[isample*jzbcuts.size()+ibin][3]; |
212 |
|
float toterr =uncertainties[isample*jzbcuts.size()+ibin][4]; |
213 |
< |
float observed,null,result; |
214 |
< |
fill_result_histos(observed, null,null,null,null,null,null,null,mcjzb,JZBcutat,(int)5,result,(signalsamples.FindSample(signalsamples.collection[isample].filename)),signalsamples); |
215 |
< |
observed-=result;//this is the actual excess we see! |
216 |
< |
float expected=observed/luminosity; |
213 |
> |
float observed,observederr,null,result; |
214 |
> |
|
215 |
> |
// fill_result_histos(observed,observederr, null,null,null,null,null,null,null,mcjzb,JZBcutat,14000,(int)5,result,(signalsamples.FindSample(signalsamples.collection[isample].filename)),signalsamples); |
216 |
> |
// observed-=result;//this is the actual excess we see! |
217 |
> |
// float expected=observed/luminosity; |
218 |
|
|
219 |
|
dout << "Sample: " << signalsamples.collection[isample].samplename << ", JZB>"<<JZBcutat<< " : " << mceff << " +/- " << staterr << " (stat) +/- " << systerr << " (syst) --> toterr = " << toterr << endl; |
220 |
|
vector<float> sigmas = compute_one_upper_limit(mceff,toterr,ibin,mcjzb,doobserved); |
221 |
|
|
222 |
|
if(doobserved) { |
223 |
< |
rows.push_back(any2string(sigmas[0])+";"+any2string(sigmas[1])+";"+"("+any2string(expected)+")"); |
223 |
> |
// rows.push_back(any2string(sigmas[0])+";"+any2string(sigmas[1])+";"+"("+any2string(expected)+")"); |
224 |
> |
rows.push_back(any2string(sigmas[0])+";"+any2string(sigmas[1])+";"+"("+any2string(signalsamples.collection[isample].xs)+")"); |
225 |
|
vrows.push_back(sigmas[0]); |
226 |
|
vrows.push_back(sigmas[1]); |
227 |
< |
vrows.push_back(expected); |
227 |
> |
// vrows.push_back(expected); |
228 |
> |
vrows.push_back(signalsamples.collection[isample].xs); |
229 |
|
} |
230 |
|
else { |
231 |
< |
rows.push_back(any2string(sigmas[0])+"("+any2string(expected)+")"); |
231 |
> |
// rows.push_back(any2string(sigmas[0])+"("+any2string(expected)+")"); |
232 |
> |
rows.push_back(any2string(sigmas[0])); |
233 |
|
vrows.push_back(sigmas[0]); |
234 |
< |
vrows.push_back(expected); |
234 |
> |
vrows.push_back(signalsamples.collection[isample].xs); |
235 |
> |
// vrows.push_back(expected); |
236 |
|
} |
237 |
|
}//end of bin loop |
238 |
|
limits.push_back(rows); |
239 |
|
vlimits.push_back(vrows); |
240 |
|
}//end of sample loop |
241 |
< |
dout << endl << endl << "PAS table 3: " << endl << endl; |
241 |
> |
dout << endl << endl << endl << "_________________________________________________________________________________________________" << endl << endl; |
242 |
> |
dout << endl << endl << "PAS table 3: (notation: limit [95%CL])" << endl << endl; |
243 |
|
dout << "\t"; |
244 |
|
for (int irow=0;irow<jzbcuts.size();irow++) { |
245 |
|
dout << jzbcuts[irow] << "\t"; |
247 |
|
dout << endl; |
248 |
|
for(int irow=0;irow<limits.size();irow++) { |
249 |
|
for(int ientry=0;ientry<limits[irow].size();ientry++) { |
250 |
< |
dout << limits[irow][ientry] << "\t"; |
250 |
> |
if (limits[irow][ientry]>0) dout << limits[irow][ientry] << "\t"; |
251 |
> |
else dout << " (N/A) \t"; |
252 |
|
} |
253 |
|
dout << endl; |
254 |
|
} |
255 |
|
|
256 |
|
if(!doobserved) { |
257 |
< |
dout << endl << endl << "LIMITS: " << endl; |
258 |
< |
dout << "\t"; |
257 |
> |
dout << endl << endl << "LIMITS: (Tex)" << endl; |
258 |
> |
tout << "\\begin{tabular}{ | l | "; |
259 |
> |
for (int irow=0;irow<jzbcuts.size();irow++) tout << " l |"; |
260 |
> |
tout << "} " << endl << " \\hline " << endl << "& \t "; |
261 |
|
for (int irow=0;irow<jzbcuts.size();irow++) { |
262 |
< |
dout << jzbcuts[irow] << "\t"; |
262 |
> |
tout << "JZB $>$ " << jzbcuts[irow] << " GeV & \t "; |
263 |
|
} |
264 |
< |
dout << endl; |
264 |
> |
tout << " \\\\ \\hline " << endl; |
265 |
|
for(int irow=0;irow<limits.size();irow++) { |
266 |
< |
dout << limits[irow][0] << "\t"; |
266 |
> |
tout << limits[irow][0] << " \t"; |
267 |
|
for(int ientry=0;ientry<jzbcuts.size();ientry++) { |
268 |
< |
dout << Round(vlimits[irow][2*ientry] / vlimits[irow][2*ientry+1],3)<< "\t"; |
268 |
> |
if(vlimits[irow][2*ientry]>0) tout << " & " << Round(vlimits[irow][2*ientry],2) << " \t (" << Round(vlimits[irow][2*ientry] / vlimits[irow][2*ientry+1],3)<< "x \\sigma ) \t"; |
269 |
> |
else tout << " & ( N / A ) \t"; |
270 |
> |
// dout << Round(vlimits[irow][2*ientry],3) << " / " << Round(vlimits[irow][2*ientry+1],3)<< "\t"; |
271 |
|
} |
272 |
< |
dout << endl; |
272 |
> |
tout << " \\\\ \\hline " << endl; |
273 |
|
} |
274 |
+ |
tout << "\\end{tabular}" << endl; |
275 |
|
}//do observed |
276 |
|
|
277 |
|
dout << endl << endl << "Final selection efficiencies with total statistical and systematic errors, and corresponding observed and expected upper limits (UL) on ($\\sigma\\times$ BR $\\times$ acceptance) for the LM4 and LM8 scenarios, in the different regions. The last column contains the predicted ($\\sigma \\times $BR$\\times$ acceptance) at NLO obtained from Monte Carlo simulation." << endl; |
278 |
< |
dout << "Scenario \t Efficiency [%] \t Upper limits [pb] \t Prediction [pb]" << endl; |
278 |
> |
dout << "Scenario \t Efficiency [%] \t Upper limits [pb] \t \\sigma [pb]" << endl; |
279 |
|
for(int icut=0;icut<jzbcuts.size();icut++) { |
280 |
|
dout << "Region with JZB>" << jzbcuts[icut] << endl; |
281 |
|
for(int isample=0;isample<signalsamples.collection.size();isample++) { |
282 |
< |
dout << limits[icut][0] << "\t" << Round(100*uncertainties[isample*jzbcuts.size()+icut][1],1) << "+/-" << Round(100*uncertainties[isample*jzbcuts.size()+icut][2],1) << " (stat) +/- " << Round(100*uncertainties[isample*jzbcuts.size()+icut][3],1) << " (syst) \t" << Round((vlimits[isample][2*icut]),3) << "\t" << Round(vlimits[isample][2*icut+1],3) << endl; |
282 |
> |
dout << limits[isample][0] << "\t" << Round(100*uncertainties[isample*jzbcuts.size()+icut][1],3) << "+/-" << Round(100*uncertainties[isample*jzbcuts.size()+icut][2],3) << " (stat) +/- " << Round(100*uncertainties[isample*jzbcuts.size()+icut][3],3) << " (syst) \t" << Round((vlimits[isample][2*icut]),3) << "\t" << Round(vlimits[isample][2*icut+1],3) << endl; |
283 |
|
} |
284 |
|
dout << endl; |
285 |
|
} |
286 |
|
|
287 |
< |
write_warning("compute_upper_limits_from_counting_experiment","Still need to update the script"); |
287 |
> |
write_warning(__FUNCTION__,"Still need to update the script"); |
288 |
|
} |
289 |
|
|
290 |
|
|
291 |
|
|
292 |
< |
//********************************************************************** new : Limits using SHAPES *********************************** |
292 |
> |
/********************************************************************** new : Limits using SHAPES *********************************** |
293 |
> |
|
294 |
> |
|
295 |
> |
SSSSSSSSSSSSSSS hhhhhhh |
296 |
> |
SS:::::::::::::::Sh:::::h |
297 |
> |
S:::::SSSSSS::::::Sh:::::h |
298 |
> |
S:::::S SSSSSSSh:::::h |
299 |
> |
S:::::S h::::h hhhhh aaaaaaaaaaaaa ppppp ppppppppp eeeeeeeeeeee ssssssssss |
300 |
> |
S:::::S h::::hh:::::hhh a::::::::::::a p::::ppp:::::::::p ee::::::::::::ee ss::::::::::s |
301 |
> |
S::::SSSS h::::::::::::::hh aaaaaaaaa:::::ap:::::::::::::::::p e::::::eeeee:::::eess:::::::::::::s |
302 |
> |
SS::::::SSSSS h:::::::hhh::::::h a::::app::::::ppppp::::::pe::::::e e:::::es::::::ssss:::::s |
303 |
> |
SSS::::::::SS h::::::h h::::::h aaaaaaa:::::a p:::::p p:::::pe:::::::eeeee::::::e s:::::s ssssss |
304 |
> |
SSSSSS::::S h:::::h h:::::h aa::::::::::::a p:::::p p:::::pe:::::::::::::::::e s::::::s |
305 |
> |
S:::::S h:::::h h:::::h a::::aaaa::::::a p:::::p p:::::pe::::::eeeeeeeeeee s::::::s |
306 |
> |
S:::::S h:::::h h:::::ha::::a a:::::a p:::::p p::::::pe:::::::e ssssss s:::::s |
307 |
> |
SSSSSSS S:::::S h:::::h h:::::ha::::a a:::::a p:::::ppppp:::::::pe::::::::e s:::::ssss::::::s |
308 |
> |
S::::::SSSSSS:::::S h:::::h h:::::ha:::::aaaa::::::a p::::::::::::::::p e::::::::eeeeeeee s::::::::::::::s |
309 |
> |
S:::::::::::::::SS h:::::h h:::::h a::::::::::aa:::ap::::::::::::::pp ee:::::::::::::e s:::::::::::ss |
310 |
> |
SSSSSSSSSSSSSSS hhhhhhh hhhhhhh aaaaaaaaaa aaaap::::::pppppppp eeeeeeeeeeeeee sssssssssss |
311 |
> |
p:::::p |
312 |
> |
p:::::p |
313 |
> |
p:::::::p |
314 |
> |
p:::::::p |
315 |
> |
p:::::::p |
316 |
> |
ppppppppp |
317 |
> |
|
318 |
> |
|
319 |
> |
*********************************************************************** new : Limits using SHAPES ***********************************/ |
320 |
> |
|
321 |
|
|
322 |
|
void limit_shapes_for_systematic_effect(TFile *limfile, string identifier, string mcjzb, string datajzb, int JES,vector<float> binning, TCanvas *limcan) { |
323 |
|
dout << "Creatig shape templates ... "; |
463 |
|
limfile->Close(); |
464 |
|
write_info("prepare_limits","limitfile.root and datacard.txt have been generated. You can now use them to calculate limits!"); |
465 |
|
|
466 |
< |
} |
466 |
> |
} |