15 |
|
#ifndef Verbosity |
16 |
|
#define Verbosity 0 |
17 |
|
#endif |
18 |
– |
#ifndef HUSH |
19 |
– |
#define HUSH 1 |
20 |
– |
#endif |
18 |
|
|
19 |
|
#include <TFile.h> |
20 |
|
#include <TTree.h> |
34 |
|
Float_t jzbSel = 100; |
35 |
|
int iplot=0; |
36 |
|
int verbose=0; |
37 |
+ |
string geqleq; |
38 |
+ |
string mcjzbexpression; |
39 |
+ |
bool automatized=false;//if we're running this fully automatized we don't want each function to flood the screen |
40 |
+ |
|
41 |
+ |
TString geq_or_leq() { |
42 |
+ |
if(geqleq=="geq") return TString(">="); |
43 |
+ |
if(geqleq=="leq") return TString("<="); |
44 |
+ |
return TString("GEQ_OR_LEQ_ERROR"); |
45 |
+ |
} |
46 |
+ |
|
47 |
+ |
TString ngeq_or_leq() { |
48 |
+ |
if(geqleq=="geq") return TString("<="); |
49 |
+ |
if(geqleq=="leq") return TString(">="); |
50 |
+ |
return TString("NGEQ_OR_LEQ_ERROR"); |
51 |
+ |
} |
52 |
|
|
53 |
|
//______________________________________________________________________________ |
54 |
|
Double_t Interpolate(Double_t x, TH1 *histo) |
81 |
|
} |
82 |
|
} |
83 |
|
|
84 |
+ |
//____________________________________________________________________________________ |
85 |
+ |
// Plotting with all contributions, i.e. sidebands, peak, osof,ossf ... (for a systematic) |
86 |
+ |
float allcontributionsplot(TTree* events, TCut kBaseCut, TCut kMassCut, TCut kSidebandCut, TCut JZBPosCut, TCut JZBNegCut) { |
87 |
+ |
iplot++; |
88 |
+ |
int count=iplot; |
89 |
+ |
// Define new histogram |
90 |
+ |
string hname=GetNumericHistoName(); |
91 |
+ |
TH1F* hossfp = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
92 |
+ |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kMassCut&&JZBPosCut&&cutOSSF,"goff"); |
93 |
+ |
hname=GetNumericHistoName(); |
94 |
+ |
TH1F* hossfn = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
95 |
+ |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kMassCut&&JZBNegCut&&cutOSSF,"goff"); |
96 |
+ |
|
97 |
+ |
hname=GetNumericHistoName(); |
98 |
+ |
TH1F* hosofp = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
99 |
+ |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kMassCut&&JZBPosCut&&cutOSOF,"goff"); |
100 |
+ |
hname=GetNumericHistoName(); |
101 |
+ |
TH1F* hosofn = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
102 |
+ |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kMassCut&&JZBNegCut&&cutOSOF,"goff"); |
103 |
+ |
|
104 |
+ |
hname=GetNumericHistoName(); |
105 |
+ |
TH1F* sbhossfp = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
106 |
+ |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBPosCut&&cutOSSF,"goff"); |
107 |
+ |
hname=GetNumericHistoName(); |
108 |
+ |
TH1F* sbhossfn = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
109 |
+ |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBNegCut&&cutOSSF,"goff"); |
110 |
+ |
|
111 |
+ |
hname=GetNumericHistoName(); |
112 |
+ |
TH1F* sbhosofp = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
113 |
+ |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBPosCut&&cutOSOF,"goff"); |
114 |
+ |
hname=GetNumericHistoName(); |
115 |
+ |
TH1F* sbhosofn = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
116 |
+ |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBNegCut&&cutOSOF,"goff"); |
117 |
+ |
|
118 |
+ |
float obs = hossfp->Integral(); |
119 |
+ |
float pred= hossfn->Integral() + (1.0/3)*( hosofp->Integral() - hosofn->Integral() + sbhossfp->Integral() - sbhossfn->Integral() + sbhosofp->Integral() - sbhosofn->Integral()); |
120 |
+ |
|
121 |
+ |
delete hossfp,hossfn,hosofp,hosofn; |
122 |
+ |
delete sbhossfp,sbhossfn,sbhosofp,sbhosofn; |
123 |
+ |
return obs-pred; |
124 |
+ |
} |
125 |
+ |
|
126 |
|
|
127 |
|
//____________________________________________________________________________________ |
128 |
|
// Efficiency plot |
135 |
|
nBins,jzbMin,jzbMax); |
136 |
|
Float_t step = (jzbMax-jzbMin)/static_cast<Float_t>(nBins); |
137 |
|
|
138 |
< |
events->Draw("jzb[1]","genJZBSel>-400"&&kbase,"goff"); |
138 |
> |
events->Draw(mcjzbexpression.c_str(),"genJZB>-400"&&kbase,"goff"); |
139 |
|
Float_t maxEff = events->GetSelectedRows(); |
140 |
< |
if(verbose>0) std::cout << hname << " (" << informalname <<") " << maxEff << std::endl; |
140 |
> |
if(verbose>0) dout << hname << " (" << informalname <<") " << maxEff << std::endl; |
141 |
|
|
142 |
< |
if(verbose>0) std::cout << "JZB max = " << jzbMax << std::endl; |
142 |
> |
if(verbose>0) dout << "JZB max = " << jzbMax << std::endl; |
143 |
|
// Loop over steps to get efficiency curve |
144 |
|
char cut[256]; |
145 |
|
for ( Int_t iBin = 0; iBin<nBins; ++iBin ) { |
146 |
< |
sprintf(cut,"genJZBSel>%3f",jzbMin+iBin*step); |
147 |
< |
events->Draw("jzb[1]",TCut(cut)&&kbase,"goff"); |
146 |
> |
sprintf(cut,"genJZB>%3f",jzbMin+iBin*step); |
147 |
> |
events->Draw(mcjzbexpression.c_str(),TCut(cut)&&kbase,"goff"); |
148 |
|
Float_t eff = static_cast<Float_t>(events->GetSelectedRows())/maxEff; |
149 |
< |
// std::cout << "COUCOU " << __LINE__ << std::endl; |
149 |
> |
// dout << "COUCOU " << __LINE__ << std::endl; |
150 |
|
hJzbEff->SetBinContent(iBin+1,eff); |
151 |
|
hJzbEff->SetBinError(iBin+1,TMath::Sqrt(eff*(1-eff)/maxEff)); |
152 |
|
} |
163 |
|
jzbMax = myJzbMax; |
164 |
|
|
165 |
|
// Acceptance cuts |
166 |
< |
TCut kbase("abs(genMllSel-91.2)<20&&pfJetGoodNum>2&&genZPtSel>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
166 |
> |
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
167 |
|
|
168 |
|
TH1F* hLM4 = plotEff(events,kbase,informalname); |
169 |
|
hLM4->SetMinimum(0.); |
177 |
|
// Pimped-up function |
178 |
|
TF1* funcUp = (TF1*)func->Clone(); |
179 |
|
funcUp->SetParameter( 0., func->GetParameter(0)/1.1); // 10% systematic error (up in sigma => 0.1 in erfc) |
180 |
< |
std::cout << " PU: " << funcUp->Eval(jzbSel) << " " << func->Eval(jzbSel) |
180 |
> |
if(!automatized) dout << " PU: " << funcUp->Eval(jzbSel) << " " << func->Eval(jzbSel) |
181 |
|
<< "(" << (funcUp->Eval(jzbSel)-func->Eval(jzbSel))/func->Eval(jzbSel)*100. << "%)" << std::endl; |
182 |
|
|
183 |
|
return (funcUp->Eval(jzbSel)-func->Eval(jzbSel))/func->Eval(jzbSel)*100.; |
185 |
|
} |
186 |
|
|
187 |
|
//____________________________________________________________________________________ |
188 |
+ |
// Effect of peak shifting |
189 |
+ |
void PeakError(TTree *events,float &result, string mcjzb, float peakerr) { |
190 |
+ |
TString peakup("("+TString(mcjzb)+"+"+TString(any2string(TMath::Abs(peakerr)))+")"+geq_or_leq()+TString(any2string(jzbSel))); |
191 |
+ |
TString peakdown("("+TString(mcjzb)+"-"+TString(any2string(TMath::Abs(peakerr)))+")"+geq_or_leq()+TString(any2string(jzbSel))); |
192 |
+ |
TString peakcentral("("+TString(mcjzb)+")"+geq_or_leq()+TString(any2string(jzbSel))); |
193 |
+ |
TString npeakup("("+TString(mcjzb)+"+"+TString(any2string(TMath::Abs(peakerr)))+")"+ngeq_or_leq()+"-"+TString(any2string(jzbSel))); |
194 |
+ |
TString npeakdown("("+TString(mcjzb)+"-"+TString(any2string(TMath::Abs(peakerr)))+")"+ngeq_or_leq()+"-"+TString(any2string(jzbSel))); |
195 |
+ |
TString npeakcentral("("+TString(mcjzb)+")"+ngeq_or_leq()+"-"+TString(any2string(jzbSel))); |
196 |
+ |
|
197 |
+ |
nBins = 1; |
198 |
+ |
string informalname="PeakErrorCalculation"; |
199 |
+ |
float resup,resdown,rescent; |
200 |
+ |
for(int i=0;i<3;i++) { |
201 |
+ |
string poscut,negcut; |
202 |
+ |
if(i==0) { |
203 |
+ |
poscut=peakcentral; |
204 |
+ |
negcut=npeakcentral; |
205 |
+ |
} else if(i==1) { |
206 |
+ |
poscut=peakdown; |
207 |
+ |
negcut=npeakdown; |
208 |
+ |
} else if(i==2) { |
209 |
+ |
poscut=peakup; |
210 |
+ |
negcut=npeakup; |
211 |
+ |
} |
212 |
+ |
float res=allcontributionsplot(events,cutnJets,cutmass,sidebandcut,poscut.c_str(),negcut.c_str()); |
213 |
+ |
if(i==0) rescent=res; |
214 |
+ |
else if(i==1) resdown=res; |
215 |
+ |
else if(i==2) resup=res; |
216 |
+ |
} |
217 |
+ |
if(TMath::Abs(rescent-resup)>TMath::Abs(rescent-resdown)) result=(TMath::Abs(rescent-resup)/rescent)*100; |
218 |
+ |
else result=(TMath::Abs(rescent-resdown)/rescent)*100; |
219 |
+ |
|
220 |
+ |
} |
221 |
+ |
|
222 |
+ |
//____________________________________________________________________________________ |
223 |
|
// Total selection efficiency (MC) |
224 |
< |
void MCefficiency(TTree *events,float &res, float &reserr) { |
224 |
> |
void MCefficiency(TTree *events,float &result, float &resulterr,string mcjzb) { |
225 |
|
|
226 |
|
char jzbSelStr[256]; sprintf(jzbSelStr,"%f",jzbSel); |
227 |
|
// All acceptance cuts at gen. level |
228 |
< |
TCut kbase("abs(genMllSel-91.2)<20&&pfJetGoodNum>2&&genZPt>0&&genJZB>"+TString(jzbSelStr)+"&&genId1==-genId2"); |
228 |
> |
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&genJZB"+geq_or_leq()+TString(jzbSelStr)+"&&genId1==-genId2"); |
229 |
|
// Corresponding reco. cuts |
230 |
< |
TCut ksel("abs(mll-91.2)<20&&id1==id2&&jzb[1]+0.9>"+TString(jzbSelStr)); |
230 |
> |
TCut ksel("abs(mll-91.2)<20&&id1==id2&&"+TString(mcjzb)+geq_or_leq()+TString(jzbSelStr)); |
231 |
|
|
232 |
< |
events->Draw("jzb[1]",kbase&&ksel,"goff"); |
232 |
> |
events->Draw(mcjzbexpression.c_str(),kbase&&ksel,"goff"); |
233 |
|
Float_t sel = events->GetSelectedRows(); |
234 |
< |
events->Draw("jzb[1]",kbase,"goff"); |
234 |
> |
events->Draw(mcjzbexpression.c_str(),kbase,"goff"); |
235 |
|
Float_t tot = events->GetSelectedRows(); |
236 |
|
|
237 |
< |
res=sel/tot; |
238 |
< |
reserr=TMath::Sqrt(sel/tot*(1-sel/tot)/tot); |
239 |
< |
std::cout << " MC efficiency: " << res << "+-" << reserr << std::endl; |
237 |
> |
result=sel/tot; |
238 |
> |
resulterr=TMath::Sqrt(sel/tot*(1-sel/tot)/tot); |
239 |
> |
if(!automatized) dout << " MC efficiency: " << result << "+-" << resulterr << std::endl; |
240 |
|
} |
241 |
|
|
242 |
|
float JZBefficiency(TTree *events, string informalname) { |
243 |
< |
TCut kbase("abs(genMllSel-91.2)<20&&pfJetGoodNum>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
243 |
> |
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
244 |
|
TH1F* hLM4 = plotEff(events,kbase,informalname); |
245 |
|
Int_t bin = hLM4->FindBin(jzbSel); // To get the error |
246 |
< |
std::cout << " Efficiency at JZB==" << jzbSel << std::endl; |
247 |
< |
std::cout << " " << Interpolate(jzbSel,hLM4) << "+-" << hLM4->GetBinError(bin) << std::endl; |
246 |
> |
if(!automatized) dout << " Efficiency at JZB==" << jzbSel << std::endl; |
247 |
> |
if(!automatized) dout << " " << Interpolate(jzbSel,hLM4) << "+-" << hLM4->GetBinError(bin) << std::endl; |
248 |
|
return -1; |
249 |
|
} |
250 |
|
|
251 |
|
//________________________________________________________________________ |
252 |
|
// Effect of energy scale on efficiency |
253 |
|
void JZBjetScale(TTree *events, float &jesdown, float &jesup, string informalname="",float syst=0.1, Float_t jzbSelection=-1, TString plotName = "" ) { |
254 |
< |
TCut kbase("abs(genMllSel-91.2)<20&&genZPt>0"); |
254 |
> |
TCut kbase("abs(genMll-91.2)<20&&genZPt>0"); |
255 |
|
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
256 |
|
TCut nJets("pfJetGoodNum>2"); |
257 |
|
stringstream down,up; |
261 |
|
TCut nJetsP(up.str().c_str()); |
262 |
|
TCut nJetsM(down.str().c_str()); |
263 |
|
|
175 |
– |
if ( jzbSelection>0 ) jzbSel = jzbSelection; |
176 |
– |
|
264 |
|
if ( !(plotName.Length()>1) ) plotName = informalname; |
265 |
|
|
266 |
|
nBins = 1; jzbMin = jzbSel*0.95; jzbMax = jzbSel*1.05; |
274 |
|
Float_t eff = Interpolate(jzbSel,hist); |
275 |
|
Float_t effp = Interpolate(jzbSel,histp); |
276 |
|
Float_t effm = Interpolate(jzbSel,histm); |
277 |
< |
std::cout << " Efficiency at JZB==" << jzbSel << std::endl; |
278 |
< |
std::cout << " JESup: " << effp << " (" << (effp-eff)/eff*100. << "%)" << std::endl; |
279 |
< |
std::cout << " central: " << eff << std::endl; |
280 |
< |
std::cout << " JESdown: " << effm << " (" << (effm-eff)/eff*100. << "%)" << std::endl; |
277 |
> |
if(!automatized) dout << " Efficiency at JZB==" << jzbSel << std::endl; |
278 |
> |
if(!automatized) dout << " JESup: " << effp << " (" << (effp-eff)/eff*100. << "%)" << std::endl; |
279 |
> |
if(!automatized) dout << " central: " << eff << std::endl; |
280 |
> |
if(!automatized) dout << " JESdown: " << effm << " (" << (effm-eff)/eff*100. << "%)" << std::endl; |
281 |
|
jesup=(effp-eff)/eff*100.; |
282 |
|
jesdown=(effm-eff)/eff*100.; |
283 |
|
} |
286 |
|
// Effect of energy scale on JZB efficiency |
287 |
|
void doJZBscale(TTree *events, float &down, float &up, float &syst, float systematic, string informalname) { |
288 |
|
|
289 |
< |
TCut kbase("abs(genMllSel-91.2)<20&&genZPt>0&&pfJetGoodNum>2"); |
289 |
> |
TCut kbase("abs(genMll-91.2)<20&&genZPt>0&&genNjets>2"); |
290 |
|
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
291 |
|
|
292 |
|
nBins = 50; |
299 |
|
Float_t eff = Interpolate(jzbSel,hist); |
300 |
|
Float_t effp = Interpolate(jzbSel*(1.+systematic),hist); |
301 |
|
Float_t effm = Interpolate(jzbSel*(1.-systematic),hist); |
302 |
< |
std::cout << " efficiency at JZB==" << jzbSel*(1.+systematic) << "(-"<<syst*100<<"%) : " << effp << " (" << ((effp-eff)/eff)*100. << "%)" << std::endl; |
303 |
< |
std::cout << " efficiency at JZB==" << jzbSel << ": " << eff << std::endl; |
304 |
< |
std::cout << " efficiency at JZB==" << jzbSel*(1.-systematic) << "(-"<<syst*100<<"%) : " << effm << " (" << ((effm-eff)/eff)*100. << "%)" << std::endl; |
302 |
> |
if(!automatized) dout << " efficiency at JZB==" << jzbSel*(1.+systematic) << "(-"<<syst*100<<"%) : " << effp << " (" << ((effp-eff)/eff)*100. << "%)" << std::endl; |
303 |
> |
if(!automatized) dout << " efficiency at JZB==" << jzbSel << ": " << eff << std::endl; |
304 |
> |
if(!automatized) dout << " efficiency at JZB==" << jzbSel*(1.-systematic) << "(-"<<syst*100<<"%) : " << effm << " (" << ((effm-eff)/eff)*100. << "%)" << std::endl; |
305 |
|
up=((effp-eff)/eff)*100; |
306 |
|
down=((effm-eff)/eff)*100; |
307 |
|
} |
311 |
|
void JZBresponse(TTree *events, bool isMET = kFALSE, Float_t myJzbMax = 200., Int_t nPeriods = 9 ) { |
312 |
|
|
313 |
|
jzbMin = 20; |
314 |
< |
TCut kbase("abs(genMllSel-91.2)<20&&genZPtSel>0&&pfJetGoodNum>2"); |
314 |
> |
TCut kbase("abs(genMll-91.2)<20&&genZPt>0&&genNjets>2"); |
315 |
|
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
316 |
|
|
317 |
|
TProfile* hJzbResp = new TProfile("hJzbResp","JZB response ; JZB true (GeV/c); JZB reco. / JZB true", |
318 |
|
nPeriods, jzbMin, myJzbMax, "" ); |
319 |
|
|
320 |
< |
if (!isMET) events->Project("hJzbResp","jzb[1]/genJZBSel:genJZBSel",kbase&&ksel); |
320 |
> |
if (!isMET) events->Project("hJzbResp","("+TString(mcjzbexpression)+")/genJZB:genJZB",kbase&&ksel); |
321 |
|
else events->Project("hJzbResp","met[4]/genMET:genMET",kbase&&ksel); |
322 |
|
|
323 |
|
hJzbResp->SetMaximum(1.2); |
324 |
|
hJzbResp->SetMinimum(0.2); |
325 |
|
hJzbResp->Fit("pol0","Q"); |
326 |
|
TF1 *fittedfunction = hJzbResp->GetFunction("pol0"); |
327 |
< |
cout << " Response: " << fittedfunction->GetParameter(0) << " +/- " << fittedfunction->GetParError(0) << endl; |
327 |
> |
if(!automatized) dout << " Response: " << fittedfunction->GetParameter(0) << " +/- " << fittedfunction->GetParError(0) << endl; |
328 |
> |
delete hJzbResp; |
329 |
|
} |
330 |
|
|
331 |
|
|
332 |
< |
void do_systematics_for_one_file(TTree *events,string informalname, vector<vector<float> > &uncertainties) { |
332 |
> |
void do_systematics_for_one_file(TTree *events,string informalname, vector<vector<float> > &results,string mcjzb,string datajzb,float peakerror) { |
333 |
|
|
334 |
|
float JetEnergyScaleUncert=0.1; |
335 |
|
float JZBScaleUncert=0.1; |
336 |
+ |
mcjzbexpression=mcjzb; |
337 |
|
|
338 |
|
float triggereff=4;//percent! |
339 |
< |
cout << "Trigger efficiency not implemented in this script yet, still using external one" << endl; |
339 |
> |
dout << "Trigger efficiency not implemented in this script yet, still using external one" << endl; |
340 |
|
float leptonseleff=2;//percent! |
341 |
< |
cout << "Lepton selection efficiency not implemented in this script yet, still using external one" << endl; |
341 |
> |
dout << "Lepton selection efficiency not implemented in this script yet, still using external one" << endl; |
342 |
|
|
343 |
|
float mceff,mcefferr; |
344 |
< |
cout << "MC efficiencies:" << endl; |
345 |
< |
MCefficiency(events,mceff,mcefferr); |
344 |
> |
if(!automatized) dout << "MC efficiencies:" << endl; |
345 |
> |
MCefficiency(events,mceff,mcefferr,mcjzb); |
346 |
|
JZBefficiency(events,informalname); |
347 |
|
|
348 |
< |
std::cout << "Jet energy scale: " << std::endl; |
348 |
> |
if(!automatized) dout << "Error from Peak position:" << endl; |
349 |
> |
float sysfrompeak=0; |
350 |
> |
PeakError(events,sysfrompeak,mcjzb,peakerror); |
351 |
> |
|
352 |
> |
if(!automatized) dout << "Jet energy scale: " << std::endl; |
353 |
|
float jesup,jesdown; |
354 |
|
JZBjetScale(events,jesdown,jesup,informalname,JetEnergyScaleUncert); |
355 |
|
|
356 |
< |
std::cout << "JZB scale: " << std::endl; |
356 |
> |
if(!automatized) dout << "JZB scale: " << std::endl; |
357 |
|
float scaleup,scaledown,scalesyst; |
358 |
|
doJZBscale(events,scaledown,scaleup,scalesyst,JZBScaleUncert,informalname); |
359 |
|
|
360 |
< |
std::cout << "JZB response: " << std::endl; |
360 |
> |
if(!automatized) dout << "JZB response: " << std::endl; |
361 |
|
JZBresponse(events); |
362 |
|
|
363 |
< |
std::cout << "Pileup: " << std::endl; |
363 |
> |
if(!automatized) dout << "Pileup: " << std::endl; |
364 |
|
float resolution=pileup(events,informalname); |
365 |
|
|
366 |
< |
cout << "_______________________________________________" << endl; |
367 |
< |
cout << " SUMMARY FOR " << informalname << " with JZB>" << jzbSel << endl; |
368 |
< |
cout << "Trigger efficiency: " << triggereff << endl; |
369 |
< |
cout << "Lepton Sel Eff: " << leptonseleff << endl; |
370 |
< |
cout << "For JZB>" << jzbSel << endl; |
371 |
< |
cout << "Jet energy scale: " << jesup << " " << jesdown << " --> suggesting: " << Round(0.5*(fabs(jesup)+fabs(jesdown)),1) << endl; |
372 |
< |
cout << "JZB Scale Uncert: " << scaledown << " " << scaleup << " --> suggesting: " << Round(0.5*(fabs(scaledown)+fabs(scaleup)),1) << endl; |
373 |
< |
cout << "Resolution : " << resolution << endl; |
366 |
> |
dout << "_______________________________________________" << endl; |
367 |
> |
dout << " SUMMARY FOR " << informalname << " with JZB>" << jzbSel << " (all in %) " << endl; |
368 |
> |
dout << "MC efficiency: " << 100*mceff << "+/-" << 100*mcefferr << endl; |
369 |
> |
dout << "Trigger efficiency: " << triggereff << endl; |
370 |
> |
dout << "Lepton Sel Eff: " << leptonseleff << endl; |
371 |
> |
dout << "Jet energy scale: " << jesup << " " << jesdown << endl; |
372 |
> |
dout << "JZB Scale Uncert: " << scaledown << " " << scaleup << endl; |
373 |
> |
dout << "Resolution : " << resolution << endl; |
374 |
> |
dout << "From peak : " << sysfrompeak << endl; |
375 |
> |
|
376 |
|
|
377 |
< |
vector<float> uncert; |
378 |
< |
uncert.push_back(jzbSel); |
379 |
< |
uncert.push_back(triggereff); |
380 |
< |
uncert.push_back(leptonseleff); |
381 |
< |
uncert.push_back(0.5*(fabs(jesup)+fabs(jesdown))); |
382 |
< |
uncert.push_back(0.5*(fabs(scaledown)+fabs(scaleup))); |
383 |
< |
uncert.push_back(resolution); |
377 |
> |
float toterr=0; |
378 |
> |
toterr+=(triggereff/100)*(triggereff/100); |
379 |
> |
toterr+=(leptonseleff/100)*(leptonseleff/100); |
380 |
> |
if(fabs(jesup)>fabs(jesdown)) toterr+=(jesup/100)*(jesup/100); else toterr+=(jesdown/100)*(jesdown/100); |
381 |
> |
if(fabs(scaleup)>fabs(scaledown)) toterr+=(scaleup/100)*(scaleup/100); else toterr+=(scaledown/100)*(scaledown/100); |
382 |
> |
toterr+=(resolution/100)*(resolution/100); |
383 |
> |
toterr+=(sysfrompeak/100)*(sysfrompeak/100); |
384 |
> |
toterr=TMath::Sqrt(toterr); |
385 |
> |
dout << "FINAL RESULT : " << 100*mceff << " +/- "<< 100*mcefferr << " (stat) +/- " << 100*toterr << " (syst) %" << endl; |
386 |
> |
dout << " we thus use the sqrt of the sum of the squares which is : " << 100*TMath::Sqrt(mcefferr*mcefferr+(toterr*toterr)) << endl; |
387 |
> |
vector<float> res; |
388 |
> |
res.push_back(jzbSel); |
389 |
> |
res.push_back(mceff); |
390 |
> |
res.push_back(mcefferr); |
391 |
> |
res.push_back(toterr); |
392 |
> |
res.push_back(TMath::Sqrt((mcefferr)*(mcefferr)+(toterr*toterr))); |
393 |
|
|
394 |
< |
uncertainties.push_back(uncert); |
394 |
> |
results.push_back(res); |
395 |
|
} |
396 |
|
|
397 |
< |
vector<vector<float> > compute_systematics(string mcjzb, string datajzb, samplecollection &signalsamples, vector<float> bins) { |
398 |
< |
vector< vector<float> > uncertainties; |
397 |
> |
vector<vector<float> > compute_systematics(string mcjzb, float mcpeakerror, string datajzb, samplecollection &signalsamples, vector<float> bins) { |
398 |
> |
automatized=true; |
399 |
> |
vector< vector<float> > systematics; |
400 |
|
for (int isignal=0; isignal<signalsamples.collection.size();isignal++) { |
401 |
< |
cout << "Looking at signal " << (signalsamples.collection)[isignal].filename << endl; |
401 |
> |
dout << "Looking at signal " << (signalsamples.collection)[isignal].filename << endl; |
402 |
|
for(int ibin=0;ibin<bins.size();ibin++) { |
403 |
|
jzbSel=bins[ibin]; |
404 |
< |
do_systematics_for_one_file((signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,uncertainties); |
404 |
> |
geqleq="geq"; |
405 |
> |
do_systematics_for_one_file((signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,systematics,mcjzb,datajzb,mcpeakerror); |
406 |
|
}//end of bin loop |
407 |
|
}//end of signal loop |
408 |
< |
return uncertainties; |
408 |
> |
return systematics; |
409 |
|
} |