28 |
|
dout << "Info : The pt requirement is currently set to " << (const char*) passtrig << endl; |
29 |
|
dout << "Info : The mll requirement is currently set to " << (const char*) cutmass << endl; |
30 |
|
dout << "Info : The lepton requirement is currently set to " << (const char*) leptoncut << endl; |
31 |
+ |
dout << "Info : The weight applied to all MC is " << (const char*) cutWeight << endl; |
32 |
|
} |
33 |
|
|
34 |
< |
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &DataSigma, stringstream &result, bool doPUreweighting = true ) |
34 |
> |
|
35 |
> |
|
36 |
> |
void find_one_peak_combination(TCut specialcut, float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &MCSigmaError, float &DataSigma, float& DataSigmaError, stringstream &result, bool doPUreweighting = true, string saveas="") |
37 |
|
{ |
38 |
|
// Temporarily switch off PU reweighting, if asked |
39 |
|
TCut weightbackup=cutWeight; |
40 |
|
if ( !doPUreweighting ) cutWeight="1.0"; |
41 |
< |
|
41 |
> |
|
42 |
> |
int nbins=100; |
43 |
> |
if(PlottingSetup::DoBTag) nbins=25; |
44 |
> |
|
45 |
|
TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations"); |
46 |
< |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity); |
47 |
< |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity); |
48 |
< |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc, luminosity); |
49 |
< |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity); |
46 |
> |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&specialcut,mc, luminosity); |
47 |
> |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&specialcut,data, luminosity); |
48 |
> |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&specialcut,mc, luminosity); |
49 |
> |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&specialcut,data, luminosity); |
50 |
|
TH1F *rawttbarjzbeemmMC; |
51 |
|
|
52 |
|
if(method==doKM) { |
53 |
|
//we only need this histo for the KM fitting... |
54 |
< |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,100, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample("TTJet")); |
55 |
< |
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
56 |
< |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
54 |
> |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&specialcut,mc,luminosity,allsamples.FindSample("TTJet")); |
55 |
> |
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
56 |
> |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
57 |
> |
delete rawttbarjzbeemmMC; |
58 |
|
} |
59 |
|
else { |
60 |
|
TH1F *reducedMC = (TH1F*)rawJZBeemmMC->Clone(); |
62 |
|
reducedMC->Add(rawJZBemMC,-1); |
63 |
|
reducedData->Add(rawJZBemData,-1); |
64 |
|
//this is Kostas' way of doing it - we subtract em to get rid of some of the ttbar contribution (in reality, of flavor-symmetric contribution) |
65 |
< |
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
66 |
< |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
67 |
< |
|
65 |
> |
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
66 |
> |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
67 |
> |
delete reducedMC; |
68 |
> |
delete reducedData; |
69 |
|
} |
70 |
|
|
71 |
|
// Revert to original PU reweighting |
73 |
|
|
74 |
|
// MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
75 |
|
// DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
76 |
< |
dout << "We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl; |
77 |
< |
result << "We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl; |
78 |
< |
dout << "We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl; |
79 |
< |
result << "We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl; |
76 |
> |
dout << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
77 |
> |
result << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
78 |
> |
dout << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
79 |
> |
result << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
80 |
> |
delete rawJZBeemmData; |
81 |
> |
delete rawJZBeemmMC; |
82 |
> |
delete rawJZBemData; |
83 |
> |
delete rawJZBemMC; |
84 |
|
delete tempcan; |
85 |
|
} |
86 |
|
|
87 |
< |
void make_special_obs_pred_mll_plot(string mcjzb, float jzbthreshold) { |
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 |
> |
|
95 |
> |
float mceepeak,mcmmpeak; |
96 |
> |
float mceepeakerr,mcmmpeakerr; |
97 |
> |
|
98 |
> |
float datammpeak,dataeepeak; |
99 |
> |
float datammpeakerr,dataeepeakerr; |
100 |
> |
|
101 |
> |
float mcSigma,mcSigmaError, dataSigma, dataSigmaError; |
102 |
> |
|
103 |
> |
dout << "Finding global peak : " << endl; |
104 |
> |
find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
105 |
> |
|
106 |
> |
if(DoInvidualeemmPeaks) { |
107 |
> |
dout << "Finding peak for electrons : " << endl; |
108 |
> |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele"); |
109 |
> |
dout << "Finding peak for muons : " << endl; |
110 |
> |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,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 |
> |
|
154 |
> |
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth = 5.0) { |
155 |
|
float min=70.0; |
156 |
|
float max=115.0; |
157 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
158 |
< |
min=10; |
159 |
< |
max=150; |
158 |
> |
min=20; |
159 |
> |
max=300; |
160 |
|
} |
161 |
< |
int nbins=int((max-min)/5); |
161 |
> |
int nbins=int((max-min)/binWidth); |
162 |
|
|
163 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
164 |
|
|
165 |
|
stringstream largerzeroS; |
166 |
< |
largerzeroS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
167 |
< |
TCut largerzero(largerzeroS.str().c_str()); |
166 |
> |
largerzeroS << "(" << datajzb << ">" << jzbthreshold << ")"; |
167 |
> |
TCut largerzeroD(largerzeroS.str().c_str()); |
168 |
|
|
169 |
|
stringstream smallerzeroS; |
170 |
< |
smallerzeroS << "(" << mcjzb << "<-" << jzbthreshold << ")"; |
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&&largerzero,data,luminosity); |
174 |
< |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,mc,luminosity); |
175 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,data,luminosity); |
176 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,data,luminosity); |
177 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,data,luminosity); |
170 |
> |
smallerzeroS << "(" << datajzb << "<-" << jzbthreshold << ")"; |
171 |
> |
TCut smallerzeroD(smallerzeroS.str().c_str()); |
172 |
> |
|
173 |
> |
|
174 |
> |
stringstream largerzeroMS; |
175 |
> |
largerzeroMS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
176 |
> |
TCut largerzeroM(largerzeroMS.str().c_str()); |
177 |
> |
|
178 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroD,data,luminosity); |
179 |
> |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroM,mc,luminosity); |
180 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzeroD,data,luminosity); |
181 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzeroD,data,luminosity); |
182 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzeroD,data,luminosity); |
183 |
|
|
184 |
|
TH1F *RcorrJZBSBem; |
185 |
|
TH1F *LcorrJZBSBem; |
186 |
|
TH1F *RcorrJZBSBeemm; |
187 |
|
TH1F *LcorrJZBSBeemm; |
188 |
|
|
189 |
< |
TH1F *RcorrJZBeemmNoS; |
189 |
> |
// TH1F *RcorrJZBeemmNoS; |
190 |
|
|
191 |
|
if(PlottingSetup::RestrictToMassPeak) { |
192 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,data, luminosity); |
193 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,data, luminosity); |
194 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,data, luminosity); |
195 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,data, luminosity); |
196 |
< |
} |
197 |
< |
|
198 |
< |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
199 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
200 |
< |
Bpred->Add(RcorrJZBem,1.0/3.); |
201 |
< |
Bpred->Add(LcorrJZBem,-1.0/3.); |
202 |
< |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
203 |
< |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
204 |
< |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
205 |
< |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
206 |
< |
} else { |
207 |
< |
Bpred->Add(RcorrJZBem,1.0); |
208 |
< |
Bpred->Add(LcorrJZBem,-1.0); |
209 |
< |
} |
210 |
< |
|
192 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity); |
193 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity); |
194 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity); |
195 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzeroD,data, luminosity); |
196 |
> |
} |
197 |
> |
|
198 |
> |
// Separate predictions |
199 |
> |
TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN"); |
200 |
> |
TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP"); |
201 |
> |
TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN"); |
202 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
203 |
> |
OFP->Scale(1.0/3.0); |
204 |
> |
OFP->Add(RcorrJZBSBem,1.0/3.); |
205 |
> |
OFP->Add(RcorrJZBSBeemm,1.0/3.); |
206 |
> |
OFN->Scale(1.0/3.0); |
207 |
> |
OFN->Add(LcorrJZBSBem,1.0/3.); |
208 |
> |
OFN->Add(LcorrJZBSBeemm,1.0/3.); |
209 |
> |
} |
210 |
> |
|
211 |
> |
TH1F* Bpred = (TH1F*)SFN->Clone("Bpred"); |
212 |
> |
Bpred->Add(OFP); |
213 |
> |
Bpred->Add(OFN,-1); |
214 |
|
Bpred->SetLineColor(kRed); |
215 |
|
|
216 |
+ |
RcorrJZBeemm->SetTitleOffset(1.3,"y"); |
217 |
|
RcorrJZBeemm->Draw(); |
218 |
|
mcRcorrJZBeemm.Draw("same"); |
219 |
|
Bpred->Draw("histo,same"); |
228 |
|
stringstream saveas; |
229 |
|
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold; |
230 |
|
CompleteSave(ckin,saveas.str()); |
231 |
+ |
|
232 |
+ |
// Draw all predictions overlayed |
233 |
+ |
unsigned int w = gStyle->GetHistLineWidth()+1; // Make line a bit wider, since we dash it |
234 |
+ |
SFN->SetLineColor(kGreen+2); |
235 |
+ |
SFN->SetLineStyle(2); |
236 |
+ |
SFN->SetLineWidth(w); |
237 |
+ |
OFP->SetLineColor(kBlue+2); |
238 |
+ |
OFP->SetLineStyle(2); |
239 |
+ |
OFP->SetLineWidth(w); |
240 |
+ |
OFN->SetLineColor(kMagenta+2); |
241 |
+ |
OFN->SetLineStyle(3); |
242 |
+ |
OFN->SetLineWidth(w); |
243 |
+ |
|
244 |
+ |
RcorrJZBeemm->Draw(); |
245 |
+ |
SFN->Draw("histo,same"); |
246 |
+ |
OFP->Draw("histo,same"); |
247 |
+ |
OFN->Draw("histo,same"); |
248 |
+ |
Bpred->Draw("histo,same"); |
249 |
+ |
RcorrJZBeemm->Draw("same"); |
250 |
+ |
|
251 |
+ |
TLegend *leg2 = make_legend("",0.52,0.7); |
252 |
+ |
leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp"); |
253 |
+ |
leg2->AddEntry(Bpred,"predicted (data)","l"); |
254 |
+ |
leg2->AddEntry(SFN, " SF JZB<0","l"); |
255 |
+ |
leg2->AddEntry(OFN, " OF JZB<0","l"); |
256 |
+ |
leg2->AddEntry(OFP, " OF JZB>0","l"); |
257 |
+ |
leg2->Draw("same"); |
258 |
+ |
|
259 |
+ |
saveas.str(""); |
260 |
+ |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold << "_nomc"; |
261 |
+ |
CompleteSave(ckin,saveas.str()); |
262 |
+ |
|
263 |
+ |
|
264 |
|
|
265 |
|
delete RcorrJZBeemm; |
266 |
|
delete LcorrJZBeemm; |
310 |
|
TIter next(bgleg->GetListOfPrimitives()); |
311 |
|
TObject* obj; |
312 |
|
// Copy the nice bkgd legend skipping the "data" |
313 |
< |
while ( obj = next() ) |
313 |
> |
while ( (obj = next()) ) |
314 |
|
if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") ) |
315 |
|
kinleg->GetListOfPrimitives()->Add(obj); |
316 |
|
|
329 |
|
TIter next(hmc.GetHists()); |
330 |
|
TObject* obj; |
331 |
|
TH1* hratio = NULL; |
332 |
< |
while ( obj = next() ) { |
332 |
> |
while ( (obj = next()) ) { |
333 |
|
if ( !hratio ) { |
334 |
|
hratio = (TH1*)obj->Clone(); |
335 |
|
hratio->SetName("hratio"); |
390 |
|
TCut cut; |
391 |
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut; |
392 |
|
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut; |
393 |
+ |
if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut; |
394 |
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF; |
395 |
|
if(filename=="mll") { |
396 |
|
cut=cutOSSF&&cutnJets&&ibasiccut; |
402 |
|
draw_separation_lines=true; |
403 |
|
} |
404 |
|
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
405 |
< |
if(Contains(filename,"mll_aboveJZB100")) cut=cutOSSF&&cutnJets&&ibasiccut; |
405 |
> |
if(Contains(filename,"aboveJZB")) cut=cutOSSF&&cutnJets&&ibasiccut; |
406 |
> |
if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0"; |
407 |
> |
if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1"; |
408 |
|
if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut; |
409 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF; |
410 |
|
if(filename=="mll_inclusive_osof") cut=cutOSOF; |
417 |
|
ckin->SetLogy(logscale); |
418 |
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
419 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
420 |
< |
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
420 |
> |
if ( !logscale ) datahisto->SetMinimum(0); // Defaults |
421 |
> |
else datahisto->SetMinimum(0.5); |
422 |
> |
// Custom max. |
423 |
> |
if(variable=="TMath::Abs(pfJetDphiMet[0])") datahisto->SetMaximum(1.5*datahisto->GetMaximum()); |
424 |
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
425 |
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
426 |
< |
if(filename=="mll_inclusive") datahisto->SetMinimum(1); |
426 |
> |
if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1); |
427 |
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
428 |
|
if(filename=="mll_osof") datahisto->SetMinimum(9); |
429 |
+ |
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
430 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
431 |
|
|
303 |
– |
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
304 |
– |
datahisto->Draw("e1"); |
305 |
– |
ckin->Update(); |
432 |
|
if(loadlastminmax) { |
433 |
|
datahisto->SetMinimum(lastrange_min); |
434 |
|
datahisto->SetMaximum(lastrange_max); |
438 |
|
} |
439 |
|
} |
440 |
|
|
441 |
+ |
// Draw signal by hand (for some reason I don't manage to use the sample class: it adds it to the stack!) |
442 |
+ |
string signal("LM3"); |
443 |
+ |
TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
444 |
+ |
int idx = signalsamples.FindSample(signal)[0]; |
445 |
+ |
(signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut); |
446 |
+ |
signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
447 |
+ |
signalhisto->SetLineColor(kOrange); |
448 |
+ |
|
449 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
450 |
+ |
datahisto->Draw("e1"); |
451 |
+ |
ckin->Update(); |
452 |
|
mcstack.Draw("same"); |
453 |
+ |
|
454 |
|
datahisto->Draw("same,e1"); |
455 |
|
TLegend *kinleg = allsamples.allbglegend(); |
456 |
|
kinleg->Draw(); |
493 |
|
kinpad->SetLogy(logscale); |
494 |
|
datahisto->Draw("e1"); |
495 |
|
mcstack.Draw("same"); |
496 |
+ |
signalhisto->Draw("same"); |
497 |
|
datahisto->Draw("same,e1"); |
498 |
|
datahisto->Draw("same,axis"); |
499 |
|
if(RestrictToMassPeak&&draw_separation_lines) { |
501 |
|
upperboundary->Draw("same"); |
502 |
|
} |
503 |
|
|
504 |
+ |
kinleg->AddEntry("signalhisto",signal.c_str(),"l"); |
505 |
|
kinleg->Draw(); |
506 |
|
write_cut->Draw(); |
507 |
|
DrawPrelim(); |
519 |
|
delete ckin; |
520 |
|
} |
521 |
|
|
522 |
< |
void make_JES_plot() { |
522 |
> |
void make_JES_plot(TCut cut, string name) { |
523 |
|
|
524 |
|
int nbins=10; |
525 |
|
float min=-0.5; |
526 |
|
float max = 9.5; |
527 |
|
bool logscale=true; |
528 |
|
string xlabel="nJets"; |
389 |
– |
TCut cut=cutmass&&cutOSSF&&basiccut; |
529 |
|
|
530 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
531 |
|
ckin->SetLogy(logscale); |
532 |
< |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,data,luminosity); |
532 |
> |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,data,luminosity); |
533 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
534 |
< |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
535 |
< |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum315",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
536 |
< |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum285",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
534 |
> |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
535 |
> |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum40p1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
536 |
> |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum40n1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
537 |
|
|
538 |
|
datahisto->SetMinimum(1); |
539 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); // in line with kinematic plots style |
558 |
|
TLegend *kinleg = allsamples.allbglegend(); |
559 |
|
kinleg->AddEntry(JESunc,"JES uncertainty","f"); |
560 |
|
kinleg->Draw(); |
561 |
< |
CompleteSave(ckin,"Systematics/JES"); |
561 |
> |
CompleteSave(ckin,"Systematics/JES"+name); |
562 |
|
datahisto->Delete(); |
563 |
|
delete ckin; |
564 |
|
|
569 |
|
bool dolog=true; |
570 |
|
bool nolog=false; |
571 |
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!"); |
572 |
< |
float mll_low=40; |
572 |
> |
float mll_low=50; |
573 |
|
float mll_hi=160; |
574 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
575 |
< |
mll_low=10; |
576 |
< |
mll_hi=210; |
575 |
> |
mll_low=20; |
576 |
> |
mll_hi=300; |
577 |
|
} |
578 |
< |
/* |
578 |
> |
|
579 |
> |
make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true); |
580 |
> |
|
581 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
582 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
583 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
584 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true); |
585 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
586 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
587 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
588 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
589 |
< |
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);/* |
449 |
< |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
450 |
< |
make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
451 |
< |
make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
452 |
< |
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
453 |
< |
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF); |
454 |
< |
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF); |
455 |
< |
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
456 |
< |
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
457 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF); |
458 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);*//* |
585 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
586 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
587 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
588 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
589 |
> |
make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
590 |
|
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
591 |
+ |
|
592 |
+ |
make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true); |
593 |
+ |
make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true); |
594 |
+ |
|
595 |
+ |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
596 |
+ |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
597 |
+ |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
598 |
+ |
|
599 |
+ |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
600 |
+ |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
601 |
+ |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
602 |
+ |
make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
603 |
+ |
make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF); |
604 |
+ |
make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF); |
605 |
+ |
make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF); |
606 |
+ |
make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF); |
607 |
|
stringstream jzbcut; |
608 |
|
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
609 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
610 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
611 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
612 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
609 |
> |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
610 |
> |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
611 |
> |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB100",doPF,true); |
612 |
> |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB100",doPF,true); |
613 |
|
stringstream jzbcut2; |
614 |
|
jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
615 |
< |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
616 |
< |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB150",doPF,true); |
615 |
> |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
616 |
> |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB150",doPF,true); |
617 |
> |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB150",doPF,true); |
618 |
> |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB150",doPF,true); |
619 |
|
stringstream jzbcut3; |
620 |
|
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
621 |
< |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true); |
622 |
< |
*/ |
623 |
< |
make_special_obs_pred_mll_plot(mcjzb,50); |
624 |
< |
make_special_obs_pred_mll_plot(mcjzb,100); |
625 |
< |
make_special_obs_pred_mll_plot(mcjzb,150); |
626 |
< |
make_special_obs_pred_mll_plot(mcjzb,200); |
627 |
< |
make_special_obs_pred_mll_plot(mcjzb,250); |
621 |
> |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
622 |
> |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true); |
623 |
> |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB50",doPF,true); |
624 |
> |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB50",doPF,true); |
625 |
> |
|
626 |
> |
make_kin_plot("mll","met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV] (MET>100GeV)","mll_met100",doPF,true); |
627 |
> |
|
628 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,0); |
629 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,50); |
630 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,80); |
631 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,100); |
632 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,150); |
633 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,200); |
634 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,250); |
635 |
> |
|
636 |
> |
make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf"); |
637 |
> |
make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof"); |
638 |
> |
|
639 |
> |
|
640 |
|
} |
641 |
|
|
642 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
643 |
|
int nbins, float xmin, float xmax, bool log, |
644 |
|
float ymin=0, float ymax=0, bool leftJustified=false ) { |
645 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
645 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
646 |
|
|
647 |
|
TCut weightbackup=cutWeight;//backing up the correct weight (restoring below!) |
648 |
|
if(weightbackup==TCut("1.0")||weightbackup==TCut("1")) write_warning(__FUNCTION__,"WATCH OUT THE WEIGHT HAS POSSIBLY NOT BEEN RESET!!!! PLEASE CHANGE LINE "+any2string(__LINE__)); |
649 |
< |
if(var=="numVtx") cutWeight=TCut("1.0"); |
649 |
> |
//if(var=="numVtx") cutWeight=TCut("1.0"); |
650 |
|
TCut jzbData[]= { TCut(TString(datajzb+">"+any2string(jzbcut))),TCut(TString(datajzb+"<-"+any2string(jzbcut))) }; |
651 |
|
TCut jzbMC[] = { TCut(TString(mcjzb+">"+any2string(jzbcut))),TCut(TString(mcjzb+"<-"+any2string(jzbcut))) }; |
652 |
|
|
670 |
|
TCanvas *ccomp = new TCanvas("ccomp","Comparison plot",600,400); |
671 |
|
ccomp->SetLogy(log); |
672 |
|
TH1F *datahisto = allsamples.Draw("datahisto", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity); |
673 |
< |
TH1F *lm4histo = signalsamples.Draw("lm4histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity,signalsamples.FindSample("LM4")); |
673 |
> |
TH1F *lm3histo = signalsamples.Draw("lm3histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb],data,luminosity,signalsamples.FindSample("LM3")); |
674 |
|
THStack mcstack = allsamples.DrawStack("mcstack",var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb], mc, luminosity); |
675 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
676 |
|
if (ymax>ymin) datahisto->SetMaximum(ymax); |
677 |
< |
lm4histo->SetLineStyle(2); |
677 |
> |
lm3histo->SetLineStyle(2); |
678 |
|
datahisto->Draw("e1"); |
679 |
|
mcstack.Draw("same"); |
680 |
|
datahisto->Draw("same,e1"); |
681 |
< |
// lm4histo->Draw("hist,same"); |
681 |
> |
lm3histo->Draw("hist,same"); |
682 |
|
TLegend *kinleg = allsamples.allbglegend((sRegions[iregion]+(ijzb?"neg":"pos")).c_str()); |
683 |
|
if ( leftJustified ) { |
684 |
|
Float_t w = kinleg->GetX2()-kinleg->GetX1(); |
685 |
|
kinleg->SetX1(0.2); |
686 |
|
kinleg->SetX2(0.2+w); |
687 |
|
} |
688 |
< |
// kinleg->AddEntry(lm4histo,"LM4","l"); |
688 |
> |
kinleg->AddEntry(lm3histo,"LM3","l"); |
689 |
|
kinleg->Draw(); |
690 |
|
TText* write_variable = write_text(0.99,0.01,var); |
691 |
|
write_variable->SetTextAlign(31); |
694 |
|
CompleteSave(ccomp,"compare/JZBcut_at_"+any2string(jzbcut)+"/"+filename+"/"+filename+sRegions[iregion]+(ijzb?"neg":"pos")); |
695 |
|
delete datahisto; |
696 |
|
delete ccomp; |
697 |
< |
delete lm4histo; |
697 |
> |
delete lm3histo; |
698 |
|
} |
699 |
|
cutWeight=weightbackup; |
700 |
|
} |
704 |
|
dout << "Creating comparison plots for signal and control regions" << endl; |
705 |
|
// Compare a few quantities in the signal region and all 7 control regions |
706 |
|
|
707 |
< |
switch_overunderflow(true); // switching overflow/underflow bins on |
707 |
> |
// switch_overunderflow(true); // switching overflow/underflow bins on |
708 |
|
|
709 |
|
|
710 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
711 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
711 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
712 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
713 |
|
float mll_low=50;float mll_high=170; |
714 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
715 |
< |
mll_high=200; |
716 |
< |
mll_low=50; |
715 |
> |
mll_high=300; |
716 |
> |
mll_low=20; |
717 |
|
} |
718 |
< |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,30,mll_low,mll_high,false,0,16.); |
718 |
> |
make_comp_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",jzbcut,mcjzb,datajzb,100,0,10,true); |
719 |
> |
make_comp_plot("TMath::Abs(pfJetDphiMet[0])","|#Delta#phi(jet1,MET)|","dphiJ1MET",jzbcut,mcjzb,datajzb,32,0,3.2,false,0,0,true); |
720 |
> |
|
721 |
> |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,56,mll_low,mll_high,false,0,16.); |
722 |
|
make_comp_plot("met[4]","pfMET [GeV]","pfmet",jzbcut,mcjzb,datajzb,18,0,360,false,0,16.); |
723 |
< |
make_comp_plot("pfJetGoodNum","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
723 |
> |
make_comp_plot("pfJetGoodNum40","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
724 |
> |
make_comp_plot("pfJetGoodNumBtag","#(b-jets)","nBjets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
725 |
|
make_comp_plot("pt","Z p_{T} [GeV]","Zpt",jzbcut,mcjzb,datajzb,26,0,525,false,0.,21.); |
726 |
< |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,20,0.,20.,false,0,16.); |
726 |
> |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,40,0.,40.,false,0,16.); |
727 |
|
make_comp_plot("TMath::Abs(dphi)","#Delta#phi(leptons)","dphilep",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
728 |
|
make_comp_plot("TMath::Abs(dphi_sumJetVSZ[1])","#Delta#phi(Z,jets)","dphiZjets",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
729 |
+ |
make_comp_plot("eta1","#eta_1","eta1",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
730 |
+ |
make_comp_plot("eta2","#eta_2","eta2",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
731 |
|
} |
732 |
|
|
733 |
|
switch_overunderflow(false); // switching overflow/underflow bins off |
1021 |
|
return return_functions; |
1022 |
|
} |
1023 |
|
|
1024 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
1024 |
> |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
1025 |
|
{ |
1026 |
< |
// note: sigma is not used ATM |
860 |
< |
switch_overunderflow(true); |
1026 |
> |
// switch_overunderflow(true); |
1027 |
|
bool is_data=false; |
1028 |
|
bool use_signal=false; |
1029 |
|
if(use_data==1) is_data=true; |
1033 |
|
float low=0; |
1034 |
|
float hi=500; |
1035 |
|
|
870 |
– |
stringstream largerzeroS; |
871 |
– |
largerzeroS << "("<<jzb<<">0)"; |
872 |
– |
TCut largerzero(largerzeroS.str().c_str()); |
873 |
– |
stringstream smallerzeroS; |
874 |
– |
smallerzeroS << "("<<jzb<<"<0)"; |
875 |
– |
TCut smallerzero(smallerzeroS.str().c_str()); |
876 |
– |
|
1036 |
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
1037 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1038 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1039 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1040 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1037 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1038 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1039 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1040 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1041 |
|
|
1042 |
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
1043 |
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
1054 |
|
|
1055 |
|
//these are for the ratio |
1056 |
|
|
1057 |
< |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1058 |
< |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1059 |
< |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1060 |
< |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1057 |
> |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1058 |
> |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1059 |
> |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1060 |
> |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1061 |
|
|
1062 |
|
TH1F *JRcorrJZBSBem; |
1063 |
|
TH1F *JLcorrJZBSBem; |
1064 |
|
TH1F *JRcorrJZBSBeemm; |
1065 |
|
TH1F *JLcorrJZBSBeemm; |
1066 |
|
|
1067 |
< |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,false); |
1067 |
> |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false); |
1068 |
|
|
1069 |
|
|
1070 |
|
if(PlottingSetup::RestrictToMassPeak) { |
1071 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1072 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1073 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1074 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1071 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1072 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1073 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1074 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1075 |
|
|
1076 |
|
//these are for the ratio |
1077 |
< |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1078 |
< |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1079 |
< |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1080 |
< |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1077 |
> |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1078 |
> |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1079 |
> |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1080 |
> |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1081 |
|
} |
1082 |
|
|
1083 |
|
TH1F *lm4RcorrJZBeemm; |
1084 |
< |
if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,allsamples.FindSample("LM")); |
1084 |
> |
if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM")); |
1085 |
|
|
1086 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
1087 |
|
|
1090 |
|
|
1091 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
1092 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
1093 |
+ |
|
1094 |
+ |
TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]); |
1095 |
+ |
ClearHisto(BpredSys); |
1096 |
+ |
|
1097 |
|
if(PlottingSetup::RestrictToMassPeak) { |
1098 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
1099 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
1116 |
|
JBpred->Add(JLcorrJZBSBem,-1.0/3.); |
1117 |
|
JBpred->Add(JRcorrJZBSBeemm,1.0/3.); |
1118 |
|
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.); |
1119 |
+ |
|
1120 |
+ |
//Systematics: |
1121 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertONPEAK*zjetsestimateuncertONPEAK); |
1122 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
1123 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
1124 |
+ |
AddSquared(BpredSys,JRcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
1125 |
+ |
AddSquared(BpredSys,JLcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
1126 |
+ |
AddSquared(BpredSys,JRcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
1127 |
+ |
AddSquared(BpredSys,JLcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
1128 |
|
} else { |
1129 |
|
Bpred->Add(RcorrJZBem,1.0); |
1130 |
|
Bpred->Add(LcorrJZBem,-1.0); |
1134 |
|
//these are for the ratio |
1135 |
|
JBpred->Add(JRcorrJZBem,1.0); |
1136 |
|
JBpred->Add(JLcorrJZBem,-1.0); |
1137 |
+ |
|
1138 |
+ |
//Systematics |
1139 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertOFFPEAK*zjetsestimateuncertOFFPEAK); |
1140 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
1141 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
1142 |
+ |
|
1143 |
|
} |
1144 |
|
|
1145 |
< |
|
1145 |
> |
SQRT(BpredSys); |
1146 |
> |
BpredSys->Divide(JBpred); |
1147 |
> |
|
1148 |
|
|
1149 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
1150 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
1189 |
|
blankback->Draw(); |
1190 |
|
if(use_data==1) |
1191 |
|
{ |
1192 |
+ |
//Bpred->SetLineWidth(3); //paper style.overruled. |
1193 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style.overruled. |
1194 |
|
analytical_function = do_extended_fit_to_plot(Bpred,Tpred,LcorrJZBeemm,LcorrJZBem,is_data); |
1195 |
|
kinpad->cd();//necessary because the extended fit function creates its own canvas |
1196 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1197 |
|
|
1198 |
|
Bpred->Draw("hist,same"); |
1199 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1199 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1200 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1201 |
|
lm4RcorrJZBeemm->Draw("hist,same"); |
1202 |
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p"); |
1203 |
|
legBpred->AddEntry(Bpred,"predicted","l"); |
1204 |
< |
legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1205 |
< |
legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1206 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1204 |
> |
// legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1205 |
> |
// legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1206 |
> |
legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l"); |
1207 |
|
legBpred->Draw(); |
1208 |
|
DrawPrelim(); |
1209 |
|
|
1232 |
|
Bpred->Draw("hist,same"); |
1233 |
|
// analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1234 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1235 |
< |
// TH1F *lm4RcorrJZBeemmC = (TH1F*)lm4RcorrJZBeemm->Clone("lm4RcorrJZBeemmC"); |
1054 |
< |
// lm4RcorrJZBeemmC->SetLineColor(kOrange+1); |
1055 |
< |
lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
1056 |
< |
// lm4RcorrJZBeemmC->Draw("histo,same"); |
1235 |
> |
// lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
1236 |
|
lm4RcorrJZBeemm->SetLineWidth(2); |
1237 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled. |
1238 |
|
lm4RcorrJZBeemm->Draw("histo,same"); |
1239 |
|
DrawPrelim(); |
1240 |
|
TLegend *speciallegBpred = make_legend("",0.45,0.55); |
1241 |
+ |
//TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled. |
1242 |
|
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
1243 |
|
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
1244 |
|
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
1245 |
< |
speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1245 |
> |
if(PlottingSetup::RestrictToMassPeak) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1246 |
> |
else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f"); |
1247 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
1248 |
|
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1249 |
|
speciallegBpred->Draw(); |
1250 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,use_data!=1,"data/pred"); |
1250 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
1251 |
|
|
1252 |
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1253 |
< |
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1253 |
> |
specialcanv->SetLogy(1); |
1254 |
> |
// THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1255 |
|
blankback->Draw(); |
1256 |
< |
kostack.Draw("same"); |
1256 |
> |
// kostack.Draw("same"); |
1257 |
> |
predcomposition.Draw(); |
1258 |
|
Bpred->Draw("hist,same"); |
1259 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1259 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1260 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1261 |
|
legBpred->Draw(); |
1262 |
|
DrawPrelim(); |
1263 |
|
CompleteSave(specialcanv,subdir+"Bpred_Data_____PredictionCompositioninMC"); |
1264 |
|
Bpred->SetLineWidth((int)CurrentBpredLineWidth); |
1265 |
|
|
1266 |
+ |
|
1267 |
+ |
//for(int i=1;i<=Bpred->GetNbinsX();i++) cout << Bpred->GetBinLowEdge(i) << ";" << Bpred->GetBinLowEdge(i)+Bpred->GetBinWidth(i) << ";;" << RcorrJZBeemm->GetBinContent(i) << ";" << LcorrJZBeemm->GetBinContent(i) << ";" << RcorrJZBem->GetBinContent(i) << ";" << LcorrJZBem->GetBinContent(i) << endl; |
1268 |
+ |
|
1269 |
|
delete speciallegBpred; |
1270 |
|
delete Zjetspred; |
1271 |
|
delete TTbarpred; |
1274 |
|
} |
1275 |
|
if(use_data==0) { |
1276 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1277 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1278 |
|
Bpred->Draw("hist,same"); |
1279 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1280 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1281 |
< |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1281 |
> |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1282 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
1283 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
1284 |
|
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1289 |
|
} |
1290 |
|
if(use_data==2) { |
1291 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1292 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1293 |
|
Bpred->Draw("hist,same"); |
1294 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1295 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1305 |
|
// CompleteSave(globalcanvas,"Bpred_MCwithS"); // done below in save_with_ratio |
1306 |
|
} |
1307 |
|
{ |
1308 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style. overruled. |
1309 |
+ |
//RcorrJZBeemmNoS->SetLineWidth(3); //paper style. overruled. |
1310 |
+ |
//lm4RcorrJZBeemm->SetLineStyle(2); //paper style. overruled. |
1311 |
+ |
//RcorrJZBeemmNoS->SetLineStyle(3); //paper style. overruled. |
1312 |
+ |
//lm4RcorrJZBeemm->SetLineColor(kOrange+1); //paper style. overruled. |
1313 |
+ |
|
1314 |
|
RcorrJZBeemmNoS->SetLineStyle(2); |
1315 |
|
legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l"); |
1316 |
|
legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
1330 |
|
string ytitle("ratio"); |
1331 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
1332 |
|
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1333 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle);//not extending the y range anymore up to 4 |
1333 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4 |
1334 |
|
|
1335 |
|
|
1336 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1337 |
< |
/// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1337 |
> |
// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1338 |
|
if(PlottingSetup::RestrictToMassPeak) { |
1339 |
|
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1340 |
|
Bpredem->Add(RcorrJZBem); |
1396 |
|
} |
1397 |
|
} |
1398 |
|
|
1399 |
+ |
TFile *f = new TFile("tester.root","RECREATE"); |
1400 |
+ |
RcorrJZBeemm->Write(); |
1401 |
+ |
Bpred->Write(); |
1402 |
+ |
f->Close(); |
1403 |
+ |
|
1404 |
|
delete RcorrJZBeemm; |
1405 |
|
delete LcorrJZBeemm; |
1406 |
|
delete RcorrJZBem; |
1413 |
|
|
1414 |
|
delete blankback; |
1415 |
|
|
1416 |
+ |
delete BpredSys; |
1417 |
|
if(PlottingSetup::RestrictToMassPeak) { |
1418 |
|
delete RcorrJZBSBem; |
1419 |
|
delete LcorrJZBSBem; |
1431 |
|
|
1432 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
1433 |
|
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
1434 |
< |
do_prediction_plot(datajzb,globalcanvas,DataSigma,jzbHigh ,data,overlay_signal); |
1435 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal); |
1436 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal); |
1434 |
> |
do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
1435 |
> |
if ( !PlottingSetup::Approved ) { |
1436 |
> |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
1437 |
> |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
1438 |
> |
} else { |
1439 |
> |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
1440 |
> |
} |
1441 |
|
} |
1442 |
|
|
1443 |
|
void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) { |
1774 |
|
datahisto->Draw("same,e1"); |
1775 |
|
|
1776 |
|
TLegend *leg; |
1777 |
< |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
1778 |
< |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
1779 |
< |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
1780 |
< |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
1781 |
< |
else { |
1782 |
< |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
1783 |
< |
exit(-1); |
1784 |
< |
} |
1777 |
> |
if (!PlottingSetup::RestrictToMassPeak) { |
1778 |
> |
if(is_OF(cut)) leg = allsamples.allbglegend("Opposite flavor",datahisto); |
1779 |
> |
else leg = allsamples.allbglegend("Same flavor",datahisto); |
1780 |
> |
} else { |
1781 |
> |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
1782 |
> |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
1783 |
> |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
1784 |
> |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
1785 |
> |
else { |
1786 |
> |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
1787 |
> |
exit(-1); |
1788 |
> |
} |
1789 |
> |
} |
1790 |
|
leg->Draw(); |
1791 |
|
string write_cut = decipher_cut(cut,""); |
1792 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
1862 |
|
|
1863 |
|
|
1864 |
|
dout << "Going to increase the cross section for diboson samples ... " << endl; |
1865 |
< |
for(int i=0;i<SamplesToBeModified.size();i++) { |
1865 |
> |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
1866 |
|
float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1867 |
|
(allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor; |
1868 |
|
dout << " Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl; |
1872 |
|
} |
1873 |
|
|
1874 |
|
dout << "Going to produce JZB plots" << endl; |
1875 |
< |
// produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
1875 |
> |
produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
1876 |
|
TCanvas *gloca = new TCanvas("gloca","gloca"); |
1667 |
– |
float sigma=123456; |
1877 |
|
|
1878 |
|
dout << "Going to produce prediction plots" << endl; |
1879 |
< |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
1880 |
< |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
1879 |
> |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
1880 |
> |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
1881 |
|
delete gloca; |
1882 |
|
|
1883 |
|
dout << "Going to reset the cross section for diboson samples ... " << endl; |
1884 |
< |
for(int i=0;i<SamplesToBeModified.size();i++) { |
1884 |
> |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
1885 |
|
float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1886 |
|
(allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor); |
1887 |
|
string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename; |
1891 |
|
} |
1892 |
|
|
1893 |
|
} |
1894 |
+ |
|
1895 |
+ |
|
1896 |
+ |
void draw_normalized_data_vs_data_histo(TCut cut1, TCut cut2, string variable, string legentry1, string legentry2, string savename, TCanvas *can,vector<float> binning) { |
1897 |
+ |
TPad *jzbpad = new TPad("jzbpad","jzbpad",0,0,1,1); |
1898 |
+ |
jzbpad->cd(); |
1899 |
+ |
jzbpad->SetLogy(1); |
1900 |
+ |
string xlabel="JZB [GeV]"; |
1901 |
+ |
|
1902 |
+ |
TH1F *datahisto1 = allsamples.Draw("datahisto1",variable,binning, xlabel, "events",cut1,data,luminosity); |
1903 |
+ |
datahisto1->SetLineColor(kRed); |
1904 |
+ |
datahisto1->SetMarkerColor(kRed); |
1905 |
+ |
TH1F *datahisto2 = allsamples.Draw("datahisto2",variable,binning, xlabel, "events",cut2,data,luminosity); |
1906 |
+ |
datahisto2->SetLineColor(kBlue); |
1907 |
+ |
datahisto2->SetMarkerColor(kBlue); |
1908 |
+ |
|
1909 |
+ |
datahisto2->SetMarkerSize(DataMarkerSize); |
1910 |
+ |
datahisto1->DrawNormalized("e1"); |
1911 |
+ |
datahisto2->DrawNormalized("histo,same"); |
1912 |
+ |
datahisto1->DrawNormalized("same,e1"); |
1913 |
+ |
|
1914 |
+ |
TLegend *leg = make_legend(); |
1915 |
+ |
leg->AddEntry(datahisto1,legentry1.c_str()); |
1916 |
+ |
leg->AddEntry(datahisto2,legentry2.c_str()); |
1917 |
+ |
leg->Draw(); |
1918 |
+ |
|
1919 |
+ |
save_with_ratio(datahisto1,datahisto2,jzbpad->cd(),("jzb/"+savename)); |
1920 |
+ |
|
1921 |
+ |
datahisto1->Delete(); |
1922 |
+ |
datahisto2->Delete(); |
1923 |
+ |
} |
1924 |
+ |
|
1925 |
+ |
|
1926 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1927 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
1928 |
|
float max=jzbHigh ; |
1936 |
|
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
1937 |
|
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
1938 |
|
|
1939 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
1940 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
1941 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
1942 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
1943 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
1944 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
1945 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1946 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
1947 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1939 |
> |
if ( !PlottingSetup::Approved ) { |
1940 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
1941 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
1942 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
1943 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
1944 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
1945 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
1946 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1947 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
1948 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1949 |
> |
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm",can,binning); |
1950 |
> |
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarse",can,coarse_binning); |
1951 |
> |
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarsest",can,coarsest_binning); |
1952 |
> |
|
1953 |
> |
} |
1954 |
|
|
1955 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarse",can,coarse_binning); |
1956 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
1957 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1958 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
1959 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
1960 |
< |
|
1961 |
< |
// draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarsest",can,coarsest_binning); |
1715 |
< |
// draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarsest",can,coarsest_binning); |
1716 |
< |
// flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1717 |
< |
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarsest",can,coarsest_binning); |
1718 |
< |
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarsest",can,coarsest_binning); |
1956 |
> |
if ( !PlottingSetup::Approved ) { |
1957 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
1958 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1959 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
1960 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
1961 |
> |
} |
1962 |
|
delete can; |
1963 |
|
} |
1964 |
|
|
2014 |
|
string posneg[] = {"pos","neg"}; |
2015 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
2016 |
|
|
2017 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
2017 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
2018 |
|
TCut jzbMC[] = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") }; |
2019 |
|
dout << "_________________________________________________________" << endl; |
2020 |
|
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl; |
2021 |
< |
for(int isample=0;isample<(allsamples.collection).size();isample++) { |
2021 |
> |
for(int isample=0;isample<(int)(allsamples.collection).size();isample++) { |
2022 |
|
if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << " & "; |
2023 |
|
else dout << "Sample & "; |
2024 |
|
for(int iregion=0;iregion<nRegions;iregion++) { |
2277 |
|
|
2278 |
|
void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) { |
2279 |
|
int all_leptons=-1; |
2037 |
– |
int electrons_only=0; |
2038 |
– |
int mu_only=1; |
2039 |
– |
int twojetswith50gev=1; |
2280 |
|
int threejetswith30gev=0; |
2281 |
|
/* |
2282 |
+ |
int twojetswith50gev=1; |
2283 |
+ |
int electrons_only=0; |
2284 |
+ |
int mu_only=1; |
2285 |
+ |
|
2286 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev); |
2287 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev); |
2288 |
|
|
2296 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true); |
2297 |
|
} |
2298 |
|
|
2299 |
< |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
2056 |
< |
//first: colorful plots |
2299 |
> |
float find_one_correction_factor(string FindKeyword, bool dodata, TCut SpecialCut, string SaveAs) { |
2300 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
2301 |
|
cancorr->SetLogz(); |
2302 |
|
cancorr->SetRightMargin(0.13); |
2303 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2304 |
< |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"); |
2303 |
> |
TCut zptforresponsepresentation(cutmass&&SpecialCut&&passtrig); |
2304 |
> |
|
2305 |
> |
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2306 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2307 |
< |
(allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation); |
2307 |
> |
niceresponseplotd->Sumw2(); |
2308 |
> |
TH2F* emuResponse = (TH2F*)niceresponseplotd->Clone("emuResponse"); |
2309 |
> |
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
2310 |
> |
for(int iSample=0;iSample<(int)SampleIndices.size();iSample++) { |
2311 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data && !dodata) continue; |
2312 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data ==false && dodata) continue; |
2313 |
> |
|
2314 |
> |
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl; |
2315 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",(zptforresponsepresentation&&cutOSSF)*cutWeight); |
2316 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+emuResponse",(zptforresponsepresentation&&cutOSOF)*cutWeight); |
2317 |
> |
} |
2318 |
> |
niceresponseplotd->Add(emuResponse,-1); |
2319 |
> |
|
2320 |
|
niceresponseplotd->SetStats(0); |
2321 |
|
niceresponseplotd->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2322 |
|
niceresponseplotd->GetYaxis()->SetTitle("Response"); |
2324 |
|
niceresponseplotd->GetYaxis()->CenterTitle(); |
2325 |
|
niceresponseplotd->Draw("COLZ"); |
2326 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
2327 |
+ |
profd->Rebin(2); |
2328 |
|
profd->SetMarkerSize(DataMarkerSize); |
2329 |
< |
profd->Fit("pol0","","same,e1",30,400); |
2329 |
> |
profd->Fit("pol0","","same,e1",100,400); |
2330 |
|
DrawPrelim(); |
2331 |
< |
TText* title = write_text(0.5,0.7,"Data"); |
2331 |
> |
string stitle="Data"; |
2332 |
> |
if(!Contains(FindKeyword,"Data")) stitle="MC"; |
2333 |
> |
TText* title = write_text(0.5,0.7,stitle.c_str()); |
2334 |
|
title->SetTextAlign(12); |
2335 |
|
title->Draw(); |
2336 |
|
TF1 *datapol=(TF1*)profd->GetFunction("pol0"); |
2337 |
< |
float datacorrection=datapol->GetParameter(0); |
2338 |
< |
stringstream dataresstring; |
2339 |
< |
dataresstring<<"Response: "<<std::setprecision(2)<<100*datacorrection<<" %"; |
2340 |
< |
TText* restitle = write_text(0.5,0.65,dataresstring.str()); |
2337 |
> |
float correction=datapol->GetParameter(0); |
2338 |
> |
stringstream resstring; |
2339 |
> |
resstring<<"Response: "<<std::setprecision(2)<<100*correction<<" %"; |
2340 |
> |
TText* restitle = write_text(0.5,0.65,resstring.str()); |
2341 |
|
restitle->SetTextAlign(12); |
2342 |
|
restitle->SetTextSize(0.03); |
2343 |
|
restitle->Draw(); |
2344 |
< |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_Data"); |
2345 |
< |
|
2346 |
< |
TH2F *niceresponseplotm = new TH2F("niceresponseplotm","",100,0,600,100,0,5); |
2347 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation); |
2348 |
< |
niceresponseplotm->SetStats(0); |
2349 |
< |
niceresponseplotm->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2350 |
< |
niceresponseplotm->GetYaxis()->SetTitle("Response"); |
2351 |
< |
niceresponseplotm->GetXaxis()->CenterTitle(); |
2093 |
< |
niceresponseplotm->GetYaxis()->CenterTitle(); |
2094 |
< |
niceresponseplotm->Draw("COLZ"); |
2095 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt",zptforresponsepresentation,"PROF,same"); |
2096 |
< |
TProfile * profm = (TProfile*)niceresponseplotm->ProfileX(); |
2097 |
< |
profm->SetMarkerSize(DataMarkerSize); |
2098 |
< |
profm->Fit("pol0","","same,e1",30,400); |
2099 |
< |
DrawMCPrelim(); |
2100 |
< |
title = write_text(0.5,0.7,"MC simulation"); |
2101 |
< |
title->SetTextAlign(12); |
2102 |
< |
title->Draw(); |
2103 |
< |
TF1 *mcpol=(TF1*)profm->GetFunction("pol0"); |
2104 |
< |
float mccorrection=mcpol->GetParameter(0); |
2105 |
< |
stringstream mcresstring; |
2106 |
< |
mcresstring<<"Response: "<<std::setprecision(2)<<100*mccorrection<<" %"; |
2107 |
< |
TText* mcrestitle = write_text(0.5,0.65,mcresstring.str()); |
2108 |
< |
mcrestitle->SetTextAlign(12); |
2109 |
< |
mcrestitle->SetTextSize(0.03); |
2110 |
< |
mcrestitle->Draw(); |
2111 |
< |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_MC"); |
2344 |
> |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_New_"+SaveAs); |
2345 |
> |
delete cancorr; |
2346 |
> |
delete niceresponseplotd; |
2347 |
> |
delete profd; |
2348 |
> |
return correction; |
2349 |
> |
} |
2350 |
> |
|
2351 |
> |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
2352 |
|
|
2353 |
+ |
dout << "Computing response corrections: " << endl; |
2354 |
+ |
//Step 1 : Get results |
2355 |
+ |
float datacorrection=find_one_correction_factor("Data",true,"","Data"); |
2356 |
+ |
float mccorrection=find_one_correction_factor("DY",false,"","MC"); |
2357 |
+ |
|
2358 |
+ |
float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
2359 |
+ |
float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee"); |
2360 |
+ |
|
2361 |
+ |
float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm"); |
2362 |
+ |
float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm"); |
2363 |
+ |
|
2364 |
+ |
cout << "Corrections : " << endl; |
2365 |
+ |
cout << " Data : " << datacorrection << endl; |
2366 |
+ |
cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
2367 |
+ |
cout << " MC : " << mccorrection << endl; |
2368 |
+ |
cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
2369 |
|
|
2370 |
< |
//Step 2: Getting the result |
2115 |
< |
// TCut zptcutforresponse("pt>30&&pt<300&&TMath::Abs(91.2-mll)<20&&id1==id2&&(ch1*ch2<0)"); |
2370 |
> |
//Step 2: Processing the result and making it into something useful :-) |
2371 |
|
stringstream jzbvardatas; |
2372 |
< |
if(datacorrection>1) jzbvardatas<<"(jzb[1]-"<<datacorrection-1<<"*pt)"; |
2373 |
< |
if(datacorrection<1) jzbvardatas<<"(jzb[1]+"<<1-datacorrection<<"*pt)"; |
2372 |
> |
jzbvardatas << "("; |
2373 |
> |
|
2374 |
> |
if(dataEEcorrection>=1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]-" << dataEEcorrection-1 << "*pt))"; |
2375 |
> |
if(dataEEcorrection<1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-dataEEcorrection << "*pt))"; |
2376 |
> |
|
2377 |
> |
if(dataMMcorrection>=1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]-" << dataMMcorrection-1 << "*pt))"; |
2378 |
> |
if(dataMMcorrection<1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-dataMMcorrection << "*pt))"; |
2379 |
> |
|
2380 |
> |
float averagecorrection=(dataMMcorrection+dataEEcorrection)/2.0; |
2381 |
> |
|
2382 |
> |
if(datacorrection>=1) jzbvardatas<<"+((id1!=id2)*(jzb[1]-" << datacorrection-1 << "*pt))"; |
2383 |
> |
if(datacorrection<1) jzbvardatas<<"+((id1!=id2)*(jzb[1]+" << 1-datacorrection << "*pt))"; |
2384 |
> |
|
2385 |
> |
jzbvardatas << ")"; |
2386 |
|
jzbvardata=jzbvardatas.str(); |
2387 |
+ |
|
2388 |
|
stringstream jzbvarmcs; |
2389 |
< |
if(mccorrection>1) jzbvarmcs<<"(jzb[1]-"<<mccorrection-1<<"*pt)"; |
2390 |
< |
if(mccorrection<1) jzbvarmcs<<"(jzb[1]+"<<1-mccorrection<<"*pt)"; |
2389 |
> |
jzbvarmcs << "("; |
2390 |
> |
|
2391 |
> |
if(mcEEcorrection>=1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]-" << mcEEcorrection-1 << "*pt))"; |
2392 |
> |
if(mcEEcorrection<1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-mcEEcorrection << "*pt))"; |
2393 |
> |
|
2394 |
> |
if(mcMMcorrection>=1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]-" << mcMMcorrection-1 << "*pt))"; |
2395 |
> |
if(mcMMcorrection<1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-mcMMcorrection << "*pt))"; |
2396 |
> |
|
2397 |
> |
float averagemccorrection=(mcMMcorrection+mcEEcorrection)/2.0; |
2398 |
> |
|
2399 |
> |
if(mccorrection>=1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]-" << mccorrection-1 << "*pt))"; |
2400 |
> |
if(mccorrection<1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]+" << 1-mccorrection << "*pt))"; |
2401 |
> |
|
2402 |
> |
jzbvarmcs << ")"; |
2403 |
|
jzbvarmc=jzbvarmcs.str(); |
2404 |
+ |
|
2405 |
|
dout << "JZB Z pt correction summary : " << endl; |
2406 |
|
dout << " Data: The response is " << datacorrection << " --> jzb variable is now : " << jzbvardata << endl; |
2407 |
|
dout << " MC : The response is " << mccorrection << " --> jzb variable is now : " << jzbvarmc << endl; |
2408 |
+ |
|
2409 |
|
} |
2410 |
|
|
2411 |
|
void pick_up_events(string cut) { |
2413 |
|
allsamples.PickUpEvents(cut); |
2414 |
|
} |
2415 |
|
|
2416 |
< |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError) { |
2416 |
> |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) { |
2417 |
|
dout << "Saving configuration template!" << endl; |
2418 |
|
ofstream configfile; |
2419 |
|
configfile.open("../DistributedModelCalculations/last_configuration.C"); |
2433 |
|
configfile<<"string datajzb=\"datajzb_ERROR\";\n"; |
2434 |
|
configfile<<"string mcjzb=\"mcjzb_ERROR\";\n"; |
2435 |
|
configfile<<"vector<float>jzb_cuts;\n"; |
2436 |
+ |
configfile<<"vector<float>jzb_shape_limit_bins;\n"; |
2437 |
|
configfile<<"float MCPeakError=-999;\n"; |
2438 |
|
configfile<<"float DataPeakError=-999;\n"; |
2439 |
|
configfile<<"}\n\n"; |
2443 |
|
configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n"; |
2444 |
|
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n"; |
2445 |
|
configfile<<"DataPeakError="<<DataPeakError<<";\n\n"; |
2446 |
< |
for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2446 |
> |
for(int i=0;i<(int)jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2447 |
> |
configfile<<"\n\n"; |
2448 |
> |
for(int i=0;i<(int)Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2449 |
> |
for(int i=0;i<(int)Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2450 |
> |
for(int i=0;i<(int)Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2451 |
|
configfile<<"\n\n"; |
2452 |
< |
for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2453 |
< |
for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2454 |
< |
for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2452 |
> |
for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2453 |
> |
for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2454 |
> |
for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2455 |
> |
for(int i=0;i<(int)jzb_shape_limit_bins.size();i++) configfile<<"jzb_shape_limit_bins.push_back("<<jzb_shape_limit_bins[i]<<"); // JZB shape bin boundary at " << jzb_shape_limit_bins[i] << "\n"; |
2456 |
|
configfile<<"\n\n"; |
2169 |
– |
for(int i=0;i<flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2170 |
– |
for(int i=0;i<flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2171 |
– |
for(int i=0;i<flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2457 |
|
configfile<<"\n\n"; |
2458 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
2459 |
|
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
2479 |
|
float max=histos[0]->GetMaximum(); |
2480 |
|
if(manualmin>=0) min=manualmin; |
2481 |
|
else { |
2482 |
< |
for(int i=1;i<histos.size();i++) { |
2482 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2483 |
|
float curmin=get_nonzero_minimum(histos[i]); |
2484 |
|
float curmax=histos[i]->GetMaximum(); |
2485 |
|
if(curmin<min) min=curmin; |
2490 |
|
histos[0]->Draw(drawoption.c_str()); |
2491 |
|
stringstream drawopt; |
2492 |
|
drawopt << drawoption << ",same"; |
2493 |
< |
for(int i=1;i<histos.size();i++) { |
2493 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2494 |
|
histos[i]->Draw(drawopt.str().c_str()); |
2495 |
|
} |
2496 |
|
} |
2499 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
2500 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
2501 |
|
TCut weightbackup=cutWeight; |
2217 |
– |
cutWeight="1.0"; |
2218 |
– |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2502 |
|
|
2503 |
+ |
bool doPURW=false; |
2504 |
+ |
|
2505 |
+ |
|
2506 |
+ |
if(!doPURW) { |
2507 |
+ |
dout << "Not doing PU reweighting for ttbar closure test" << endl; |
2508 |
+ |
cutWeight="1.0"; |
2509 |
+ |
// Do it without PU re-weighting |
2510 |
+ |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2511 |
+ |
stringstream resultsNoPU; |
2512 |
+ |
stringstream noPUdatajzb; |
2513 |
+ |
stringstream noPUmcjzb; |
2514 |
+ |
|
2515 |
+ |
stringstream mcjzbnoPU; |
2516 |
+ |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
2517 |
+ |
mcjzb = noPUmcjzb.str(); |
2518 |
+ |
} |
2519 |
|
|
2520 |
< |
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2520 |
> |
|
2521 |
> |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2522 |
> |
|
2523 |
> |
TH1F *TZem = systsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2524 |
|
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2525 |
|
TH1F *TSem; |
2526 |
|
TH1F *nTSem; |
2527 |
< |
TH1F *TZeemm = systsamples.Draw("TZeemm",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2527 |
> |
TH1F *TZeemm = systsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2528 |
|
TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2529 |
|
TH1F *TSeemm; |
2530 |
|
TH1F *nTSeemm; |
2531 |
|
|
2532 |
|
if(PlottingSetup::RestrictToMassPeak) { |
2533 |
< |
TSem = systsamples.Draw("TSem",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2534 |
< |
nTSem = systsamples.Draw("nTSem","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2535 |
< |
TSeemm = systsamples.Draw("TSeemm",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2533 |
> |
TSem = systsamples.Draw("TSem", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2534 |
> |
nTSem = systsamples.Draw("nTSem", "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2535 |
> |
TSeemm = systsamples.Draw("TSeemm", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2536 |
|
nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2537 |
|
} |
2538 |
|
|
2539 |
|
TCanvas *tcan = new TCanvas("tcan","tcan"); |
2238 |
– |
|
2540 |
|
tcan->SetLogy(1); |
2541 |
|
|
2542 |
|
TZeemm->SetLineColor(kBlack); |
2555 |
|
} |
2556 |
|
|
2557 |
|
vector<TH1F*> histos; |
2558 |
+ |
TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2559 |
+ |
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2560 |
|
histos.push_back(TZem); |
2561 |
|
histos.push_back(TZeemm); |
2562 |
|
if(PlottingSetup::RestrictToMassPeak) { |
2563 |
+ |
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2564 |
+ |
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2565 |
|
histos.push_back(TSem); |
2566 |
|
histos.push_back(TSeemm); |
2567 |
|
} |
2568 |
< |
draw_all_ttbar_histos(tcan,histos,"histo",0.04); |
2568 |
> |
draw_all_ttbar_histos(tcan,histos,"histo",1); |
2569 |
|
|
2570 |
|
TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false); |
2571 |
|
leg->AddEntry(TZeemm,"SFZP","l"); |
2577 |
|
leg->Draw("same"); |
2578 |
|
DrawMCPrelim(simulatedlumi); |
2579 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
2275 |
– |
cout << __LINE__ << endl; |
2580 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
2277 |
– |
cout << __LINE__ << endl; |
2581 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
2279 |
– |
cout << __LINE__ << endl; |
2582 |
|
TH1F *TSeemmcopy; |
2583 |
|
TH1F *TSemcopy; |
2584 |
|
if(PlottingSetup::RestrictToMassPeak) { |
2593 |
|
TSeemm->Divide(TZeemm); |
2594 |
|
TSem->SetMarkerStyle(24); |
2595 |
|
TSeemm->SetMarkerStyle(32); |
2596 |
< |
} |
2596 |
> |
} |
2597 |
|
|
2598 |
|
tcan->SetLogy(0); |
2599 |
|
TZem->GetYaxis()->SetRangeUser(0,2.5); |
2604 |
|
TSeemm->Draw("same"); |
2605 |
|
} |
2606 |
|
|
2607 |
< |
float linepos=0.25; |
2608 |
< |
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
2609 |
< |
if(!PlottingSetup::RestrictToMassPeak) linepos=0.1; //sys uncertainty for iJZB |
2607 |
> |
float linepos=emuncertONPEAK; |
2608 |
> |
if(!PlottingSetup::RestrictToMassPeak) linepos=emuncertOFFPEAK; |
2609 |
> |
|
2610 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2611 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2612 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2642 |
|
DrawMCPrelim(simulatedlumi); |
2643 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
2644 |
|
|
2645 |
+ |
if (0) { // Turn this off: we don't need this |
2646 |
|
|
2647 |
< |
///-------------- second part: only look at the quantity we actually care about! |
2648 |
< |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
2649 |
< |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
2650 |
< |
rightsfzp->Add(leftsfzp,-1); |
2651 |
< |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
2652 |
< |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
2653 |
< |
rightofzp->Add(leftofzp,-1); |
2654 |
< |
TH1F *leftofsb; |
2655 |
< |
TH1F *rightofsb; |
2656 |
< |
TH1F *leftsfsb; |
2657 |
< |
TH1F *rightsfsb; |
2658 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2659 |
< |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
2660 |
< |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
2661 |
< |
rightofsb->Add(leftofsb,-1); |
2662 |
< |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
2663 |
< |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
2664 |
< |
rightsfsb->Add(leftsfsb,-1); |
2665 |
< |
} |
2647 |
> |
///-------------- second part: only look at the quantity we actually care about! |
2648 |
> |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
2649 |
> |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
2650 |
> |
rightsfzp->Add(leftsfzp,-1); |
2651 |
> |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
2652 |
> |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
2653 |
> |
rightofzp->Add(leftofzp,-1); |
2654 |
> |
TH1F *leftofsb; |
2655 |
> |
TH1F *rightofsb; |
2656 |
> |
TH1F *leftsfsb; |
2657 |
> |
TH1F *rightsfsb; |
2658 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2659 |
> |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
2660 |
> |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
2661 |
> |
rightofsb->Add(leftofsb,-1); |
2662 |
> |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
2663 |
> |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
2664 |
> |
rightsfsb->Add(leftsfsb,-1); |
2665 |
> |
} |
2666 |
|
|
2667 |
< |
tcan->SetLogy(1); |
2668 |
< |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
2669 |
< |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
2670 |
< |
rightsfzp->Draw("histo"); |
2671 |
< |
rightofzp->Draw("histo,same"); |
2672 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2673 |
< |
rightofsb->Draw("histo,same"); |
2674 |
< |
rightsfsb->Draw("histo,same"); |
2675 |
< |
} |
2676 |
< |
DrawMCPrelim(simulatedlumi); |
2667 |
> |
tcan->SetLogy(1); |
2668 |
> |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
2669 |
> |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
2670 |
> |
rightsfzp->Draw("histo"); |
2671 |
> |
rightofzp->Draw("histo,same"); |
2672 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2673 |
> |
rightofsb->Draw("histo,same"); |
2674 |
> |
rightsfsb->Draw("histo,same"); |
2675 |
> |
} |
2676 |
> |
DrawMCPrelim(simulatedlumi); |
2677 |
|
|
2678 |
< |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
2679 |
< |
legA->AddEntry(rightsfzp,"SFZP","l"); |
2680 |
< |
legA->AddEntry(rightofzp,"OFZP","l"); |
2681 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2682 |
< |
legA->AddEntry(rightofsb,"SFSB","l"); |
2683 |
< |
legA->AddEntry(rightsfsb,"OFSB","l"); |
2684 |
< |
} |
2685 |
< |
legA->Draw(); |
2678 |
> |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
2679 |
> |
legA->AddEntry(rightsfzp,"SFZP","l"); |
2680 |
> |
legA->AddEntry(rightofzp,"OFZP","l"); |
2681 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2682 |
> |
legA->AddEntry(rightofsb,"SFSB","l"); |
2683 |
> |
legA->AddEntry(rightsfsb,"OFSB","l"); |
2684 |
> |
} |
2685 |
> |
legA->Draw(); |
2686 |
|
|
2687 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
2687 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
2688 |
|
|
2689 |
< |
tcan->SetLogy(0); |
2690 |
< |
rightofzp->Divide(rightsfzp); |
2691 |
< |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
2692 |
< |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.0); |
2693 |
< |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
2694 |
< |
rightofzp->Draw(); |
2695 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2696 |
< |
rightofsb->Divide(rightsfzp); |
2697 |
< |
rightsfsb->Divide(rightsfzp); |
2698 |
< |
rightofsb->Draw("same"); |
2699 |
< |
rightsfsb->Draw("same"); |
2700 |
< |
} |
2689 |
> |
tcan->SetLogy(0); |
2690 |
> |
rightofzp->Divide(rightsfzp); |
2691 |
> |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
2692 |
> |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
2693 |
> |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
2694 |
> |
rightofzp->Draw(); |
2695 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2696 |
> |
rightofsb->Divide(rightsfzp); |
2697 |
> |
rightsfsb->Divide(rightsfzp); |
2698 |
> |
rightofsb->Draw("same"); |
2699 |
> |
rightsfsb->Draw("same"); |
2700 |
> |
} |
2701 |
|
|
2702 |
< |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2703 |
< |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
2704 |
< |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2705 |
< |
|
2706 |
< |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
2707 |
< |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
2708 |
< |
center2->SetLineColor(kBlue); |
2709 |
< |
|
2710 |
< |
top2->Draw("same"); |
2711 |
< |
center2->Draw("same"); |
2712 |
< |
bottom2->Draw("same"); |
2702 |
> |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2703 |
> |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
2704 |
> |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2705 |
> |
|
2706 |
> |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
2707 |
> |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
2708 |
> |
center2->SetLineColor(kBlue); |
2709 |
> |
|
2710 |
> |
top2->Draw("same"); |
2711 |
> |
center2->Draw("same"); |
2712 |
> |
bottom2->Draw("same"); |
2713 |
|
|
2714 |
< |
rightofzp->SetMarkerStyle(21); |
2715 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2716 |
< |
rightofsb->SetMarkerStyle(24); |
2717 |
< |
rightsfsb->SetMarkerStyle(32); |
2718 |
< |
} |
2714 |
> |
rightofzp->SetMarkerStyle(21); |
2715 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2716 |
> |
rightofsb->SetMarkerStyle(24); |
2717 |
> |
rightsfsb->SetMarkerStyle(32); |
2718 |
> |
} |
2719 |
|
|
2720 |
< |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
2721 |
< |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
2722 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2723 |
< |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
2724 |
< |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
2725 |
< |
} |
2726 |
< |
leg3->AddEntry(bottom,"syst. envelope","l"); |
2727 |
< |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
2728 |
< |
leg3->SetY1(0.65); |
2720 |
> |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
2721 |
> |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
2722 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2723 |
> |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
2724 |
> |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
2725 |
> |
} |
2726 |
> |
leg3->AddEntry(bottom,"syst. envelope","l"); |
2727 |
> |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
2728 |
> |
leg3->SetY1(0.65); |
2729 |
|
|
2730 |
< |
leg3->Draw("same"); |
2730 |
> |
leg3->Draw("same"); |
2731 |
|
|
2732 |
< |
DrawMCPrelim(simulatedlumi); |
2733 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
2732 |
> |
DrawMCPrelim(simulatedlumi); |
2733 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
2734 |
> |
|
2735 |
> |
} |
2736 |
|
|
2737 |
|
delete TZem; |
2738 |
|
delete nTZem; |
2751 |
|
|
2752 |
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) { |
2753 |
|
vector<float> nicer_binning; |
2754 |
< |
nicer_binning.push_back(-125); |
2754 |
> |
|
2755 |
> |
/* nicer_binning.push_back(-400); |
2756 |
> |
nicer_binning.push_back(-250); |
2757 |
> |
nicer_binning.push_back(-200); |
2758 |
> |
nicer_binning.push_back(-150); |
2759 |
> |
nicer_binning.push_back(-100); |
2760 |
> |
nicer_binning.push_back(-50); |
2761 |
> |
nicer_binning.push_back(-20); |
2762 |
> |
|
2763 |
> |
nicer_binning.push_back(0); |
2764 |
> |
nicer_binning.push_back(20); |
2765 |
> |
nicer_binning.push_back(50); |
2766 |
> |
nicer_binning.push_back(100); |
2767 |
> |
nicer_binning.push_back(150); |
2768 |
> |
nicer_binning.push_back(200); |
2769 |
> |
nicer_binning.push_back(250); |
2770 |
> |
nicer_binning.push_back(400);*/ |
2771 |
> |
|
2772 |
|
nicer_binning.push_back(-100); |
2451 |
– |
nicer_binning.push_back(-75); |
2773 |
|
nicer_binning.push_back(-50); |
2774 |
|
nicer_binning.push_back(-25); |
2775 |
|
nicer_binning.push_back(0); |
2779 |
|
nicer_binning.push_back(100); |
2780 |
|
nicer_binning.push_back(125); |
2781 |
|
nicer_binning.push_back(150); |
2782 |
< |
nicer_binning.push_back(175); |
2782 |
> |
//nicer_binning.push_back(175); |
2783 |
|
nicer_binning.push_back(200); |
2784 |
< |
nicer_binning.push_back(230); |
2785 |
< |
nicer_binning.push_back(280); |
2784 |
> |
nicer_binning.push_back(250); |
2785 |
> |
nicer_binning.push_back(300); |
2786 |
|
nicer_binning.push_back(400); |
2787 |
+ |
|
2788 |
|
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
2789 |
|
} |
2790 |
|
|
2791 |
|
|
2792 |
< |
void zjets_prediction_comparison() { |
2793 |
< |
// Do it without PU re-weighting |
2794 |
< |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2795 |
< |
stringstream resultsNoPU; |
2796 |
< |
|
2797 |
< |
stringstream mcjzbnoPU; |
2798 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,false); |
2799 |
< |
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2800 |
< |
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2792 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa) { |
2793 |
> |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2794 |
> |
// zcan->SetLogy(1); |
2795 |
> |
TCut weightbackup=cutWeight; |
2796 |
> |
|
2797 |
> |
bool UsePURW=false; |
2798 |
> |
|
2799 |
> |
|
2800 |
> |
string mcjzb; |
2801 |
> |
if(UsePURW) { |
2802 |
> |
mcjzb=mcjzbWithPUa; |
2803 |
> |
} else { |
2804 |
> |
// Do it without PU re-weighting |
2805 |
> |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2806 |
> |
stringstream resultsNoPU; |
2807 |
> |
stringstream noPUdatajzb; |
2808 |
> |
stringstream noPUmcjzb; |
2809 |
> |
|
2810 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,false,noPUdatajzb,noPUmcjzb); |
2811 |
> |
dout << "The peak corrected JZB expression for MC without pileup is : " << noPUmcjzb.str() << endl; |
2812 |
> |
|
2813 |
> |
mcjzb = noPUmcjzb.str(); |
2814 |
> |
|
2815 |
> |
cutWeight="1.0"; |
2816 |
> |
} |
2817 |
|
|
2818 |
< |
string mcjzb = mcjzbnoPU.str(); |
2819 |
< |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
2818 |
> |
|
2819 |
> |
vector<float> binning; |
2820 |
> |
binning.push_back(0); |
2821 |
> |
binning.push_back(10); |
2822 |
> |
binning.push_back(20); |
2823 |
> |
binning.push_back(40); |
2824 |
> |
binning.push_back(60); |
2825 |
> |
// binning.push_back(50); |
2826 |
> |
// binning.push_back(60); |
2827 |
> |
// binning.push_back(70); |
2828 |
> |
// binning.push_back(80); |
2829 |
> |
// binning.push_back(90); |
2830 |
> |
binning.push_back(100); |
2831 |
|
|
2483 |
– |
TCut weightbackup=cutWeight; |
2484 |
– |
cutWeight="1.0"; |
2485 |
– |
float sbg_min=0.; |
2486 |
– |
float sbg_max=100.; |
2487 |
– |
int sbg_nbins=5; |
2832 |
|
float simulatedlumi = luminosity;//in pb please - adjust to your likings |
2833 |
|
|
2834 |
|
TCut kPos((mcjzb+">0").c_str()); |
2835 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
2836 |
|
string var( "abs("+mcjzb+")" ); |
2837 |
+ |
|
2838 |
+ |
TCut notTau("abs(genMID1)!=15"); |
2839 |
+ |
TCut ONLYTau("mll>20"); |
2840 |
+ |
|
2841 |
|
|
2842 |
< |
TCut kcut(cutmass&&cutOSSF&&"pfJetGoodNum>2"); |
2843 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2844 |
< |
kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2497 |
< |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2498 |
< |
kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2842 |
> |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2843 |
> |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2844 |
> |
|
2845 |
|
hJZBpos->SetLineColor(kBlack); |
2846 |
|
hJZBneg->SetLineColor(kRed); |
2847 |
|
|
2848 |
< |
Int_t nbins = 5; |
2503 |
< |
Float_t xmax = 100.; |
2504 |
< |
|
2505 |
< |
|
2506 |
< |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2507 |
< |
zcan->SetLogy(1); |
2508 |
< |
|
2848 |
> |
hJZBpos->SetMinimum(1.0); |
2849 |
|
hJZBpos->Draw("e1"); |
2850 |
|
hJZBneg->Draw("same,hist"); |
2851 |
|
hJZBpos->Draw("same,e1"); // So it's on top... |
2852 |
|
|
2853 |
< |
TLegend *leg = make_legend("MC Z+jets",0.55,0.75,false); |
2853 |
> |
TLegend *leg = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.55,0.75,false); |
2854 |
|
leg->AddEntry(hJZBpos,"Observed","pe"); |
2855 |
|
leg->AddEntry(hJZBneg,"Predicted","l"); |
2856 |
|
leg->Draw("same"); |
2857 |
|
DrawMCPrelim(simulatedlumi); |
2858 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction"); |
2858 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction"); |
2859 |
|
|
2860 |
|
TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio"); |
2861 |
|
hratio->Divide(hJZBneg); |
2862 |
|
|
2863 |
+ |
for(int i=1;i<=hJZBpos->GetNbinsX();i++) { |
2864 |
+ |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << " (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << endl; |
2865 |
+ |
} |
2866 |
+ |
|
2867 |
|
zcan->SetLogy(0); |
2868 |
< |
hratio->GetYaxis()->SetRangeUser(0,2.5); |
2868 |
> |
hratio->GetYaxis()->SetRangeUser(0,2.0); |
2869 |
|
hratio->GetYaxis()->SetTitle("Observed/Predicted"); |
2870 |
|
hratio->Draw("e1"); |
2871 |
|
|
2872 |
< |
TLine *top = new TLine(sbg_min,1.25,sbg_max,1.25); |
2873 |
< |
TLine *center = new TLine(sbg_min,1.0,sbg_max,1.0); |
2874 |
< |
TLine *bottom = new TLine(sbg_min,0.75,sbg_max,0.75); |
2872 |
> |
TLine *top = new TLine(binning[0],1.25,binning[binning.size()-1],1.25); |
2873 |
> |
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2874 |
> |
TLine *bottom = new TLine(binning[0],0.75,binning[binning.size()-1],0.75); |
2875 |
|
|
2876 |
|
|
2877 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
2882 |
|
center->Draw("same"); |
2883 |
|
bottom->Draw("same"); |
2884 |
|
|
2885 |
< |
TLegend *leg2 = make_legend("MC Z+jets",0.25,0.75,false); |
2885 |
> |
TLegend *leg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
2886 |
|
leg2->AddEntry(hratio,"obs / pred","pe"); |
2887 |
|
leg2->AddEntry(bottom,"syst. envelope","l"); |
2888 |
|
leg2->Draw("same"); |
2889 |
|
DrawMCPrelim(simulatedlumi); |
2890 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction_ratio"); |
2890 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"); |
2891 |
> |
|
2892 |
> |
TCut reducedNJets(cutnJets); |
2893 |
> |
|
2894 |
> |
TH1F *TAUhJZBpos = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2895 |
> |
TH1F *LcorrJZBeemm = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2896 |
> |
TH1F *RcorrJZBem = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2897 |
> |
TH1F *LcorrJZBem = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2898 |
> |
|
2899 |
> |
TH1F *RcorrJZBSBem; |
2900 |
> |
TH1F *LcorrJZBSBem; |
2901 |
> |
TH1F *RcorrJZBSBeemm; |
2902 |
> |
TH1F *LcorrJZBSBeemm; |
2903 |
> |
|
2904 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2905 |
> |
RcorrJZBSBem = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2906 |
> |
LcorrJZBSBem = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2907 |
> |
RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2908 |
> |
LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2909 |
> |
} |
2910 |
> |
|
2911 |
> |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
2912 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2913 |
> |
Bpred->Add(RcorrJZBem,1.0/3.); |
2914 |
> |
Bpred->Add(LcorrJZBem,-1.0/3.); |
2915 |
> |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
2916 |
> |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
2917 |
> |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
2918 |
> |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
2919 |
> |
} else { |
2920 |
> |
Bpred->Add(RcorrJZBem,1.0); |
2921 |
> |
Bpred->Add(LcorrJZBem,-1.0); |
2922 |
> |
} |
2923 |
> |
|
2924 |
> |
Bpred->SetLineColor(kRed); |
2925 |
> |
|
2926 |
> |
TAUhJZBpos->SetLineColor(kBlack); |
2927 |
> |
Bpred->SetLineColor(kRed); |
2928 |
> |
|
2929 |
> |
TAUhJZBpos->SetMinimum(1.0); |
2930 |
> |
TAUhJZBpos->Draw("e1"); |
2931 |
> |
Bpred->Draw("same,hist"); |
2932 |
> |
TAUhJZBpos->Draw("same,e1"); |
2933 |
> |
|
2934 |
> |
TLegend *TAUleg = make_legend("MC Z+jets #rightarrow ee,#mu#mu,#tau#tau",0.55,0.75,false); |
2935 |
> |
TAUleg->AddEntry(TAUhJZBpos,"Observed","pe"); |
2936 |
> |
TAUleg->AddEntry(Bpred,"Predicted","l"); |
2937 |
> |
TAUleg->Draw("same"); |
2938 |
> |
DrawMCPrelim(simulatedlumi); |
2939 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction"); |
2940 |
> |
|
2941 |
> |
TH1F* TAUhratio = (TH1F*)TAUhJZBpos->Clone("TAUhratio"); |
2942 |
> |
TAUhratio->Divide(Bpred); |
2943 |
> |
|
2944 |
> |
for(int i=1;i<=TAUhJZBpos->GetNbinsX();i++) { |
2945 |
> |
cout << "ee/mm/tautau observed: " << TAUhJZBpos->GetBinContent(i) << " vs predicted : " << Bpred->GetBinContent(i) << " (ratio : " << TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i) << endl; |
2946 |
> |
} |
2947 |
> |
|
2948 |
> |
zcan->SetLogy(0); |
2949 |
> |
TAUhratio->GetYaxis()->SetRangeUser(0,2.5); |
2950 |
> |
TAUhratio->GetYaxis()->SetTitle("Observed/Predicted"); |
2951 |
> |
TAUhratio->Draw("e1"); |
2952 |
> |
|
2953 |
> |
top->Draw("same"); |
2954 |
> |
center->Draw("same"); |
2955 |
> |
bottom->Draw("same"); |
2956 |
> |
|
2957 |
> |
TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow #tau#tau",0.25,0.75,false); |
2958 |
> |
TAUleg2->AddEntry(TAUhratio,"obs / pred","pe"); |
2959 |
> |
TAUleg2->AddEntry(bottom,"syst. envelope","l"); |
2960 |
> |
TAUleg2->Draw("same"); |
2961 |
> |
DrawMCPrelim(simulatedlumi); |
2962 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio"); |
2963 |
> |
|
2964 |
> |
delete Bpred; |
2965 |
> |
delete TAUhJZBpos; |
2966 |
> |
delete LcorrJZBeemm; |
2967 |
> |
delete RcorrJZBem; |
2968 |
> |
delete LcorrJZBem; |
2969 |
> |
|
2970 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2971 |
> |
delete RcorrJZBSBem; |
2972 |
> |
delete LcorrJZBSBem; |
2973 |
> |
delete RcorrJZBSBeemm; |
2974 |
> |
delete LcorrJZBSBeemm; |
2975 |
> |
} |
2976 |
> |
|
2977 |
|
|
2978 |
|
delete zcan; |
2979 |
|
cutWeight=weightbackup; |
2999 |
|
tout << "\\begin{tabular}{l|cc}" << endl; |
3000 |
|
tout << "\\hline" << endl; |
3001 |
|
tout << "& {\\OFZP} & {\\OFSB} \\\\\\hline" << endl; |
3002 |
< |
tout << "\\#(events) & "<<OFSB<<" & "<<OFZP<<"\\\\ \\hline" << endl; |
3002 |
> |
tout << "\\#(events) & "<<OFZP<<" & "<<OFSB<<"\\\\ \\hline" << endl; |
3003 |
|
tout << "\\end{tabular}" << endl; |
3004 |
|
tout << "\\end{center}" << endl; |
3005 |
|
tout << "\\end{table}" << endl; |
3017 |
|
|
3018 |
|
TCanvas *cannie = new TCanvas("cannie","cannie"); |
3019 |
|
|
3020 |
< |
for(int icut=0;icut<jzb_cuts.size();icut++) { |
3020 |
> |
for(int icut=0;icut<(int)jzb_cuts.size();icut++) { |
3021 |
|
float currcut=jzb_cuts[icut]; |
3022 |
|
int nbins=1;float low=currcut; |
3023 |
|
vector<int> mysample; |
3076 |
|
//prediction part |
3077 |
|
if(is_data) cout << "Data prediction & "; |
3078 |
|
if(subselection!="none") cout << subselection << " prediction &"; |
3079 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
3079 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
3080 |
|
|
3081 |
|
cout << endl; |
3082 |
|
//observation part |
3083 |
|
if(is_data) cout << "Data observation & "; |
3084 |
|
if(subselection!="none") cout << subselection << " observation &"; |
3085 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
3085 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
3086 |
|
cout << endl; |
3087 |
|
cout << "_________________________________________________________________" << endl; |
3088 |
|
delete cannie; |
3117 |
|
int nbins = sizeof(xbins)/sizeof(float)-1; |
3118 |
|
int markers[] = { 20, 26, 21, 24, 22, 25, 28 }; |
3119 |
|
|
3120 |
< |
TH1F* heff = new TH1F("heff", "JZB eff ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
3121 |
< |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
3122 |
< |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
3120 |
> |
|
3121 |
> |
TH1F* heff = new TH1F("heff", "JZB eff ; generator JZB [GeV]; efficiency",nbins,xbins); |
3122 |
> |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator JZB [GeV]; efficiency",nbins,xbins); |
3123 |
> |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator JZB [GeV]; efficiency",nbins,xbins); |
3124 |
|
|
3125 |
|
TCut kgen(genMassCut&&"genZPt>0&&genNjets>2&&abs(genMID)==23"&&cutOSSF); |
3126 |
|
TCut kreco(cutmass); |
3136 |
|
TCanvas *can = new TCanvas("can","Canvas for JZB Efficiency",600,600); |
3137 |
|
can->SetGridx(1); |
3138 |
|
can->SetGridy(1); |
3139 |
+ |
can->SetLeftMargin(0.16); |
3140 |
+ |
can->SetRightMargin(0.05); |
3141 |
|
TLegend *leg = make_legend("",0.6,0.2,false,0.89,0.5); |
3142 |
+ |
leg->SetBorderSize(1); |
3143 |
+ |
leg->SetLineColor(kBlack); |
3144 |
+ |
leg->SetTextFont(62); |
3145 |
|
|
3146 |
< |
|
2711 |
< |
|
2712 |
< |
for ( int icut=0; icut<jzb_bins.size(); ++icut ) { |
3146 |
> |
for ( int icut=0; icut<(int)jzb_bins.size(); ++icut ) { |
3147 |
|
|
3148 |
|
ostringstream selection; |
3149 |
|
selection << mcjzb << ">" << jzb_bins[icut]; |
3159 |
|
} |
3160 |
|
|
3161 |
|
heff->GetXaxis()->SetRangeUser(min, max); |
3162 |
+ |
// heff->GetXaxis()->SetLabelSize(0.05); // paper style. overruled. |
3163 |
+ |
// heff->GetYaxis()->SetLabelSize(0.05); // paper style. overruled. |
3164 |
+ |
// heff->GetXaxis()->SetTitleSize(0.06); // paper style. overruled. |
3165 |
+ |
// heff->GetYaxis()->SetTitleSize(0.06); // paper style. overruled. |
3166 |
|
heff->SetMarkerStyle(markers[icut]); |
3167 |
|
heff->Fit("func","Q+","same"); |
3168 |
|
|
3174 |
|
|
3175 |
|
// Store plot |
3176 |
|
TH1F* h = (TH1F*)heff->Clone(hname); |
3177 |
+ |
h->SetNdivisions(505,"X"); |
3178 |
|
if ( icut) h->Draw("same"); |
3179 |
|
else h->Draw(); |
3180 |
|
char htitle[256]; sprintf(htitle,"JZB > %3.0f GeV", jzb_bins[icut]); |
3195 |
|
// Calls the above function for each signal sample |
3196 |
|
void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins ) |
3197 |
|
{ |
3198 |
< |
for (int isignal=0; isignal<signalsamples.collection.size();isignal++) { |
3198 |
> |
for (int isignal=0; isignal<(int)signalsamples.collection.size();isignal++) { |
3199 |
|
dout << "JZB selection efficiency curve: " << std::endl; |
3200 |
|
JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples |
3201 |
|
} |
3238 |
|
TH1F *RcorrJZBSBeemm; |
3239 |
|
TH1F *LcorrJZBSBeemm; |
3240 |
|
|
3241 |
< |
TH1F *RcorrJZBeemmNoS; |
3241 |
> |
// TH1F *RcorrJZBeemmNoS; |
3242 |
|
|
3243 |
|
//these are for the ratio |
3244 |
|
TH1F *JRcorrJZBeemm = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3322 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
3323 |
|
string ytitle("ratio"); |
3324 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
3325 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,use_data!=1,ytitle); |
3325 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,false,ytitle); |
3326 |
|
|
3327 |
|
TH1F *allevents = qcdsamples.Draw("allevents","pfJetGoodNum",1,0,100, "internal code", "events", "" ,mc, luminosity); |
3328 |
|
TH1F *ossf = qcdsamples.Draw("ossf","pfJetGoodNum",1,0,100, "internal code", "events", cutOSSF ,mc, luminosity); |
3369 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral() << endl; |
3370 |
|
|
3371 |
|
dout << endl; |
3372 |
< |
for(int i=0;i<bins.size();i++) { |
3372 |
> |
for(int i=0;i<(int)bins.size();i++) { |
3373 |
|
dout << " JZB > " << bins[i] << " : " << endl; |
3374 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
3375 |
|
if(PlottingSetup::RestrictToMassPeak) { |
3417 |
|
leg->SetY2(1.0); |
3418 |
|
|
3419 |
|
|
3420 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
3420 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3421 |
|
string nowname=(allsamples.collection)[isample].filename; |
3422 |
|
cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl; |
3423 |
|
individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
3441 |
|
ptsancan->cd(2); |
3442 |
|
fpt2->Draw(); |
3443 |
|
|
3444 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
3444 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3445 |
|
ptsancan->cd(1); |
3446 |
|
individualpt1histos[isample]->DrawNormalized("same,histo"); |
3447 |
|
ptsancan->cd(2); |
3457 |
|
void do_mlls_plot(string mcjzb) { |
3458 |
|
cout << "At this point we'd plot the mll distribution" << endl; |
3459 |
|
TCanvas *sigcan = new TCanvas("sigcan","sigcan"); |
3460 |
< |
for(int isig=0;isig<(signalsamples.collection).size();isig++) { |
3460 |
> |
for(int isig=0;isig<(int)(signalsamples.collection).size();isig++) { |
3461 |
|
if(!(signalsamples.collection)[isig].events) continue; |
3462 |
|
string nowname=(signalsamples.collection)[isig].filename; |
3463 |
|
TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname)); |
3496 |
|
findme.push_back("TTJets"); |
3497 |
|
findme.push_back("LM"); |
3498 |
|
|
3499 |
< |
for(int ifind=0;ifind<findme.size();ifind++) { |
3499 |
> |
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
3500 |
|
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
3501 |
|
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
3502 |
< |
for(int isel=0;isel<selsamples.size();isel++) { |
3502 |
> |
for(int isel=0;isel<(int)selsamples.size();isel++) { |
3503 |
|
cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
3504 |
|
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF); |
3505 |
|
} |
3522 |
|
|
3523 |
|
TCanvas *testcanv = new TCanvas("testcanv","testcanv"); |
3524 |
|
testcanv->cd(); |
3525 |
< |
switch_overunderflow(true); |
3525 |
> |
// switch_overunderflow(true); |
3526 |
|
TH1F *ptdistr = allsamples.Draw("ptdistr","pt1",100,30,200, "p_{T} [GeV]", "events", cutOSSF,data,luminosity); |
3527 |
|
switch_overunderflow(false); |
3528 |
|
ptdistr->Draw(); |