86 |
|
|
87 |
|
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb) |
88 |
|
{ |
89 |
+ |
|
90 |
+ |
bool DoInvidualeemmPeaks=false; |
91 |
+ |
|
92 |
|
float mcpeak, datapeak; |
93 |
|
float mcpeakerr, datapeakerr; |
94 |
|
|
103 |
|
dout << "Finding global peak : " << endl; |
104 |
|
find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma, dataSigma,result,doPUreweighting,""); |
105 |
|
|
106 |
< |
dout << "Finding peak for electrons : " << endl; |
107 |
< |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr, dataeepeak,dataeepeakerr,mcSigma, dataSigma,result,doPUreweighting,"_ele"); |
108 |
< |
dout << "Finding peak for muons : " << endl; |
109 |
< |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr, datammpeak,datammpeakerr,mcSigma, dataSigma,result,doPUreweighting,"_mu"); |
110 |
< |
|
111 |
< |
datajzb << "(" << jzbvariabledata; |
112 |
< |
mcjzb << "(" << jzbvariablemc; |
113 |
< |
|
114 |
< |
if(dataeepeak>0) datajzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
115 |
< |
else datajzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
116 |
< |
|
117 |
< |
if(datammpeak>0) datajzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
118 |
< |
else datajzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
119 |
< |
|
120 |
< |
if(datapeak>0) datajzb << "- (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
121 |
< |
else datajzb << "+ (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
122 |
< |
|
123 |
< |
datajzb << ")"; |
124 |
< |
|
125 |
< |
if(mceepeak>0) mcjzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
126 |
< |
else mcjzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
127 |
< |
|
128 |
< |
if(mcmmpeak>0) mcjzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
129 |
< |
else mcjzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
130 |
< |
|
131 |
< |
if(mcpeak>0) mcjzb << "- (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
132 |
< |
else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
133 |
< |
|
134 |
< |
mcjzb << ")"; |
106 |
> |
if(DoInvidualeemmPeaks) { |
107 |
> |
dout << "Finding peak for electrons : " << endl; |
108 |
> |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr, dataeepeak,dataeepeakerr,mcSigma, dataSigma,result,doPUreweighting,"_ele"); |
109 |
> |
dout << "Finding peak for muons : " << endl; |
110 |
> |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr, datammpeak,datammpeakerr,mcSigma, dataSigma,result,doPUreweighting,"_mu"); |
111 |
> |
|
112 |
> |
datajzb << "(" << jzbvariabledata; |
113 |
> |
mcjzb << "(" << jzbvariablemc; |
114 |
> |
|
115 |
> |
if(dataeepeak>0) datajzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
116 |
> |
else datajzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
117 |
> |
|
118 |
> |
if(datammpeak>0) datajzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
119 |
> |
else datajzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
120 |
> |
|
121 |
> |
if(datapeak>0) datajzb << "- (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
122 |
> |
else datajzb << "+ (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
123 |
> |
|
124 |
> |
datajzb << ")"; |
125 |
> |
|
126 |
> |
if(mceepeak>0) mcjzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
127 |
> |
else mcjzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
128 |
> |
|
129 |
> |
if(mcmmpeak>0) mcjzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
130 |
> |
else mcjzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
131 |
> |
|
132 |
> |
if(mcpeak>0) mcjzb << "- (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
133 |
> |
else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
134 |
> |
|
135 |
> |
mcjzb << ")"; |
136 |
> |
} else { |
137 |
> |
datajzb << "(" << jzbvariabledata; |
138 |
> |
mcjzb << "(" << jzbvariablemc; |
139 |
> |
|
140 |
> |
if(datapeak>0) datajzb << "- " << TMath::Abs(datapeak) << " "; |
141 |
> |
else datajzb << "+ " << TMath::Abs(datapeak) << " "; |
142 |
> |
|
143 |
> |
datajzb << ")"; |
144 |
> |
|
145 |
> |
if(mcpeak>0) mcjzb << "- " << TMath::Abs(mcpeak) << " "; |
146 |
> |
else mcjzb << "+ " << TMath::Abs(mcpeak) << " "; |
147 |
> |
|
148 |
> |
mcjzb << ")"; |
149 |
> |
} |
150 |
> |
|
151 |
|
|
152 |
|
} |
153 |
|
|
162 |
|
|
163 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
164 |
|
|
165 |
< |
stringstream largerzeroS; |
165 |
> |
/* stringstream largerzeroS; |
166 |
|
largerzeroS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
167 |
|
TCut largerzero(largerzeroS.str().c_str()); |
168 |
|
|
169 |
|
stringstream smallerzeroS; |
170 |
|
smallerzeroS << "(" << mcjzb << "<-" << jzbthreshold << ")"; |
171 |
< |
TCut smallerzero(smallerzeroS.str().c_str()); |
171 |
> |
TCut smallerzero(smallerzeroS.str().c_str());*/ |
172 |
|
|
173 |
|
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity); |
174 |
|
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets,mc,luminosity); |
626 |
|
dout << "Creating comparison plots for signal and control regions" << endl; |
627 |
|
// Compare a few quantities in the signal region and all 7 control regions |
628 |
|
|
629 |
< |
switch_overunderflow(true); // switching overflow/underflow bins on |
629 |
> |
// switch_overunderflow(true); // switching overflow/underflow bins on |
630 |
|
|
631 |
|
|
632 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
939 |
|
|
940 |
|
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
941 |
|
{ |
942 |
< |
switch_overunderflow(true); |
942 |
> |
// switch_overunderflow(true); |
943 |
|
bool is_data=false; |
944 |
|
bool use_signal=false; |
945 |
|
if(use_data==1) is_data=true; |
1309 |
|
} |
1310 |
|
} |
1311 |
|
|
1312 |
+ |
TFile *f = new TFile("tester.root","RECREATE"); |
1313 |
+ |
RcorrJZBeemm->Write(); |
1314 |
+ |
Bpred->Write(); |
1315 |
+ |
f->Close(); |
1316 |
+ |
|
1317 |
|
delete RcorrJZBeemm; |
1318 |
|
delete LcorrJZBeemm; |
1319 |
|
delete RcorrJZBem; |
2168 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true); |
2169 |
|
} |
2170 |
|
|
2171 |
< |
float find_one_correction_factor(string FindKeyword, TCut SpecialCut, string SaveAs) { |
2171 |
> |
float find_one_correction_factor(string FindKeyword, bool dodata, TCut SpecialCut, string SaveAs) { |
2172 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
2173 |
|
cancorr->SetLogz(); |
2174 |
|
cancorr->SetRightMargin(0.13); |
2176 |
|
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2177 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2178 |
|
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
2179 |
< |
for(int iSample=0;iSample<SampleIndices.size();iSample++) { |
2179 |
> |
for(int iSample=0;iSample<(int)SampleIndices.size();iSample++) { |
2180 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data && !dodata) continue; |
2181 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data ==false && dodata) continue; |
2182 |
> |
|
2183 |
|
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl; |
2184 |
|
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",zptforresponsepresentation*cutWeight); |
2185 |
|
} |
2217 |
|
|
2218 |
|
dout << "Computing response corrections: " << endl; |
2219 |
|
//Step 1 : Get results |
2220 |
< |
float datacorrection=find_one_correction_factor("Data","","Data"); |
2221 |
< |
float mccorrection=find_one_correction_factor("DY","","MC"); |
2220 |
> |
float datacorrection=find_one_correction_factor("Data",true,"","Data"); |
2221 |
> |
float mccorrection=find_one_correction_factor("DY",false,"","MC"); |
2222 |
|
|
2223 |
< |
float dataEEcorrection=find_one_correction_factor("Data","id1==0","Data_ee"); |
2224 |
< |
float mcEEcorrection=find_one_correction_factor("DY","id1==0","MC_ee"); |
2223 |
> |
float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
2224 |
> |
float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee"); |
2225 |
|
|
2226 |
< |
float dataMMcorrection=find_one_correction_factor("Data","id1==1","Data_mm"); |
2227 |
< |
float mcMMcorrection=find_one_correction_factor("DY","id1==1","MC_mm"); |
2226 |
> |
float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm"); |
2227 |
> |
float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm"); |
2228 |
|
|
2229 |
|
cout << "Corrections : " << endl; |
2230 |
|
cout << " Data : " << datacorrection << endl; |
2366 |
|
TCut weightbackup=cutWeight; |
2367 |
|
// cutWeight="1.0"; |
2368 |
|
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2342 |
– |
|
2369 |
|
|
2370 |
|
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2371 |
|
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2403 |
|
} |
2404 |
|
|
2405 |
|
vector<TH1F*> histos; |
2406 |
+ |
TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2407 |
+ |
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2408 |
|
histos.push_back(TZem); |
2409 |
|
histos.push_back(TZeemm); |
2410 |
|
if(PlottingSetup::RestrictToMassPeak) { |
2411 |
+ |
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2412 |
+ |
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2413 |
|
histos.push_back(TSem); |
2414 |
|
histos.push_back(TSeemm); |
2415 |
|
} |
2452 |
|
TSeemm->Draw("same"); |
2453 |
|
} |
2454 |
|
|
2455 |
< |
float linepos=0.25; |
2456 |
< |
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
2457 |
< |
if(!PlottingSetup::RestrictToMassPeak) linepos=0.1; //sys uncertainty for iJZB |
2455 |
> |
float linepos=emuncertONPEAK; |
2456 |
> |
if(!PlottingSetup::RestrictToMassPeak) linepos=emuncertOFFPEAK; |
2457 |
> |
|
2458 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2459 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2460 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2596 |
|
|
2597 |
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) { |
2598 |
|
vector<float> nicer_binning; |
2599 |
< |
nicer_binning.push_back(-125); |
2599 |
> |
|
2600 |
> |
/* nicer_binning.push_back(-400); |
2601 |
> |
nicer_binning.push_back(-250); |
2602 |
> |
nicer_binning.push_back(-200); |
2603 |
> |
nicer_binning.push_back(-150); |
2604 |
> |
nicer_binning.push_back(-100); |
2605 |
> |
nicer_binning.push_back(-50); |
2606 |
> |
nicer_binning.push_back(-20); |
2607 |
> |
|
2608 |
> |
nicer_binning.push_back(0); |
2609 |
> |
nicer_binning.push_back(20); |
2610 |
> |
nicer_binning.push_back(50); |
2611 |
> |
nicer_binning.push_back(100); |
2612 |
> |
nicer_binning.push_back(150); |
2613 |
> |
nicer_binning.push_back(200); |
2614 |
> |
nicer_binning.push_back(250); |
2615 |
> |
nicer_binning.push_back(400);*/ |
2616 |
> |
|
2617 |
|
nicer_binning.push_back(-100); |
2571 |
– |
nicer_binning.push_back(-75); |
2618 |
|
nicer_binning.push_back(-50); |
2619 |
|
nicer_binning.push_back(-25); |
2620 |
|
nicer_binning.push_back(0); |
2629 |
|
nicer_binning.push_back(230); |
2630 |
|
nicer_binning.push_back(280); |
2631 |
|
nicer_binning.push_back(400); |
2632 |
+ |
|
2633 |
|
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
2634 |
|
} |
2635 |
|
|
2651 |
|
|
2652 |
|
string mcjzb = mcjzbnoPU.str(); |
2653 |
|
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
2607 |
– |
|
2608 |
– |
cutWeight="1.0"; |
2654 |
|
*/ |
2655 |
+ |
// cutWeight="1.0"; |
2656 |
+ |
|
2657 |
|
string mcjzb = mcjzbWithPU; // this is with PURW, if you want without it you have to uncomment the part above (and comment out this line) |
2658 |
|
|
2659 |
|
vector<float> binning; |
2660 |
|
binning.push_back(0); |
2661 |
< |
binning.push_back(20); |
2662 |
< |
binning.push_back(40); |
2663 |
< |
binning.push_back(60); |
2664 |
< |
binning.push_back(80); |
2661 |
> |
binning.push_back(10); |
2662 |
> |
binning.push_back(30); |
2663 |
> |
binning.push_back(50); |
2664 |
> |
// binning.push_back(80); |
2665 |
|
binning.push_back(100); |
2666 |
|
// float sbg_min=0.; |
2667 |
|
// float sbg_max=100.; |
3269 |
|
|
3270 |
|
TCanvas *testcanv = new TCanvas("testcanv","testcanv"); |
3271 |
|
testcanv->cd(); |
3272 |
< |
switch_overunderflow(true); |
3272 |
> |
// switch_overunderflow(true); |
3273 |
|
TH1F *ptdistr = allsamples.Draw("ptdistr","pt1",100,30,200, "p_{T} [GeV]", "events", cutOSSF,data,luminosity); |
3274 |
|
switch_overunderflow(false); |
3275 |
|
ptdistr->Draw(); |