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, bool SwitchOffNJetsCut, 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 |
> |
TCut nJetsCut(cutnJets); |
46 |
> |
if(SwitchOffNJetsCut) nJetsCut=specialcut; |
47 |
> |
|
48 |
|
TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations"); |
49 |
< |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity); |
50 |
< |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity); |
51 |
< |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc, luminosity); |
52 |
< |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity); |
49 |
> |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&nJetsCut&&specialcut,mc, luminosity); |
50 |
> |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&nJetsCut&&specialcut,data, luminosity); |
51 |
> |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&nJetsCut&&specialcut,mc, luminosity); |
52 |
> |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&nJetsCut&&specialcut,data, luminosity); |
53 |
|
TH1F *rawttbarjzbeemmMC; |
54 |
|
|
55 |
|
if(method==doKM) { |
56 |
|
//we only need this histo for the KM fitting... |
57 |
< |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,100, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample("TTJet")); |
58 |
< |
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
59 |
< |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
57 |
> |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&nJetsCut&&specialcut,mc,luminosity,allsamples.FindSample("TTJet")); |
58 |
> |
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
59 |
> |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
60 |
> |
delete rawttbarjzbeemmMC; |
61 |
|
} |
62 |
|
else { |
63 |
|
TH1F *reducedMC = (TH1F*)rawJZBeemmMC->Clone(); |
65 |
|
reducedMC->Add(rawJZBemMC,-1); |
66 |
|
reducedData->Add(rawJZBemData,-1); |
67 |
|
//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) |
68 |
< |
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
69 |
< |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
70 |
< |
|
68 |
> |
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
69 |
> |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
70 |
> |
delete reducedMC; |
71 |
> |
delete reducedData; |
72 |
|
} |
73 |
|
|
74 |
|
// Revert to original PU reweighting |
76 |
|
|
77 |
|
// MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
78 |
|
// DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
79 |
< |
dout << "We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl; |
80 |
< |
result << "We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl; |
81 |
< |
dout << "We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl; |
82 |
< |
result << "We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl; |
79 |
> |
dout << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
80 |
> |
result << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
81 |
> |
dout << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
82 |
> |
result << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
83 |
> |
delete rawJZBeemmData; |
84 |
> |
delete rawJZBeemmMC; |
85 |
> |
delete rawJZBemData; |
86 |
> |
delete rawJZBemMC; |
87 |
|
delete tempcan; |
88 |
|
} |
89 |
|
|
90 |
< |
void make_special_obs_pred_mll_plot(string mcjzb, float jzbthreshold) { |
90 |
> |
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb, string sSpecialCut="", bool SwitchOffNJetsCut=false) |
91 |
> |
{ |
92 |
> |
bool overunderflowstatus=addoverunderflowbins; |
93 |
> |
switch_overunderflow(false); |
94 |
> |
|
95 |
> |
TCut SpecialCut("mll>=0"); |
96 |
> |
if(sSpecialCut!="") SpecialCut=TCut(sSpecialCut.c_str()); |
97 |
> |
|
98 |
> |
bool DoInvidualeemmPeaks=false; |
99 |
> |
|
100 |
> |
float mcpeak, datapeak; |
101 |
> |
float mcpeakerr, datapeakerr; |
102 |
> |
|
103 |
> |
float mceepeak,mcmmpeak; |
104 |
> |
float mceepeakerr,mcmmpeakerr; |
105 |
> |
|
106 |
> |
float datammpeak,dataeepeak; |
107 |
> |
float datammpeakerr,dataeepeakerr; |
108 |
> |
|
109 |
> |
float mcSigma,mcSigmaError, dataSigma, dataSigmaError; |
110 |
> |
|
111 |
> |
dout << "Finding global peak : " << endl; |
112 |
> |
find_one_peak_combination(SpecialCut,SwitchOffNJetsCut,mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
113 |
> |
|
114 |
> |
if(DoInvidualeemmPeaks) { |
115 |
> |
dout << "Finding peak for electrons : " << endl; |
116 |
> |
find_one_peak_combination(SpecialCut&&TCut("id1==0"),SwitchOffNJetsCut,mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele"); |
117 |
> |
dout << "Finding peak for muons : " << endl; |
118 |
> |
find_one_peak_combination(SpecialCut&&TCut("id1==1"),SwitchOffNJetsCut,mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_mu"); |
119 |
> |
|
120 |
> |
datajzb << "(" << jzbvariabledata; |
121 |
> |
mcjzb << "(" << jzbvariablemc; |
122 |
> |
|
123 |
> |
if(dataeepeak>0) datajzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
124 |
> |
else datajzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
125 |
> |
|
126 |
> |
if(datammpeak>0) datajzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
127 |
> |
else datajzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
128 |
> |
|
129 |
> |
if(datapeak>0) datajzb << "- (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
130 |
> |
else datajzb << "+ (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
131 |
> |
|
132 |
> |
datajzb << ")"; |
133 |
> |
|
134 |
> |
if(mceepeak>0) mcjzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
135 |
> |
else mcjzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
136 |
> |
|
137 |
> |
if(mcmmpeak>0) mcjzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
138 |
> |
else mcjzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
139 |
> |
|
140 |
> |
if(mcpeak>0) mcjzb << "- (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
141 |
> |
else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
142 |
> |
|
143 |
> |
mcjzb << ")"; |
144 |
> |
|
145 |
> |
} else { |
146 |
> |
datajzb << "(" << jzbvariabledata; |
147 |
> |
mcjzb << "(" << jzbvariablemc; |
148 |
> |
|
149 |
> |
if(datapeak>0) datajzb << "- " << TMath::Abs(datapeak) << " "; |
150 |
> |
else datajzb << "+ " << TMath::Abs(datapeak) << " "; |
151 |
> |
|
152 |
> |
datajzb << ")"; |
153 |
> |
|
154 |
> |
if(mcpeak>0) mcjzb << "- " << TMath::Abs(mcpeak) << " "; |
155 |
> |
else mcjzb << "+ " << TMath::Abs(mcpeak) << " "; |
156 |
> |
|
157 |
> |
mcjzb << ")"; |
158 |
> |
} |
159 |
> |
|
160 |
> |
MCPeak=mcpeak; |
161 |
> |
MCPeakError=mcpeakerr; |
162 |
> |
DataPeak=datapeak; |
163 |
> |
DataPeakError=datapeakerr; |
164 |
> |
switch_overunderflow(overunderflowstatus); |
165 |
> |
} |
166 |
> |
|
167 |
> |
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth = 5.0) { |
168 |
|
float min=70.0; |
169 |
|
float max=115.0; |
170 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
171 |
< |
min=10; |
172 |
< |
max=150; |
171 |
> |
min=20; |
172 |
> |
max=300; |
173 |
|
} |
174 |
< |
int nbins=int((max-min)/5); |
174 |
> |
int nbins=int((max-min)/binWidth); |
175 |
|
|
176 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
177 |
|
|
178 |
|
stringstream largerzeroS; |
179 |
< |
largerzeroS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
180 |
< |
TCut largerzero(largerzeroS.str().c_str()); |
179 |
> |
largerzeroS << "(" << datajzb << ">" << jzbthreshold << ")"; |
180 |
> |
TCut largerzeroD(largerzeroS.str().c_str()); |
181 |
|
|
182 |
|
stringstream smallerzeroS; |
183 |
< |
smallerzeroS << "(" << mcjzb << "<-" << jzbthreshold << ")"; |
184 |
< |
TCut smallerzero(smallerzeroS.str().c_str()); |
185 |
< |
|
186 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,data,luminosity); |
187 |
< |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,mc,luminosity); |
188 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,data,luminosity); |
189 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,data,luminosity); |
190 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,data,luminosity); |
183 |
> |
smallerzeroS << "(" << datajzb << "<-" << jzbthreshold << ")"; |
184 |
> |
TCut smallerzeroD(smallerzeroS.str().c_str()); |
185 |
> |
|
186 |
> |
|
187 |
> |
stringstream largerzeroMS; |
188 |
> |
largerzeroMS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
189 |
> |
TCut largerzeroM(largerzeroMS.str().c_str()); |
190 |
> |
|
191 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroD,data,luminosity); |
192 |
> |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroM,mc,luminosity); |
193 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzeroD,data,luminosity); |
194 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzeroD,data,luminosity); |
195 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzeroD,data,luminosity); |
196 |
|
|
197 |
|
TH1F *RcorrJZBSBem; |
198 |
|
TH1F *LcorrJZBSBem; |
199 |
|
TH1F *RcorrJZBSBeemm; |
200 |
|
TH1F *LcorrJZBSBeemm; |
201 |
|
|
202 |
< |
TH1F *RcorrJZBeemmNoS; |
202 |
> |
// TH1F *RcorrJZBeemmNoS; |
203 |
|
|
204 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
205 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,data, luminosity); |
206 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,data, luminosity); |
207 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,data, luminosity); |
208 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,data, luminosity); |
209 |
< |
} |
210 |
< |
|
211 |
< |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
212 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
213 |
< |
Bpred->Add(RcorrJZBem,1.0/3.); |
214 |
< |
Bpred->Add(LcorrJZBem,-1.0/3.); |
215 |
< |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
216 |
< |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
217 |
< |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
218 |
< |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
219 |
< |
} else { |
220 |
< |
Bpred->Add(RcorrJZBem,1.0); |
221 |
< |
Bpred->Add(LcorrJZBem,-1.0); |
222 |
< |
} |
223 |
< |
|
204 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
205 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity); |
206 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity); |
207 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity); |
208 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzeroD,data, luminosity); |
209 |
> |
} |
210 |
> |
|
211 |
> |
// Separate predictions |
212 |
> |
TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN"); |
213 |
> |
TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP"); |
214 |
> |
TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN"); |
215 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
216 |
> |
OFP->Scale(1.0/3.0); |
217 |
> |
OFP->Add(RcorrJZBSBem,1.0/3.); |
218 |
> |
OFP->Add(RcorrJZBSBeemm,1.0/3.); |
219 |
> |
OFN->Scale(1.0/3.0); |
220 |
> |
OFN->Add(LcorrJZBSBem,1.0/3.); |
221 |
> |
OFN->Add(LcorrJZBSBeemm,1.0/3.); |
222 |
> |
} |
223 |
> |
|
224 |
> |
TH1F* Bpred = (TH1F*)SFN->Clone("Bpred"); |
225 |
> |
Bpred->Add(OFP); |
226 |
> |
Bpred->Add(OFN,-1); |
227 |
|
Bpred->SetLineColor(kRed); |
228 |
|
|
229 |
+ |
RcorrJZBeemm->SetTitleOffset(1.3,"y"); |
230 |
|
RcorrJZBeemm->Draw(); |
231 |
|
mcRcorrJZBeemm.Draw("same"); |
232 |
|
Bpred->Draw("histo,same"); |
241 |
|
stringstream saveas; |
242 |
|
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold; |
243 |
|
CompleteSave(ckin,saveas.str()); |
244 |
< |
|
244 |
> |
|
245 |
> |
// Draw all predictions overlayed |
246 |
> |
unsigned int w = gStyle->GetHistLineWidth()+1; // Make line a bit wider, since we dash it |
247 |
> |
SFN->SetLineColor(kGreen+2); |
248 |
> |
SFN->SetLineStyle(2); |
249 |
> |
SFN->SetLineWidth(w); |
250 |
> |
OFP->SetLineColor(kBlue+2); |
251 |
> |
OFP->SetLineStyle(2); |
252 |
> |
OFP->SetLineWidth(w); |
253 |
> |
OFN->SetLineColor(kMagenta+2); |
254 |
> |
OFN->SetLineStyle(3); |
255 |
> |
OFN->SetLineWidth(w); |
256 |
> |
|
257 |
> |
RcorrJZBeemm->Draw(); |
258 |
> |
SFN->Draw("histo,same"); |
259 |
> |
OFP->Draw("histo,same"); |
260 |
> |
OFN->Draw("histo,same"); |
261 |
> |
Bpred->Draw("histo,same"); |
262 |
> |
RcorrJZBeemm->Draw("same"); |
263 |
> |
|
264 |
> |
TLegend *leg2 = make_legend("",0.52,0.7); |
265 |
> |
leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp"); |
266 |
> |
leg2->AddEntry(Bpred,"predicted (data)","l"); |
267 |
> |
leg2->AddEntry(SFN, " SF JZB<0","l"); |
268 |
> |
leg2->AddEntry(OFN, " OF JZB<0","l"); |
269 |
> |
leg2->AddEntry(OFP, " OF JZB>0","l"); |
270 |
> |
leg2->Draw("same"); |
271 |
> |
|
272 |
> |
saveas.str(""); |
273 |
> |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold << "_nomc"; |
274 |
> |
CompleteSave(ckin,saveas.str()); |
275 |
> |
|
276 |
|
delete RcorrJZBeemm; |
277 |
|
delete LcorrJZBeemm; |
278 |
|
delete RcorrJZBem; |
279 |
|
delete LcorrJZBem; |
280 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
280 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
281 |
|
delete RcorrJZBSBeemm; |
282 |
|
delete LcorrJZBSBeemm; |
283 |
|
delete RcorrJZBSBem; |
321 |
|
TIter next(bgleg->GetListOfPrimitives()); |
322 |
|
TObject* obj; |
323 |
|
// Copy the nice bkgd legend skipping the "data" |
324 |
< |
while ( obj = next() ) |
324 |
> |
while ( (obj = next()) ) |
325 |
|
if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") ) |
326 |
|
kinleg->GetListOfPrimitives()->Add(obj); |
327 |
|
|
340 |
|
TIter next(hmc.GetHists()); |
341 |
|
TObject* obj; |
342 |
|
TH1* hratio = NULL; |
343 |
< |
while ( obj = next() ) { |
343 |
> |
while ( (obj = next()) ) { |
344 |
|
if ( !hratio ) { |
345 |
|
hratio = (TH1*)obj->Clone(); |
346 |
|
hratio->SetName("hratio"); |
371 |
|
oneline->Draw("same"); |
372 |
|
} |
373 |
|
|
374 |
+ |
float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale, |
375 |
+ |
string xlabel, string filename, float legendPosition=0.55) { |
376 |
+ |
|
377 |
+ |
TCut ibasiccut=basiccut; |
378 |
+ |
bool draw_separation_lines=false; |
379 |
+ |
|
380 |
+ |
if(addcut != "") ibasiccut = ibasiccut && addcut.c_str(); |
381 |
+ |
|
382 |
+ |
TCut cutSF; |
383 |
+ |
TCut cutOF; |
384 |
+ |
|
385 |
+ |
cutOF = cutOSOF&&cutnJets&&ibasiccut; |
386 |
+ |
cutSF = cutOSSF&&cutnJets&&ibasiccut; |
387 |
+ |
|
388 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
389 |
+ |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
390 |
+ |
rcan->SetLogy(logscale); |
391 |
+ |
rcan->cd(); |
392 |
+ |
|
393 |
+ |
std::cout << "OF/SF comparison: variable = " << variable << ", cut = " << cutSF.GetTitle() << std::endl; |
394 |
+ |
TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity); |
395 |
+ |
TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity); |
396 |
+ |
// string signal("LM3"); |
397 |
+ |
// TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
398 |
+ |
// int idx = signalsamples.FindSample(signal)[0]; |
399 |
+ |
// (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF); |
400 |
+ |
// signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
401 |
+ |
// signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor); |
402 |
+ |
// signalhisto->SetLineStyle(2); |
403 |
+ |
datahistoSF->SetMarkerSize(DataMarkerSize); |
404 |
+ |
datahistoOF->SetLineColor(kRed); |
405 |
+ |
|
406 |
+ |
if ( !logscale ) { |
407 |
+ |
datahistoSF->SetMinimum(0); // Defaults |
408 |
+ |
} else { |
409 |
+ |
datahistoSF->SetMinimum(0.5); |
410 |
+ |
} |
411 |
+ |
if (ymax<0) { |
412 |
+ |
if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum()); |
413 |
+ |
else datahistoSF->SetMaximum(1.8*datahistoSF->GetMaximum()); |
414 |
+ |
} else { |
415 |
+ |
datahistoSF->SetMaximum(ymax); |
416 |
+ |
} |
417 |
+ |
|
418 |
+ |
float ymaxSet = datahistoSF->GetMaximum(); |
419 |
+ |
|
420 |
+ |
datahistoSF->GetXaxis()->SetTitle(xlabel.c_str()); |
421 |
+ |
datahistoSF->GetYaxis()->SetTitle("Events"); |
422 |
+ |
datahistoSF->GetXaxis()->CenterTitle(); |
423 |
+ |
datahistoSF->GetYaxis()->CenterTitle(); |
424 |
+ |
|
425 |
+ |
TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.7,false,legendPosition+0.2); |
426 |
+ |
mleg->AddEntry(datahistoSF, "Same-flavor", "PL"); |
427 |
+ |
if (datahistoOF->Integral()>0) { |
428 |
+ |
mleg->AddEntry(datahistoOF, "Opposite-flavor", "L"); |
429 |
+ |
} else { |
430 |
+ |
mleg->AddEntry((TObject*)0, "", ""); |
431 |
+ |
} |
432 |
+ |
//mleg->AddEntry(signalhisto, "LM3", "L"); |
433 |
+ |
|
434 |
+ |
datahistoSF->Draw("E1"); |
435 |
+ |
if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES"); |
436 |
+ |
//signalhisto->Draw("HIST,SAMES"); |
437 |
+ |
mleg->Draw(); |
438 |
+ |
DrawPrelim(); |
439 |
+ |
if (datahistoOF->Integral()>0) { |
440 |
+ |
save_with_ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" ); |
441 |
+ |
} else { |
442 |
+ |
CompleteSave(rcan, "SFOF/" + filename); |
443 |
+ |
delete rcan; |
444 |
+ |
} |
445 |
+ |
|
446 |
+ |
datahistoSF->Delete(); |
447 |
+ |
datahistoOF->Delete(); |
448 |
+ |
//signalhisto->Delete(); |
449 |
+ |
delete mleg; |
450 |
+ |
delete ckin; |
451 |
+ |
|
452 |
+ |
return ymaxSet; |
453 |
+ |
|
454 |
+ |
} |
455 |
+ |
|
456 |
+ |
// Compare data to data |
457 |
+ |
float make_data_comparison_plot(string variable, TCut cut, int nbins, float min, float max, float ymax, bool logscale, |
458 |
+ |
string xlabel, string filename, float legendPosition=0.55) { |
459 |
+ |
|
460 |
+ |
TCut ibasiccut=basiccut&&cut; |
461 |
+ |
|
462 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
463 |
+ |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
464 |
+ |
rcan->SetLogy(logscale); |
465 |
+ |
rcan->cd(); |
466 |
+ |
|
467 |
+ |
std::cout << "Data comparison: variable = " << variable << ", cut = " << ibasiccut.GetTitle() << std::endl; |
468 |
+ |
|
469 |
+ |
TH1F *data1 = allsamples.Draw("data1",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity); |
470 |
+ |
TH1F *data2 = comparesamples.Draw("data2",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity); |
471 |
+ |
data1->Scale(5.0/9.2); |
472 |
+ |
|
473 |
+ |
data1->SetMarkerSize(DataMarkerSize); |
474 |
+ |
data2->SetLineColor(kRed); |
475 |
+ |
|
476 |
+ |
if ( !logscale ) { |
477 |
+ |
data1->SetMinimum(0); // Defaults |
478 |
+ |
} else { |
479 |
+ |
data1->SetMinimum(0.5); |
480 |
+ |
} |
481 |
+ |
if (ymax<0) { |
482 |
+ |
if ( logscale ) data1->SetMaximum(5.3*data1->GetMaximum()); |
483 |
+ |
else data1->SetMaximum(1.5*data1->GetMaximum()); |
484 |
+ |
} else { |
485 |
+ |
data1->SetMaximum(ymax); |
486 |
+ |
} |
487 |
+ |
|
488 |
+ |
float ymaxSet = data1->GetMaximum(); |
489 |
+ |
|
490 |
+ |
data1->GetXaxis()->SetTitle(xlabel.c_str()); |
491 |
+ |
data1->GetYaxis()->SetTitle("Events"); |
492 |
+ |
data1->GetXaxis()->CenterTitle(); |
493 |
+ |
data1->GetYaxis()->CenterTitle(); |
494 |
+ |
|
495 |
+ |
TLegend *mleg = make_legend("",legendPosition,0.7,false,legendPosition+0.2); |
496 |
+ |
mleg->AddEntry(data1, "2012 data (scaled)", "PL"); |
497 |
+ |
mleg->AddEntry(data2, "2011 data", "L"); |
498 |
+ |
|
499 |
+ |
data1->Draw("E1"); |
500 |
+ |
data2->Draw("HIST,SAMES"); |
501 |
+ |
mleg->Draw(); |
502 |
+ |
DrawPrelim(); |
503 |
+ |
save_with_ratio( data1, data2, rcan, "compareData/" + filename, false, false, "new/old" ); |
504 |
+ |
|
505 |
+ |
data1->Delete(); |
506 |
+ |
data2->Delete(); |
507 |
+ |
delete mleg; |
508 |
+ |
delete ckin; |
509 |
+ |
|
510 |
+ |
} |
511 |
+ |
|
512 |
+ |
void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale, |
513 |
+ |
string xlabel, string filename, float legendPosition=0.55) { |
514 |
+ |
|
515 |
+ |
string mllcuts[] = { "mll>20","mll>15&&mll<70", "mll>75&&mll<105", "mll>120" }; |
516 |
+ |
string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 120 GeV" }; |
517 |
+ |
string plotname[] = {"_all","_low","_peak","_high"}; |
518 |
+ |
float ymax; |
519 |
+ |
|
520 |
+ |
int start = 0; |
521 |
+ |
if ( !PlottingSetup::openBox ) start = 3; |
522 |
+ |
|
523 |
+ |
for ( int i=start; i<4; ++i ) { |
524 |
+ |
if ( addcut != "" ) mllcuts[i] += "&&"+addcut; |
525 |
+ |
if ( i==start ) { |
526 |
+ |
ymax = make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, -1, logscale, xlabel, |
527 |
+ |
filename+plotname[i], legendPosition ); |
528 |
+ |
} else { |
529 |
+ |
make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
530 |
+ |
filename+plotname[i], legendPosition ); |
531 |
+ |
} |
532 |
+ |
make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
533 |
+ |
filename+plotname[i]+"_mm", legendPosition ); |
534 |
+ |
make_one_OFSF_plot(variable, "id1==0&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
535 |
+ |
filename+plotname[i]+"_ee", legendPosition ); |
536 |
+ |
} |
537 |
+ |
|
538 |
+ |
} |
539 |
+ |
|
540 |
+ |
|
541 |
|
float lastrange_min=0; |
542 |
|
float lastrange_max=0; |
543 |
|
|
546 |
|
// TCut basiccut("(pfJetGoodNum>=2&&pfJetGoodID[0])&&(pfJetGoodNum>=2&&pfJetGoodID[1])&&(passed_triggers||!is_data)"); |
547 |
|
TCut ibasiccut=basiccut; |
548 |
|
bool draw_separation_lines=false; |
549 |
+ |
bool drawsignal = false; |
550 |
|
|
551 |
|
if(isPF) ibasiccut=basiccut&&"pfjzb[0]>-998"; |
552 |
|
|
568 |
|
//Step 2: Refine the cut |
569 |
|
TCut cut; |
570 |
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut; |
571 |
< |
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut; |
571 |
> |
if(filename=="nJets" || filename=="nJets_inclusive" || filename=="nJets_met100" || filename=="nJets_inclusive_met100") cut=cutmass&&cutOSSF&&ibasiccut; |
572 |
> |
if(filename=="nJets_osof" || filename=="nJets_osof_inclusive" || filename=="nJets_osof_met100" || filename=="nJets_osof_inclusive_met100") cut=cutmass&&cutOSOF&&ibasiccut; |
573 |
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF; |
574 |
< |
if(filename=="mll") { |
574 |
> |
if(filename=="mll"||filename=="mll_met100") { |
575 |
|
cut=cutOSSF&&cutnJets&&ibasiccut; |
576 |
|
draw_separation_lines=true; |
577 |
|
} |
578 |
< |
if(filename=="mll_ee") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0"; |
579 |
< |
if(filename=="mll_osof") { |
578 |
> |
if(filename=="mll_ee"||filename=="mll_ee_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0"; |
579 |
> |
if(filename=="mll_mm"||filename=="mll_mm_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
580 |
> |
if(filename=="mll_osof"||filename=="mll_osof_met100") { |
581 |
|
cut=cutOSOF&&cutnJets&&ibasiccut; |
582 |
|
draw_separation_lines=true; |
583 |
|
} |
584 |
< |
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
585 |
< |
if(Contains(filename,"mll_aboveJZB100")) cut=cutOSSF&&cutnJets&&ibasiccut; |
584 |
> |
if(Contains(filename,"aboveJZB")) cut=cutOSSF&&cutnJets&&ibasiccut; |
585 |
> |
if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0"; |
586 |
> |
if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1"; |
587 |
|
if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut; |
588 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF; |
589 |
|
if(filename=="mll_inclusive_osof") cut=cutOSOF; |
591 |
|
if(filename=="mll_inclusive_mm") cut=cutOSSF&&"id1==1"; |
592 |
|
if(filename=="pfJetGoodEta_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets; |
593 |
|
if(filename=="pfJetGoodPt_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets; |
594 |
+ |
if(filename=="numVtx") cut=cutmass&&ibasiccut; |
595 |
|
|
596 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
597 |
|
ckin->SetLogy(logscale); |
598 |
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
599 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
600 |
< |
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
600 |
> |
if ( !logscale ) datahisto->SetMinimum(0); // Defaults |
601 |
> |
else datahisto->SetMinimum(0.5); |
602 |
> |
// Custom max. |
603 |
> |
if(variable=="TMath::Abs(pfJetDphiMet[0])") datahisto->SetMaximum(1.5*datahisto->GetMaximum()); |
604 |
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
605 |
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
606 |
< |
if(filename=="mll_inclusive") datahisto->SetMinimum(1); |
606 |
> |
if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1); |
607 |
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
608 |
|
if(filename=="mll_osof") datahisto->SetMinimum(9); |
609 |
+ |
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
610 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
611 |
|
|
612 |
< |
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
304 |
< |
datahisto->Draw("e1"); |
305 |
< |
ckin->Update(); |
612 |
> |
cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl; |
613 |
|
if(loadlastminmax) { |
614 |
|
datahisto->SetMinimum(lastrange_min); |
615 |
|
datahisto->SetMaximum(lastrange_max); |
619 |
|
} |
620 |
|
} |
621 |
|
|
622 |
+ |
// Draw signal by hand (for some reason I don't manage to use the sample class: it adds it to the stack!) |
623 |
+ |
string signal("LM3"); |
624 |
+ |
TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
625 |
+ |
int idx = signalsamples.FindSample(signal)[0]; |
626 |
+ |
if(drawsignal) (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut); |
627 |
+ |
if(drawsignal) signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
628 |
+ |
if(drawsignal) signalhisto->SetLineColor(kOrange); |
629 |
+ |
|
630 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
631 |
+ |
datahisto->Draw("e1"); |
632 |
+ |
ckin->Update(); |
633 |
|
mcstack.Draw("same"); |
634 |
+ |
|
635 |
|
datahisto->Draw("same,e1"); |
636 |
|
TLegend *kinleg = allsamples.allbglegend(); |
637 |
|
kinleg->Draw(); |
674 |
|
kinpad->SetLogy(logscale); |
675 |
|
datahisto->Draw("e1"); |
676 |
|
mcstack.Draw("same"); |
677 |
+ |
if(drawsignal) signalhisto->Draw("same"); |
678 |
|
datahisto->Draw("same,e1"); |
679 |
|
datahisto->Draw("same,axis"); |
680 |
|
if(RestrictToMassPeak&&draw_separation_lines) { |
682 |
|
upperboundary->Draw("same"); |
683 |
|
} |
684 |
|
|
685 |
+ |
if(drawsignal) kinleg->AddEntry("signalhisto",signal.c_str(),"l"); |
686 |
|
kinleg->Draw(); |
687 |
|
write_cut->Draw(); |
688 |
|
DrawPrelim(); |
697 |
|
else CompleteSave(ckin,"kin/"+filename); |
698 |
|
} |
699 |
|
datahisto->Delete(); |
700 |
+ |
delete signalhisto; |
701 |
+ |
delete ckin; |
702 |
+ |
} |
703 |
+ |
|
704 |
+ |
|
705 |
+ |
void make_plain_kin_plot(string variable, string addcut, int nbins, float min, float max, bool logscale, |
706 |
+ |
string xlabel, string filename, bool isPF=true, bool plotratio=true, bool loadlastminmax=false ) { |
707 |
+ |
TCut cut=TCut(addcut.c_str())&&basiccut; |
708 |
+ |
|
709 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
710 |
+ |
ckin->SetLogy(logscale); |
711 |
+ |
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
712 |
+ |
datahisto->SetMarkerSize(DataMarkerSize); |
713 |
+ |
if ( !logscale ) datahisto->SetMinimum(0); // Defaults |
714 |
+ |
else datahisto->SetMinimum(0.5); |
715 |
+ |
// Custom max. |
716 |
+ |
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
717 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
718 |
+ |
|
719 |
+ |
cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl; |
720 |
+ |
if(loadlastminmax) { |
721 |
+ |
datahisto->SetMinimum(lastrange_min); |
722 |
+ |
datahisto->SetMaximum(lastrange_max); |
723 |
+ |
if(logscale) { |
724 |
+ |
datahisto->SetMinimum(pow(10,lastrange_min)); |
725 |
+ |
datahisto->SetMaximum(pow(10,lastrange_max)); |
726 |
+ |
} |
727 |
+ |
} |
728 |
+ |
|
729 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
730 |
+ |
datahisto->Draw("e1"); |
731 |
+ |
ckin->Update(); |
732 |
+ |
mcstack.Draw("same"); |
733 |
+ |
|
734 |
+ |
datahisto->Draw("same,e1"); |
735 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
736 |
+ |
kinleg->Draw(); |
737 |
+ |
|
738 |
+ |
lastrange_min=ckin->GetUymin(); |
739 |
+ |
lastrange_max=ckin->GetUymax(); |
740 |
+ |
|
741 |
+ |
if ( plotratio ) { |
742 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
743 |
+ |
kinpad->cd(); |
744 |
+ |
kinpad->SetLogy(logscale); |
745 |
+ |
datahisto->Draw("e1"); |
746 |
+ |
mcstack.Draw("same"); |
747 |
+ |
datahisto->Draw("same,e1"); |
748 |
+ |
datahisto->Draw("same,axis"); |
749 |
+ |
|
750 |
+ |
kinleg->Draw(); |
751 |
+ |
DrawPrelim(); |
752 |
+ |
string saveas="kin/"+filename; |
753 |
+ |
if(isPF) saveas="kin/"+filename+"__PF"; |
754 |
+ |
save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas); |
755 |
+ |
} else { |
756 |
+ |
if(isPF) CompleteSave(ckin,"kin/"+filename+"__PF"); |
757 |
+ |
else CompleteSave(ckin,"kin/"+filename); |
758 |
+ |
} |
759 |
+ |
datahisto->Delete(); |
760 |
|
delete ckin; |
761 |
|
} |
762 |
|
|
763 |
< |
void make_JES_plot() { |
763 |
> |
|
764 |
> |
void make_JES_plot(TCut cut, string name) { |
765 |
|
|
766 |
|
int nbins=10; |
767 |
|
float min=-0.5; |
768 |
|
float max = 9.5; |
769 |
|
bool logscale=true; |
770 |
|
string xlabel="nJets"; |
389 |
– |
TCut cut=cutmass&&cutOSSF&&basiccut; |
771 |
|
|
772 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
773 |
|
ckin->SetLogy(logscale); |
774 |
< |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,data,luminosity); |
774 |
> |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,data,luminosity); |
775 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
776 |
< |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
777 |
< |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum315",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
778 |
< |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum285",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
776 |
> |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
777 |
> |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum40p1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
778 |
> |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum40n1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
779 |
|
|
780 |
|
datahisto->SetMinimum(1); |
781 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); // in line with kinematic plots style |
800 |
|
TLegend *kinleg = allsamples.allbglegend(); |
801 |
|
kinleg->AddEntry(JESunc,"JES uncertainty","f"); |
802 |
|
kinleg->Draw(); |
803 |
< |
CompleteSave(ckin,"Systematics/JES"); |
803 |
> |
CompleteSave(ckin,"Systematics/JES"+name); |
804 |
|
datahisto->Delete(); |
805 |
|
delete ckin; |
806 |
|
|
807 |
|
} |
808 |
|
|
809 |
+ |
string Cut2Str(TCut cut) { |
810 |
+ |
return ((string)(const char*)cut); |
811 |
+ |
} |
812 |
+ |
|
813 |
+ |
void MakeElegantTwoThreeComparisons() { |
814 |
+ |
|
815 |
+ |
TCut signal("met[4]>100&&mll>20"&&PlottingSetup::basicqualitycut); |
816 |
+ |
TCut TwoJets("pfJetGoodNum40==2"); |
817 |
+ |
TCut ThreeJets("pfJetGoodNum40>=3"); |
818 |
+ |
|
819 |
+ |
int nbins=40; |
820 |
+ |
float min=0; |
821 |
+ |
float max=200; |
822 |
+ |
string xlabel="m_{ll}"; |
823 |
+ |
|
824 |
+ |
TCanvas *can2 = new TCanvas("can2","can2"); |
825 |
+ |
TH1F *TwoOF = allsamples.Draw("TwoOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
826 |
+ |
TH1F *TwoSF = allsamples.Draw("TwoSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
827 |
+ |
TH1F *ThreeOF = allsamples.Draw("ThreeOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
828 |
+ |
TH1F *ThreeSF = allsamples.Draw("ThreeSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
829 |
+ |
|
830 |
+ |
can2->cd(1); |
831 |
+ |
|
832 |
+ |
TwoSF->SetFillColor(kWhite); |
833 |
+ |
TwoOF->SetFillColor(kWhite); |
834 |
+ |
ThreeSF->SetFillColor(kWhite); |
835 |
+ |
ThreeOF->SetFillColor(kWhite); |
836 |
+ |
|
837 |
+ |
TPad *kin = new TPad("kin","kin",0,0,1,1); |
838 |
+ |
kin->cd(); |
839 |
+ |
TwoSF->Draw("histo"); |
840 |
+ |
ThreeSF->Draw("e1,same"); |
841 |
+ |
TLegend *leg_SF_Two_Three = make_legend(); |
842 |
+ |
leg_SF_Two_Three->SetHeader("t#bar{t} MC:"); |
843 |
+ |
leg_SF_Two_Three->AddEntry(TwoSF,"SF, nJets==2","l"); |
844 |
+ |
leg_SF_Two_Three->AddEntry(ThreeSF,"SF, nJets#geq3","lp"); |
845 |
+ |
leg_SF_Two_Three->Draw(); |
846 |
+ |
save_with_ratio(TwoSF,ThreeSF,kin->cd(),"DoubleRatios/SF_Two_Three"); |
847 |
+ |
|
848 |
+ |
TPad *kin2 = new TPad("kin2","kin2",0,0,1,1); |
849 |
+ |
kin2->cd(); |
850 |
+ |
TwoOF->Draw("histo"); |
851 |
+ |
ThreeOF->Draw("e1,same"); |
852 |
+ |
TLegend *leg_OF_Two_Three = make_legend(); |
853 |
+ |
leg_OF_Two_Three->SetHeader("t#bar{t} MC:"); |
854 |
+ |
leg_OF_Two_Three->AddEntry(TwoSF,"OF, nJets==2","l"); |
855 |
+ |
leg_OF_Two_Three->AddEntry(ThreeSF,"OF, nJets#geq3","lp"); |
856 |
+ |
leg_OF_Two_Three->Draw(); |
857 |
+ |
save_with_ratio(TwoOF,ThreeOF,kin2->cd(),"DoubleRatios/OF_Two_Three"); |
858 |
+ |
|
859 |
+ |
TPad *kin3 = new TPad("kin3","kin3",0,0,1,1); |
860 |
+ |
kin3->cd(); |
861 |
+ |
TwoOF->Draw("histo"); |
862 |
+ |
TwoSF->Draw("e1,same"); |
863 |
+ |
TLegend *leg_SFOF_Two = make_legend(); |
864 |
+ |
leg_SFOF_Two->SetHeader("t#bar{t} MC:"); |
865 |
+ |
leg_SFOF_Two->AddEntry(TwoOF,"OF, nJets==2","l"); |
866 |
+ |
leg_SFOF_Two->AddEntry(TwoSF,"SF, nJets==2","lp"); |
867 |
+ |
leg_SFOF_Two->Draw(); |
868 |
+ |
save_with_ratio(TwoSF,TwoOF,kin3->cd(),"DoubleRatios/SFOF_Two"); |
869 |
+ |
|
870 |
+ |
TPad *kin4 = new TPad("kin4","kin4",0,0,1,1); |
871 |
+ |
kin4->cd(); |
872 |
+ |
ThreeOF->Draw("histo"); |
873 |
+ |
ThreeSF->Draw("e1,same"); |
874 |
+ |
TLegend *leg_SFOF_Three = make_legend(); |
875 |
+ |
leg_SFOF_Three->SetHeader("t#bar{t} MC:"); |
876 |
+ |
leg_SFOF_Three->AddEntry(TwoOF,"OF, nJet#geq3","l"); |
877 |
+ |
leg_SFOF_Three->AddEntry(TwoSF,"SF, nJets#geq3","lp"); |
878 |
+ |
leg_SFOF_Three->Draw(); |
879 |
+ |
save_with_ratio(ThreeSF,ThreeOF,kin4->cd(),"DoubleRatios/SFOF_Three"); |
880 |
+ |
|
881 |
+ |
assert(0); |
882 |
+ |
} |
883 |
+ |
|
884 |
+ |
|
885 |
|
void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false) |
886 |
|
{ |
887 |
+ |
// switch_overunderflow(true); |
888 |
|
bool dolog=true; |
889 |
|
bool nolog=false; |
890 |
+ |
|
891 |
+ |
bool doOFSF = false; |
892 |
+ |
bool doKin = true; |
893 |
+ |
bool doDataComp = false; |
894 |
+ |
|
895 |
+ |
|
896 |
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!"); |
897 |
< |
float mll_low=40; |
897 |
> |
float mll_low=50; |
898 |
|
float mll_hi=160; |
899 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
900 |
< |
mll_low=10; |
901 |
< |
mll_hi=210; |
900 |
> |
mll_low=20; |
901 |
> |
mll_hi=320; |
902 |
|
} |
903 |
< |
/* |
904 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
905 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
906 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
907 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true); |
908 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
909 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
910 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
911 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
912 |
< |
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);/* |
913 |
< |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
914 |
< |
make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
915 |
< |
make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
916 |
< |
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
917 |
< |
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF); |
918 |
< |
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF); |
919 |
< |
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
920 |
< |
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
921 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF); |
922 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);*//* |
923 |
< |
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
924 |
< |
stringstream jzbcut; |
925 |
< |
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
926 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
927 |
< |
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); |
928 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
929 |
< |
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); |
930 |
< |
stringstream jzbcut2; |
931 |
< |
jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
932 |
< |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
933 |
< |
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); |
934 |
< |
stringstream jzbcut3; |
935 |
< |
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
936 |
< |
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); |
903 |
> |
|
904 |
> |
MakeElegantTwoThreeComparisons(); |
905 |
> |
|
906 |
> |
if ( doOFSF ) { |
907 |
> |
make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll"); |
908 |
> |
|
909 |
> |
// make_OFSF_plots("pfJetGoodNum40", "met[4]>100", 7, 3, 10, true, "#(jets)", "njets"); |
910 |
> |
// make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto"); |
911 |
> |
// make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30>0", 7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30"); |
912 |
> |
|
913 |
> |
// make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets"); |
914 |
> |
// make_OFSF_plots("pfJetGoodPtBtag[0]", "met[4]>100&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", "ptb1"); |
915 |
> |
|
916 |
> |
// make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1"); |
917 |
> |
// make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2"); |
918 |
> |
// make_OFSF_plots("pt1", "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1"); |
919 |
> |
// make_OFSF_plots("pt2", "met[4]>100", 22, 0., 220., true, "p_{T,2}", "pt2"); |
920 |
> |
// make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", 0.15); |
921 |
> |
// make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", 0.15); |
922 |
> |
// make_OFSF_plots("phi1", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", "phi1", 0.2); |
923 |
> |
// make_OFSF_plots("phi2", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", "phi2", 0.2); |
924 |
> |
// make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", 0.2); |
925 |
> |
make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphij1met", 0.2); |
926 |
> |
// make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", 0.2); |
927 |
> |
// make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", 0.2); |
928 |
> |
// make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", 0.2); |
929 |
> |
// make_OFSF_plots("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", "dphilc"); |
930 |
> |
// make_OFSF_plots("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", "dphijc"); |
931 |
> |
// make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", "met[4]>100", 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(l,MET)|)", "dphilco"); |
932 |
> |
// make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", "met[4]>100", 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(jet,MET)|)", "dphijco"); |
933 |
> |
} |
934 |
> |
|
935 |
> |
if ( doDataComp) { |
936 |
> |
TCut mllCut(""); |
937 |
> |
float massmin = 15.; |
938 |
> |
float massmax = 315; |
939 |
> |
int massnbins = 60; |
940 |
> |
/* if ( !PlottingSetup::openBox ) { |
941 |
> |
mllCut = "mll>70"; |
942 |
> |
massmin = 120; |
943 |
> |
massmax = 360; |
944 |
> |
massnbins = 14; |
945 |
> |
}*/ |
946 |
> |
|
947 |
> |
TCut cutSignal = cutmass&&cutnJets&&"met[4]>100"; |
948 |
> |
|
949 |
> |
/* make_data_comparison_plot("numVtx", "",40, -0.5, 39.5,-1., true, "N(Vertices)", "numVtx"); |
950 |
> |
make_data_comparison_plot("pfJetGoodEta[0]", "",50, -3.0, 3.0,-1., true, "N(Jets)", "pfJetGoodEta0"); |
951 |
> |
|
952 |
> |
|
953 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF,10, -0.5, 9.5,-1., true, "N(Jets)", "njets_OF"); |
954 |
> |
make_data_comparison_plot("met[4]", cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_inclusive"); |
955 |
> |
make_data_comparison_plot("met[1]", cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_inclusive"); |
956 |
> |
make_data_comparison_plot("met[4]", cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_inclusive"); |
957 |
> |
make_data_comparison_plot("met[1]", cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_inclusive"); |
958 |
> |
|
959 |
> |
make_data_comparison_plot("met[4]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_exclusive"); |
960 |
> |
// make_data_comparison_plot("met[1]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_exclusive"); |
961 |
> |
make_data_comparison_plot("met[4]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_exclusive"); |
962 |
> |
// make_data_comparison_plot("met[1]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_exclusive"); |
963 |
> |
*/ |
964 |
> |
|
965 |
> |
string basiccutsaved = (const char*)basiccut; |
966 |
> |
|
967 |
> |
string newbasiccut=basiccutsaved; |
968 |
> |
|
969 |
> |
size_t found; |
970 |
> |
found = newbasiccut.find( "pt2>20" ); |
971 |
> |
while (found!=string::npos){ |
972 |
> |
newbasiccut.replace( found, string( "pt2>20" ).length(), "pt2>10" ); |
973 |
> |
found = newbasiccut.find( "pt2>20" ); |
974 |
> |
} |
975 |
> |
// basiccut=TCut(newbasiccut.c_str()); |
976 |
> |
// make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSSF,60, 0., 300.,-1., false, "mll", "mll_SF_Aachen_pt2010_met"); |
977 |
> |
// make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSOF,60, 0., 300.,-1., false, "mll", "mll_OF_Aachen_pt2010_met"); |
978 |
> |
// make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_Aachen_pt2010_t1cpfmet"); |
979 |
> |
// make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_Aachen_pt2010_t1cpfmet"); |
980 |
> |
// basiccut=TCut(basiccutsaved.c_str()); |
981 |
> |
|
982 |
> |
// make_data_comparison_plot("pfJetGoodNum40", cutOSSF, 8, 0., 8.,-1., true, "#(jets)", "njets_SF"); |
983 |
> |
// make_data_comparison_plot("pfJetGoodNum40", cutOSOF, 8, 0., 8.,-1., true, "#(jets)", "njets_OF"); |
984 |
> |
|
985 |
> |
// make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_met"); |
986 |
> |
// make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_met"); |
987 |
> |
// make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_t1cpfmet"); |
988 |
> |
// make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_t1cpfmet"); |
989 |
> |
|
990 |
> |
|
991 |
> |
/* make_data_comparison_plot("mll", cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive"); |
992 |
> |
make_data_comparison_plot("mll", cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_ee"); |
993 |
> |
make_data_comparison_plot("mll", cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_mm"); |
994 |
> |
make_data_comparison_plot("mll", cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_inclusive"); |
995 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_ee"); |
996 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_mm"); |
997 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive"); |
998 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_exclusive"); |
999 |
> |
*/ |
1000 |
> |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig"); |
1001 |
> |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig"); |
1002 |
> |
|
1003 |
> |
make_data_comparison_plot("mll", TCut("abs(eta1)<1.4&&abs(eta2)<1.4") && cutOSSF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_central"); |
1004 |
> |
make_data_comparison_plot("mll", TCut("abs(eta1)<1.4&&abs(eta2)<1.4") && cutOSOF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_central"); |
1005 |
> |
|
1006 |
> |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto"); |
1007 |
> |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_btagVeto"); |
1008 |
> |
|
1009 |
> |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet"); |
1010 |
> |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_AtLeastOneBJet"); |
1011 |
> |
|
1012 |
> |
/* |
1013 |
> |
make_data_comparison_plot("mll", mllCut&&cutOSOF&&cutSignal, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig"); |
1014 |
> |
make_data_comparison_plot("mll", cutmass&&cutOSSF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_CR"); |
1015 |
> |
make_data_comparison_plot("mll", cutmass&&cutOSOF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_CR"); |
1016 |
> |
|
1017 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_SF_sig"); |
1018 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_OF_sig"); |
1019 |
> |
make_data_comparison_plot("pfJetGoodNumBtag30", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_SF_sig"); |
1020 |
> |
make_data_comparison_plot("pfJetGoodNumBtag30", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_OF_sig"); |
1021 |
|
*/ |
1022 |
< |
make_special_obs_pred_mll_plot(mcjzb,50); |
1023 |
< |
make_special_obs_pred_mll_plot(mcjzb,100); |
1024 |
< |
make_special_obs_pred_mll_plot(mcjzb,150); |
1025 |
< |
make_special_obs_pred_mll_plot(mcjzb,200); |
1026 |
< |
make_special_obs_pred_mll_plot(mcjzb,250); |
1022 |
> |
} |
1023 |
> |
|
1024 |
> |
|
1025 |
> |
if ( doKin ) { |
1026 |
> |
string mllCut(""); |
1027 |
> |
|
1028 |
> |
write_info(__FUNCTION__,"First plot"); |
1029 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&cutnJets&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_SF_20to70",doPF,true); |
1030 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&cutnJets&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_OF_20to70",doPF,true); |
1031 |
> |
|
1032 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&cutnJets&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_SF_above120",doPF,true); |
1033 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&cutnJets&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_OF_above120",doPF,true); |
1034 |
> |
|
1035 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&TCut("pfJetGoodNum40==2")&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_SF_20to70___2jetsonly",doPF,true); |
1036 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("pfJetGoodNum40==2")&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_OF_20to70___2jetsonly",doPF,true); |
1037 |
> |
|
1038 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&TCut("pfJetGoodNum40==2")&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_SF_above120___2jetsonly",doPF,true); |
1039 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("pfJetGoodNum40==2")&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_OF_above120___2jetsonly",doPF,true); |
1040 |
> |
write_info(__FUNCTION__,"Last plot"); |
1041 |
> |
|
1042 |
> |
|
1043 |
> |
|
1044 |
> |
|
1045 |
> |
|
1046 |
> |
|
1047 |
> |
|
1048 |
> |
|
1049 |
> |
return; |
1050 |
> |
|
1051 |
> |
|
1052 |
> |
|
1053 |
> |
make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true); |
1054 |
> |
make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true); |
1055 |
> |
// Plots in signal region |
1056 |
> |
// make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true); |
1057 |
> |
make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
1058 |
> |
make_kin_plot("mll","mll>20",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
1059 |
> |
make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
1060 |
> |
make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true); |
1061 |
> |
|
1062 |
> |
make_kin_plot("pfJetGoodNum40",mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
1063 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
1064 |
> |
|
1065 |
> |
// make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_met100",doPF,true); |
1066 |
> |
// make_kin_plot("mll","mll>20&&met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_met100",doPF,true,true); |
1067 |
> |
// make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee_met100",doPF,true); |
1068 |
> |
// make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm_met100",doPF,true); |
1069 |
> |
|
1070 |
> |
|
1071 |
> |
// make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets_met100",doPF); |
1072 |
> |
// make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof_met100",doPF); |
1073 |
> |
|
1074 |
> |
// Further inclusive invariant mass plots |
1075 |
> |
make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
1076 |
> |
// make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
1077 |
> |
// make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
1078 |
> |
make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
1079 |
> |
|
1080 |
> |
//make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
1081 |
> |
//if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
1082 |
> |
|
1083 |
> |
|
1084 |
> |
// Number of jets |
1085 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_inclusive",doPF); |
1086 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof_inclusive",doPF); |
1087 |
> |
//make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
1088 |
> |
|
1089 |
> |
// Others |
1090 |
> |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
1091 |
> |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
1092 |
> |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
1093 |
> |
make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
1094 |
> |
make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF); |
1095 |
> |
make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF); |
1096 |
> |
make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF); |
1097 |
> |
make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF); |
1098 |
> |
// stringstream jzbcut; |
1099 |
> |
// jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
1100 |
> |
// make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
1101 |
> |
// 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); |
1102 |
> |
// 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); |
1103 |
> |
// 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); |
1104 |
> |
// stringstream jzbcut2; |
1105 |
> |
// jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
1106 |
> |
// make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
1107 |
> |
// 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); |
1108 |
> |
// 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); |
1109 |
> |
// 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); |
1110 |
> |
// stringstream jzbcut3; |
1111 |
> |
// jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
1112 |
> |
// make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
1113 |
> |
// 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); |
1114 |
> |
// 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); |
1115 |
> |
// 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); |
1116 |
> |
|
1117 |
> |
// 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_ll",doPF,true); |
1118 |
> |
//make_kin_plot("mll","met[4]>150&&id1==0",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ee} [GeV] (MET>150GeV)","mll_met150_ee",doPF,true); |
1119 |
> |
//make_kin_plot("mll","met[4]>150&&id1==1",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{#mu#mu} [GeV] (MET>150GeV)","mll_met150_mm",doPF,true); |
1120 |
> |
} |
1121 |
> |
|
1122 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,0); |
1123 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,50); |
1124 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,80); |
1125 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,100); |
1126 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,150); |
1127 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,200); |
1128 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,250); |
1129 |
> |
|
1130 |
> |
// make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf"); |
1131 |
> |
// make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof"); |
1132 |
> |
|
1133 |
> |
switch_overunderflow(false); |
1134 |
|
} |
1135 |
|
|
1136 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
1137 |
|
int nbins, float xmin, float xmax, bool log, |
1138 |
|
float ymin=0, float ymax=0, bool leftJustified=false ) { |
1139 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
1139 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
1140 |
|
|
1141 |
|
TCut weightbackup=cutWeight;//backing up the correct weight (restoring below!) |
1142 |
|
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__)); |
1143 |
< |
if(var=="numVtx") cutWeight=TCut("1.0"); |
1143 |
> |
//if(var=="numVtx") cutWeight=TCut("1.0"); |
1144 |
|
TCut jzbData[]= { TCut(TString(datajzb+">"+any2string(jzbcut))),TCut(TString(datajzb+"<-"+any2string(jzbcut))) }; |
1145 |
|
TCut jzbMC[] = { TCut(TString(mcjzb+">"+any2string(jzbcut))),TCut(TString(mcjzb+"<-"+any2string(jzbcut))) }; |
1146 |
|
|
1147 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- below: the next ~20 lines changed! |
1148 |
|
int nRegions=4; |
1149 |
< |
if(!PlottingSetup::RestrictToMassPeak) { |
1149 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
1150 |
|
nRegions=2; |
1151 |
|
} |
1152 |
|
|
1164 |
|
TCanvas *ccomp = new TCanvas("ccomp","Comparison plot",600,400); |
1165 |
|
ccomp->SetLogy(log); |
1166 |
|
TH1F *datahisto = allsamples.Draw("datahisto", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity); |
1167 |
< |
TH1F *lm4histo = signalsamples.Draw("lm4histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity,signalsamples.FindSample("LM4")); |
1167 |
> |
TH1F *lm3histo = signalsamples.Draw("lm3histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb],data,luminosity,signalsamples.FindSample("LM3")); |
1168 |
|
THStack mcstack = allsamples.DrawStack("mcstack",var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb], mc, luminosity); |
1169 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
1170 |
|
if (ymax>ymin) datahisto->SetMaximum(ymax); |
1171 |
< |
lm4histo->SetLineStyle(2); |
1171 |
> |
lm3histo->SetLineStyle(2); |
1172 |
|
datahisto->Draw("e1"); |
1173 |
|
mcstack.Draw("same"); |
1174 |
|
datahisto->Draw("same,e1"); |
1175 |
< |
// lm4histo->Draw("hist,same"); |
1175 |
> |
lm3histo->Draw("hist,same"); |
1176 |
|
TLegend *kinleg = allsamples.allbglegend((sRegions[iregion]+(ijzb?"neg":"pos")).c_str()); |
1177 |
|
if ( leftJustified ) { |
1178 |
|
Float_t w = kinleg->GetX2()-kinleg->GetX1(); |
1179 |
|
kinleg->SetX1(0.2); |
1180 |
|
kinleg->SetX2(0.2+w); |
1181 |
|
} |
1182 |
< |
// kinleg->AddEntry(lm4histo,"LM4","l"); |
1182 |
> |
kinleg->AddEntry(lm3histo,"LM3","l"); |
1183 |
|
kinleg->Draw(); |
1184 |
|
TText* write_variable = write_text(0.99,0.01,var); |
1185 |
|
write_variable->SetTextAlign(31); |
1188 |
|
CompleteSave(ccomp,"compare/JZBcut_at_"+any2string(jzbcut)+"/"+filename+"/"+filename+sRegions[iregion]+(ijzb?"neg":"pos")); |
1189 |
|
delete datahisto; |
1190 |
|
delete ccomp; |
1191 |
< |
delete lm4histo; |
1191 |
> |
delete lm3histo; |
1192 |
|
} |
1193 |
|
cutWeight=weightbackup; |
1194 |
|
} |
1198 |
|
dout << "Creating comparison plots for signal and control regions" << endl; |
1199 |
|
// Compare a few quantities in the signal region and all 7 control regions |
1200 |
|
|
1201 |
< |
switch_overunderflow(true); // switching overflow/underflow bins on |
1201 |
> |
// switch_overunderflow(true); // switching overflow/underflow bins on |
1202 |
|
|
1203 |
< |
|
1203 |
> |
switch_overunderflow(true); |
1204 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
1205 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
1205 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
1206 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
1207 |
|
float mll_low=50;float mll_high=170; |
1208 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
1209 |
< |
mll_high=200; |
1210 |
< |
mll_low=50; |
1209 |
> |
mll_high=300; |
1210 |
> |
mll_low=20; |
1211 |
|
} |
1212 |
< |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,30,mll_low,mll_high,false,0,16.); |
1212 |
> |
make_comp_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",jzbcut,mcjzb,datajzb,100,0,10,true); |
1213 |
> |
make_comp_plot("TMath::Abs(pfJetDphiMet[0])","|#Delta#phi(jet1,MET)|","dphiJ1MET",jzbcut,mcjzb,datajzb,32,0,3.2,false,0,0,true); |
1214 |
> |
|
1215 |
> |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,56,mll_low,mll_high,false,0,16.); |
1216 |
|
make_comp_plot("met[4]","pfMET [GeV]","pfmet",jzbcut,mcjzb,datajzb,18,0,360,false,0,16.); |
1217 |
< |
make_comp_plot("pfJetGoodNum","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
1217 |
> |
make_comp_plot("pfJetGoodNum40","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
1218 |
> |
make_comp_plot("pfJetGoodNumBtag","#(b-jets)","nBjets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
1219 |
|
make_comp_plot("pt","Z p_{T} [GeV]","Zpt",jzbcut,mcjzb,datajzb,26,0,525,false,0.,21.); |
1220 |
< |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,20,0.,20.,false,0,16.); |
1220 |
> |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,40,0.,40.,false,0,16.); |
1221 |
|
make_comp_plot("TMath::Abs(dphi)","#Delta#phi(leptons)","dphilep",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
1222 |
|
make_comp_plot("TMath::Abs(dphi_sumJetVSZ[1])","#Delta#phi(Z,jets)","dphiZjets",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
1223 |
+ |
make_comp_plot("eta1","#eta_1","eta1",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
1224 |
+ |
make_comp_plot("eta2","#eta_2","eta2",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
1225 |
|
} |
1226 |
|
|
1227 |
|
switch_overunderflow(false); // switching overflow/underflow bins off |
1420 |
|
// the line above is not necessary anymore as we're now looking at a prediction without Z+Jets, and not multiplied with (1.0/3) |
1421 |
|
TF1 *ttbarlogpar = do_logpar_fit_to_plot(Tprediction); |
1422 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1423 |
< |
if(PlottingSetup::RestrictToMassPeak) ttbarlogpar->SetParameter(0,1.0/3*ttbarlogpar->GetParameter(0));//correcting for the fact that we didn't multiply with (1.0/3); |
1423 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) ttbarlogpar->SetParameter(0,1.0/3*ttbarlogpar->GetParameter(0));//correcting for the fact that we didn't multiply with (1.0/3); |
1424 |
|
|
1425 |
|
|
1426 |
|
TF1 *ttbarlogparP = new TF1("ttbarlogparP",LogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8); |
1515 |
|
return return_functions; |
1516 |
|
} |
1517 |
|
|
1518 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
1518 |
> |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
1519 |
|
{ |
1520 |
< |
// note: sigma is not used ATM |
860 |
< |
switch_overunderflow(true); |
1520 |
> |
|
1521 |
|
bool is_data=false; |
1522 |
|
bool use_signal=false; |
1523 |
|
if(use_data==1) is_data=true; |
1524 |
|
if(use_data==2) use_signal=true; |
1525 |
< |
int nbins=50;//100; |
1526 |
< |
if(is_data) nbins=50; |
1525 |
> |
int nbins=int(high/10);//100; |
1526 |
> |
if(is_data) nbins=int(high/10); |
1527 |
|
float low=0; |
1528 |
< |
float hi=500; |
1528 |
> |
float hi=high; |
1529 |
> |
|
1530 |
> |
stringstream cutpositiveS; |
1531 |
> |
cutpositiveS << "(" << jzb << ">0)"; |
1532 |
> |
TCut cutpositive(cutpositiveS.str().c_str()); |
1533 |
> |
stringstream cutnegativeS; |
1534 |
> |
cutnegativeS << "(" << jzb << "<0)"; |
1535 |
> |
TCut cutnegative(cutnegativeS.str().c_str()); |
1536 |
|
|
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()); |
1537 |
|
|
1538 |
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
1539 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1540 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1541 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1542 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1539 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1540 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1541 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1542 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1543 |
|
|
1544 |
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
1545 |
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
1554 |
|
|
1555 |
|
TH1F *RcorrJZBeemmNoS; |
1556 |
|
|
1557 |
< |
//these are for the ratio |
1558 |
< |
|
1559 |
< |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1560 |
< |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1561 |
< |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
901 |
< |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1557 |
> |
//these are for the ratio |
1558 |
> |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1559 |
> |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1560 |
> |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1561 |
> |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1562 |
|
|
1563 |
|
TH1F *JRcorrJZBSBem; |
1564 |
|
TH1F *JLcorrJZBSBem; |
1565 |
|
TH1F *JRcorrJZBSBeemm; |
1566 |
|
TH1F *JLcorrJZBSBeemm; |
1567 |
|
|
1568 |
< |
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); |
1568 |
> |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false); |
1569 |
|
|
1570 |
|
|
1571 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1572 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1573 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1574 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1575 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1571 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1572 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1573 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1574 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1575 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1576 |
|
|
1577 |
|
//these are for the ratio |
1578 |
< |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1579 |
< |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1580 |
< |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1581 |
< |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1578 |
> |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1579 |
> |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1580 |
> |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1581 |
> |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1582 |
|
} |
1583 |
|
|
1584 |
|
TH1F *lm4RcorrJZBeemm; |
1585 |
< |
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")); |
1585 |
> |
if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM")); |
1586 |
|
|
1587 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
1588 |
|
|
1591 |
|
|
1592 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
1593 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
1594 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1594 |
> |
|
1595 |
> |
TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]); |
1596 |
> |
ClearHisto(BpredSys); |
1597 |
> |
|
1598 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1599 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
1600 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
1601 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
1617 |
|
JBpred->Add(JLcorrJZBSBem,-1.0/3.); |
1618 |
|
JBpred->Add(JRcorrJZBSBeemm,1.0/3.); |
1619 |
|
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.); |
1620 |
+ |
|
1621 |
+ |
//Systematics: |
1622 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertONPEAK*zjetsestimateuncertONPEAK); |
1623 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
1624 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
1625 |
+ |
AddSquared(BpredSys,JRcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
1626 |
+ |
AddSquared(BpredSys,JLcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
1627 |
+ |
AddSquared(BpredSys,JRcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
1628 |
+ |
AddSquared(BpredSys,JLcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
1629 |
|
} else { |
1630 |
|
Bpred->Add(RcorrJZBem,1.0); |
1631 |
|
Bpred->Add(LcorrJZBem,-1.0); |
1635 |
|
//these are for the ratio |
1636 |
|
JBpred->Add(JRcorrJZBem,1.0); |
1637 |
|
JBpred->Add(JLcorrJZBem,-1.0); |
1638 |
+ |
|
1639 |
+ |
//Systematics |
1640 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertOFFPEAK*zjetsestimateuncertOFFPEAK); |
1641 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
1642 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
1643 |
+ |
|
1644 |
|
} |
1645 |
|
|
1646 |
< |
|
1647 |
< |
|
1646 |
> |
SQRT(BpredSys); |
1647 |
> |
BpredSys->Divide(JBpred); |
1648 |
> |
|
1649 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
1650 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
1651 |
|
Tpred->Add(LcorrJZBem,-1.0); |
1652 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1652 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1653 |
|
Tpred->Add(RcorrJZBSBem,1.0); |
1654 |
|
Tpred->Add(LcorrJZBSBem,-1.0); |
1655 |
|
Tpred->Add(RcorrJZBSBeemm,1.0); |
1689 |
|
blankback->Draw(); |
1690 |
|
if(use_data==1) |
1691 |
|
{ |
1692 |
+ |
//Bpred->SetLineWidth(3); //paper style.overruled. |
1693 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style.overruled. |
1694 |
|
analytical_function = do_extended_fit_to_plot(Bpred,Tpred,LcorrJZBeemm,LcorrJZBem,is_data); |
1695 |
|
kinpad->cd();//necessary because the extended fit function creates its own canvas |
1696 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1697 |
|
|
1698 |
|
Bpred->Draw("hist,same"); |
1699 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1699 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1700 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1701 |
< |
lm4RcorrJZBeemm->Draw("hist,same"); |
1701 |
> |
//lm4RcorrJZBeemm->Draw("hist,same"); |
1702 |
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p"); |
1703 |
|
legBpred->AddEntry(Bpred,"predicted","l"); |
1704 |
< |
legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1705 |
< |
legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1706 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1704 |
> |
// legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1705 |
> |
// legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1706 |
> |
// legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l"); |
1707 |
|
legBpred->Draw(); |
1708 |
|
DrawPrelim(); |
1709 |
|
|
1713 |
|
Bpred->SetLineWidth(2); |
1714 |
|
predcomppad->cd(); |
1715 |
|
predcomppad->SetLogy(1); |
1034 |
– |
|
1716 |
|
TH1F *jzbnegative = (TH1F*)LcorrJZBeemm->Clone("jzbnegative"); |
1717 |
|
TH1F *sidebandsemu = (TH1F*)Bpred->Clone("sidebandsemu"); |
1718 |
|
sidebandsemu->Add(jzbnegative,-1); |
1731 |
|
Bpred->Draw("hist,same"); |
1732 |
|
// analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1733 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1734 |
< |
// TH1F *lm4RcorrJZBeemmC = (TH1F*)lm4RcorrJZBeemm->Clone("lm4RcorrJZBeemmC"); |
1054 |
< |
// lm4RcorrJZBeemmC->SetLineColor(kOrange+1); |
1055 |
< |
lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
1056 |
< |
// lm4RcorrJZBeemmC->Draw("histo,same"); |
1734 |
> |
// lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
1735 |
|
lm4RcorrJZBeemm->SetLineWidth(2); |
1736 |
< |
lm4RcorrJZBeemm->Draw("histo,same"); |
1736 |
> |
//lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled. |
1737 |
> |
// lm4RcorrJZBeemm->Draw("histo,same"); |
1738 |
|
DrawPrelim(); |
1739 |
|
TLegend *speciallegBpred = make_legend("",0.45,0.55); |
1740 |
+ |
//TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled. |
1741 |
|
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
1742 |
|
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
1743 |
|
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
1744 |
< |
speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1744 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1745 |
> |
else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f"); |
1746 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
1747 |
< |
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1747 |
> |
// speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1748 |
|
speciallegBpred->Draw(); |
1749 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,use_data!=1,"data/pred"); |
1749 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
1750 |
|
|
1751 |
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1752 |
< |
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1752 |
> |
specialcanv->SetLogy(1); |
1753 |
> |
// THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1754 |
|
blankback->Draw(); |
1755 |
< |
kostack.Draw("same"); |
1755 |
> |
// kostack.Draw("same"); |
1756 |
> |
predcomposition.Draw(); |
1757 |
|
Bpred->Draw("hist,same"); |
1758 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1758 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1759 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1760 |
|
legBpred->Draw(); |
1761 |
|
DrawPrelim(); |
1762 |
|
CompleteSave(specialcanv,subdir+"Bpred_Data_____PredictionCompositioninMC"); |
1763 |
|
Bpred->SetLineWidth((int)CurrentBpredLineWidth); |
1764 |
|
|
1765 |
+ |
|
1766 |
+ |
//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; |
1767 |
+ |
|
1768 |
|
delete speciallegBpred; |
1769 |
|
delete Zjetspred; |
1770 |
|
delete TTbarpred; |
1773 |
|
} |
1774 |
|
if(use_data==0) { |
1775 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1776 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1777 |
|
Bpred->Draw("hist,same"); |
1778 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1779 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1780 |
< |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1780 |
> |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1781 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
1782 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
1783 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1783 |
> |
// if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1784 |
|
legBpred->Draw(); |
1785 |
|
DrawMCPrelim(); |
1786 |
|
Bpredsaveas="Bpred_MC"; |
1788 |
|
} |
1789 |
|
if(use_data==2) { |
1790 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1791 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1792 |
|
Bpred->Draw("hist,same"); |
1793 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1794 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1804 |
|
// CompleteSave(globalcanvas,"Bpred_MCwithS"); // done below in save_with_ratio |
1805 |
|
} |
1806 |
|
{ |
1807 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style. overruled. |
1808 |
+ |
//RcorrJZBeemmNoS->SetLineWidth(3); //paper style. overruled. |
1809 |
+ |
//lm4RcorrJZBeemm->SetLineStyle(2); //paper style. overruled. |
1810 |
+ |
//RcorrJZBeemmNoS->SetLineStyle(3); //paper style. overruled. |
1811 |
+ |
//lm4RcorrJZBeemm->SetLineColor(kOrange+1); //paper style. overruled. |
1812 |
+ |
|
1813 |
|
RcorrJZBeemmNoS->SetLineStyle(2); |
1814 |
|
legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l"); |
1815 |
< |
legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
1815 |
> |
// legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
1816 |
|
legBpred2->Draw(); |
1817 |
|
RcorrJZBeemmNoS->SetLineColor(TColor::GetColor("#61210B")); |
1818 |
|
RcorrJZBeemmNoS->Draw("histo,same"); |
1829 |
|
string ytitle("ratio"); |
1830 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
1831 |
|
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1832 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle);//not extending the y range anymore up to 4 |
1832 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4 |
1833 |
> |
|
1834 |
|
|
1835 |
|
|
1836 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1837 |
< |
/// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1838 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1837 |
> |
// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1838 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1839 |
|
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1840 |
|
Bpredem->Add(RcorrJZBem); |
1841 |
|
Bpredem->Add(LcorrJZBem,-1); |
1890 |
|
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1891 |
|
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1892 |
|
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1893 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1893 |
> |
// if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1894 |
|
legBpredc->Draw(); |
1895 |
|
CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison"); |
1896 |
|
} |
1897 |
|
} |
1898 |
|
|
1899 |
+ |
TFile *f = new TFile("tester.root","RECREATE"); |
1900 |
+ |
RcorrJZBeemm->Write(); |
1901 |
+ |
Bpred->Write(); |
1902 |
+ |
f->Close(); |
1903 |
+ |
|
1904 |
|
delete RcorrJZBeemm; |
1905 |
|
delete LcorrJZBeemm; |
1906 |
|
delete RcorrJZBem; |
1913 |
|
|
1914 |
|
delete blankback; |
1915 |
|
|
1916 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1916 |
> |
delete BpredSys; |
1917 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1918 |
|
delete RcorrJZBSBem; |
1919 |
|
delete LcorrJZBSBem; |
1920 |
|
delete RcorrJZBSBeemm; |
1926 |
|
delete JLcorrJZBSBeemm; |
1927 |
|
} |
1928 |
|
if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm; |
1228 |
– |
switch_overunderflow(false); |
1929 |
|
} |
1930 |
|
|
1931 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
1932 |
+ |
switch_overunderflow(true); |
1933 |
|
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
1934 |
< |
do_prediction_plot(datajzb,globalcanvas,DataSigma,jzbHigh ,data,overlay_signal); |
1935 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal); |
1936 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal); |
1937 |
< |
} |
1237 |
< |
|
1238 |
< |
void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) { |
1239 |
< |
bool do_data=0; |
1240 |
< |
bool dosignal=0; |
1241 |
< |
if(is_data==1) do_data=1; |
1242 |
< |
if(is_data==2) dosignal=1; |
1243 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1244 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1245 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1246 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1247 |
< |
|
1248 |
< |
TH1F *RcorrJZBSBem; |
1249 |
< |
TH1F *LcorrJZBSBem; |
1250 |
< |
TH1F *RcorrJZBSBeemm; |
1251 |
< |
TH1F *LcorrJZBSbeemm; |
1252 |
< |
|
1253 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1254 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1255 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1256 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1257 |
< |
LcorrJZBSbeemm = allsamples.Draw("LcorrJZBSbeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1258 |
< |
} |
1259 |
< |
|
1260 |
< |
|
1261 |
< |
|
1262 |
< |
|
1263 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1264 |
< |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
1265 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1266 |
< |
Bpred->Add(RcorrJZBem,1.0/3); |
1267 |
< |
Bpred->Add(LcorrJZBem,-1.0/3); |
1268 |
< |
Bpred->Add(RcorrJZBSBem,1.0/3); |
1269 |
< |
Bpred->Add(LcorrJZBSBem,-1.0/3); |
1270 |
< |
Bpred->Add(RcorrJZBSBeemm,1.0/3); |
1271 |
< |
Bpred->Add(LcorrJZBSbeemm,-1.0/3); |
1934 |
> |
do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
1935 |
> |
if ( !PlottingSetup::Approved ) { |
1936 |
> |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
1937 |
> |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
1938 |
|
} else { |
1939 |
< |
Bpred->Add(RcorrJZBem,1.0); |
1274 |
< |
Bpred->Add(LcorrJZBem,-1.0); |
1939 |
> |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
1940 |
|
} |
1941 |
< |
|
1942 |
< |
can->cd(); |
1278 |
< |
can->SetLogy(0); |
1279 |
< |
Bpred->SetLineColor(kRed); |
1280 |
< |
Bpred->SetStats(0); |
1281 |
< |
if(high>0) Bpred->GetXaxis()->SetRangeUser(0,high); |
1282 |
< |
TH1F *JZBratioforfitting=(TH1F*)RcorrJZBeemm->Clone("JZBratioforfitting"); |
1283 |
< |
JZBratioforfitting->Divide(Bpred); |
1284 |
< |
TGraphAsymmErrors *JZBratio = histRatio(RcorrJZBeemm,Bpred,is_data,binning,false); |
1285 |
< |
|
1286 |
< |
|
1287 |
< |
JZBratio->SetTitle(""); |
1288 |
< |
JZBratio->GetYaxis()->SetRangeUser(0.0,9.0); |
1289 |
< |
// if(is_data==1) JZBratio->GetXaxis()->SetRangeUser(0,jzbHigh ); |
1290 |
< |
|
1291 |
< |
TF1 *pol0 = new TF1("pol0","[0]",0,1000); |
1292 |
< |
TF1 *pol0d = new TF1("pol0","[0]",0,1000); |
1293 |
< |
// straightline_fit->SetParameter(0,1); |
1294 |
< |
JZBratioforfitting->Fit(pol0,"Q0R","",0,30); |
1295 |
< |
pol0d->SetParameter(0,pol0->GetParameter(0)); |
1296 |
< |
|
1297 |
< |
JZBratio->GetYaxis()->SetTitle("Observed/Predicted"); |
1298 |
< |
JZBratio->GetXaxis()->SetTitle("JZB [GeV]"); |
1299 |
< |
if ( high>0 ) JZBratio->GetXaxis()->SetRangeUser(0.0,high); |
1300 |
< |
JZBratio->GetYaxis()->SetNdivisions(519); |
1301 |
< |
JZBratio->GetYaxis()->SetRangeUser(0.0,4.0); |
1302 |
< |
JZBratio->GetYaxis()->CenterTitle(); |
1303 |
< |
JZBratio->GetXaxis()->CenterTitle(); |
1304 |
< |
JZBratio->SetMarkerSize(DataMarkerSize); |
1305 |
< |
JZBratio->Draw("AP"); |
1306 |
< |
/////---------------------------- |
1307 |
< |
TPaveText *writeresult = new TPaveText(0.15,0.78,0.49,0.91,"blNDC"); |
1308 |
< |
writeresult->SetFillStyle(4000); |
1309 |
< |
writeresult->SetFillColor(kWhite); |
1310 |
< |
writeresult->SetTextFont(42); |
1311 |
< |
writeresult->SetTextSize(0.03); |
1312 |
< |
writeresult->SetTextAlign(12); |
1313 |
< |
ostringstream jzb_agreement_data_text; |
1314 |
< |
jzb_agreement_data_text<< setprecision(2) << "mean =" << pol0->GetParameter(0) << " #pm " << setprecision(1) << pol0->GetParError(0); |
1315 |
< |
if(is_data==1) fitresultconstdata=pol0->GetParameter(0);// data |
1316 |
< |
if(is_data==0) fitresultconstmc=pol0->GetParameter(0); // monte carlo, no signal |
1317 |
< |
/* if(is_data) writeresult->AddText("Data closure test"); |
1318 |
< |
else writeresult->AddText("MC closure test"); |
1319 |
< |
*/ |
1320 |
< |
writeresult->AddText(jzb_agreement_data_text.str().c_str()); |
1321 |
< |
// writeresult->Draw("same"); |
1322 |
< |
// pol0d->Draw("same"); |
1323 |
< |
TF1 *topline = new TF1("","1.5",0,1000); |
1324 |
< |
TF1 *bottomline = new TF1("","0.5",0,1000); |
1325 |
< |
topline->SetLineColor(kBlue); |
1326 |
< |
topline->SetLineStyle(2); |
1327 |
< |
bottomline->SetLineColor(kBlue); |
1328 |
< |
bottomline->SetLineStyle(2); |
1329 |
< |
// topline->Draw("same"); |
1330 |
< |
// bottomline->Draw("same"); |
1331 |
< |
TF1 *oneline = new TF1("","1.0",0,1000); |
1332 |
< |
oneline->SetLineColor(kBlue); |
1333 |
< |
oneline->SetLineStyle(1); |
1334 |
< |
oneline->Draw("same"); |
1335 |
< |
TLegend *phony_leg = make_legend("ratio",0.6,0.55,false);//this line is just to have the default CMS Preliminary (...) on the canvas as well. |
1336 |
< |
if(is_data==1) DrawPrelim(); |
1337 |
< |
else DrawMCPrelim(); |
1338 |
< |
TLegend *leg = new TLegend(0.55,0.75,0.89,0.89); |
1339 |
< |
leg->SetTextFont(42); |
1340 |
< |
leg->SetTextSize(0.04); |
1341 |
< |
// if(is_data==1) leg->SetHeader("Ratio (data)"); |
1342 |
< |
// else leg->SetHeader("Ratio (MC)"); |
1343 |
< |
|
1344 |
< |
TString MCtitle("MC "); |
1345 |
< |
if (is_data==1) MCtitle = ""; |
1346 |
< |
|
1347 |
< |
leg->SetFillStyle(4000); |
1348 |
< |
leg->SetFillColor(kWhite); |
1349 |
< |
leg->SetTextFont(42); |
1350 |
< |
// leg->AddEntry(topline,"+20\% sys envelope","l"); |
1351 |
< |
leg->AddEntry(JZBratio,MCtitle+"obs / "+MCtitle+"pred","p"); |
1352 |
< |
leg->AddEntry(oneline,"ratio = 1","l"); |
1353 |
< |
// leg->AddEntry(pol0d,"fit in [0,30] GeV","l"); |
1354 |
< |
// leg->AddEntry(bottomline,"#pm50% envelope","l"); |
1355 |
< |
|
1356 |
< |
|
1357 |
< |
//leg->Draw("same"); // no longer drawing legend |
1358 |
< |
|
1359 |
< |
if(is_data==1) CompleteSave(can, "jzb_ratio_data"); |
1360 |
< |
if(is_data==0) CompleteSave(can, "jzb_ratio_mc"); |
1361 |
< |
if(is_data==2) CompleteSave(can, "jzb_ratio_mc_BandS");//special case, MC with signal! |
1362 |
< |
|
1363 |
< |
delete RcorrJZBeemm; |
1364 |
< |
delete LcorrJZBeemm; |
1365 |
< |
delete RcorrJZBem; |
1366 |
< |
delete LcorrJZBem; |
1367 |
< |
|
1368 |
< |
delete RcorrJZBSBem; |
1369 |
< |
delete LcorrJZBSBem; |
1370 |
< |
delete RcorrJZBSBeemm; |
1371 |
< |
delete LcorrJZBSbeemm; |
1372 |
< |
} |
1373 |
< |
|
1374 |
< |
void do_ratio_plots(string mcjzb,string datajzb,vector<float> ratio_binning) { |
1375 |
< |
TCanvas *globalc = new TCanvas("globalc","Ratio Plot Canvas"); |
1376 |
< |
globalc->SetLogy(0); |
1377 |
< |
|
1378 |
< |
do_ratio_plot(mc,ratio_binning,mcjzb,globalc, jzbHigh ); |
1379 |
< |
do_ratio_plot(data,ratio_binning,datajzb,globalc, jzbHigh ); |
1380 |
< |
do_ratio_plot(mcwithsignal,ratio_binning,mcjzb,globalc, jzbHigh ); |
1941 |
> |
delete globalcanvas; |
1942 |
> |
switch_overunderflow(false); |
1943 |
|
} |
1944 |
|
|
1945 |
|
string give_jzb_expression(float peak, int type) { |
2131 |
|
datahisto->Draw("same,e1"); |
2132 |
|
|
2133 |
|
TLegend *leg; |
2134 |
< |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
2135 |
< |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
2136 |
< |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
2137 |
< |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
2138 |
< |
else { |
2139 |
< |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
2140 |
< |
exit(-1); |
2141 |
< |
} |
2134 |
> |
if (!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
2135 |
> |
if(is_OF(cut)) leg = allsamples.allbglegend("Opposite flavor",datahisto); |
2136 |
> |
else leg = allsamples.allbglegend("Same flavor",datahisto); |
2137 |
> |
} else { |
2138 |
> |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
2139 |
> |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
2140 |
> |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
2141 |
> |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
2142 |
> |
else { |
2143 |
> |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
2144 |
> |
exit(-1); |
2145 |
> |
} |
2146 |
> |
} |
2147 |
|
leg->Draw(); |
2148 |
|
string write_cut = decipher_cut(cut,""); |
2149 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
2194 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning); |
2195 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning); |
2196 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning); |
2197 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
2198 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
2197 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
2198 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
2199 |
|
|
2200 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning); |
2201 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning); |
2202 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
2203 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
2202 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
2203 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
2204 |
|
|
2205 |
|
delete dican; |
2206 |
|
} |
2207 |
|
|
2208 |
|
|
2209 |
|
void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
2210 |
+ |
switch_overunderflow(true); |
2211 |
|
vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ"); |
2212 |
|
|
2213 |
|
if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) { |
2220 |
|
|
2221 |
|
|
2222 |
|
dout << "Going to increase the cross section for diboson samples ... " << endl; |
2223 |
< |
for(int i=0;i<SamplesToBeModified.size();i++) { |
2223 |
> |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
2224 |
|
float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
2225 |
|
(allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor; |
2226 |
|
dout << " Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl; |
2230 |
|
} |
2231 |
|
|
2232 |
|
dout << "Going to produce JZB plots" << endl; |
2233 |
< |
// produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
2233 |
> |
produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
2234 |
|
TCanvas *gloca = new TCanvas("gloca","gloca"); |
1667 |
– |
float sigma=123456; |
2235 |
|
|
2236 |
|
dout << "Going to produce prediction plots" << endl; |
2237 |
< |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
2238 |
< |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
2237 |
> |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
2238 |
> |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
2239 |
|
delete gloca; |
2240 |
|
|
2241 |
|
dout << "Going to reset the cross section for diboson samples ... " << endl; |
2242 |
< |
for(int i=0;i<SamplesToBeModified.size();i++) { |
2242 |
> |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
2243 |
|
float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
2244 |
|
(allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor); |
2245 |
|
string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename; |
2247 |
|
dout << " Reset xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " from " << Upxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ") and reset the correct name (from " << Upname << ")" << endl; |
2248 |
|
|
2249 |
|
} |
2250 |
+ |
// switch_overunderflow(false); |
2251 |
+ |
} |
2252 |
+ |
|
2253 |
+ |
|
2254 |
+ |
void draw_normalized_data_vs_data_histo(TCut cut1, TCut cut2, string variable, string legentry1, string legentry2, string savename, TCanvas *can,vector<float> binning) { |
2255 |
+ |
TPad *jzbpad = new TPad("jzbpad","jzbpad",0,0,1,1); |
2256 |
+ |
jzbpad->cd(); |
2257 |
+ |
jzbpad->SetLogy(1); |
2258 |
+ |
string xlabel="JZB [GeV]"; |
2259 |
+ |
|
2260 |
+ |
TH1F *datahisto1 = allsamples.Draw("datahisto1",variable,binning, xlabel, "events",cut1,data,luminosity); |
2261 |
+ |
datahisto1->SetLineColor(kRed); |
2262 |
+ |
datahisto1->SetMarkerColor(kRed); |
2263 |
+ |
TH1F *datahisto2 = allsamples.Draw("datahisto2",variable,binning, xlabel, "events",cut2,data,luminosity); |
2264 |
+ |
datahisto2->SetLineColor(kBlue); |
2265 |
+ |
datahisto2->SetMarkerColor(kBlue); |
2266 |
+ |
|
2267 |
+ |
datahisto2->SetMarkerSize(DataMarkerSize); |
2268 |
+ |
datahisto1->DrawNormalized("e1"); |
2269 |
+ |
datahisto2->DrawNormalized("histo,same"); |
2270 |
+ |
datahisto1->DrawNormalized("same,e1"); |
2271 |
|
|
2272 |
+ |
TLegend *leg = make_legend(); |
2273 |
+ |
leg->AddEntry(datahisto1,legentry1.c_str()); |
2274 |
+ |
leg->AddEntry(datahisto2,legentry2.c_str()); |
2275 |
+ |
leg->Draw(); |
2276 |
+ |
|
2277 |
+ |
save_with_ratio(datahisto1,datahisto2,jzbpad->cd(),("jzb/"+savename)); |
2278 |
+ |
|
2279 |
+ |
datahisto1->Delete(); |
2280 |
+ |
datahisto2->Delete(); |
2281 |
|
} |
2282 |
+ |
|
2283 |
+ |
|
2284 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
2285 |
+ |
switch_overunderflow(true); |
2286 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
2287 |
|
float max=jzbHigh ; |
2288 |
|
float min=-120; |
2295 |
|
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
2296 |
|
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
2297 |
|
|
2298 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
2299 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
2300 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
2301 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
2302 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
2303 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
2304 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2305 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
2306 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
2298 |
> |
if ( !PlottingSetup::Approved ) { |
2299 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
2300 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
2301 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
2302 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
2303 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
2304 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
2305 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2306 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
2307 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
2308 |
> |
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); |
2309 |
> |
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); |
2310 |
> |
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); |
2311 |
> |
|
2312 |
> |
} |
2313 |
|
|
2314 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarse",can,coarse_binning); |
2315 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
2316 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2317 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
2318 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
2319 |
< |
|
2320 |
< |
// 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); |
2315 |
> |
if ( !PlottingSetup::Approved ) { |
2316 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
2317 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2318 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
2319 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
2320 |
> |
} |
2321 |
|
delete can; |
2322 |
+ |
switch_overunderflow(false); |
2323 |
|
} |
2324 |
|
|
2325 |
|
|
2369 |
|
TCanvas *yica = new TCanvas("yica","yield canvas"); |
2370 |
|
|
2371 |
|
int nRegions=4; |
2372 |
< |
if(!PlottingSetup::RestrictToMassPeak) nRegions=2; |
2372 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2; |
2373 |
|
string tsRegions[] = {"SFZP","OFZP","SFSB","OFSB"}; |
2374 |
|
string posneg[] = {"pos","neg"}; |
2375 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
2376 |
|
|
2377 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
2377 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
2378 |
|
TCut jzbMC[] = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") }; |
2379 |
|
dout << "_________________________________________________________" << endl; |
2380 |
|
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl; |
2381 |
< |
for(int isample=0;isample<(allsamples.collection).size();isample++) { |
2381 |
> |
for(int isample=0;isample<(int)(allsamples.collection).size();isample++) { |
2382 |
|
if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << " & "; |
2383 |
|
else dout << "Sample & "; |
2384 |
|
for(int iregion=0;iregion<nRegions;iregion++) { |
2637 |
|
|
2638 |
|
void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) { |
2639 |
|
int all_leptons=-1; |
2037 |
– |
int electrons_only=0; |
2038 |
– |
int mu_only=1; |
2039 |
– |
int twojetswith50gev=1; |
2640 |
|
int threejetswith30gev=0; |
2641 |
|
/* |
2642 |
+ |
int twojetswith50gev=1; |
2643 |
+ |
int electrons_only=0; |
2644 |
+ |
int mu_only=1; |
2645 |
+ |
|
2646 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev); |
2647 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev); |
2648 |
|
|
2656 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true); |
2657 |
|
} |
2658 |
|
|
2659 |
< |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
2056 |
< |
//first: colorful plots |
2659 |
> |
float find_one_correction_factor(string FindKeyword, bool dodata, TCut SpecialCut, string SaveAs) { |
2660 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
2661 |
|
cancorr->SetLogz(); |
2662 |
|
cancorr->SetRightMargin(0.13); |
2663 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2664 |
< |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"); |
2663 |
> |
TCut zptforresponsepresentation(Restrmasscut&&SpecialCut&&passtrig); |
2664 |
> |
|
2665 |
> |
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2666 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2667 |
< |
(allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation); |
2667 |
> |
niceresponseplotd->Sumw2(); |
2668 |
> |
TH2F* emuResponse = (TH2F*)niceresponseplotd->Clone("emuResponse"); |
2669 |
> |
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
2670 |
> |
for(int iSample=0;iSample<(int)SampleIndices.size();iSample++) { |
2671 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data && !dodata) continue; |
2672 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data ==false && dodata) continue; |
2673 |
> |
|
2674 |
> |
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl; |
2675 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",(zptforresponsepresentation&&cutOSSF)*cutWeight); |
2676 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+emuResponse",(zptforresponsepresentation&&cutOSOF)*cutWeight); |
2677 |
> |
} |
2678 |
> |
niceresponseplotd->Add(emuResponse,-1); |
2679 |
> |
|
2680 |
|
niceresponseplotd->SetStats(0); |
2681 |
|
niceresponseplotd->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2682 |
|
niceresponseplotd->GetYaxis()->SetTitle("Response"); |
2684 |
|
niceresponseplotd->GetYaxis()->CenterTitle(); |
2685 |
|
niceresponseplotd->Draw("COLZ"); |
2686 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
2687 |
+ |
profd->Rebin(2); |
2688 |
|
profd->SetMarkerSize(DataMarkerSize); |
2689 |
< |
profd->Fit("pol0","","same,e1",30,400); |
2689 |
> |
profd->Fit("pol0","","same,e1",100,400); |
2690 |
|
DrawPrelim(); |
2691 |
< |
TText* title = write_text(0.5,0.7,"Data"); |
2691 |
> |
string stitle="Data"; |
2692 |
> |
if(!Contains(FindKeyword,"Data")) stitle="MC"; |
2693 |
> |
TText* title = write_text(0.5,0.7,stitle.c_str()); |
2694 |
|
title->SetTextAlign(12); |
2695 |
|
title->Draw(); |
2696 |
|
TF1 *datapol=(TF1*)profd->GetFunction("pol0"); |
2697 |
< |
float datacorrection=datapol->GetParameter(0); |
2698 |
< |
stringstream dataresstring; |
2699 |
< |
dataresstring<<"Response: "<<std::setprecision(2)<<100*datacorrection<<" %"; |
2700 |
< |
TText* restitle = write_text(0.5,0.65,dataresstring.str()); |
2697 |
> |
float correction=datapol->GetParameter(0); |
2698 |
> |
stringstream resstring; |
2699 |
> |
resstring<<"Response: "<<std::setprecision(2)<<100*correction<<" %"; |
2700 |
> |
TText* restitle = write_text(0.5,0.65,resstring.str()); |
2701 |
|
restitle->SetTextAlign(12); |
2702 |
|
restitle->SetTextSize(0.03); |
2703 |
|
restitle->Draw(); |
2704 |
< |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_Data"); |
2705 |
< |
|
2706 |
< |
TH2F *niceresponseplotm = new TH2F("niceresponseplotm","",100,0,600,100,0,5); |
2707 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation); |
2708 |
< |
niceresponseplotm->SetStats(0); |
2709 |
< |
niceresponseplotm->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2710 |
< |
niceresponseplotm->GetYaxis()->SetTitle("Response"); |
2711 |
< |
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"); |
2704 |
> |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_New_"+SaveAs); |
2705 |
> |
delete cancorr; |
2706 |
> |
delete niceresponseplotd; |
2707 |
> |
delete profd; |
2708 |
> |
return correction; |
2709 |
> |
} |
2710 |
> |
|
2711 |
> |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
2712 |
|
|
2713 |
+ |
dout << "Computing response corrections: " << endl; |
2714 |
+ |
//Step 1 : Get results |
2715 |
+ |
float datacorrection=find_one_correction_factor("Data",true,"","Data"); |
2716 |
+ |
float mccorrection=find_one_correction_factor("DY",false,"","MC"); |
2717 |
+ |
|
2718 |
+ |
float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
2719 |
+ |
float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee"); |
2720 |
+ |
|
2721 |
+ |
float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm"); |
2722 |
+ |
float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm"); |
2723 |
+ |
|
2724 |
+ |
cout << "Corrections : " << endl; |
2725 |
+ |
cout << " Data : " << datacorrection << endl; |
2726 |
+ |
cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
2727 |
+ |
cout << " MC : " << mccorrection << endl; |
2728 |
+ |
cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
2729 |
|
|
2730 |
< |
//Step 2: Getting the result |
2115 |
< |
// TCut zptcutforresponse("pt>30&&pt<300&&TMath::Abs(91.2-mll)<20&&id1==id2&&(ch1*ch2<0)"); |
2730 |
> |
//Step 2: Processing the result and making it into something useful :-) |
2731 |
|
stringstream jzbvardatas; |
2732 |
< |
if(datacorrection>1) jzbvardatas<<"(jzb[1]-"<<datacorrection-1<<"*pt)"; |
2733 |
< |
if(datacorrection<1) jzbvardatas<<"(jzb[1]+"<<1-datacorrection<<"*pt)"; |
2732 |
> |
jzbvardatas << "("; |
2733 |
> |
|
2734 |
> |
if(dataEEcorrection>=1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]-" << dataEEcorrection-1 << "*pt))"; |
2735 |
> |
if(dataEEcorrection<1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-dataEEcorrection << "*pt))"; |
2736 |
> |
|
2737 |
> |
if(dataMMcorrection>=1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]-" << dataMMcorrection-1 << "*pt))"; |
2738 |
> |
if(dataMMcorrection<1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-dataMMcorrection << "*pt))"; |
2739 |
> |
|
2740 |
> |
float averagecorrection=(dataMMcorrection+dataEEcorrection)/2.0; |
2741 |
> |
|
2742 |
> |
if(datacorrection>=1) jzbvardatas<<"+((id1!=id2)*(jzb[1]-" << datacorrection-1 << "*pt))"; |
2743 |
> |
if(datacorrection<1) jzbvardatas<<"+((id1!=id2)*(jzb[1]+" << 1-datacorrection << "*pt))"; |
2744 |
> |
|
2745 |
> |
jzbvardatas << ")"; |
2746 |
|
jzbvardata=jzbvardatas.str(); |
2747 |
+ |
|
2748 |
|
stringstream jzbvarmcs; |
2749 |
< |
if(mccorrection>1) jzbvarmcs<<"(jzb[1]-"<<mccorrection-1<<"*pt)"; |
2750 |
< |
if(mccorrection<1) jzbvarmcs<<"(jzb[1]+"<<1-mccorrection<<"*pt)"; |
2749 |
> |
jzbvarmcs << "("; |
2750 |
> |
|
2751 |
> |
if(mcEEcorrection>=1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]-" << mcEEcorrection-1 << "*pt))"; |
2752 |
> |
if(mcEEcorrection<1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-mcEEcorrection << "*pt))"; |
2753 |
> |
|
2754 |
> |
if(mcMMcorrection>=1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]-" << mcMMcorrection-1 << "*pt))"; |
2755 |
> |
if(mcMMcorrection<1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-mcMMcorrection << "*pt))"; |
2756 |
> |
|
2757 |
> |
float averagemccorrection=(mcMMcorrection+mcEEcorrection)/2.0; |
2758 |
> |
|
2759 |
> |
if(mccorrection>=1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]-" << mccorrection-1 << "*pt))"; |
2760 |
> |
if(mccorrection<1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]+" << 1-mccorrection << "*pt))"; |
2761 |
> |
|
2762 |
> |
jzbvarmcs << ")"; |
2763 |
|
jzbvarmc=jzbvarmcs.str(); |
2764 |
+ |
|
2765 |
|
dout << "JZB Z pt correction summary : " << endl; |
2766 |
|
dout << " Data: The response is " << datacorrection << " --> jzb variable is now : " << jzbvardata << endl; |
2767 |
|
dout << " MC : The response is " << mccorrection << " --> jzb variable is now : " << jzbvarmc << endl; |
2768 |
+ |
|
2769 |
|
} |
2770 |
|
|
2771 |
|
void pick_up_events(string cut) { |
2773 |
|
allsamples.PickUpEvents(cut); |
2774 |
|
} |
2775 |
|
|
2776 |
< |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError) { |
2776 |
> |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) { |
2777 |
|
dout << "Saving configuration template!" << endl; |
2778 |
|
ofstream configfile; |
2779 |
|
configfile.open("../DistributedModelCalculations/last_configuration.C"); |
2793 |
|
configfile<<"string datajzb=\"datajzb_ERROR\";\n"; |
2794 |
|
configfile<<"string mcjzb=\"mcjzb_ERROR\";\n"; |
2795 |
|
configfile<<"vector<float>jzb_cuts;\n"; |
2796 |
+ |
configfile<<"vector<float>jzb_shape_limit_bins;\n"; |
2797 |
|
configfile<<"float MCPeakError=-999;\n"; |
2798 |
|
configfile<<"float DataPeakError=-999;\n"; |
2799 |
|
configfile<<"}\n\n"; |
2803 |
|
configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n"; |
2804 |
|
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n"; |
2805 |
|
configfile<<"DataPeakError="<<DataPeakError<<";\n\n"; |
2806 |
< |
for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2806 |
> |
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"; |
2807 |
|
configfile<<"\n\n"; |
2808 |
< |
for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2809 |
< |
for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2810 |
< |
for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2808 |
> |
for(int i=0;i<(int)Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2809 |
> |
for(int i=0;i<(int)Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2810 |
> |
for(int i=0;i<(int)Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2811 |
> |
configfile<<"\n\n"; |
2812 |
> |
for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2813 |
> |
for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2814 |
> |
for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2815 |
> |
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"; |
2816 |
|
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"; |
2817 |
|
configfile<<"\n\n"; |
2818 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
2819 |
|
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
2820 |
+ |
configfile<<"UseSidebandsForcJZB="<<UseSidebandsForcJZB<<";//tells us whether to use the sidebands or not\n"; |
2821 |
|
|
2822 |
|
configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n"; |
2823 |
|
|
2840 |
|
float max=histos[0]->GetMaximum(); |
2841 |
|
if(manualmin>=0) min=manualmin; |
2842 |
|
else { |
2843 |
< |
for(int i=1;i<histos.size();i++) { |
2843 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2844 |
|
float curmin=get_nonzero_minimum(histos[i]); |
2845 |
|
float curmax=histos[i]->GetMaximum(); |
2846 |
|
if(curmin<min) min=curmin; |
2851 |
|
histos[0]->Draw(drawoption.c_str()); |
2852 |
|
stringstream drawopt; |
2853 |
|
drawopt << drawoption << ",same"; |
2854 |
< |
for(int i=1;i<histos.size();i++) { |
2854 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2855 |
|
histos[i]->Draw(drawopt.str().c_str()); |
2856 |
|
} |
2857 |
|
} |
2860 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
2861 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
2862 |
|
TCut weightbackup=cutWeight; |
2863 |
< |
cutWeight="1.0"; |
2864 |
< |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2863 |
> |
switch_overunderflow(true); |
2864 |
> |
|
2865 |
> |
bool doPURW=false; |
2866 |
> |
|
2867 |
|
|
2868 |
+ |
if(!doPURW) { |
2869 |
+ |
dout << "Not doing PU reweighting for ttbar closure test" << endl; |
2870 |
+ |
cutWeight="1.0"; |
2871 |
+ |
// Do it without PU re-weighting |
2872 |
+ |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2873 |
+ |
stringstream resultsNoPU; |
2874 |
+ |
stringstream noPUdatajzb; |
2875 |
+ |
stringstream noPUmcjzb; |
2876 |
+ |
|
2877 |
+ |
stringstream mcjzbnoPU; |
2878 |
+ |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
2879 |
+ |
mcjzb = noPUmcjzb.str(); |
2880 |
+ |
} |
2881 |
+ |
|
2882 |
+ |
|
2883 |
+ |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2884 |
|
|
2885 |
< |
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2886 |
< |
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2885 |
> |
TH1F *TZem = systsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT")); |
2886 |
> |
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT")); |
2887 |
|
TH1F *TSem; |
2888 |
|
TH1F *nTSem; |
2889 |
< |
TH1F *TZeemm = systsamples.Draw("TZeemm",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2890 |
< |
TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2889 |
> |
TH1F *TZeemm = systsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT")); |
2890 |
> |
TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT")); |
2891 |
|
TH1F *TSeemm; |
2892 |
|
TH1F *nTSeemm; |
2893 |
|
|
2894 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2895 |
< |
TSem = systsamples.Draw("TSem",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2896 |
< |
nTSem = systsamples.Draw("nTSem","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2897 |
< |
TSeemm = systsamples.Draw("TSeemm",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2898 |
< |
nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2894 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2895 |
> |
TSem = systsamples.Draw("TSem", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT")); |
2896 |
> |
nTSem = systsamples.Draw("nTSem", "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT")); |
2897 |
> |
TSeemm = systsamples.Draw("TSeemm", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT")); |
2898 |
> |
nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT")); |
2899 |
|
} |
2900 |
|
|
2901 |
|
TCanvas *tcan = new TCanvas("tcan","tcan"); |
2238 |
– |
|
2902 |
|
tcan->SetLogy(1); |
2903 |
|
|
2904 |
|
TZeemm->SetLineColor(kBlack); |
2907 |
|
TZem->SetMarkerColor(kRed); |
2908 |
|
|
2909 |
|
|
2910 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2910 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2911 |
|
TSem->SetLineColor(TColor::GetColor("#00A616")); |
2912 |
|
TSeemm->SetLineColor(kMagenta+2); |
2913 |
|
TSem->SetMarkerColor(TColor::GetColor("#00A616")); |
2917 |
|
} |
2918 |
|
|
2919 |
|
vector<TH1F*> histos; |
2920 |
+ |
TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2921 |
+ |
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2922 |
|
histos.push_back(TZem); |
2923 |
|
histos.push_back(TZeemm); |
2924 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2924 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2925 |
> |
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2926 |
> |
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2927 |
|
histos.push_back(TSem); |
2928 |
|
histos.push_back(TSeemm); |
2929 |
|
} |
2930 |
< |
draw_all_ttbar_histos(tcan,histos,"histo",0.04); |
2930 |
> |
draw_all_ttbar_histos(tcan,histos,"histo",8); |
2931 |
|
|
2932 |
|
TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false); |
2933 |
|
leg->AddEntry(TZeemm,"SFZP","l"); |
2934 |
|
leg->AddEntry(TZem,"OFZP","l"); |
2935 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2935 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2936 |
|
leg->AddEntry(TSeemm,"SFSB","l"); |
2937 |
|
leg->AddEntry(TSem,"OFSB","l"); |
2938 |
|
} |
2939 |
|
leg->Draw("same"); |
2940 |
|
DrawMCPrelim(simulatedlumi); |
2941 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
2942 |
< |
cout << __LINE__ << endl; |
2942 |
> |
|
2943 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
2277 |
– |
cout << __LINE__ << endl; |
2944 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
2279 |
– |
cout << __LINE__ << endl; |
2945 |
|
TH1F *TSeemmcopy; |
2946 |
|
TH1F *TSemcopy; |
2947 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2947 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2948 |
|
TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2949 |
|
TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2950 |
|
} |
2951 |
|
|
2952 |
|
TZem->Divide(TZeemm); |
2953 |
|
TZem->SetMarkerStyle(21); |
2954 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2954 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2955 |
|
TSem->Divide(TZeemm); |
2956 |
|
TSeemm->Divide(TZeemm); |
2957 |
|
TSem->SetMarkerStyle(24); |
2958 |
|
TSeemm->SetMarkerStyle(32); |
2959 |
< |
} |
2959 |
> |
} |
2960 |
|
|
2961 |
|
tcan->SetLogy(0); |
2962 |
|
TZem->GetYaxis()->SetRangeUser(0,2.5); |
2963 |
|
TZem->GetYaxis()->SetTitle("ratio"); |
2964 |
|
TZem->Draw(); |
2965 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2965 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2966 |
|
TSem->Draw("same"); |
2967 |
|
TSeemm->Draw("same"); |
2968 |
|
} |
2969 |
|
|
2970 |
< |
float linepos=0.25; |
2971 |
< |
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
2972 |
< |
if(!PlottingSetup::RestrictToMassPeak) linepos=0.1; //sys uncertainty for iJZB |
2970 |
> |
float linepos=emuncertONPEAK; |
2971 |
> |
if(!PlottingSetup::RestrictToMassPeak) linepos=emuncertOFFPEAK; |
2972 |
> |
|
2973 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2974 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2975 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2992 |
|
|
2993 |
|
TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false); |
2994 |
|
leg2->AddEntry(TZem,"OFZP / SFZP","ple"); |
2995 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2995 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2996 |
|
leg2->AddEntry(TSeemm,"SFSB / SFZP","ple"); |
2997 |
|
leg2->AddEntry(TSem,"OFSB / SFZP","ple"); |
2998 |
|
} |
3005 |
|
DrawMCPrelim(simulatedlumi); |
3006 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
3007 |
|
|
3008 |
+ |
|
3009 |
+ |
if (0) { // Turn this off: we don't need this |
3010 |
|
|
3011 |
< |
///-------------- second part: only look at the quantity we actually care about! |
3012 |
< |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
3013 |
< |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
3014 |
< |
rightsfzp->Add(leftsfzp,-1); |
3015 |
< |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
3016 |
< |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
3017 |
< |
rightofzp->Add(leftofzp,-1); |
3018 |
< |
TH1F *leftofsb; |
3019 |
< |
TH1F *rightofsb; |
3020 |
< |
TH1F *leftsfsb; |
3021 |
< |
TH1F *rightsfsb; |
3022 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3023 |
< |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
3024 |
< |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
3025 |
< |
rightofsb->Add(leftofsb,-1); |
3026 |
< |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
3027 |
< |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
3028 |
< |
rightsfsb->Add(leftsfsb,-1); |
3029 |
< |
} |
3011 |
> |
///-------------- second part: only look at the quantity we actually care about! |
3012 |
> |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
3013 |
> |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
3014 |
> |
rightsfzp->Add(leftsfzp,-1); |
3015 |
> |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
3016 |
> |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
3017 |
> |
rightofzp->Add(leftofzp,-1); |
3018 |
> |
TH1F *leftofsb; |
3019 |
> |
TH1F *rightofsb; |
3020 |
> |
TH1F *leftsfsb; |
3021 |
> |
TH1F *rightsfsb; |
3022 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3023 |
> |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
3024 |
> |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
3025 |
> |
rightofsb->Add(leftofsb,-1); |
3026 |
> |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
3027 |
> |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
3028 |
> |
rightsfsb->Add(leftsfsb,-1); |
3029 |
> |
} |
3030 |
|
|
3031 |
< |
tcan->SetLogy(1); |
3032 |
< |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
3033 |
< |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
3034 |
< |
rightsfzp->Draw("histo"); |
3035 |
< |
rightofzp->Draw("histo,same"); |
3036 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3037 |
< |
rightofsb->Draw("histo,same"); |
3038 |
< |
rightsfsb->Draw("histo,same"); |
3039 |
< |
} |
3040 |
< |
DrawMCPrelim(simulatedlumi); |
3031 |
> |
tcan->SetLogy(1); |
3032 |
> |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
3033 |
> |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
3034 |
> |
rightsfzp->Draw("histo"); |
3035 |
> |
rightofzp->Draw("histo,same"); |
3036 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3037 |
> |
rightofsb->Draw("histo,same"); |
3038 |
> |
rightsfsb->Draw("histo,same"); |
3039 |
> |
} |
3040 |
> |
DrawMCPrelim(simulatedlumi); |
3041 |
|
|
3042 |
< |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
3043 |
< |
legA->AddEntry(rightsfzp,"SFZP","l"); |
3044 |
< |
legA->AddEntry(rightofzp,"OFZP","l"); |
3045 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3046 |
< |
legA->AddEntry(rightofsb,"SFSB","l"); |
3047 |
< |
legA->AddEntry(rightsfsb,"OFSB","l"); |
3048 |
< |
} |
3049 |
< |
legA->Draw(); |
3042 |
> |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
3043 |
> |
legA->AddEntry(rightsfzp,"SFZP","l"); |
3044 |
> |
legA->AddEntry(rightofzp,"OFZP","l"); |
3045 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3046 |
> |
legA->AddEntry(rightofsb,"SFSB","l"); |
3047 |
> |
legA->AddEntry(rightsfsb,"OFSB","l"); |
3048 |
> |
} |
3049 |
> |
legA->Draw(); |
3050 |
|
|
3051 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
3051 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
3052 |
|
|
3053 |
< |
tcan->SetLogy(0); |
3054 |
< |
rightofzp->Divide(rightsfzp); |
3055 |
< |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
3056 |
< |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.0); |
3057 |
< |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
3058 |
< |
rightofzp->Draw(); |
3059 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3060 |
< |
rightofsb->Divide(rightsfzp); |
3061 |
< |
rightsfsb->Divide(rightsfzp); |
3062 |
< |
rightofsb->Draw("same"); |
3063 |
< |
rightsfsb->Draw("same"); |
3064 |
< |
} |
3065 |
< |
|
3066 |
< |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
3067 |
< |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
3068 |
< |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
3069 |
< |
|
3070 |
< |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
3071 |
< |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
3072 |
< |
center2->SetLineColor(kBlue); |
3073 |
< |
|
3074 |
< |
top2->Draw("same"); |
3075 |
< |
center2->Draw("same"); |
3076 |
< |
bottom2->Draw("same"); |
3077 |
< |
|
3078 |
< |
rightofzp->SetMarkerStyle(21); |
3079 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3080 |
< |
rightofsb->SetMarkerStyle(24); |
3081 |
< |
rightsfsb->SetMarkerStyle(32); |
3082 |
< |
} |
3083 |
< |
|
3084 |
< |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
3085 |
< |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
3086 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3087 |
< |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
3088 |
< |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
3089 |
< |
} |
3090 |
< |
leg3->AddEntry(bottom,"syst. envelope","l"); |
3091 |
< |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
3092 |
< |
leg3->SetY1(0.65); |
3053 |
> |
tcan->SetLogy(0); |
3054 |
> |
rightofzp->Divide(rightsfzp); |
3055 |
> |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
3056 |
> |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
3057 |
> |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
3058 |
> |
rightofzp->Draw(); |
3059 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3060 |
> |
rightofsb->Divide(rightsfzp); |
3061 |
> |
rightsfsb->Divide(rightsfzp); |
3062 |
> |
rightofsb->Draw("same"); |
3063 |
> |
rightsfsb->Draw("same"); |
3064 |
> |
} |
3065 |
> |
|
3066 |
> |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
3067 |
> |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
3068 |
> |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
3069 |
> |
|
3070 |
> |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
3071 |
> |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
3072 |
> |
center2->SetLineColor(kBlue); |
3073 |
> |
|
3074 |
> |
top2->Draw("same"); |
3075 |
> |
center2->Draw("same"); |
3076 |
> |
bottom2->Draw("same"); |
3077 |
> |
|
3078 |
> |
rightofzp->SetMarkerStyle(21); |
3079 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3080 |
> |
rightofsb->SetMarkerStyle(24); |
3081 |
> |
rightsfsb->SetMarkerStyle(32); |
3082 |
> |
} |
3083 |
> |
|
3084 |
> |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
3085 |
> |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
3086 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3087 |
> |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
3088 |
> |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
3089 |
> |
} |
3090 |
> |
leg3->AddEntry(bottom,"syst. envelope","l"); |
3091 |
> |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
3092 |
> |
leg3->SetY1(0.65); |
3093 |
|
|
3094 |
< |
leg3->Draw("same"); |
3094 |
> |
leg3->Draw("same"); |
3095 |
|
|
3096 |
< |
DrawMCPrelim(simulatedlumi); |
3097 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
3096 |
> |
DrawMCPrelim(simulatedlumi); |
3097 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
3098 |
> |
|
3099 |
> |
} |
3100 |
|
|
3101 |
|
delete TZem; |
3102 |
|
delete nTZem; |
3103 |
|
delete TZeemm; |
3104 |
|
delete nTZeemm; |
3105 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3105 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3106 |
|
delete TSem; |
3107 |
|
delete nTSem; |
3108 |
|
delete TSeemm; |
3111 |
|
|
3112 |
|
delete tcan; |
3113 |
|
cutWeight=weightbackup; |
3114 |
+ |
switch_overunderflow(false); |
3115 |
|
} |
3116 |
|
|
3117 |
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) { |
3118 |
|
vector<float> nicer_binning; |
3119 |
< |
nicer_binning.push_back(-125); |
3119 |
> |
|
3120 |
> |
/* nicer_binning.push_back(-400); |
3121 |
> |
nicer_binning.push_back(-250); |
3122 |
> |
nicer_binning.push_back(-200); |
3123 |
> |
nicer_binning.push_back(-150); |
3124 |
> |
nicer_binning.push_back(-100); |
3125 |
> |
nicer_binning.push_back(-50); |
3126 |
> |
nicer_binning.push_back(-20); |
3127 |
> |
|
3128 |
> |
nicer_binning.push_back(0); |
3129 |
> |
nicer_binning.push_back(20); |
3130 |
> |
nicer_binning.push_back(50); |
3131 |
> |
nicer_binning.push_back(100); |
3132 |
> |
nicer_binning.push_back(150); |
3133 |
> |
nicer_binning.push_back(200); |
3134 |
> |
nicer_binning.push_back(250); |
3135 |
> |
nicer_binning.push_back(400);*/ |
3136 |
> |
|
3137 |
|
nicer_binning.push_back(-100); |
2451 |
– |
nicer_binning.push_back(-75); |
3138 |
|
nicer_binning.push_back(-50); |
3139 |
|
nicer_binning.push_back(-25); |
3140 |
|
nicer_binning.push_back(0); |
3144 |
|
nicer_binning.push_back(100); |
3145 |
|
nicer_binning.push_back(125); |
3146 |
|
nicer_binning.push_back(150); |
3147 |
< |
nicer_binning.push_back(175); |
3147 |
> |
//nicer_binning.push_back(175); |
3148 |
|
nicer_binning.push_back(200); |
3149 |
< |
nicer_binning.push_back(230); |
3150 |
< |
nicer_binning.push_back(280); |
3151 |
< |
nicer_binning.push_back(400); |
3149 |
> |
// nicer_binning.push_back(250); |
3150 |
> |
// nicer_binning.push_back(300); |
3151 |
> |
// nicer_binning.push_back(400); |
3152 |
> |
|
3153 |
|
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
3154 |
|
} |
3155 |
|
|
3156 |
|
|
3157 |
< |
void zjets_prediction_comparison() { |
3158 |
< |
// Do it without PU re-weighting |
3159 |
< |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
3160 |
< |
stringstream resultsNoPU; |
3161 |
< |
|
3162 |
< |
stringstream mcjzbnoPU; |
3163 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,false); |
3164 |
< |
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
3165 |
< |
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
3157 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa, TCut massregioncut, string massregionname) { |
3158 |
> |
cout << "****************************************************************************************************************************************************************" << endl; |
3159 |
> |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
3160 |
> |
// zcan->SetLogy(1); |
3161 |
> |
TCut weightbackup=cutWeight; |
3162 |
> |
|
3163 |
> |
bool UsePURW=true; |
3164 |
> |
|
3165 |
> |
|
3166 |
> |
string mcjzb; |
3167 |
> |
if(UsePURW) { |
3168 |
> |
mcjzb=mcjzbWithPUa; |
3169 |
> |
cout << "Using PURW peak positions" << endl; |
3170 |
> |
} else { |
3171 |
> |
// Do it without PU re-weighting |
3172 |
> |
cutWeight="1.0"; |
3173 |
> |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
3174 |
> |
stringstream resultsNoPU; |
3175 |
> |
stringstream noPUdatajzb; |
3176 |
> |
stringstream noPUmcjzb; |
3177 |
> |
|
3178 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,false,noPUdatajzb,noPUmcjzb); |
3179 |
> |
dout << "The peak corrected JZB expression for MC without pileup is : " << noPUmcjzb.str() << endl; |
3180 |
> |
|
3181 |
> |
mcjzb = noPUmcjzb.str(); |
3182 |
> |
|
3183 |
> |
} |
3184 |
|
|
3185 |
< |
string mcjzb = mcjzbnoPU.str(); |
3186 |
< |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
3185 |
> |
|
3186 |
> |
vector<float> binning; |
3187 |
> |
binning.push_back(0); |
3188 |
> |
binning.push_back(10); |
3189 |
> |
binning.push_back(20); |
3190 |
> |
binning.push_back(40); |
3191 |
> |
binning.push_back(60); |
3192 |
> |
// binning.push_back(50); |
3193 |
> |
// binning.push_back(60); |
3194 |
> |
// binning.push_back(70); |
3195 |
> |
// binning.push_back(80); |
3196 |
> |
// binning.push_back(90); |
3197 |
> |
binning.push_back(100); |
3198 |
|
|
2483 |
– |
TCut weightbackup=cutWeight; |
2484 |
– |
cutWeight="1.0"; |
2485 |
– |
float sbg_min=0.; |
2486 |
– |
float sbg_max=100.; |
2487 |
– |
int sbg_nbins=5; |
3199 |
|
float simulatedlumi = luminosity;//in pb please - adjust to your likings |
3200 |
|
|
3201 |
|
TCut kPos((mcjzb+">0").c_str()); |
3202 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
3203 |
|
string var( "abs("+mcjzb+")" ); |
3204 |
+ |
|
3205 |
+ |
TCut notTau("abs(genMID1)!=15"); |
3206 |
+ |
TCut ee_mm_tautau("mll>0"); |
3207 |
+ |
|
3208 |
|
|
3209 |
< |
TCut kcut(cutmass&&cutOSSF&&"pfJetGoodNum>2"); |
3210 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
3211 |
< |
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")); |
3209 |
> |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3210 |
> |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3211 |
> |
|
3212 |
|
hJZBpos->SetLineColor(kBlack); |
3213 |
|
hJZBneg->SetLineColor(kRed); |
3214 |
|
|
3215 |
< |
Int_t nbins = 5; |
2503 |
< |
Float_t xmax = 100.; |
2504 |
< |
|
2505 |
< |
|
2506 |
< |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2507 |
< |
zcan->SetLogy(1); |
2508 |
< |
|
3215 |
> |
hJZBpos->SetMinimum(1.0); |
3216 |
|
hJZBpos->Draw("e1"); |
3217 |
|
hJZBneg->Draw("same,hist"); |
3218 |
|
hJZBpos->Draw("same,e1"); // So it's on top... |
3219 |
|
|
3220 |
< |
TLegend *leg = make_legend("MC Z+jets",0.55,0.75,false); |
3220 |
> |
TLegend *leg = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.55,0.75,false); |
3221 |
|
leg->AddEntry(hJZBpos,"Observed","pe"); |
3222 |
|
leg->AddEntry(hJZBneg,"Predicted","l"); |
3223 |
|
leg->Draw("same"); |
3224 |
|
DrawMCPrelim(simulatedlumi); |
3225 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction"); |
3225 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction"+any2string(massregionname)); |
3226 |
|
|
3227 |
|
TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio"); |
3228 |
|
hratio->Divide(hJZBneg); |
3229 |
|
|
3230 |
< |
zcan->SetLogy(0); |
3230 |
> |
for(int i=1;i<=hJZBpos->GetNbinsX();i++) { |
3231 |
> |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << " (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << endl; |
3232 |
> |
} |
3233 |
> |
|
3234 |
> |
// zcan->SetLogy(0); |
3235 |
|
hratio->GetYaxis()->SetRangeUser(0,2.5); |
3236 |
|
hratio->GetYaxis()->SetTitle("Observed/Predicted"); |
3237 |
|
hratio->Draw("e1"); |
3238 |
|
|
3239 |
< |
TLine *top = new TLine(sbg_min,1.25,sbg_max,1.25); |
3240 |
< |
TLine *center = new TLine(sbg_min,1.0,sbg_max,1.0); |
3241 |
< |
TLine *bottom = new TLine(sbg_min,0.75,sbg_max,0.75); |
3239 |
> |
TLine *top = new TLine(binning[0],1.25,binning[binning.size()-1],1.25); |
3240 |
> |
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
3241 |
> |
TLine *bottom = new TLine(binning[0],0.75,binning[binning.size()-1],0.75); |
3242 |
|
|
3243 |
|
|
3244 |
+ |
cout << __LINE__ << endl; |
3245 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
3246 |
|
bottom->SetLineColor(kBlue);bottom->SetLineStyle(2); |
3247 |
|
center->SetLineColor(kBlue); |
3250 |
|
center->Draw("same"); |
3251 |
|
bottom->Draw("same"); |
3252 |
|
|
3253 |
< |
TLegend *leg2 = make_legend("MC Z+jets",0.25,0.75,false); |
3253 |
> |
TLegend *leg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
3254 |
|
leg2->AddEntry(hratio,"obs / pred","pe"); |
3255 |
|
leg2->AddEntry(bottom,"syst. envelope","l"); |
3256 |
|
leg2->Draw("same"); |
3257 |
|
DrawMCPrelim(simulatedlumi); |
3258 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction_ratio"); |
3258 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"+any2string(massregionname)); |
3259 |
> |
|
3260 |
> |
TCut reducedNJets(cutnJets); |
3261 |
> |
|
3262 |
> |
TH1F *TAUhJZBpos = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3263 |
> |
TH1F *LcorrJZBeemm = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3264 |
> |
TH1F *RcorrJZBem = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3265 |
> |
TH1F *LcorrJZBem = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3266 |
> |
|
3267 |
> |
cout << __LINE__ << endl; |
3268 |
> |
TH1F *RcorrJZBSBem; |
3269 |
> |
TH1F *LcorrJZBSBem; |
3270 |
> |
TH1F *RcorrJZBSBeemm; |
3271 |
> |
TH1F *LcorrJZBSBeemm; |
3272 |
> |
|
3273 |
> |
cout << __LINE__ << endl; |
3274 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3275 |
> |
RcorrJZBSBem = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3276 |
> |
LcorrJZBSBem = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3277 |
> |
RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3278 |
> |
LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3279 |
> |
} |
3280 |
> |
|
3281 |
> |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3282 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3283 |
> |
Bpred->Add(RcorrJZBem,1.0/3.); |
3284 |
> |
Bpred->Add(LcorrJZBem,-1.0/3.); |
3285 |
> |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3286 |
> |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
3287 |
> |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
3288 |
> |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
3289 |
> |
} else { |
3290 |
> |
Bpred->Add(RcorrJZBem,1.0); |
3291 |
> |
Bpred->Add(LcorrJZBem,-1.0); |
3292 |
> |
} |
3293 |
> |
|
3294 |
> |
Bpred->SetLineColor(kRed); |
3295 |
> |
|
3296 |
> |
cout << __LINE__ << endl; |
3297 |
> |
TAUhJZBpos->SetLineColor(kBlack); |
3298 |
> |
Bpred->SetLineColor(kRed); |
3299 |
> |
|
3300 |
> |
TAUhJZBpos->SetMinimum(1.0); |
3301 |
> |
TAUhJZBpos->Draw("e1"); |
3302 |
> |
Bpred->Draw("same,hist"); |
3303 |
> |
TAUhJZBpos->Draw("same,e1"); |
3304 |
> |
|
3305 |
> |
TLegend *TAUleg = make_legend("MC Z+jets #rightarrow ee,#mu#mu,#tau#tau",0.55,0.75,false); |
3306 |
> |
TAUleg->AddEntry(TAUhJZBpos,"Observed","pe"); |
3307 |
> |
TAUleg->AddEntry(Bpred,"Predicted","l"); |
3308 |
> |
TAUleg->Draw("same"); |
3309 |
> |
DrawMCPrelim(simulatedlumi); |
3310 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction__"+any2string(massregionname)); |
3311 |
> |
|
3312 |
> |
TH1F* TAUhratio = (TH1F*)TAUhJZBpos->Clone("TAUhratio"); |
3313 |
> |
TAUhratio->Divide(Bpred); |
3314 |
> |
|
3315 |
> |
for(int i=1;i<=TAUhJZBpos->GetNbinsX();i++) { |
3316 |
> |
cout << "ee/mm/tautau observed: " << TAUhJZBpos->GetBinContent(i) << " vs predicted : " << Bpred->GetBinContent(i) << " (ratio : " << TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i) << endl; |
3317 |
> |
} |
3318 |
> |
|
3319 |
> |
zcan->SetLogy(0); |
3320 |
> |
TAUhratio->GetYaxis()->SetRangeUser(0,2.5); |
3321 |
> |
TAUhratio->GetYaxis()->SetTitle("Observed/Predicted"); |
3322 |
> |
TAUhratio->Draw("e1"); |
3323 |
> |
|
3324 |
> |
top->Draw("same"); |
3325 |
> |
center->Draw("same"); |
3326 |
> |
bottom->Draw("same"); |
3327 |
> |
|
3328 |
> |
TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
3329 |
> |
TAUleg2->AddEntry(TAUhratio,"obs / pred","pe"); |
3330 |
> |
TAUleg2->AddEntry(bottom,"syst. envelope","l"); |
3331 |
> |
TAUleg2->Draw("same"); |
3332 |
> |
DrawMCPrelim(simulatedlumi); |
3333 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio"+any2string(massregionname)); |
3334 |
> |
|
3335 |
> |
delete Bpred; |
3336 |
> |
delete TAUhJZBpos; |
3337 |
> |
delete LcorrJZBeemm; |
3338 |
> |
delete RcorrJZBem; |
3339 |
> |
delete LcorrJZBem; |
3340 |
> |
delete hJZBpos; |
3341 |
> |
delete hJZBneg; |
3342 |
> |
|
3343 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3344 |
> |
delete RcorrJZBSBem; |
3345 |
> |
delete LcorrJZBSBem; |
3346 |
> |
delete RcorrJZBSBeemm; |
3347 |
> |
delete LcorrJZBSBeemm; |
3348 |
> |
} |
3349 |
> |
|
3350 |
|
|
3351 |
|
delete zcan; |
3352 |
|
cutWeight=weightbackup; |
3353 |
|
|
3354 |
+ |
cout << __LINE__ << endl; |
3355 |
|
} |
3356 |
|
|
3357 |
|
|
3358 |
< |
|
3358 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa) { |
3359 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut(""), "nomasscut"); |
3360 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)<20"), "Zwindow_20"); |
3361 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20&&mll<70"), "LowMassRegion2070"); |
3362 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>110"), "HighMassRegion110"); |
3363 |
> |
} |
3364 |
> |
|
3365 |
|
void sideband_assessment(string datajzb, float min=30.0, float max=50.0) { |
3366 |
|
tout << endl << endl; |
3367 |
|
stringstream bordercut; |
3379 |
|
tout << "\\begin{tabular}{l|cc}" << endl; |
3380 |
|
tout << "\\hline" << endl; |
3381 |
|
tout << "& {\\OFZP} & {\\OFSB} \\\\\\hline" << endl; |
3382 |
< |
tout << "\\#(events) & "<<OFSB<<" & "<<OFZP<<"\\\\ \\hline" << endl; |
3382 |
> |
tout << "\\#(events) & "<<OFZP<<" & "<<OFSB<<"\\\\ \\hline" << endl; |
3383 |
|
tout << "\\end{tabular}" << endl; |
3384 |
|
tout << "\\end{center}" << endl; |
3385 |
|
tout << "\\end{table}" << endl; |
3397 |
|
|
3398 |
|
TCanvas *cannie = new TCanvas("cannie","cannie"); |
3399 |
|
|
3400 |
< |
for(int icut=0;icut<jzb_cuts.size();icut++) { |
3400 |
> |
for(int icut=0;icut<(int)jzb_cuts.size();icut++) { |
3401 |
|
float currcut=jzb_cuts[icut]; |
3402 |
|
int nbins=1;float low=currcut; |
3403 |
|
vector<int> mysample; |
3412 |
|
TH1F *RcorrJZBSBeemm; |
3413 |
|
TH1F *LcorrJZBSBeemm; |
3414 |
|
|
3415 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3415 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3416 |
|
RcorrJZBSBem = coll.Draw("RcorrJZBSBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
3417 |
|
LcorrJZBSBem = coll.Draw("LcorrJZBSBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
3418 |
|
RcorrJZBSBeemm = coll.Draw("RcorrJZBSBeemm",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample); |
3420 |
|
} |
3421 |
|
|
3422 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3423 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3423 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3424 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
3425 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
3426 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3456 |
|
//prediction part |
3457 |
|
if(is_data) cout << "Data prediction & "; |
3458 |
|
if(subselection!="none") cout << subselection << " prediction &"; |
3459 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
3459 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
3460 |
|
|
3461 |
|
cout << endl; |
3462 |
|
//observation part |
3463 |
|
if(is_data) cout << "Data observation & "; |
3464 |
|
if(subselection!="none") cout << subselection << " observation &"; |
3465 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
3465 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
3466 |
|
cout << endl; |
3467 |
|
cout << "_________________________________________________________________" << endl; |
3468 |
|
delete cannie; |
3497 |
|
int nbins = sizeof(xbins)/sizeof(float)-1; |
3498 |
|
int markers[] = { 20, 26, 21, 24, 22, 25, 28 }; |
3499 |
|
|
3500 |
< |
TH1F* heff = new TH1F("heff", "JZB eff ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
3501 |
< |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
3502 |
< |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
3500 |
> |
|
3501 |
> |
TH1F* heff = new TH1F("heff", "JZB eff ; generator JZB [GeV]; efficiency",nbins,xbins); |
3502 |
> |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator JZB [GeV]; efficiency",nbins,xbins); |
3503 |
> |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator JZB [GeV]; efficiency",nbins,xbins); |
3504 |
|
|
3505 |
|
TCut kgen(genMassCut&&"genZPt>0&&genNjets>2&&abs(genMID)==23"&&cutOSSF); |
3506 |
|
TCut kreco(cutmass); |
3516 |
|
TCanvas *can = new TCanvas("can","Canvas for JZB Efficiency",600,600); |
3517 |
|
can->SetGridx(1); |
3518 |
|
can->SetGridy(1); |
3519 |
+ |
can->SetLeftMargin(0.16); |
3520 |
+ |
can->SetRightMargin(0.05); |
3521 |
|
TLegend *leg = make_legend("",0.6,0.2,false,0.89,0.5); |
3522 |
+ |
leg->SetBorderSize(1); |
3523 |
+ |
leg->SetLineColor(kBlack); |
3524 |
+ |
leg->SetTextFont(62); |
3525 |
|
|
3526 |
< |
|
2711 |
< |
|
2712 |
< |
for ( int icut=0; icut<jzb_bins.size(); ++icut ) { |
3526 |
> |
for ( int icut=0; icut<(int)jzb_bins.size(); ++icut ) { |
3527 |
|
|
3528 |
|
ostringstream selection; |
3529 |
|
selection << mcjzb << ">" << jzb_bins[icut]; |
3539 |
|
} |
3540 |
|
|
3541 |
|
heff->GetXaxis()->SetRangeUser(min, max); |
3542 |
+ |
// heff->GetXaxis()->SetLabelSize(0.05); // paper style. overruled. |
3543 |
+ |
// heff->GetYaxis()->SetLabelSize(0.05); // paper style. overruled. |
3544 |
+ |
// heff->GetXaxis()->SetTitleSize(0.06); // paper style. overruled. |
3545 |
+ |
// heff->GetYaxis()->SetTitleSize(0.06); // paper style. overruled. |
3546 |
|
heff->SetMarkerStyle(markers[icut]); |
3547 |
|
heff->Fit("func","Q+","same"); |
3548 |
|
|
3554 |
|
|
3555 |
|
// Store plot |
3556 |
|
TH1F* h = (TH1F*)heff->Clone(hname); |
3557 |
+ |
h->SetNdivisions(505,"X"); |
3558 |
|
if ( icut) h->Draw("same"); |
3559 |
|
else h->Draw(); |
3560 |
|
char htitle[256]; sprintf(htitle,"JZB > %3.0f GeV", jzb_bins[icut]); |
3575 |
|
// Calls the above function for each signal sample |
3576 |
|
void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins ) |
3577 |
|
{ |
3578 |
< |
for (int isignal=0; isignal<signalsamples.collection.size();isignal++) { |
3578 |
> |
for (int isignal=0; isignal<(int)signalsamples.collection.size();isignal++) { |
3579 |
|
dout << "JZB selection efficiency curve: " << std::endl; |
3580 |
|
JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples |
3581 |
|
} |
3618 |
|
TH1F *RcorrJZBSBeemm; |
3619 |
|
TH1F *LcorrJZBSBeemm; |
3620 |
|
|
3621 |
< |
TH1F *RcorrJZBeemmNoS; |
3621 |
> |
// TH1F *RcorrJZBeemmNoS; |
3622 |
|
|
3623 |
|
//these are for the ratio |
3624 |
|
TH1F *JRcorrJZBeemm = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3631 |
|
TH1F *JRcorrJZBSBeemm; |
3632 |
|
TH1F *JLcorrJZBSBeemm; |
3633 |
|
|
3634 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3634 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3635 |
|
RcorrJZBSBem = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3636 |
|
LcorrJZBSBem = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3637 |
|
RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3652 |
|
|
3653 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3654 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
3655 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3655 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3656 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
3657 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
3658 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3702 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
3703 |
|
string ytitle("ratio"); |
3704 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
3705 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,use_data!=1,ytitle); |
3705 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,false,ytitle); |
3706 |
|
|
3707 |
|
TH1F *allevents = qcdsamples.Draw("allevents","pfJetGoodNum",1,0,100, "internal code", "events", "" ,mc, luminosity); |
3708 |
|
TH1F *ossf = qcdsamples.Draw("ossf","pfJetGoodNum",1,0,100, "internal code", "events", cutOSSF ,mc, luminosity); |
3722 |
|
dout << "______________________________________________" << endl; |
3723 |
|
dout << "How QCD shows up in the different regions: " << endl; |
3724 |
|
dout << "OSSF: " << endl; |
3725 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3725 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3726 |
|
dout << " Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
3727 |
|
dout << " sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl; |
3728 |
|
} else { |
3729 |
|
dout << " " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
3730 |
|
} |
3731 |
|
dout << "OSOF: " << endl; |
3732 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3732 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3733 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
3734 |
|
dout << " sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl; |
3735 |
|
} else { |
3736 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
3737 |
|
} |
3738 |
|
dout << "Therefore: " << endl; |
3739 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3739 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3740 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) "; |
3741 |
|
dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) "; |
3742 |
|
dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) "; |
3749 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral() << endl; |
3750 |
|
|
3751 |
|
dout << endl; |
3752 |
< |
for(int i=0;i<bins.size();i++) { |
3752 |
> |
for(int i=0;i<(int)bins.size();i++) { |
3753 |
|
dout << " JZB > " << bins[i] << " : " << endl; |
3754 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
3755 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3755 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3756 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + (1.0/3)*(RcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX())) << endl; |
3757 |
|
} else { |
3758 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
3766 |
|
if(LcorrJZBem) delete LcorrJZBem; |
3767 |
|
if(RcorrJZBeemm) delete RcorrJZBeemm; |
3768 |
|
if(LcorrJZBeemm) delete LcorrJZBeemm; |
3769 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem; |
3770 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem; |
3771 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
3772 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
3769 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBem) delete RcorrJZBSBem; |
3770 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBem) delete LcorrJZBSBem; |
3771 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
3772 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
3773 |
|
} |
3774 |
|
|
3775 |
|
void check_ptsanity() { |
3797 |
|
leg->SetY2(1.0); |
3798 |
|
|
3799 |
|
|
3800 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
3800 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3801 |
|
string nowname=(allsamples.collection)[isample].filename; |
3802 |
|
cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl; |
3803 |
|
individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
3821 |
|
ptsancan->cd(2); |
3822 |
|
fpt2->Draw(); |
3823 |
|
|
3824 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
3824 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3825 |
|
ptsancan->cd(1); |
3826 |
|
individualpt1histos[isample]->DrawNormalized("same,histo"); |
3827 |
|
ptsancan->cd(2); |
3837 |
|
void do_mlls_plot(string mcjzb) { |
3838 |
|
cout << "At this point we'd plot the mll distribution" << endl; |
3839 |
|
TCanvas *sigcan = new TCanvas("sigcan","sigcan"); |
3840 |
< |
for(int isig=0;isig<(signalsamples.collection).size();isig++) { |
3840 |
> |
for(int isig=0;isig<(int)(signalsamples.collection).size();isig++) { |
3841 |
|
if(!(signalsamples.collection)[isig].events) continue; |
3842 |
|
string nowname=(signalsamples.collection)[isig].filename; |
3843 |
|
TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname)); |
3866 |
|
} |
3867 |
|
} |
3868 |
|
|
3869 |
< |
void met_vs_jzb_plots() { |
3869 |
> |
void met_vs_jzb_plots(string datajzb, string mcjzb) { |
3870 |
|
|
3871 |
|
TCanvas *canmetjzb = new TCanvas("canmet","MET vs JZB canvas"); |
3872 |
|
canmetjzb->SetRightMargin(0.16); |
3875 |
|
findme.push_back("DY"); |
3876 |
|
findme.push_back("TTJets"); |
3877 |
|
findme.push_back("LM"); |
3878 |
< |
|
3879 |
< |
for(int ifind=0;ifind<findme.size();ifind++) { |
3878 |
> |
/* |
3879 |
> |
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
3880 |
|
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
3881 |
|
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
3882 |
< |
for(int isel=0;isel<selsamples.size();isel++) { |
3883 |
< |
cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
3884 |
< |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF); |
3882 |
> |
for(int isel=0;isel<(int)selsamples.size();isel++) { |
3883 |
> |
dout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
3884 |
> |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF&&cutnJets); |
3885 |
|
} |
3886 |
|
metvsjzb->Scale(allsamples.collection[selsamples[0]].weight); |
3887 |
|
metvsjzb->SetStats(0); |
3895 |
|
title->Draw(); |
3896 |
|
CompleteSave(canmetjzb,(string)"METvsJZBplots/"+findme[ifind]); |
3897 |
|
} |
3898 |
+ |
*/ |
3899 |
+ |
|
3900 |
+ |
dout << "About to produce MET plot for DY split up by JZB" << endl; |
3901 |
+ |
|
3902 |
+ |
int nbins=14; |
3903 |
+ |
float low=0; |
3904 |
+ |
float high=140; |
3905 |
+ |
|
3906 |
+ |
stringstream sLEFT; |
3907 |
+ |
sLEFT << "((" << mcjzb << ")<0)"; |
3908 |
+ |
TCut LEFT(sLEFT.str().c_str()); |
3909 |
+ |
stringstream sRIGHT; |
3910 |
+ |
sRIGHT << "((" << mcjzb << ")>0)"; |
3911 |
+ |
TCut RIGHT(sRIGHT.str().c_str()); |
3912 |
+ |
|
3913 |
+ |
TH1F *metleft = allsamples.Draw("metleft","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3914 |
+ |
TH1F *metleftO = allsamples.Draw("metleftO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3915 |
+ |
TH1F *metright = allsamples.Draw("metright","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3916 |
+ |
TH1F *metrightO = allsamples.Draw("metrightO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3917 |
+ |
|
3918 |
+ |
|
3919 |
+ |
TH1F *Bpred = (TH1F*)metleft->Clone("Bpred"); |
3920 |
+ |
Bpred->Add(metleftO,-1); |
3921 |
+ |
Bpred->Add(metrightO); |
3922 |
+ |
TH1F *obs = (TH1F*)metright->Clone("obs"); |
3923 |
+ |
|
3924 |
+ |
metleft->Add(metleftO,-1); |
3925 |
+ |
metright->Add(metrightO,-1); |
3926 |
+ |
|
3927 |
+ |
metleft->SetLineColor(kRed); |
3928 |
+ |
metright->SetLineColor(kBlack); |
3929 |
+ |
TPad *metpad = new TPad("metpad","metpad",0,0,1,1); |
3930 |
+ |
metpad->cd(); |
3931 |
+ |
metpad->SetLogy(1); |
3932 |
+ |
metleft->Draw("histo"); |
3933 |
+ |
metright->Draw("same"); |
3934 |
+ |
TLegend *lg = make_legend(); |
3935 |
+ |
lg->SetX1(0.5); |
3936 |
+ |
lg->SetY1(0.7); |
3937 |
+ |
lg->AddEntry(metright,"JZB>0 (OSOF corrected)","P"); |
3938 |
+ |
lg->AddEntry(metleft,"JZB<0 (OSOF corrected)","L"); |
3939 |
+ |
lg->SetHeader("DY"); |
3940 |
+ |
|
3941 |
+ |
lg->Draw(); |
3942 |
+ |
save_with_ratio(metright,metleft,metpad->cd(),"METvsJZBplots/ComparingLeftToRightinMETspectrum"); |
3943 |
+ |
|
3944 |
+ |
TPad *metpad3 = new TPad("metpad3","metpad3",0,0,1,1); |
3945 |
+ |
metpad3->cd(); |
3946 |
+ |
metpad3->SetLogy(1); |
3947 |
+ |
Bpred->SetLineColor(kRed); |
3948 |
+ |
Bpred->Draw("histo"); |
3949 |
+ |
obs->SetLineColor(kBlack); |
3950 |
+ |
obs->Draw("same"); |
3951 |
+ |
TLegend *lg2 = make_legend(); |
3952 |
+ |
lg2->SetX1(0.5); |
3953 |
+ |
lg2->SetY1(0.7); |
3954 |
+ |
lg2->AddEntry(obs,"observed","P"); |
3955 |
+ |
lg2->AddEntry(Bpred,"predicted","L"); |
3956 |
+ |
lg2->SetHeader("DY"); |
3957 |
+ |
|
3958 |
+ |
lg2->Draw(); |
3959 |
+ |
|
3960 |
+ |
save_with_ratio(obs,Bpred,metpad3->cd(),"METvsJZBplots/ComparingPredObsinMET"); |
3961 |
+ |
|
3962 |
+ |
TPad *metpad2 = new TPad("metpad2","metpad2",0,0,1,1); |
3963 |
+ |
metpad2->cd(); |
3964 |
+ |
metpad2->SetLogy(1); |
3965 |
+ |
|
3966 |
+ |
TH1F *metlefta = allsamples.Draw("metlefta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3967 |
+ |
TH1F *metleftOa = allsamples.Draw("metleftOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3968 |
+ |
TH1F *metrighta = allsamples.Draw("metrighta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3969 |
+ |
TH1F *metrightOa = allsamples.Draw("metrightOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3970 |
+ |
|
3971 |
+ |
metlefta->Add(metleftOa,-1); |
3972 |
+ |
metrighta->Add(metrightOa,-1); |
3973 |
+ |
|
3974 |
+ |
metlefta->SetLineColor(kRed); |
3975 |
+ |
metpad2->cd(); |
3976 |
+ |
metlefta->Draw("histo"); |
3977 |
+ |
metrighta->Draw("same"); |
3978 |
+ |
lg->Draw(); |
3979 |
+ |
save_with_ratio(metrighta,metlefta,metpad2->cd(),"METvsJZBplots/ComparingLeftToRightinMET_type1_spectrum"); |
3980 |
+ |
|
3981 |
+ |
delete Bpred; |
3982 |
+ |
delete obs; |
3983 |
+ |
|
3984 |
+ |
float newhigh=300; |
3985 |
+ |
int newNBins=30; |
3986 |
+ |
|
3987 |
+ |
TPad *metpad4 = new TPad("metpad4","metpad4",0,0,1,1); |
3988 |
+ |
TH1F *Ametleft = allsamples.Draw("Ametleft","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity); |
3989 |
+ |
TH1F *AmetleftO = allsamples.Draw("AmetleftO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity); |
3990 |
+ |
TH1F *Ametright = allsamples.Draw("Ametright","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity); |
3991 |
+ |
TH1F *AmetrightO = allsamples.Draw("AmetrightO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity); |
3992 |
+ |
|
3993 |
+ |
TH1F *aBpred = (TH1F*)Ametleft->Clone("aBpred"); |
3994 |
+ |
aBpred->Add(AmetleftO,-1); |
3995 |
+ |
aBpred->Add(AmetrightO); |
3996 |
+ |
aBpred->SetLineColor(kRed); |
3997 |
+ |
|
3998 |
+ |
TH1F *aobs = (TH1F*)Ametright->Clone("aobs"); |
3999 |
+ |
metpad4->cd(); |
4000 |
+ |
metpad4->SetLogy(1); |
4001 |
+ |
aobs->Draw(); |
4002 |
+ |
aBpred->Draw("histo,same"); |
4003 |
+ |
aobs->Draw("same"); |
4004 |
+ |
lg->SetHeader("All MC"); |
4005 |
+ |
lg->Draw(); |
4006 |
+ |
save_with_ratio(aobs,aBpred,metpad4->cd(),"METvsJZBplots/ComparingPredObsinMET_ALLSAMPLES"); |
4007 |
+ |
|
4008 |
+ |
|
4009 |
+ |
delete lg; |
4010 |
+ |
delete canmetjzb; |
4011 |
+ |
delete metleft; |
4012 |
+ |
delete metleftO; |
4013 |
+ |
delete metright; |
4014 |
+ |
delete metrightO; |
4015 |
|
} |
4016 |
|
|
4017 |
|
|
4019 |
|
|
4020 |
|
TCanvas *testcanv = new TCanvas("testcanv","testcanv"); |
4021 |
|
testcanv->cd(); |
4022 |
< |
switch_overunderflow(true); |
4022 |
> |
// switch_overunderflow(true); |
4023 |
|
TH1F *ptdistr = allsamples.Draw("ptdistr","pt1",100,30,200, "p_{T} [GeV]", "events", cutOSSF,data,luminosity); |
4024 |
|
switch_overunderflow(false); |
4025 |
|
ptdistr->Draw(); |