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"); |
231 |
> |
mcRcorrJZBeemm.Draw("histo,same"); |
232 |
|
Bpred->Draw("histo,same"); |
233 |
|
RcorrJZBeemm->Draw("same"); |
234 |
|
|
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; |
285 |
|
} |
286 |
|
delete Bpred; |
287 |
|
delete ckin; |
288 |
+ |
CleanLegends(); |
289 |
|
} |
290 |
|
|
291 |
|
void make_special_mll_plot(int nbins, float min, float max, bool logscale,string xlabel) { |
306 |
|
datahistoOSSF->SetMarkerSize(DataMarkerSize); |
307 |
|
datahistoOSSF->Draw(); |
308 |
|
|
309 |
< |
mcstackOSSF.Draw("same"); |
309 |
> |
mcstackOSSF.Draw("histo,same"); |
310 |
|
datahistoOSSF->Draw("same"); |
311 |
|
|
312 |
|
datahistoOSOF->SetMarkerColor(TColor::GetColor("#FE642E")); |
322 |
|
TIter next(bgleg->GetListOfPrimitives()); |
323 |
|
TObject* obj; |
324 |
|
// Copy the nice bkgd legend skipping the "data" |
325 |
< |
while ( obj = next() ) |
325 |
> |
while ( (obj = next()) ) |
326 |
|
if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") ) |
327 |
|
kinleg->GetListOfPrimitives()->Add(obj); |
328 |
|
|
332 |
|
delete datahistoOSOF; |
333 |
|
delete datahistoOSSF; |
334 |
|
delete ckin; |
335 |
+ |
CleanLegends(); |
336 |
|
} |
337 |
|
|
338 |
|
|
342 |
|
TIter next(hmc.GetHists()); |
343 |
|
TObject* obj; |
344 |
|
TH1* hratio = NULL; |
345 |
< |
while ( obj = next() ) { |
345 |
> |
while ( (obj = next()) ) { |
346 |
|
if ( !hratio ) { |
347 |
|
hratio = (TH1*)obj->Clone(); |
348 |
|
hratio->SetName("hratio"); |
373 |
|
oneline->Draw("same"); |
374 |
|
} |
375 |
|
|
376 |
+ |
float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale, |
377 |
+ |
string xlabel, string filename, float legendPosition=0.55) { |
378 |
+ |
|
379 |
+ |
TCut ibasiccut=basiccut; |
380 |
+ |
bool draw_separation_lines=false; |
381 |
+ |
|
382 |
+ |
if(addcut != "") ibasiccut = ibasiccut && addcut.c_str(); |
383 |
+ |
|
384 |
+ |
TCut cutSF; |
385 |
+ |
TCut cutOF; |
386 |
+ |
|
387 |
+ |
cutOF = cutOSOF&&cutnJets&&ibasiccut; |
388 |
+ |
cutSF = cutOSSF&&cutnJets&&ibasiccut; |
389 |
+ |
|
390 |
+ |
TCanvas *ofsf_can = new TCanvas("ofsf_can","ofsf_can"); |
391 |
+ |
|
392 |
+ |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
393 |
+ |
rcan->SetLogy(logscale); |
394 |
+ |
rcan->cd(); |
395 |
+ |
|
396 |
+ |
std::cout << "OF/SF comparison: variable = " << variable << ", cut = " << cutSF.GetTitle() << std::endl; |
397 |
+ |
TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity); |
398 |
+ |
TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity); |
399 |
+ |
// string signal("LM3"); |
400 |
+ |
// TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
401 |
+ |
// int idx = signalsamples.FindSample(signal)[0]; |
402 |
+ |
// (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF); |
403 |
+ |
// signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
404 |
+ |
// signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor); |
405 |
+ |
// signalhisto->SetLineStyle(2); |
406 |
+ |
datahistoSF->SetMarkerSize(DataMarkerSize); |
407 |
+ |
datahistoOF->SetLineColor(kRed); |
408 |
+ |
|
409 |
+ |
if ( !logscale ) { |
410 |
+ |
datahistoSF->SetMinimum(0); // Defaults |
411 |
+ |
} else { |
412 |
+ |
datahistoSF->SetMinimum(0.5); |
413 |
+ |
} |
414 |
+ |
if (ymax<0) { |
415 |
+ |
if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum()); |
416 |
+ |
else datahistoSF->SetMaximum(0.8*datahistoSF->GetMaximum()); |
417 |
+ |
} else { |
418 |
+ |
datahistoSF->SetMaximum(ymax); |
419 |
+ |
} |
420 |
+ |
|
421 |
+ |
float ymaxSet = datahistoSF->GetMaximum(); |
422 |
+ |
|
423 |
+ |
datahistoSF->GetXaxis()->SetTitle(xlabel.c_str()); |
424 |
+ |
datahistoSF->GetYaxis()->SetTitle("Events"); |
425 |
+ |
datahistoSF->GetXaxis()->CenterTitle(); |
426 |
+ |
datahistoSF->GetYaxis()->CenterTitle(); |
427 |
+ |
|
428 |
+ |
TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.7,false,legendPosition+0.2); |
429 |
+ |
mleg->AddEntry(datahistoSF, "Same-flavor", "PL"); |
430 |
+ |
if (datahistoOF->Integral()>0) { |
431 |
+ |
mleg->AddEntry(datahistoOF, "Opposite-flavor", "L"); |
432 |
+ |
} else { |
433 |
+ |
mleg->AddEntry((TObject*)0, "", ""); |
434 |
+ |
} |
435 |
+ |
//mleg->AddEntry(signalhisto, "LM3", "L"); |
436 |
+ |
|
437 |
+ |
datahistoSF->Draw("E1"); |
438 |
+ |
if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES"); |
439 |
+ |
//signalhisto->Draw("HIST,SAMES"); |
440 |
+ |
mleg->Draw(); |
441 |
+ |
DrawPrelim(); |
442 |
+ |
if (datahistoOF->Integral()>0) { |
443 |
+ |
Save_With_Ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" ); |
444 |
+ |
} else { |
445 |
+ |
CompleteSave(rcan, "SFOF/" + filename); |
446 |
+ |
} |
447 |
+ |
|
448 |
+ |
datahistoSF->Delete(); |
449 |
+ |
datahistoOF->Delete(); |
450 |
+ |
//signalhisto->Delete(); |
451 |
+ |
delete mleg; |
452 |
+ |
delete rcan; |
453 |
+ |
delete ofsf_can; |
454 |
+ |
|
455 |
+ |
return ymaxSet; |
456 |
+ |
|
457 |
+ |
} |
458 |
+ |
|
459 |
+ |
// Compare data to data |
460 |
+ |
float make_data_comparison_plot(string variable, TCut cut, int nbins, float min, float max, float ymax, bool logscale, |
461 |
+ |
string xlabel, string filename, float legendPosition=0.55) { |
462 |
+ |
|
463 |
+ |
TCut ibasiccut=basiccut&&cut; |
464 |
+ |
|
465 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
466 |
+ |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
467 |
+ |
rcan->SetLogy(logscale); |
468 |
+ |
rcan->cd(); |
469 |
+ |
|
470 |
+ |
std::cout << "Data comparison: variable = " << variable << ", cut = " << ibasiccut.GetTitle() << std::endl; |
471 |
+ |
|
472 |
+ |
TH1F *data1 = allsamples.Draw("data1",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity); |
473 |
+ |
TH1F *data2 = comparesamples.Draw("data2",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity); |
474 |
+ |
data1->Scale(5.0/9.2); |
475 |
+ |
|
476 |
+ |
data1->SetMarkerSize(DataMarkerSize); |
477 |
+ |
data2->SetLineColor(kRed); |
478 |
+ |
|
479 |
+ |
if ( !logscale ) { |
480 |
+ |
data1->SetMinimum(0); // Defaults |
481 |
+ |
} else { |
482 |
+ |
data1->SetMinimum(0.5); |
483 |
+ |
} |
484 |
+ |
if (ymax<0) { |
485 |
+ |
if ( logscale ) data1->SetMaximum(5.3*data1->GetMaximum()); |
486 |
+ |
else data1->SetMaximum(1.5*data1->GetMaximum()); |
487 |
+ |
} else { |
488 |
+ |
data1->SetMaximum(ymax); |
489 |
+ |
} |
490 |
+ |
|
491 |
+ |
float ymaxSet = data1->GetMaximum(); |
492 |
+ |
|
493 |
+ |
data1->GetXaxis()->SetTitle(xlabel.c_str()); |
494 |
+ |
data1->GetYaxis()->SetTitle("Events"); |
495 |
+ |
data1->GetXaxis()->CenterTitle(); |
496 |
+ |
data1->GetYaxis()->CenterTitle(); |
497 |
+ |
|
498 |
+ |
TLegend *mleg = make_legend("",legendPosition,0.7,false,legendPosition+0.2); |
499 |
+ |
mleg->AddEntry(data1, "2012 data (scaled)", "PL"); |
500 |
+ |
mleg->AddEntry(data2, "2011 data", "L"); |
501 |
+ |
|
502 |
+ |
data1->Draw("E1"); |
503 |
+ |
data2->Draw("HIST,SAMES"); |
504 |
+ |
mleg->Draw(); |
505 |
+ |
DrawPrelim(); |
506 |
+ |
Save_With_Ratio( data1, data2, rcan, "compareData/" + filename, false, false, "new/old" ); |
507 |
+ |
|
508 |
+ |
data1->Delete(); |
509 |
+ |
data2->Delete(); |
510 |
+ |
delete mleg; |
511 |
+ |
delete rcan; |
512 |
+ |
delete ckin; |
513 |
+ |
|
514 |
+ |
} |
515 |
+ |
|
516 |
+ |
void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale, |
517 |
+ |
string xlabel, string filename, float legendPosition=0.55) { |
518 |
+ |
|
519 |
+ |
string mllcuts[] = { "mll>20","mll>15&&mll<70", "mll>75&&mll<105", "mll>120" }; |
520 |
+ |
string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 120 GeV" }; |
521 |
+ |
string plotname[] = {"_all","_low","_peak","_high"}; |
522 |
+ |
float ymax; |
523 |
+ |
|
524 |
+ |
int start = 0; |
525 |
+ |
if ( !PlottingSetup::openBox ) start = 3; |
526 |
+ |
|
527 |
+ |
for ( int i=start; i<4; ++i ) { |
528 |
+ |
if ( addcut != "" ) mllcuts[i] += "&&"+addcut; |
529 |
+ |
if ( i==start ) { |
530 |
+ |
ymax = make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, -1, logscale, xlabel, |
531 |
+ |
filename+plotname[i], legendPosition ); |
532 |
+ |
} else { |
533 |
+ |
make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
534 |
+ |
filename+plotname[i], legendPosition ); |
535 |
+ |
} |
536 |
+ |
make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
537 |
+ |
filename+plotname[i]+"_mm", legendPosition ); |
538 |
+ |
make_one_OFSF_plot(variable, "id1==0&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
539 |
+ |
filename+plotname[i]+"_ee", legendPosition ); |
540 |
+ |
} |
541 |
+ |
|
542 |
+ |
} |
543 |
+ |
|
544 |
+ |
TCut ReplaceInCut(TCut cut, string replacethis, string withthis) { |
545 |
+ |
string scut=(string)(const char*)cut; |
546 |
+ |
string acut=ReplaceAll(scut,replacethis,withthis); |
547 |
+ |
return TCut(acut.c_str()); |
548 |
+ |
} |
549 |
+ |
|
550 |
+ |
void DoMCSystPlot(string datavariable, string mcvariable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
551 |
+ |
TCut cut=addcut&&basiccut; |
552 |
+ |
|
553 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
554 |
+ |
ckin->SetLogy(dolog); |
555 |
+ |
cout << "\r Creating " << filename << " : data (1/6)" << std::flush; |
556 |
+ |
TH1F *datahisto = allsamples.Draw("datahisto",datavariable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
557 |
+ |
datahisto->SetMarkerSize(DataMarkerSize); |
558 |
+ |
if ( !dolog ) datahisto->SetMinimum(0); // Defaults |
559 |
+ |
else datahisto->SetMinimum(0.5); |
560 |
+ |
if (dolog) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
561 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
562 |
+ |
cout << "\r Creating " << filename << " : MC central (2/6)" << std::flush; |
563 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
564 |
+ |
TH1F *MCcentral = CollapseStack(mcstack); |
565 |
+ |
|
566 |
+ |
TCut bkpcut = cut; |
567 |
+ |
cut = ReplaceInCut(cut,"pfJetGoodNum40","pfJetGoodNum40p1sigma"); |
568 |
+ |
cout << "\r Creating " << filename << " : MC JES up (3/6)" << std::flush; |
569 |
+ |
TH1F *MCJESup = allsamples.Draw("MCJESup", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
570 |
+ |
|
571 |
+ |
cut = ReplaceInCut(cut,"pfJetGoodNum40p1sigma","pfJetGoodNum40n1sigma"); |
572 |
+ |
cout << "\r Creating " << filename << " : MC JES down (4/6)" << std::flush; |
573 |
+ |
TH1F *MCJESdn = allsamples.Draw("MCJESdn", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
574 |
+ |
|
575 |
+ |
cut=bkpcut; |
576 |
+ |
TCut bkpweight = cutWeight; |
577 |
+ |
cutWeight= ReplaceInCut(cutWeight,"weight","PUweightUP"); |
578 |
+ |
cout << "\r Creating " << filename << " : MC PU up (5/6)" << std::flush; |
579 |
+ |
TH1F *MCPUup = allsamples.Draw("MCPUup", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
580 |
+ |
|
581 |
+ |
cutWeight= ReplaceInCut(cutWeight,"PUweightUP","PUweightDOWN"); |
582 |
+ |
cout << "\r Creating " << filename << " : MC PU down (6/6)" << std::flush; |
583 |
+ |
TH1F *MCPUdn = allsamples.Draw("MCPUdn", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
584 |
+ |
cutWeight=bkpweight; |
585 |
+ |
cout << "\r Creating " << filename << " : Processing systematics ..." << std::flush; |
586 |
+ |
TH1F *Systematic = (TH1F*)MCPUdn->Clone("Systematic"); |
587 |
+ |
for(int i=1;i<=Systematic->GetNbinsX();i++) { |
588 |
+ |
float jesdn = abs(MCcentral->GetBinContent(i)-MCJESdn->GetBinContent(i)); |
589 |
+ |
float jesup = abs(MCcentral->GetBinContent(i)-MCJESup->GetBinContent(i)); |
590 |
+ |
float jes = jesdn>jesup?jesdn:jesup; |
591 |
+ |
|
592 |
+ |
float PUup = abs(MCcentral->GetBinContent(i)-MCPUup->GetBinContent(i)); |
593 |
+ |
float PUdn = abs(MCcentral->GetBinContent(i)-MCPUdn->GetBinContent(i)); |
594 |
+ |
float pu = PUdn>PUup?PUdn:PUup; |
595 |
+ |
|
596 |
+ |
float sys=sqrt(jes*jes+pu*pu); |
597 |
+ |
sys/=MCcentral->GetBinContent(i); |
598 |
+ |
if(MCcentral->GetBinContent(i)==0) sys=0; |
599 |
+ |
Systematic->SetBinContent(i,sys); |
600 |
+ |
} |
601 |
+ |
|
602 |
+ |
datahisto->Draw("e1"); |
603 |
+ |
ckin->Update(); |
604 |
+ |
mcstack.Draw("histo,same"); |
605 |
+ |
|
606 |
+ |
datahisto->Draw("same,e1"); |
607 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
608 |
+ |
kinleg->Draw(); |
609 |
+ |
|
610 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
611 |
+ |
kinpad->SetLogy(dolog); |
612 |
+ |
kinpad->cd(); |
613 |
+ |
datahisto->Draw("e1"); |
614 |
+ |
mcstack.Draw("histo,same"); |
615 |
+ |
datahisto->Draw("same,e1"); |
616 |
+ |
datahisto->Draw("same,axis"); |
617 |
+ |
|
618 |
+ |
kinleg->Draw("same"); |
619 |
+ |
DrawPrelim(); |
620 |
+ |
string saveas="kin/"+filename; |
621 |
+ |
|
622 |
+ |
cout << "Passing filename to be saved : " << filename << " as " << saveas << endl; |
623 |
+ |
save_with_ratio_and_sys_band( datahisto, CollapseStack(mcstack), kinpad->cd(), saveas, false, false, "data/mc",Systematic ); |
624 |
+ |
|
625 |
+ |
ckin->cd(); |
626 |
+ |
MCcentral->SetFillColor(kWhite); |
627 |
+ |
MCcentral->SetLineColor(kBlack); |
628 |
+ |
MCcentral->SetLineWidth(2); |
629 |
+ |
MCPUdn->SetLineColor(kRed); |
630 |
+ |
MCPUup->SetLineColor(kYellow); |
631 |
+ |
MCJESdn->SetLineColor(kBlue); |
632 |
+ |
MCJESup->SetLineColor(kGreen); |
633 |
+ |
|
634 |
+ |
TLegend *legsmall = new TLegend(0.0,0.85,1.0,1.00); |
635 |
+ |
legsmall->SetNColumns(5); |
636 |
+ |
legsmall->AddEntry(MCcentral,"central","L"); |
637 |
+ |
legsmall->AddEntry(MCPUdn,"PU down","L"); |
638 |
+ |
legsmall->AddEntry(MCPUup,"PU up","L"); |
639 |
+ |
legsmall->AddEntry(MCJESdn,"JES down","L"); |
640 |
+ |
legsmall->AddEntry(MCJESup,"JES up","L"); |
641 |
+ |
legsmall->SetFillColor(kWhite); |
642 |
+ |
legsmall->SetBorderSize(0); |
643 |
+ |
|
644 |
+ |
datahisto->Draw("e1"); |
645 |
+ |
MCcentral->Draw("histo,same"); |
646 |
+ |
MCPUdn->Draw("histo,same"); |
647 |
+ |
MCPUup->Draw("histo,same"); |
648 |
+ |
MCJESdn->Draw("histo,same"); |
649 |
+ |
MCJESup->Draw("histo,same"); |
650 |
+ |
datahisto->Draw("e1,same"); |
651 |
+ |
legsmall->Draw(); |
652 |
+ |
CompleteSave(ckin,saveas+"___AllLines"); |
653 |
+ |
|
654 |
+ |
delete datahisto; |
655 |
+ |
delete MCcentral; |
656 |
+ |
delete MCPUdn; |
657 |
+ |
delete MCPUup; |
658 |
+ |
delete MCJESdn; |
659 |
+ |
delete MCJESup; |
660 |
+ |
delete ckin; |
661 |
+ |
} |
662 |
+ |
|
663 |
+ |
void DoMCSystPlot(string variable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
664 |
+ |
DoMCSystPlot(variable, variable, nbins, min, max, addcut, dolog, xlabel, filename); |
665 |
+ |
} |
666 |
+ |
|
667 |
|
float lastrange_min=0; |
668 |
|
float lastrange_max=0; |
669 |
|
|
672 |
|
// TCut basiccut("(pfJetGoodNum>=2&&pfJetGoodID[0])&&(pfJetGoodNum>=2&&pfJetGoodID[1])&&(passed_triggers||!is_data)"); |
673 |
|
TCut ibasiccut=basiccut; |
674 |
|
bool draw_separation_lines=false; |
675 |
+ |
bool drawsignal = false; |
676 |
|
|
677 |
|
if(isPF) ibasiccut=basiccut&&"pfjzb[0]>-998"; |
678 |
|
|
694 |
|
//Step 2: Refine the cut |
695 |
|
TCut cut; |
696 |
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut; |
697 |
< |
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut; |
697 |
> |
if(filename=="nJets" || filename=="nJets_inclusive" || filename=="nJets_met100" || filename=="nJets_inclusive_met100") cut=cutmass&&cutOSSF&&ibasiccut; |
698 |
> |
if(filename=="nJets_osof" || filename=="nJets_osof_inclusive" || filename=="nJets_osof_met100" || filename=="nJets_osof_inclusive_met100") cut=cutmass&&cutOSOF&&ibasiccut; |
699 |
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF; |
700 |
< |
if(filename=="mll") { |
700 |
> |
if(filename=="mll"||filename=="mll_met100") { |
701 |
|
cut=cutOSSF&&cutnJets&&ibasiccut; |
702 |
|
draw_separation_lines=true; |
703 |
|
} |
704 |
< |
if(filename=="mll_ee") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0"; |
705 |
< |
if(filename=="mll_osof") { |
704 |
> |
if(filename=="mll_ee"||filename=="mll_ee_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0"; |
705 |
> |
if(filename=="mll_mm"||filename=="mll_mm_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
706 |
> |
if(filename=="mll_osof"||filename=="mll_osof_met100") { |
707 |
|
cut=cutOSOF&&cutnJets&&ibasiccut; |
708 |
|
draw_separation_lines=true; |
709 |
|
} |
710 |
< |
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
711 |
< |
if(Contains(filename,"mll_aboveJZB100")) cut=cutOSSF&&cutnJets&&ibasiccut; |
710 |
> |
if(Contains(filename,"aboveJZB")) cut=cutOSSF&&cutnJets&&ibasiccut; |
711 |
> |
if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0"; |
712 |
> |
if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1"; |
713 |
|
if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut; |
714 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF; |
715 |
|
if(filename=="mll_inclusive_osof") cut=cutOSOF; |
717 |
|
if(filename=="mll_inclusive_mm") cut=cutOSSF&&"id1==1"; |
718 |
|
if(filename=="pfJetGoodEta_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets; |
719 |
|
if(filename=="pfJetGoodPt_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets; |
720 |
+ |
if(filename=="numVtx") cut=cutmass&&ibasiccut; |
721 |
|
|
722 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
723 |
|
ckin->SetLogy(logscale); |
724 |
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
725 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
726 |
< |
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
726 |
> |
if ( !logscale ) datahisto->SetMinimum(0); // Defaults |
727 |
> |
else datahisto->SetMinimum(0.5); |
728 |
> |
// Custom max. |
729 |
> |
if(variable=="TMath::Abs(pfJetDphiMet[0])") datahisto->SetMaximum(1.5*datahisto->GetMaximum()); |
730 |
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
731 |
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
732 |
< |
if(filename=="mll_inclusive") datahisto->SetMinimum(1); |
732 |
> |
if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1); |
733 |
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
734 |
|
if(filename=="mll_osof") datahisto->SetMinimum(9); |
735 |
+ |
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
736 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
737 |
|
|
738 |
< |
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
304 |
< |
datahisto->Draw("e1"); |
305 |
< |
ckin->Update(); |
738 |
> |
cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl; |
739 |
|
if(loadlastminmax) { |
740 |
|
datahisto->SetMinimum(lastrange_min); |
741 |
|
datahisto->SetMaximum(lastrange_max); |
745 |
|
} |
746 |
|
} |
747 |
|
|
748 |
< |
mcstack.Draw("same"); |
748 |
> |
// Draw signal by hand (for some reason I don't manage to use the sample class: it adds it to the stack!) |
749 |
> |
string signal("LM3"); |
750 |
> |
TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
751 |
> |
int idx = signalsamples.FindSample(signal)[0]; |
752 |
> |
if(drawsignal) (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut); |
753 |
> |
if(drawsignal) signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
754 |
> |
if(drawsignal) signalhisto->SetLineColor(kOrange); |
755 |
> |
|
756 |
> |
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
757 |
> |
datahisto->Draw("e1"); |
758 |
> |
ckin->Update(); |
759 |
> |
mcstack.Draw("histo,same"); |
760 |
> |
|
761 |
|
datahisto->Draw("same,e1"); |
762 |
|
TLegend *kinleg = allsamples.allbglegend(); |
763 |
|
kinleg->Draw(); |
799 |
|
kinpad->cd(); |
800 |
|
kinpad->SetLogy(logscale); |
801 |
|
datahisto->Draw("e1"); |
802 |
< |
mcstack.Draw("same"); |
802 |
> |
mcstack.Draw("histo,same"); |
803 |
> |
if(drawsignal) signalhisto->Draw("same"); |
804 |
|
datahisto->Draw("same,e1"); |
805 |
|
datahisto->Draw("same,axis"); |
806 |
|
if(RestrictToMassPeak&&draw_separation_lines) { |
808 |
|
upperboundary->Draw("same"); |
809 |
|
} |
810 |
|
|
811 |
+ |
if(drawsignal) kinleg->AddEntry("signalhisto",signal.c_str(),"l"); |
812 |
|
kinleg->Draw(); |
813 |
|
write_cut->Draw(); |
814 |
|
DrawPrelim(); |
815 |
|
string saveas="kin/"+filename; |
816 |
|
if(isPF) saveas="kin/"+filename+"__PF"; |
817 |
< |
save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas); |
817 |
> |
Save_With_Ratio(datahisto,mcstack,kinpad->cd(),saveas); |
818 |
|
// if(isPF) CompleteSave(with_ratio,"kin/"+filename+"__PF_withratio"); |
819 |
|
// else CompleteSave(with_ratio,"kin/"+filename+"_withratio"); |
820 |
|
// delete with_ratio; |
823 |
|
else CompleteSave(ckin,"kin/"+filename); |
824 |
|
} |
825 |
|
datahisto->Delete(); |
826 |
+ |
delete signalhisto; |
827 |
|
delete ckin; |
828 |
|
} |
829 |
|
|
830 |
< |
void make_JES_plot() { |
830 |
> |
|
831 |
> |
void make_plain_kin_plot(string variable, string addcut, int nbins, float min, float max, bool logscale, |
832 |
> |
string xlabel, string filename, bool isPF=true, bool plotratio=true, bool loadlastminmax=false ) { |
833 |
> |
TCut cut=TCut(addcut.c_str())&&basiccut; |
834 |
> |
|
835 |
> |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
836 |
> |
ckin->SetLogy(logscale); |
837 |
> |
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
838 |
> |
datahisto->SetMarkerSize(DataMarkerSize); |
839 |
> |
if ( !logscale ) datahisto->SetMinimum(0); // Defaults |
840 |
> |
else datahisto->SetMinimum(0.5); |
841 |
> |
// Custom max. |
842 |
> |
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
843 |
> |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
844 |
> |
|
845 |
> |
cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl; |
846 |
> |
if(loadlastminmax) { |
847 |
> |
datahisto->SetMinimum(lastrange_min); |
848 |
> |
datahisto->SetMaximum(lastrange_max); |
849 |
> |
if(logscale) { |
850 |
> |
datahisto->SetMinimum(pow(10,lastrange_min)); |
851 |
> |
datahisto->SetMaximum(pow(10,lastrange_max)); |
852 |
> |
} |
853 |
> |
} |
854 |
> |
|
855 |
> |
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
856 |
> |
datahisto->Draw("e1"); |
857 |
> |
ckin->Update(); |
858 |
> |
mcstack.Draw("histo,same"); |
859 |
> |
|
860 |
> |
datahisto->Draw("same,e1"); |
861 |
> |
TLegend *kinleg = allsamples.allbglegend(); |
862 |
> |
kinleg->Draw(); |
863 |
> |
|
864 |
> |
lastrange_min=ckin->GetUymin(); |
865 |
> |
lastrange_max=ckin->GetUymax(); |
866 |
> |
|
867 |
> |
if ( plotratio ) { |
868 |
> |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
869 |
> |
kinpad->cd(); |
870 |
> |
kinpad->SetLogy(logscale); |
871 |
> |
datahisto->Draw("e1"); |
872 |
> |
mcstack.Draw("histo,same"); |
873 |
> |
datahisto->Draw("same,e1"); |
874 |
> |
datahisto->Draw("same,axis"); |
875 |
> |
|
876 |
> |
kinleg->Draw(); |
877 |
> |
DrawPrelim(); |
878 |
> |
string saveas="kin/"+filename; |
879 |
> |
if(isPF) saveas="kin/"+filename+"__PF"; |
880 |
> |
Save_With_Ratio(datahisto,mcstack,kinpad->cd(),saveas); |
881 |
> |
} else { |
882 |
> |
if(isPF) CompleteSave(ckin,"kin/"+filename+"__PF"); |
883 |
> |
else CompleteSave(ckin,"kin/"+filename); |
884 |
> |
} |
885 |
> |
datahisto->Delete(); |
886 |
> |
delete ckin; |
887 |
> |
} |
888 |
> |
|
889 |
> |
|
890 |
> |
void make_JES_plot(TCut cut, string name) { |
891 |
|
|
892 |
|
int nbins=10; |
893 |
|
float min=-0.5; |
894 |
|
float max = 9.5; |
895 |
|
bool logscale=true; |
896 |
|
string xlabel="nJets"; |
389 |
– |
TCut cut=cutmass&&cutOSSF&&basiccut; |
897 |
|
|
898 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
899 |
|
ckin->SetLogy(logscale); |
900 |
< |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,data,luminosity); |
900 |
> |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,data,luminosity); |
901 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
902 |
< |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
903 |
< |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum315",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
904 |
< |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum285",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
902 |
> |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
903 |
> |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum40p1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
904 |
> |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum40n1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
905 |
|
|
906 |
|
datahisto->SetMinimum(1); |
907 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); // in line with kinematic plots style |
920 |
|
JESunc->SetFillColor(TColor::GetColor("#00ADE1")); |
921 |
|
JESunc->SetFillStyle(3002); |
922 |
|
datahisto->Draw("e1"); |
923 |
< |
mcstack.Draw("same"); |
923 |
> |
mcstack.Draw("histo,same"); |
924 |
|
JESunc->Draw("2"); |
925 |
|
datahisto->Draw("same,e1"); |
926 |
|
TLegend *kinleg = allsamples.allbglegend(); |
927 |
|
kinleg->AddEntry(JESunc,"JES uncertainty","f"); |
928 |
|
kinleg->Draw(); |
929 |
< |
CompleteSave(ckin,"Systematics/JES"); |
929 |
> |
CompleteSave(ckin,"Systematics/JES"+name); |
930 |
|
datahisto->Delete(); |
931 |
|
delete ckin; |
932 |
+ |
delete JESunc; |
933 |
+ |
delete JESup; |
934 |
+ |
delete JESdn; |
935 |
+ |
CleanLegends(); |
936 |
+ |
} |
937 |
+ |
|
938 |
+ |
string Cut2Str(TCut cut) { |
939 |
+ |
return ((string)(const char*)cut); |
940 |
+ |
} |
941 |
+ |
|
942 |
+ |
void MakeElegantTwoThreeComparisons() { |
943 |
+ |
|
944 |
+ |
TCut signal("met[4]>100&&met[4]<150&&mll>20"&&PlottingSetup::basicqualitycut); |
945 |
+ |
TCut TwoJets("pfJetGoodNum40==2"); |
946 |
+ |
TCut ThreeJets("pfJetGoodNum40>=3"); |
947 |
+ |
|
948 |
+ |
float min=20; |
949 |
+ |
float max=300; |
950 |
+ |
int nbins=int((max-min)/5.0); |
951 |
+ |
string xlabel="m_{ll} [GeV]"; |
952 |
+ |
|
953 |
+ |
TCanvas *can2 = new TCanvas("can2","can2"); |
954 |
+ |
TH1F *TwoOF = allsamples.Draw("TwoOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
955 |
+ |
TH1F *TwoSF = allsamples.Draw("TwoSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
956 |
+ |
TH1F *ThreeOF = allsamples.Draw("ThreeOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
957 |
+ |
TH1F *ThreeSF = allsamples.Draw("ThreeSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
958 |
+ |
|
959 |
+ |
can2->cd(1); |
960 |
+ |
|
961 |
+ |
TwoSF->SetFillColor(kWhite); |
962 |
+ |
TwoOF->SetFillColor(kWhite); |
963 |
+ |
ThreeSF->SetFillColor(kWhite); |
964 |
+ |
ThreeOF->SetFillColor(kWhite); |
965 |
+ |
|
966 |
+ |
TPad *kin3 = new TPad("kin3","kin3",0,0,1,1); |
967 |
+ |
kin3->cd(); |
968 |
+ |
TwoOF->Draw("histo"); |
969 |
+ |
TwoSF->Draw("e1,same"); |
970 |
+ |
TLegend *leg_SFOF_Two = make_legend(); |
971 |
+ |
leg_SFOF_Two->SetHeader("t#bar{t} MC:"); |
972 |
+ |
leg_SFOF_Two->AddEntry(TwoOF,"OF, nJets==2","l"); |
973 |
+ |
leg_SFOF_Two->AddEntry(TwoSF,"SF, nJets==2","lp"); |
974 |
+ |
leg_SFOF_Two->Draw(); |
975 |
+ |
Save_With_Ratio(TwoSF,TwoOF,kin3->cd(),"DoubleRatios/SFOF_Two"); |
976 |
+ |
|
977 |
+ |
TPad *kin4 = new TPad("kin4","kin4",0,0,1,1); |
978 |
+ |
kin4->cd(); |
979 |
+ |
ThreeOF->Draw("histo"); |
980 |
+ |
ThreeSF->Draw("e1,same"); |
981 |
+ |
TLegend *leg_SFOF_Three = make_legend(); |
982 |
+ |
leg_SFOF_Three->SetHeader("t#bar{t} MC:"); |
983 |
+ |
leg_SFOF_Three->AddEntry(TwoOF,"OF, nJet#geq3","l"); |
984 |
+ |
leg_SFOF_Three->AddEntry(TwoSF,"SF, nJets#geq3","lp"); |
985 |
+ |
leg_SFOF_Three->Draw(); |
986 |
+ |
Save_With_Ratio(ThreeSF,ThreeOF,kin4->cd(),"DoubleRatios/SFOF_Three"); |
987 |
+ |
|
988 |
+ |
|
989 |
+ |
TwoSF->Scale(ThreeSF->Integral()/TwoSF->Integral()); |
990 |
+ |
TPad *kin = new TPad("kin","kin",0,0,1,1); |
991 |
+ |
kin->cd(); |
992 |
+ |
TwoSF->Draw("histo"); |
993 |
+ |
ThreeSF->Draw("e1,same"); |
994 |
+ |
TLegend *leg_SF_Two_Three = make_legend(); |
995 |
+ |
leg_SF_Two_Three->SetHeader("t#bar{t} MC:"); |
996 |
+ |
leg_SF_Two_Three->AddEntry(TwoSF,"#splitline{SF, nJets==2}{ (scaled)}","l"); |
997 |
+ |
leg_SF_Two_Three->AddEntry(ThreeSF,"SF, nJets#geq3","lp"); |
998 |
+ |
leg_SF_Two_Three->Draw(); |
999 |
+ |
Save_With_Ratio(TwoSF,ThreeSF,kin->cd(),"DoubleRatios/SF_Two_Three"); |
1000 |
+ |
|
1001 |
+ |
TwoOF->Scale(ThreeOF->Integral()/TwoOF->Integral()); |
1002 |
+ |
TPad *kin2 = new TPad("kin2","kin2",0,0,1,1); |
1003 |
+ |
kin2->cd(); |
1004 |
+ |
TwoOF->Draw("histo"); |
1005 |
+ |
ThreeOF->Draw("e1,same"); |
1006 |
+ |
TLegend *leg_OF_Two_Three = make_legend(); |
1007 |
+ |
leg_OF_Two_Three->SetHeader("t#bar{t} MC:"); |
1008 |
+ |
leg_OF_Two_Three->AddEntry(TwoSF,"#splitline{OF, nJets==2}{ (scaled)}","l"); |
1009 |
+ |
leg_OF_Two_Three->AddEntry(ThreeSF,"OF, nJets#geq3","lp"); |
1010 |
+ |
leg_OF_Two_Three->Draw(); |
1011 |
+ |
Save_With_Ratio(TwoOF,ThreeOF,kin2->cd(),"DoubleRatios/OF_Two_Three"); |
1012 |
+ |
|
1013 |
+ |
} |
1014 |
+ |
|
1015 |
+ |
void PresentRange(TH1F *Down, TH1F *Up, TH1F *central, TVirtualPad *pad, string title) { |
1016 |
+ |
pad->cd(); |
1017 |
+ |
TGraphErrors *gr = new TGraphErrors(Down->GetNbinsX()); |
1018 |
+ |
for(int i=1;i<=Down->GetNbinsX();i++) { |
1019 |
+ |
float average=0.5*(Down->GetBinContent(i)+Up->GetBinContent(i)); |
1020 |
+ |
float error=abs(Down->GetBinContent(i)-average); |
1021 |
+ |
gr->SetPoint(i-1,Down->GetBinCenter(i),average); |
1022 |
+ |
gr->SetPointError(i-1,Down->GetBinWidth(i)/2.0,error); |
1023 |
+ |
} |
1024 |
+ |
gr->SetFillColor(TColor::GetColor("#F79F81")); |
1025 |
+ |
gr->GetYaxis()->SetRangeUser(0,2); |
1026 |
+ |
gr->GetXaxis()->SetTitle(central->GetXaxis()->GetTitle()); |
1027 |
+ |
gr->GetYaxis()->SetTitle(central->GetYaxis()->GetTitle()); |
1028 |
+ |
gr->GetXaxis()->CenterTitle(); |
1029 |
+ |
gr->GetYaxis()->CenterTitle(); |
1030 |
+ |
|
1031 |
+ |
gr->Draw("A2"); |
1032 |
+ |
central->Draw("e1,same"); |
1033 |
+ |
DrawMCPrelim(); |
1034 |
+ |
TText *rtitle = write_text(0.8,0.8,title); |
1035 |
+ |
TLine *line = new TLine(Down->GetBinLowEdge(1),1.0,Down->GetBinLowEdge(Down->GetNbinsX())+Down->GetBinWidth(Down->GetNbinsX()),1.0); |
1036 |
+ |
line->SetLineColor(kBlue); |
1037 |
+ |
line->SetLineStyle(2); |
1038 |
+ |
line->Draw("same"); |
1039 |
+ |
rtitle->Draw("same"); |
1040 |
+ |
} |
1041 |
+ |
|
1042 |
+ |
TH1F* ProduceTTbarRatio(TH1F *datahisto, TH1F *fullmc, TH1F *originalttbar, TH1F *httbar) { |
1043 |
+ |
TH1F *basehisto = (TH1F*)fullmc->Clone("basehisto"); |
1044 |
+ |
basehisto->Add(originalttbar,-1); |
1045 |
+ |
basehisto->Add(httbar); |
1046 |
+ |
|
1047 |
+ |
string sname=httbar->GetName(); |
1048 |
+ |
sname="R"+sname.substr(1,sname.length()); |
1049 |
+ |
TH1F *ratio = (TH1F*)datahisto->Clone(sname.c_str()); |
1050 |
+ |
ratio->Divide(basehisto); |
1051 |
+ |
delete basehisto; |
1052 |
+ |
return ratio; |
1053 |
+ |
} |
1054 |
+ |
|
1055 |
+ |
void make_ttbar_comparison(string datavariable, string mcvariable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
1056 |
+ |
|
1057 |
+ |
TCut cut=addcut&&basiccut; |
1058 |
+ |
|
1059 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
1060 |
+ |
ckin->SetLogy(dolog); |
1061 |
+ |
cout << "\r Creating " << filename << " : data (1/11)" << std::flush; |
1062 |
+ |
TH1F *datahisto = allsamples.Draw("datahisto",datavariable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
1063 |
+ |
datahisto->SetMarkerSize(DataMarkerSize); |
1064 |
+ |
if ( !dolog ) datahisto->SetMinimum(0); // Defaults |
1065 |
+ |
else datahisto->SetMinimum(0.5); |
1066 |
+ |
if (dolog) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
1067 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
1068 |
+ |
cout << "\r Creating " << filename << " : MC central (stack) (2/11)" << std::flush; |
1069 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
1070 |
+ |
TH1F *MCcentral = CollapseStack(mcstack); |
1071 |
+ |
|
1072 |
+ |
cout << "\r Creating " << filename << " : MC central (histo) (3/11)" << std::flush; |
1073 |
+ |
TH1F *TCentral = allsamples.Draw ("TCentral", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,allsamples.FindSample("TTJets_")); |
1074 |
+ |
TH1F *RCentral = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TCentral); |
1075 |
+ |
|
1076 |
+ |
cout << "\r Creating " << filename << " : MC Matching up (4/11)" << std::flush; |
1077 |
+ |
TH1F *TMatchingUp = systsamples.Draw("TMatchingUp", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_matchingup")); |
1078 |
+ |
TH1F *RMatchingUp = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TMatchingUp); |
1079 |
+ |
|
1080 |
+ |
cout << "\r Creating " << filename << " : MC Matching down (5/11)" << std::flush; |
1081 |
+ |
TH1F *TMatchingDown = systsamples.Draw("TMatchingDown",mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_matchingdown")); |
1082 |
+ |
TH1F *RMatchingDown = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TMatchingDown); |
1083 |
+ |
|
1084 |
+ |
cout << "\r Creating " << filename << " : MC Scale up (6/11)" << std::flush; |
1085 |
+ |
TH1F *TScaleUp = systsamples.Draw("TScaleUp", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_scaleup")); |
1086 |
+ |
TH1F *RScaleUp = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TScaleUp); |
1087 |
+ |
|
1088 |
+ |
cout << "\r Creating " << filename << " : MC Scale down (7/11)" << std::flush; |
1089 |
+ |
TH1F *TScaleDown = systsamples.Draw("TScaleDown", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_scaledown")); |
1090 |
+ |
TH1F *RScaleDown = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TScaleDown); |
1091 |
+ |
|
1092 |
+ |
datahisto->Draw("e1"); |
1093 |
+ |
ckin->Update(); |
1094 |
+ |
mcstack.Draw("histo,same"); |
1095 |
+ |
|
1096 |
+ |
datahisto->Draw("same,e1"); |
1097 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
1098 |
+ |
kinleg->Draw(); |
1099 |
+ |
|
1100 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1101 |
+ |
kinpad->SetLogy(dolog); |
1102 |
+ |
kinpad->cd(); |
1103 |
+ |
datahisto->Draw("e1"); |
1104 |
+ |
mcstack.Draw("histo,same"); |
1105 |
+ |
datahisto->Draw("same,e1"); |
1106 |
+ |
datahisto->Draw("same,axis"); |
1107 |
+ |
|
1108 |
+ |
kinleg->Draw("same"); |
1109 |
+ |
DrawPrelim(); |
1110 |
+ |
string saveas="kin/"+filename; |
1111 |
+ |
|
1112 |
+ |
cout << "Passing filename to be saved : " << filename << " as " << saveas << endl; |
1113 |
+ |
Save_With_Ratio( datahisto, CollapseStack(mcstack), kinpad->cd(), saveas, false, false, "data/mc"); |
1114 |
+ |
delete kinpad; |
1115 |
+ |
|
1116 |
+ |
ckin->cd(); |
1117 |
+ |
TCentral->SetLineColor(kBlack); |
1118 |
+ |
|
1119 |
+ |
TMatchingUp->SetLineColor(TColor::GetColor("#2c17b1"));//blue |
1120 |
+ |
TMatchingUp->SetLineStyle(2);//dashed |
1121 |
+ |
TMatchingDown->SetLineColor(TColor::GetColor("#2c17b1")); |
1122 |
+ |
TMatchingDown->SetLineStyle(3);//dotted |
1123 |
+ |
|
1124 |
+ |
TScaleUp->SetLineColor(TColor::GetColor("#FF8500"));//orange |
1125 |
+ |
TScaleUp->SetLineStyle(2);//dashed |
1126 |
+ |
TScaleDown->SetLineColor(TColor::GetColor("#FF8500")); |
1127 |
+ |
TScaleDown->SetLineStyle(3);//dotted |
1128 |
+ |
|
1129 |
+ |
MCcentral->SetLineStyle(3); |
1130 |
+ |
MCcentral->SetLineColor(kRed); |
1131 |
+ |
|
1132 |
+ |
TCentral->Draw("e1,same"); |
1133 |
+ |
TCentral->Draw("histo,same"); |
1134 |
+ |
TMatchingUp->Draw("histo,same"); |
1135 |
+ |
TMatchingDown->Draw("histo,same"); |
1136 |
+ |
TScaleUp->Draw("histo,same"); |
1137 |
+ |
TScaleDown->Draw("histo,same"); |
1138 |
+ |
|
1139 |
+ |
TLegend *sleg = make_legend(); |
1140 |
+ |
sleg->AddEntry(TCentral,"Central","L"); |
1141 |
+ |
sleg->AddEntry(TMatchingUp,"matching up","L"); |
1142 |
+ |
sleg->AddEntry(TMatchingDown,"matching down","L"); |
1143 |
+ |
sleg->AddEntry(TScaleUp,"scale up","L"); |
1144 |
+ |
sleg->AddEntry(TScaleDown,"scale down","L"); |
1145 |
+ |
sleg->Draw(); |
1146 |
+ |
|
1147 |
+ |
CompleteSave(ckin,saveas+"___AllLines"); |
1148 |
+ |
ckin->cd(); |
1149 |
+ |
ckin->SetLogy(0); |
1150 |
+ |
|
1151 |
+ |
RCentral->SetLineColor(kBlack); |
1152 |
+ |
|
1153 |
+ |
RMatchingUp->SetLineColor(TColor::GetColor("#2c17b1"));//blue |
1154 |
+ |
RMatchingUp->SetLineStyle(2);//dashed |
1155 |
+ |
RMatchingDown->SetLineColor(TColor::GetColor("#2c17b1")); |
1156 |
+ |
RMatchingDown->SetLineStyle(3);//dotted |
1157 |
+ |
|
1158 |
+ |
RScaleUp->SetLineColor(TColor::GetColor("#FF8500"));//orange |
1159 |
+ |
RScaleUp->SetLineStyle(2);//dashed |
1160 |
+ |
RScaleDown->SetLineColor(TColor::GetColor("#FF8500")); |
1161 |
+ |
RScaleDown->SetLineStyle(3);//dotted |
1162 |
+ |
|
1163 |
+ |
RCentral->GetYaxis()->SetRangeUser(0,2); |
1164 |
+ |
RCentral->Draw("e1"); |
1165 |
+ |
RMatchingUp->Draw("histo,same"); |
1166 |
+ |
RMatchingDown->Draw("histo,same"); |
1167 |
+ |
RScaleUp->Draw("histo,same"); |
1168 |
+ |
RScaleDown->Draw("histo,same"); |
1169 |
+ |
|
1170 |
+ |
CompleteSave(ckin,saveas+"___AllRatios"); |
1171 |
+ |
|
1172 |
+ |
TCanvas *multicanvas = new TCanvas("multicanvas","multicanvas",1400,700); |
1173 |
+ |
multicanvas->Divide(2,1); |
1174 |
+ |
PresentRange(RMatchingUp,RMatchingDown,RCentral,multicanvas->cd(1),"Matching"); |
1175 |
+ |
PresentRange(RScaleUp,RScaleDown,RCentral,multicanvas->cd(2),"Scale"); |
1176 |
+ |
CompleteSave(multicanvas,saveas+"___RangeIllustration"); |
1177 |
+ |
|
1178 |
+ |
|
1179 |
+ |
delete datahisto; |
1180 |
+ |
delete TCentral; |
1181 |
+ |
delete TMatchingUp; |
1182 |
+ |
delete TMatchingDown; |
1183 |
+ |
delete TScaleUp; |
1184 |
+ |
delete TScaleDown; |
1185 |
+ |
// delete Ttmass166; |
1186 |
+ |
// delete Ttmass169; |
1187 |
+ |
// delete Ttmass175; |
1188 |
+ |
// delete Ttmass178; |
1189 |
+ |
|
1190 |
+ |
delete ckin; |
1191 |
+ |
|
1192 |
+ |
} |
1193 |
+ |
|
1194 |
+ |
void make_ttbar_comparison(string variable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
1195 |
+ |
make_ttbar_comparison(variable, variable, nbins, min, max, addcut, dolog, xlabel, filename); |
1196 |
+ |
} |
1197 |
|
|
1198 |
+ |
void ProduceJanPlots() { |
1199 |
+ |
TCanvas *c1 = new TCanvas("c1","c1"); |
1200 |
+ |
TH1F *metSF = allsamples.Draw("metSF","met[4]",30,100,400, "E_{T}^{miss} [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity); |
1201 |
+ |
TH1F *metOF = allsamples.Draw("metOF","met[4]",30,100,400, "E_{T}^{miss} [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity); |
1202 |
+ |
|
1203 |
+ |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
1204 |
+ |
rcan->cd(); |
1205 |
+ |
|
1206 |
+ |
metOF->SetLineColor(kRed); |
1207 |
+ |
metSF->Draw("e1"); |
1208 |
+ |
metOF->Draw("histo,same"); |
1209 |
+ |
metSF->Draw("e1,same"); |
1210 |
+ |
|
1211 |
+ |
TLegend *leg = make_legend(); |
1212 |
+ |
|
1213 |
+ |
leg->AddEntry(metSF,"Data SF","p"); |
1214 |
+ |
leg->AddEntry(metOF,"Data OF","l"); |
1215 |
+ |
leg->Draw(); |
1216 |
+ |
|
1217 |
+ |
DrawPrelim(); |
1218 |
+ |
|
1219 |
+ |
Save_With_Ratio(metSF,metOF,rcan,"JanPlots/ETHConfig",false,false,"SF/OF"); |
1220 |
+ |
|
1221 |
+ |
delete rcan; |
1222 |
+ |
delete metSF; |
1223 |
+ |
delete metOF; |
1224 |
+ |
delete c1; |
1225 |
+ |
} |
1226 |
+ |
|
1227 |
+ |
THStack MakeOneSystematicsPlot(TCut cut, string saveas, string variation, TH1F *hdata, string variable, int nbins, float bmin, float bmax, string label, TH1F* &thisto) { |
1228 |
+ |
THStack SystPlot = allsamples.DrawStack(variation,variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity); |
1229 |
+ |
|
1230 |
+ |
//now need to process the plot (calculate the variation and set the member of thstack accordingly!) |
1231 |
+ |
if(variation!="Central") { |
1232 |
+ |
TH1F *varttbar; |
1233 |
+ |
if(variation=="MatchingUp") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_matchingup_TuneZ2s")); |
1234 |
+ |
if(variation=="MatchingDown") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_matchingdown")); |
1235 |
+ |
if(variation=="ScaleUp") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_scaleup")); |
1236 |
+ |
if(variation=="ScaleDown") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_scaledown")); |
1237 |
+ |
assert(varttbar); |
1238 |
+ |
|
1239 |
+ |
TIter nextHisto(SystPlot.GetHists()); |
1240 |
+ |
TH1F* h; |
1241 |
+ |
while ( h = (TH1F*)nextHisto() ) { |
1242 |
+ |
if(Contains(h->GetName(),"t_bar_t")) { |
1243 |
+ |
varttbar->Scale(h->Integral()/varttbar->Integral()); |
1244 |
+ |
for(int i=0;i<=h->GetNbinsX()+1;i++) {//note that we deliberatly consider the under/overflow bin as well! |
1245 |
+ |
h->SetBinContent(i,varttbar->GetBinContent(i)); |
1246 |
+ |
h->SetBinError(i,varttbar->GetBinError(i)); |
1247 |
+ |
} |
1248 |
+ |
thisto=(TH1F*)varttbar->Clone(variation.c_str()); |
1249 |
+ |
SystPlot.Modified(); |
1250 |
+ |
} |
1251 |
+ |
} |
1252 |
+ |
delete varttbar; |
1253 |
+ |
} else { |
1254 |
+ |
TIter nextHisto(SystPlot.GetHists()); |
1255 |
+ |
TH1F* h; |
1256 |
+ |
while ( h = (TH1F*)nextHisto() ) { |
1257 |
+ |
if(Contains(h->GetName(),"t_bar_t")) thisto=(TH1F*)h->Clone(variation.c_str()); |
1258 |
+ |
} |
1259 |
+ |
} |
1260 |
+ |
|
1261 |
+ |
TLegend *fullleg = allsamples.allbglegend(); |
1262 |
+ |
fullleg->SetHeader(variation.c_str()); |
1263 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1264 |
+ |
kinpad->SetLogy(1); |
1265 |
+ |
kinpad->cd(); |
1266 |
+ |
|
1267 |
+ |
hdata->Draw("e1"); |
1268 |
+ |
SystPlot.Draw("histo,same"); |
1269 |
+ |
hdata->Draw("e1,same"); |
1270 |
+ |
fullleg->Draw(); |
1271 |
+ |
DrawPrelim(); |
1272 |
+ |
|
1273 |
+ |
Save_With_Ratio(hdata,SystPlot,kinpad,saveas+"_"+variation); |
1274 |
+ |
CleanLegends(); |
1275 |
+ |
|
1276 |
+ |
delete kinpad; |
1277 |
+ |
return SystPlot; |
1278 |
+ |
} |
1279 |
+ |
|
1280 |
+ |
|
1281 |
+ |
|
1282 |
+ |
void ProduceMCSystematicPlot(string variable, int nbins, float bmin, float bmax, string label, TCut thiscut, string saveas) { |
1283 |
+ |
TCanvas *ca = new TCanvas("ca","ca"); |
1284 |
+ |
TH1F *hdata = allsamples.Draw("hdata",variable,nbins,bmin,bmax,label,"events",thiscut,data,luminosity); |
1285 |
+ |
|
1286 |
+ |
TH1F *tScaleUp,*tScaleDown,*tMatchingUp,*tMatchingDown,*tCentral; |
1287 |
+ |
|
1288 |
+ |
THStack ScaleUp = MakeOneSystematicsPlot(thiscut,saveas,"ScaleUp",hdata,variable, nbins, bmin, bmax, label,tScaleUp); |
1289 |
+ |
THStack ScaleDown = MakeOneSystematicsPlot(thiscut,saveas,"ScaleDown",hdata,variable, nbins, bmin, bmax, label,tScaleDown); |
1290 |
+ |
THStack MatchingUp = MakeOneSystematicsPlot(thiscut,saveas,"MatchingUp",hdata,variable, nbins, bmin, bmax, label,tMatchingUp); |
1291 |
+ |
THStack MatchingDown = MakeOneSystematicsPlot(thiscut,saveas,"MatchingDown",hdata,variable, nbins, bmin, bmax, label,tMatchingDown); |
1292 |
+ |
|
1293 |
+ |
TH1F *HScaleUp = CollapseStack(ScaleUp); |
1294 |
+ |
TH1F *HScaleDown = CollapseStack(ScaleDown); |
1295 |
+ |
TH1F *HMatchingUp = CollapseStack(MatchingUp); |
1296 |
+ |
TH1F *HMatchingDown = CollapseStack(MatchingDown); |
1297 |
+ |
|
1298 |
+ |
THStack Central = MakeOneSystematicsPlot(thiscut,saveas,"Central",hdata,variable, nbins, bmin, bmax, label,tCentral); |
1299 |
+ |
TH1F *HCentral = CollapseStack(Central); |
1300 |
+ |
|
1301 |
+ |
TH1F *Systematic = (TH1F*)hdata->Clone("Systematic"); |
1302 |
+ |
for(int i=1;i<=Systematic->GetNbinsX();i++) { |
1303 |
+ |
float matchingup = abs(HMatchingUp->GetBinContent(i)-HCentral->GetBinContent(i)); |
1304 |
+ |
float matchingdown = abs(HMatchingDown->GetBinContent(i)-HCentral->GetBinContent(i)); |
1305 |
+ |
float scaleup = abs(HScaleUp->GetBinContent(i)-HCentral->GetBinContent(i)); |
1306 |
+ |
float scaledown = abs(HScaleDown->GetBinContent(i)-HCentral->GetBinContent(i)); |
1307 |
+ |
|
1308 |
+ |
float matching = matchingup>matchingdown?matchingup:matchingdown; |
1309 |
+ |
float scale = scaleup>scaledown?scaleup:scaledown; |
1310 |
+ |
|
1311 |
+ |
float sys=sqrt(matching*matching+scale*scale); |
1312 |
+ |
sys/=HCentral->GetBinContent(i); |
1313 |
+ |
if(HCentral->GetBinContent(i)==0) sys=0; |
1314 |
+ |
Systematic->SetBinContent(i,sys); |
1315 |
+ |
} |
1316 |
+ |
|
1317 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1318 |
+ |
kinpad->SetLogy(1); |
1319 |
+ |
kinpad->cd(); |
1320 |
+ |
if(variable=="genMET") { |
1321 |
+ |
Central.Draw("histo"); |
1322 |
+ |
} else { |
1323 |
+ |
hdata->Draw("e1"); |
1324 |
+ |
Central.Draw("histo,same"); |
1325 |
+ |
hdata->Draw("e1,same"); |
1326 |
+ |
} |
1327 |
+ |
|
1328 |
+ |
DrawPrelim(); |
1329 |
+ |
|
1330 |
+ |
save_with_ratio_and_sys_band( hdata, HCentral, kinpad->cd(), saveas, false, false, "data/mc",Systematic ); |
1331 |
+ |
|
1332 |
+ |
kinpad->cd(); |
1333 |
+ |
tCentral->SetFillColor(kWhite); |
1334 |
+ |
tCentral->SetLineColor(kBlack); |
1335 |
+ |
tScaleUp->SetLineColor(kRed); |
1336 |
+ |
tScaleDown->SetLineColor(kRed); |
1337 |
+ |
tMatchingUp->SetLineColor(kBlue); |
1338 |
+ |
tMatchingDown->SetLineColor(kBlue); |
1339 |
+ |
tScaleUp->SetLineStyle(2); |
1340 |
+ |
tScaleDown->SetLineStyle(3); |
1341 |
+ |
tMatchingUp->SetLineStyle(2); |
1342 |
+ |
tMatchingDown->SetLineStyle(3); |
1343 |
+ |
|
1344 |
+ |
TLegend *leg2 = make_legend(); |
1345 |
+ |
leg2->AddEntry(hdata,"Data","p"); |
1346 |
+ |
leg2->AddEntry(tCentral,"Central (ttbar)","l"); |
1347 |
+ |
leg2->AddEntry(tScaleUp,"ScaleUp (ttbar)","l"); |
1348 |
+ |
leg2->AddEntry(tScaleDown,"ScaleDown (ttbar)","l"); |
1349 |
+ |
leg2->AddEntry(tMatchingUp,"MatchingUp (ttbar)","l"); |
1350 |
+ |
leg2->AddEntry(tMatchingDown,"MatchingDown (ttbar)","l"); |
1351 |
+ |
if(variable=="genMET") { |
1352 |
+ |
Central.Draw("histo"); |
1353 |
+ |
}else { |
1354 |
+ |
hdata->Draw("e1"); |
1355 |
+ |
Central.Draw("histo,same"); |
1356 |
+ |
hdata->Draw("e1,same"); |
1357 |
+ |
} |
1358 |
+ |
tCentral->Draw("histo,same"); |
1359 |
+ |
tScaleUp->Draw("histo,same"); |
1360 |
+ |
tScaleDown->Draw("histo,same"); |
1361 |
+ |
tMatchingUp->Draw("histo,same"); |
1362 |
+ |
tMatchingDown->Draw("histo,same"); |
1363 |
+ |
leg2->Draw(); |
1364 |
+ |
|
1365 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison"); |
1366 |
+ |
|
1367 |
+ |
gStyle->SetOptFit(0); |
1368 |
+ |
|
1369 |
+ |
kinpad->cd(); |
1370 |
+ |
kinpad->SetLogy(0); |
1371 |
+ |
TH1F *MatchingRatio = (TH1F*)tMatchingUp->Clone("MatchingRatio"); |
1372 |
+ |
MatchingRatio->Divide(tMatchingDown); |
1373 |
+ |
TLine *lone = new TLine(tScaleUp->GetBinLowEdge(1),1,tScaleUp->GetBinLowEdge(tScaleUp->GetNbinsX())+tScaleUp->GetBinWidth(tScaleUp->GetNbinsX()),1); |
1374 |
+ |
lone->SetLineColor(TColor::GetColor("#01DF01")); |
1375 |
+ |
lone->SetLineStyle(2); |
1376 |
+ |
TH1F *ScaleRatio = (TH1F*)tScaleUp->Clone("ScaleRatio"); |
1377 |
+ |
ScaleRatio->Divide(tScaleDown); |
1378 |
+ |
MatchingRatio->GetYaxis()->SetRangeUser(0,3); |
1379 |
+ |
MatchingRatio->Draw("e1"); |
1380 |
+ |
TF1 *QP1 = new TF1("QP1","[0]+[1]*x",50,200);//simple linear function ranging from 50 to 200 |
1381 |
+ |
MatchingRatio->Fit("QP1","R"); |
1382 |
+ |
lone->Draw(); |
1383 |
+ |
stringstream summary; |
1384 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
1385 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
1386 |
+ |
TText *infobox = write_title(summary.str()); |
1387 |
+ |
infobox->SetX(0.75); |
1388 |
+ |
infobox->SetTextSize(0.03); |
1389 |
+ |
infobox->SetY(0.75); |
1390 |
+ |
infobox->Draw(); |
1391 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_MatchingUpDividedMatchingDown"); |
1392 |
+ |
kinpad->cd(); |
1393 |
+ |
ScaleRatio->GetYaxis()->SetRangeUser(0,3); |
1394 |
+ |
ScaleRatio->Draw("e1"); |
1395 |
+ |
ScaleRatio->Fit("QP1","R"); |
1396 |
+ |
summary.str(""); |
1397 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
1398 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
1399 |
+ |
TText *infobox2 = write_title(summary.str()); |
1400 |
+ |
infobox2->SetX(0.75); |
1401 |
+ |
infobox2->SetTextSize(0.03); |
1402 |
+ |
infobox2->SetY(0.75); |
1403 |
+ |
infobox2->Draw(); |
1404 |
+ |
|
1405 |
+ |
lone->Draw(); |
1406 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_ScaleUpDividedScaleDown"); |
1407 |
+ |
|
1408 |
+ |
|
1409 |
+ |
delete QP1; |
1410 |
+ |
delete infobox; |
1411 |
+ |
delete infobox2; |
1412 |
+ |
delete MatchingRatio; |
1413 |
+ |
delete ScaleRatio; |
1414 |
+ |
DeleteStack(ScaleUp); |
1415 |
+ |
DeleteStack(ScaleDown); |
1416 |
+ |
DeleteStack(MatchingUp); |
1417 |
+ |
DeleteStack(MatchingDown); |
1418 |
+ |
delete leg2; |
1419 |
+ |
CleanLegends(); |
1420 |
+ |
DeleteStack(Central); |
1421 |
+ |
delete Systematic; |
1422 |
+ |
delete HScaleUp; |
1423 |
+ |
delete HScaleDown; |
1424 |
+ |
delete HMatchingUp; |
1425 |
+ |
delete HMatchingDown; |
1426 |
+ |
delete hdata; |
1427 |
+ |
delete HCentral; |
1428 |
+ |
delete ca; |
1429 |
+ |
} |
1430 |
+ |
|
1431 |
+ |
void QuickProduceMCSystematicPlot(string variable, int nbins, float bmin, float bmax, string label, TCut thiscut, string saveas) { |
1432 |
+ |
TCanvas *ca = new TCanvas("ca","ca"); |
1433 |
+ |
TH1F *tScaleUp = systsamples.Draw("tScaleUp",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("scaleup")); |
1434 |
+ |
TH1F *tScaleDown = systsamples.Draw("tScaleDown",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("scaledown")); |
1435 |
+ |
TH1F *tMatchingUp = systsamples.Draw("tMatchingUp",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("matchingup")); |
1436 |
+ |
TH1F *tMatchingDown = systsamples.Draw("tMatchingDown",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("matchingdown")); |
1437 |
+ |
TH1F *tCentral = systsamples.Draw("tCentral",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("TTJets_MassiveBinDECAY_TuneZ2sta")); |
1438 |
+ |
|
1439 |
+ |
tScaleUp->Scale(1.0/tScaleUp->Integral()); |
1440 |
+ |
tScaleDown->Scale(1.0/tScaleDown->Integral()); |
1441 |
+ |
tMatchingDown->Scale(1.0/tMatchingDown->Integral()); |
1442 |
+ |
tMatchingUp->Scale(1.0/tMatchingUp->Integral()); |
1443 |
+ |
|
1444 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1445 |
+ |
kinpad->SetLogy(1); |
1446 |
+ |
kinpad->cd(); |
1447 |
+ |
tCentral->SetFillColor(kWhite); |
1448 |
+ |
tCentral->SetLineColor(kBlack); |
1449 |
+ |
tScaleUp->SetLineColor(kRed); |
1450 |
+ |
tScaleDown->SetLineColor(kRed); |
1451 |
+ |
tMatchingUp->SetLineColor(kBlue); |
1452 |
+ |
tMatchingDown->SetLineColor(kBlue); |
1453 |
+ |
tScaleUp->SetLineStyle(2); |
1454 |
+ |
tScaleDown->SetLineStyle(3); |
1455 |
+ |
tMatchingUp->SetLineStyle(2); |
1456 |
+ |
tMatchingDown->SetLineStyle(3); |
1457 |
+ |
|
1458 |
+ |
TLegend *leg2 = make_legend(); |
1459 |
+ |
leg2->AddEntry(tCentral,"Central (ttbar)","l"); |
1460 |
+ |
leg2->AddEntry(tScaleUp,"ScaleUp (ttbar)","l"); |
1461 |
+ |
leg2->AddEntry(tScaleDown,"ScaleDown (ttbar)","l"); |
1462 |
+ |
leg2->AddEntry(tMatchingUp,"MatchingUp (ttbar)","l"); |
1463 |
+ |
leg2->AddEntry(tMatchingDown,"MatchingDown (ttbar)","l"); |
1464 |
+ |
|
1465 |
+ |
tCentral->Draw("histo"); |
1466 |
+ |
tScaleUp->Draw("histo,same"); |
1467 |
+ |
tScaleDown->Draw("histo,same"); |
1468 |
+ |
tMatchingUp->Draw("histo,same"); |
1469 |
+ |
tMatchingDown->Draw("histo,same"); |
1470 |
+ |
leg2->Draw(); |
1471 |
+ |
|
1472 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison"); |
1473 |
+ |
|
1474 |
+ |
gStyle->SetOptFit(0); |
1475 |
+ |
|
1476 |
+ |
kinpad->cd(); |
1477 |
+ |
kinpad->SetLogy(0); |
1478 |
+ |
TH1F *MatchingRatio = (TH1F*)tMatchingUp->Clone("MatchingRatio"); |
1479 |
+ |
MatchingRatio->Divide(tMatchingDown); |
1480 |
+ |
TLine *lone = new TLine(tScaleUp->GetBinLowEdge(1),1,tScaleUp->GetBinLowEdge(tScaleUp->GetNbinsX())+tScaleUp->GetBinWidth(tScaleUp->GetNbinsX()),1); |
1481 |
+ |
lone->SetLineColor(TColor::GetColor("#01DF01")); |
1482 |
+ |
lone->SetLineStyle(2); |
1483 |
+ |
TH1F *ScaleRatio = (TH1F*)tScaleUp->Clone("ScaleRatio"); |
1484 |
+ |
ScaleRatio->Divide(tScaleDown); |
1485 |
+ |
MatchingRatio->GetYaxis()->SetRangeUser(0,3); |
1486 |
+ |
MatchingRatio->Draw("e1"); |
1487 |
+ |
TF1 *QP1 = new TF1("QP1","[0]+[1]*x",50,200);//simple linear function ranging from 50 to 200 |
1488 |
+ |
MatchingRatio->Fit("QP1","RQ"); |
1489 |
+ |
lone->Draw(); |
1490 |
+ |
stringstream summary; |
1491 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
1492 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
1493 |
+ |
TText *infobox = write_title(summary.str()); |
1494 |
+ |
infobox->SetX(0.75); |
1495 |
+ |
infobox->SetTextSize(0.03); |
1496 |
+ |
infobox->SetY(0.75); |
1497 |
+ |
infobox->Draw(); |
1498 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_MatchingUpDividedMatchingDown"); |
1499 |
+ |
kinpad->cd(); |
1500 |
+ |
ScaleRatio->GetYaxis()->SetRangeUser(0,3); |
1501 |
+ |
ScaleRatio->Draw("e1"); |
1502 |
+ |
ScaleRatio->Fit("QP1","RQ"); |
1503 |
+ |
summary.str(""); |
1504 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
1505 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
1506 |
+ |
TText *infobox2 = write_title(summary.str()); |
1507 |
+ |
infobox2->SetX(0.75); |
1508 |
+ |
infobox2->SetTextSize(0.03); |
1509 |
+ |
infobox2->SetY(0.75); |
1510 |
+ |
infobox2->Draw(); |
1511 |
+ |
|
1512 |
+ |
lone->Draw(); |
1513 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_ScaleUpDividedScaleDown"); |
1514 |
+ |
|
1515 |
+ |
delete tScaleUp; |
1516 |
+ |
delete tScaleDown; |
1517 |
+ |
delete tCentral; |
1518 |
+ |
delete tMatchingUp; |
1519 |
+ |
delete tMatchingDown; |
1520 |
+ |
delete QP1; |
1521 |
+ |
delete infobox; |
1522 |
+ |
delete infobox2; |
1523 |
+ |
delete MatchingRatio; |
1524 |
+ |
delete ScaleRatio; |
1525 |
+ |
delete leg2; |
1526 |
+ |
CleanLegends(); |
1527 |
+ |
delete ca; |
1528 |
+ |
} |
1529 |
+ |
|
1530 |
+ |
void ProduceMCSystematicPlots() { |
1531 |
+ |
cout << "Getting ready to produce systematic plots " << endl; |
1532 |
+ |
TCut cutweightBKP = cutWeight; |
1533 |
+ |
|
1534 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor"); |
1535 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor"); |
1536 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor"); |
1537 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor"); |
1538 |
+ |
|
1539 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE"); |
1540 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE"); |
1541 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE_HighMass"); |
1542 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE_HighMass"); |
1543 |
+ |
|
1544 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE"); |
1545 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE"); |
1546 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE_HighMass"); |
1547 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE_HighMass"); |
1548 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_SameFlavor"); |
1549 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_OppositeFlavor"); |
1550 |
+ |
|
1551 |
+ |
|
1552 |
+ |
|
1553 |
+ |
cout << "Kicking cutWeight " << (const char*) cutWeight << endl; |
1554 |
+ |
cout << "Keeping OSSF cut " << (const char*)cutOSSF << endl; |
1555 |
+ |
cutWeight="1.0"; |
1556 |
+ |
|
1557 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE__NOPURW"); |
1558 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE__NOPURW"); |
1559 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
1560 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
1561 |
+ |
|
1562 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE__NOPURW"); |
1563 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE__NOPURW"); |
1564 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
1565 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
1566 |
+ |
|
1567 |
+ |
|
1568 |
+ |
// -------------------------------------- ***** AACHEN ***** -------------------------------------- |
1569 |
+ |
|
1570 |
+ |
|
1571 |
+ |
cutWeight=cutweightBKP; |
1572 |
+ |
TCut essentialcutBKP = essentialcut; |
1573 |
+ |
cout << (const char*) essentialcut << endl; |
1574 |
+ |
|
1575 |
+ |
essentialcut = TCut((ReplaceAll((const char*)essentialcut,"pt2>20","pt2>10")).c_str()); |
1576 |
+ |
essentialcut = TCut((ReplaceAll((const char*)essentialcut,"abs(eta1)<1.4","abs(eta1)<2.4")).c_str()); |
1577 |
+ |
essentialcut = TCut((ReplaceAll((const char*)essentialcut,"abs(eta2)<1.4","abs(eta2)<2.4")).c_str()); |
1578 |
+ |
|
1579 |
+ |
TCut cutnJetsBKP = cutnJets; |
1580 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"pt2>20","pt2>10")).c_str()); |
1581 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"pfJetGoodNum40>=3","pfJetGoodNum40>=2")).c_str()); |
1582 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"abs(eta2)<1.4","abs(eta2)<2.4")).c_str()); |
1583 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"abs(eta1)<1.4","abs(eta1)<2.4")).c_str()); |
1584 |
+ |
|
1585 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor"); |
1586 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor"); |
1587 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor"); |
1588 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor"); |
1589 |
+ |
|
1590 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE"); |
1591 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE"); |
1592 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE_HighMass"); |
1593 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE_HighMass"); |
1594 |
+ |
|
1595 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE"); |
1596 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE"); |
1597 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE_HighMass"); |
1598 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE_HighMass"); |
1599 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/Aachen_SameFlavor"); |
1600 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/Aachen_OppositeFlavor"); |
1601 |
+ |
|
1602 |
+ |
|
1603 |
+ |
|
1604 |
+ |
cout << "Kicking cutWeight " << (const char*) cutWeight << endl; |
1605 |
+ |
cout << "Keeping OSSF cut " << (const char*)cutOSSF << endl; |
1606 |
+ |
cutWeight="1.0"; |
1607 |
+ |
|
1608 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE__NOPURW"); |
1609 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE__NOPURW"); |
1610 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
1611 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
1612 |
+ |
|
1613 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE__NOPURW"); |
1614 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE__NOPURW"); |
1615 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
1616 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
1617 |
+ |
|
1618 |
+ |
cutnJets = cutnJetsBKP; |
1619 |
+ |
cutWeight = cutweightBKP; |
1620 |
+ |
essentialcut = essentialcutBKP; |
1621 |
+ |
|
1622 |
+ |
write_error(__FUNCTION__,"Still need to add systematic shape");assert(0); |
1623 |
+ |
} |
1624 |
+ |
|
1625 |
+ |
void MakeTauPlot(string label, TCut pcut, string filename, bool TauOnly) { |
1626 |
+ |
TCut cut=pcut&&basiccut; |
1627 |
+ |
string variable="mll"; |
1628 |
+ |
string xlabel="m_{ll} [GeV]"; |
1629 |
+ |
int nbins=40; |
1630 |
+ |
float min=0; |
1631 |
+ |
float max=200; |
1632 |
+ |
|
1633 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
1634 |
+ |
TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cut&&cutOSSF,data,luminosity); |
1635 |
+ |
TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cut&&cutOSOF,data,luminosity); |
1636 |
+ |
TH1F *tauSF = allsamples.Draw("tauSF",variable,nbins,min,max, xlabel, "events",cut&&cutOSSF,data,luminosity,systsamples.FindSample("DYToTauTau")); |
1637 |
+ |
TH1F *tauOF = allsamples.Draw("tauOF",variable,nbins,min,max, xlabel, "events",cut&&cutOSOF,data,luminosity,systsamples.FindSample("DYToTauTau")); |
1638 |
+ |
datahistoSF->SetMarkerSize(DataMarkerSize); |
1639 |
+ |
datahistoSF->SetMaximum(1.3*datahistoSF->GetMaximum()); |
1640 |
+ |
datahistoOF->SetMarkerSize(DataMarkerSize); |
1641 |
+ |
datahistoOF->SetMaximum(1.3*datahistoOF->GetMaximum()); |
1642 |
+ |
|
1643 |
+ |
THStack mcstackSF = allsamples.DrawStack("mcstackSF", variable,nbins,min,max,xlabel,"events",cut&&cutOSSF,mc,luminosity); |
1644 |
+ |
THStack mcstackOF = allsamples.DrawStack("mcstackOF", variable,nbins,min,max,xlabel,"events",cut&&cutOSOF,mc,luminosity); |
1645 |
+ |
datahistoSF->Draw("e1"); |
1646 |
+ |
ckin->Update(); |
1647 |
+ |
mcstackSF.Draw("histo,same"); |
1648 |
+ |
|
1649 |
+ |
datahistoSF->Draw("same,e1"); |
1650 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
1651 |
+ |
kinleg->Draw(); |
1652 |
+ |
|
1653 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1654 |
+ |
kinpad->cd(); |
1655 |
+ |
datahistoSF->Draw("e1"); |
1656 |
+ |
mcstackSF.Draw("histo,same"); |
1657 |
+ |
datahistoSF->Draw("same,e1"); |
1658 |
+ |
datahistoSF->Draw("same,axis"); |
1659 |
+ |
kinleg->Draw(); |
1660 |
+ |
DrawPrelim(); |
1661 |
+ |
Save_With_Ratio(datahistoSF,mcstackSF,kinpad->cd(),filename+"__SF_mc"); |
1662 |
+ |
|
1663 |
+ |
kinpad->cd(); |
1664 |
+ |
datahistoOF->Draw("e1"); |
1665 |
+ |
mcstackOF.Draw("histo,same"); |
1666 |
+ |
datahistoOF->Draw("same,e1"); |
1667 |
+ |
datahistoOF->Draw("same,axis"); |
1668 |
+ |
kinleg->Draw(); |
1669 |
+ |
DrawPrelim(); |
1670 |
+ |
Save_With_Ratio(datahistoOF,mcstackOF,kinpad->cd(),filename+"__OF_mc"); |
1671 |
+ |
|
1672 |
+ |
kinpad->cd(); |
1673 |
+ |
tauSF->Draw("e1"); |
1674 |
+ |
tauOF->Draw("histo,same"); |
1675 |
+ |
tauSF->Draw("e1,same"); |
1676 |
+ |
TLegend *legtau = make_legend(); |
1677 |
+ |
legtau->AddEntry(tauSF,"DY->#tau#tau, SF","p"); |
1678 |
+ |
legtau->AddEntry(tauSF,"DY->#tau#tau, OF","l"); |
1679 |
+ |
legtau->Draw(); |
1680 |
+ |
DrawPrelim(); |
1681 |
+ |
Save_With_Ratio(tauSF,tauOF,kinpad->cd(),filename+"__Tau_SF_vs_OF"); |
1682 |
+ |
|
1683 |
+ |
delete datahistoSF; |
1684 |
+ |
delete datahistoOF; |
1685 |
+ |
delete tauSF; |
1686 |
+ |
delete tauOF; |
1687 |
+ |
delete kinpad; |
1688 |
+ |
delete ckin; |
1689 |
+ |
CleanLegends(); |
1690 |
+ |
} |
1691 |
+ |
|
1692 |
+ |
|
1693 |
+ |
void TauQuestion() { |
1694 |
+ |
// MakeTauPlot("MET>100 GeV, #geq 3 jets",cutnJets&&TCut("met[4]>100"),"TauQ/MET100_3Jets",true); |
1695 |
+ |
// MakeTauPlot("MET>100 GeV",TCut("met[4]>100"),"TauQ/MET100",true); |
1696 |
+ |
// MakeTauPlot("MET>0 GeV",TCut("met[4]>0"),"TauQ/MET0",true); |
1697 |
+ |
MakeTauPlot("b-tag veto, 50<MET<100",TCut("pfJetGoodNumBtag30==0&&met[4]>50&&met[4]<100"),"TauQ/ControlPlots",false); |
1698 |
|
} |
1699 |
|
|
1700 |
|
void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false) |
1701 |
|
{ |
1702 |
+ |
// switch_overunderflow(true); |
1703 |
|
bool dolog=true; |
1704 |
|
bool nolog=false; |
1705 |
+ |
|
1706 |
+ |
bool doOFSF = false; |
1707 |
+ |
bool doKin = true; |
1708 |
+ |
bool doDataComp = false; |
1709 |
+ |
bool MakeTwoThreeJetComparison = false; |
1710 |
+ |
|
1711 |
+ |
|
1712 |
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!"); |
1713 |
< |
float mll_low=40; |
1713 |
> |
float mll_low=50; |
1714 |
|
float mll_hi=160; |
1715 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
1716 |
< |
mll_low=10; |
1717 |
< |
mll_hi=210; |
1716 |
> |
mll_low=20; |
1717 |
> |
mll_hi=320; |
1718 |
|
} |
1719 |
< |
/* |
1720 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
1721 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
1722 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
1723 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true); |
1724 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
1725 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
1726 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
1727 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
1728 |
< |
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);/* |
1729 |
< |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
1730 |
< |
make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
1731 |
< |
make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
1732 |
< |
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
1733 |
< |
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF); |
1734 |
< |
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF); |
1735 |
< |
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
1736 |
< |
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
1737 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF); |
1738 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);*//* |
1739 |
< |
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
1740 |
< |
stringstream jzbcut; |
1741 |
< |
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
1742 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
1743 |
< |
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); |
1744 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
1745 |
< |
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); |
1746 |
< |
stringstream jzbcut2; |
1747 |
< |
jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
1748 |
< |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
1749 |
< |
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); |
1750 |
< |
stringstream jzbcut3; |
1751 |
< |
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
1752 |
< |
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); |
1753 |
< |
*/ |
1754 |
< |
make_special_obs_pred_mll_plot(mcjzb,50); |
1755 |
< |
make_special_obs_pred_mll_plot(mcjzb,100); |
1756 |
< |
make_special_obs_pred_mll_plot(mcjzb,150); |
1757 |
< |
make_special_obs_pred_mll_plot(mcjzb,200); |
1758 |
< |
make_special_obs_pred_mll_plot(mcjzb,250); |
1719 |
> |
|
1720 |
> |
if(MakeTwoThreeJetComparison) MakeElegantTwoThreeComparisons(); |
1721 |
> |
|
1722 |
> |
//TauQuestion(); |
1723 |
> |
|
1724 |
> |
//ProduceJanPlots(); |
1725 |
> |
//ProduceMCSystematicPlots(); |
1726 |
> |
// make_plain_kin_plot("pt",Cut2Str(cutOSSF&&TCut("mll>20&&pfJetGoodNumBtag30>=2")),40,0,200,nolog,"Z p_{T}","PlotForKostas",doPF,true); |
1727 |
> |
|
1728 |
> |
if ( doOFSF ) { |
1729 |
> |
make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll"); |
1730 |
> |
make_OFSF_plots("met[4]", "met[4]>100", 30, 100., 400., false, "PFMET", "met"); |
1731 |
> |
make_OFSF_plots("leptonNum", "met[4]>100", 3, 2, 5., false, "N(leptons)", "NLeptons"); |
1732 |
> |
|
1733 |
> |
make_OFSF_plots("pfJetGoodNum40", "met[4]>100", 7, 3, 10, true, "#(jets)", "njets"); |
1734 |
> |
make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto"); |
1735 |
> |
make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30>0", 7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30"); |
1736 |
> |
|
1737 |
> |
make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets"); |
1738 |
> |
make_OFSF_plots("pfJetGoodPtBtag[0]", "met[4]>100&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", "ptb1"); |
1739 |
> |
|
1740 |
> |
make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1"); |
1741 |
> |
make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2"); |
1742 |
> |
make_OFSF_plots("pt1", "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1"); |
1743 |
> |
make_OFSF_plots("pt2", "met[4]>100", 22, 0., 220., true, "p_{T,2}", "pt2"); |
1744 |
> |
make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", 0.15); |
1745 |
> |
make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", 0.15); |
1746 |
> |
make_OFSF_plots("phi1", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", "phi1", 0.2); |
1747 |
> |
make_OFSF_plots("phi2", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", "phi2", 0.2); |
1748 |
> |
make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", 0.2); |
1749 |
> |
make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphij1met", 0.2); |
1750 |
> |
make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", 0.2); |
1751 |
> |
make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", 0.2); |
1752 |
> |
make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", 0.2); |
1753 |
> |
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"); |
1754 |
> |
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"); |
1755 |
> |
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"); |
1756 |
> |
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"); |
1757 |
> |
} |
1758 |
> |
|
1759 |
> |
if ( doDataComp) { |
1760 |
> |
TCut mllCut(""); |
1761 |
> |
float massmin = 15.; |
1762 |
> |
float massmax = 315; |
1763 |
> |
int massnbins = 60; |
1764 |
> |
/* if ( !PlottingSetup::openBox ) { |
1765 |
> |
mllCut = "mll>70"; |
1766 |
> |
massmin = 120; |
1767 |
> |
massmax = 360; |
1768 |
> |
massnbins = 14; |
1769 |
> |
}*/ |
1770 |
> |
|
1771 |
> |
TCut cutSignal = cutmass&&cutnJets&&"met[4]>100"; |
1772 |
> |
|
1773 |
> |
make_data_comparison_plot("numVtx", "",40, -0.5, 39.5,-1., true, "N(Vertices)", "numVtx"); |
1774 |
> |
make_data_comparison_plot("pfJetGoodEta[0]", "",50, -3.0, 3.0,-1., true, "N(Jets)", "pfJetGoodEta0"); |
1775 |
> |
|
1776 |
> |
|
1777 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF,10, -0.5, 9.5,-1., true, "N(Jets)", "njets_OF"); |
1778 |
> |
make_data_comparison_plot("met[4]", cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_inclusive"); |
1779 |
> |
make_data_comparison_plot("met[1]", cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_inclusive"); |
1780 |
> |
make_data_comparison_plot("met[4]", cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_inclusive"); |
1781 |
> |
make_data_comparison_plot("met[1]", cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_inclusive"); |
1782 |
> |
|
1783 |
> |
make_data_comparison_plot("met[4]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_exclusive"); |
1784 |
> |
make_data_comparison_plot("met[1]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_exclusive"); |
1785 |
> |
make_data_comparison_plot("met[4]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_exclusive"); |
1786 |
> |
make_data_comparison_plot("met[1]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_exclusive"); |
1787 |
> |
|
1788 |
> |
|
1789 |
> |
string basiccutsaved = (const char*)basiccut; |
1790 |
> |
|
1791 |
> |
string newbasiccut=basiccutsaved; |
1792 |
> |
|
1793 |
> |
size_t found; |
1794 |
> |
found = newbasiccut.find( "pt2>20" ); |
1795 |
> |
while (found!=string::npos){ |
1796 |
> |
newbasiccut.replace( found, string( "pt2>20" ).length(), "pt2>10" ); |
1797 |
> |
found = newbasiccut.find( "pt2>20" ); |
1798 |
> |
} |
1799 |
> |
basiccut=TCut(newbasiccut.c_str()); |
1800 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSSF,60, 0., 300.,-1., false, "mll", "mll_SF_Aachen_pt2010_met"); |
1801 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSOF,60, 0., 300.,-1., false, "mll", "mll_OF_Aachen_pt2010_met"); |
1802 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_Aachen_pt2010_t1cpfmet"); |
1803 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_Aachen_pt2010_t1cpfmet"); |
1804 |
> |
basiccut=TCut(basiccutsaved.c_str()); |
1805 |
> |
|
1806 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSSF, 8, 0., 8.,-1., true, "#(jets)", "njets_SF"); |
1807 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF, 8, 0., 8.,-1., true, "#(jets)", "njets_OF"); |
1808 |
> |
|
1809 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_met"); |
1810 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_met"); |
1811 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_t1cpfmet"); |
1812 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_t1cpfmet"); |
1813 |
> |
|
1814 |
> |
|
1815 |
> |
make_data_comparison_plot("mll", cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive"); |
1816 |
> |
make_data_comparison_plot("mll", cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_ee"); |
1817 |
> |
make_data_comparison_plot("mll", cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_mm"); |
1818 |
> |
make_data_comparison_plot("mll", cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_inclusive"); |
1819 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_ee"); |
1820 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_mm"); |
1821 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive"); |
1822 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_exclusive"); |
1823 |
> |
|
1824 |
> |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig"); |
1825 |
> |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig"); |
1826 |
> |
|
1827 |
> |
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"); |
1828 |
> |
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"); |
1829 |
> |
|
1830 |
> |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto"); |
1831 |
> |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_btagVeto"); |
1832 |
> |
|
1833 |
> |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet"); |
1834 |
> |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_AtLeastOneBJet"); |
1835 |
> |
|
1836 |
> |
|
1837 |
> |
make_data_comparison_plot("mll", mllCut&&cutOSOF&&cutSignal, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig"); |
1838 |
> |
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"); |
1839 |
> |
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"); |
1840 |
> |
|
1841 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_SF_sig"); |
1842 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_OF_sig"); |
1843 |
> |
make_data_comparison_plot("pfJetGoodNumBtag30", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_SF_sig"); |
1844 |
> |
make_data_comparison_plot("pfJetGoodNumBtag30", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_OF_sig"); |
1845 |
> |
|
1846 |
> |
} |
1847 |
> |
|
1848 |
> |
|
1849 |
> |
if ( doKin ) { |
1850 |
> |
string mllCut(""); |
1851 |
> |
|
1852 |
> |
|
1853 |
> |
|
1854 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_0j",doPF,true); |
1855 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_1j",doPF,true); |
1856 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_2j",doPF,true); |
1857 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_3j",doPF,true); |
1858 |
> |
|
1859 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_0j",doPF,true); |
1860 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_1j",doPF,true); |
1861 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_2j",doPF,true); |
1862 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_3j",doPF,true); |
1863 |
> |
|
1864 |
> |
|
1865 |
> |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSOF&&cutnJets),120,0,1200,dolog,"H_{T}","HT_3jets_OF",doPF,true); |
1866 |
> |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSSF&&cutnJets) ,120,0,1200,dolog,"H_{T}","HT_3jets_SF",doPF,true); |
1867 |
> |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSOF&&cutnJets&&TCut("met[4]>100")),120,0,1200,dolog,"H_{T}","HT_3jets_OF_MET100",doPF,true); |
1868 |
> |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSSF&&cutnJets&&TCut("met[4]>100")) ,120,0,1200,dolog,"H_{T}","HT_3jets_SF_MET100",doPF,true); |
1869 |
> |
|
1870 |
> |
|
1871 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_0j",doPF,true); |
1872 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_1j",doPF,true); |
1873 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_2j",doPF,true); |
1874 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_3j",doPF,true); |
1875 |
> |
|
1876 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_0j",doPF,true); |
1877 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_1j",doPF,true); |
1878 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_2j",doPF,true); |
1879 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_3j",doPF,true); |
1880 |
> |
|
1881 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&cutnJets&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_SF_20to70",doPF,true); |
1882 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&cutnJets&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_OF_20to70",doPF,true); |
1883 |
> |
|
1884 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&cutnJets&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_SF_above120",doPF,true); |
1885 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&cutnJets&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_OF_above120",doPF,true); |
1886 |
> |
|
1887 |
> |
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); |
1888 |
> |
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); |
1889 |
> |
|
1890 |
> |
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); |
1891 |
> |
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); |
1892 |
> |
|
1893 |
> |
|
1894 |
> |
make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true); |
1895 |
> |
make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true); |
1896 |
> |
// Plots in signal region |
1897 |
> |
make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true); |
1898 |
> |
|
1899 |
> |
|
1900 |
> |
make_kin_plot("MetFactor","",20,0,2,nolog,"MetFactor","MetFactor",doPF,true); |
1901 |
> |
|
1902 |
> |
make_ttbar_comparison("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_30to70_2j__ALLMCSAMPLES"); |
1903 |
> |
/* |
1904 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_OF_30to70_0j"); |
1905 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_OF_30to70_1j"); |
1906 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_30to70_2j"); |
1907 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_OF_30to70_3j"); |
1908 |
> |
|
1909 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_SF_30to70_0j"); |
1910 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_SF_30to70_1j"); |
1911 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_SF_30to70_2j"); |
1912 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_SF_30to70_3j"); |
1913 |
> |
|
1914 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_OF_Z_0j"); |
1915 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_OF_Z_1j"); |
1916 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_Z_2j"); |
1917 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_OF_Z_3j"); |
1918 |
> |
|
1919 |
> |
|
1920 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSSF,dolog,"m_{ll} [GeV]","kinSys/mll"); |
1921 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSSF&&TCut("id1==0"),dolog,"m_{ll} [GeV]","kinSys/mll_ee"); |
1922 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSSF&&TCut("id1==1"),dolog,"m_{ll} [GeV]","kinSys/mll_mm"); |
1923 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSOF,dolog,"m_{ll} [GeV]","kinSys/mll_osof"); |
1924 |
> |
|
1925 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutOSSF,dolog,"m_{ll} [GeV]","kinSys/mll_inclusive"); |
1926 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutOSOF,dolog,"m_{ll} [GeV]","kinSys/mll_inclusive_osof"); |
1927 |
> |
|
1928 |
> |
DoMCSystPlot("pfJetGoodNum40", 9,-0.5,8.5,cutOSSF,dolog,"nJets","kinSys/nJets_ossf"); |
1929 |
> |
DoMCSystPlot("pfJetGoodNum40", 9,-0.5,8.5,cutOSOF,dolog,"nJets","kinSys/nJets_osof"); |
1930 |
> |
|
1931 |
> |
DoMCSystPlot("pfJetGoodPt[0]/pfJetGoodPt[1]",45,1,10,cutnJets&&cutOSSF,dolog,"p_{T}^{J1} / p_{T}^{J2}","kinSys/j1j2ratio"); |
1932 |
> |
DoMCSystPlot("TMath::Abs(pfJetDphiMet[0])",32,0,3.2,cutnJets&&cutOSSF,dolog,"|#Delta#phi(jet1,MET)|","kinSys/dphiJ1MET"); |
1933 |
> |
DoMCSystPlot(datajzb,mcjzb, (int)((PlottingSetup::jzbHigh+110)/10),-110,PlottingSetup::jzbHigh,cutnJets&&cutOSSF&&Restrmasscut,dolog,"m_{ll} [GeV]","kinSys/jzb_OS_SFZP"); |
1934 |
> |
DoMCSystPlot(datajzb,mcjzb, (int)((PlottingSetup::jzbHigh+110)/10),-110,PlottingSetup::jzbHigh,cutnJets&&cutOSOF&&Restrmasscut,dolog,"m_{ll} [GeV]","kinSys/jzb_OS_OFZP"); |
1935 |
> |
|
1936 |
> |
make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
1937 |
> |
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); |
1938 |
> |
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); |
1939 |
> |
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); |
1940 |
> |
|
1941 |
> |
make_kin_plot("pfJetGoodNum40",mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
1942 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
1943 |
> |
|
1944 |
> |
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); |
1945 |
> |
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); |
1946 |
> |
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); |
1947 |
> |
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); |
1948 |
> |
|
1949 |
> |
|
1950 |
> |
make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets_met100",doPF); |
1951 |
> |
make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof_met100",doPF); |
1952 |
> |
|
1953 |
> |
// Further inclusive invariant mass plots |
1954 |
> |
make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
1955 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
1956 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
1957 |
> |
make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
1958 |
> |
|
1959 |
> |
make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
1960 |
> |
//if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
1961 |
> |
|
1962 |
> |
|
1963 |
> |
// Number of jets |
1964 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_inclusive",doPF); |
1965 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof_inclusive",doPF); |
1966 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
1967 |
> |
|
1968 |
> |
// Others |
1969 |
> |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
1970 |
> |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
1971 |
> |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
1972 |
> |
make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
1973 |
> |
make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF); |
1974 |
> |
make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF); |
1975 |
> |
make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF); |
1976 |
> |
make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF); |
1977 |
> |
// stringstream jzbcut; |
1978 |
> |
// jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
1979 |
> |
// make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
1980 |
> |
// 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); |
1981 |
> |
// 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); |
1982 |
> |
// 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); |
1983 |
> |
// stringstream jzbcut2; |
1984 |
> |
// jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
1985 |
> |
// make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
1986 |
> |
// 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); |
1987 |
> |
// 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); |
1988 |
> |
// 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); |
1989 |
> |
// stringstream jzbcut3; |
1990 |
> |
// jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
1991 |
> |
// make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
1992 |
> |
// 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); |
1993 |
> |
// 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); |
1994 |
> |
// 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); |
1995 |
> |
|
1996 |
> |
// 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); |
1997 |
> |
//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); |
1998 |
> |
//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);*/ |
1999 |
> |
} |
2000 |
> |
/* |
2001 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,0); |
2002 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,50); |
2003 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,80); |
2004 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,100); |
2005 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,150); |
2006 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,200); |
2007 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,250); |
2008 |
> |
|
2009 |
> |
make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf"); |
2010 |
> |
make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof"); |
2011 |
> |
*/ |
2012 |
> |
switch_overunderflow(false); |
2013 |
|
} |
2014 |
|
|
2015 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
2016 |
|
int nbins, float xmin, float xmax, bool log, |
2017 |
|
float ymin=0, float ymax=0, bool leftJustified=false ) { |
2018 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
2018 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
2019 |
|
|
2020 |
|
TCut weightbackup=cutWeight;//backing up the correct weight (restoring below!) |
2021 |
|
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__)); |
2022 |
< |
if(var=="numVtx") cutWeight=TCut("1.0"); |
2022 |
> |
//if(var=="numVtx") cutWeight=TCut("1.0"); |
2023 |
|
TCut jzbData[]= { TCut(TString(datajzb+">"+any2string(jzbcut))),TCut(TString(datajzb+"<-"+any2string(jzbcut))) }; |
2024 |
|
TCut jzbMC[] = { TCut(TString(mcjzb+">"+any2string(jzbcut))),TCut(TString(mcjzb+"<-"+any2string(jzbcut))) }; |
2025 |
|
|
2026 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- below: the next ~20 lines changed! |
2027 |
|
int nRegions=4; |
2028 |
< |
if(!PlottingSetup::RestrictToMassPeak) { |
2028 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
2029 |
|
nRegions=2; |
2030 |
|
} |
2031 |
|
|
2043 |
|
TCanvas *ccomp = new TCanvas("ccomp","Comparison plot",600,400); |
2044 |
|
ccomp->SetLogy(log); |
2045 |
|
TH1F *datahisto = allsamples.Draw("datahisto", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity); |
2046 |
< |
TH1F *lm4histo = signalsamples.Draw("lm4histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity,signalsamples.FindSample("LM4")); |
2046 |
> |
TH1F *lm3histo = signalsamples.Draw("lm3histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb],data,luminosity,signalsamples.FindSample("LM3")); |
2047 |
|
THStack mcstack = allsamples.DrawStack("mcstack",var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb], mc, luminosity); |
2048 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
2049 |
|
if (ymax>ymin) datahisto->SetMaximum(ymax); |
2050 |
< |
lm4histo->SetLineStyle(2); |
2050 |
> |
lm3histo->SetLineStyle(2); |
2051 |
|
datahisto->Draw("e1"); |
2052 |
< |
mcstack.Draw("same"); |
2052 |
> |
mcstack.Draw("histo,same"); |
2053 |
|
datahisto->Draw("same,e1"); |
2054 |
< |
// lm4histo->Draw("hist,same"); |
2054 |
> |
lm3histo->Draw("hist,same"); |
2055 |
|
TLegend *kinleg = allsamples.allbglegend((sRegions[iregion]+(ijzb?"neg":"pos")).c_str()); |
2056 |
|
if ( leftJustified ) { |
2057 |
|
Float_t w = kinleg->GetX2()-kinleg->GetX1(); |
2058 |
|
kinleg->SetX1(0.2); |
2059 |
|
kinleg->SetX2(0.2+w); |
2060 |
|
} |
2061 |
< |
// kinleg->AddEntry(lm4histo,"LM4","l"); |
2061 |
> |
kinleg->AddEntry(lm3histo,"LM3","l"); |
2062 |
|
kinleg->Draw(); |
2063 |
|
TText* write_variable = write_text(0.99,0.01,var); |
2064 |
|
write_variable->SetTextAlign(31); |
2067 |
|
CompleteSave(ccomp,"compare/JZBcut_at_"+any2string(jzbcut)+"/"+filename+"/"+filename+sRegions[iregion]+(ijzb?"neg":"pos")); |
2068 |
|
delete datahisto; |
2069 |
|
delete ccomp; |
2070 |
< |
delete lm4histo; |
2070 |
> |
delete lm3histo; |
2071 |
|
} |
2072 |
|
cutWeight=weightbackup; |
2073 |
|
} |
2077 |
|
dout << "Creating comparison plots for signal and control regions" << endl; |
2078 |
|
// Compare a few quantities in the signal region and all 7 control regions |
2079 |
|
|
2080 |
< |
switch_overunderflow(true); // switching overflow/underflow bins on |
2080 |
> |
// switch_overunderflow(true); // switching overflow/underflow bins on |
2081 |
|
|
2082 |
< |
|
2082 |
> |
switch_overunderflow(true); |
2083 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
2084 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
2084 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
2085 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
2086 |
|
float mll_low=50;float mll_high=170; |
2087 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
2088 |
< |
mll_high=200; |
2089 |
< |
mll_low=50; |
2088 |
> |
mll_high=300; |
2089 |
> |
mll_low=20; |
2090 |
|
} |
2091 |
< |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,30,mll_low,mll_high,false,0,16.); |
2091 |
> |
make_comp_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",jzbcut,mcjzb,datajzb,100,0,10,true); |
2092 |
> |
make_comp_plot("TMath::Abs(pfJetDphiMet[0])","|#Delta#phi(jet1,MET)|","dphiJ1MET",jzbcut,mcjzb,datajzb,32,0,3.2,false,0,0,true); |
2093 |
> |
|
2094 |
> |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,56,mll_low,mll_high,false,0,16.); |
2095 |
|
make_comp_plot("met[4]","pfMET [GeV]","pfmet",jzbcut,mcjzb,datajzb,18,0,360,false,0,16.); |
2096 |
< |
make_comp_plot("pfJetGoodNum","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
2096 |
> |
make_comp_plot("pfJetGoodNum40","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
2097 |
> |
make_comp_plot("pfJetGoodNumBtag","#(b-jets)","nBjets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
2098 |
|
make_comp_plot("pt","Z p_{T} [GeV]","Zpt",jzbcut,mcjzb,datajzb,26,0,525,false,0.,21.); |
2099 |
< |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,20,0.,20.,false,0,16.); |
2099 |
> |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,40,0.,40.,false,0,16.); |
2100 |
|
make_comp_plot("TMath::Abs(dphi)","#Delta#phi(leptons)","dphilep",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
2101 |
|
make_comp_plot("TMath::Abs(dphi_sumJetVSZ[1])","#Delta#phi(Z,jets)","dphiZjets",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
2102 |
+ |
make_comp_plot("eta1","#eta_1","eta1",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
2103 |
+ |
make_comp_plot("eta2","#eta_2","eta2",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
2104 |
|
} |
2105 |
|
|
2106 |
|
switch_overunderflow(false); // switching overflow/underflow bins off |
2299 |
|
// 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) |
2300 |
|
TF1 *ttbarlogpar = do_logpar_fit_to_plot(Tprediction); |
2301 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2302 |
< |
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); |
2302 |
> |
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); |
2303 |
|
|
2304 |
|
|
2305 |
|
TF1 *ttbarlogparP = new TF1("ttbarlogparP",LogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8); |
2394 |
|
return return_functions; |
2395 |
|
} |
2396 |
|
|
2397 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
2397 |
> |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
2398 |
|
{ |
2399 |
< |
// note: sigma is not used ATM |
860 |
< |
switch_overunderflow(true); |
2399 |
> |
|
2400 |
|
bool is_data=false; |
2401 |
|
bool use_signal=false; |
2402 |
|
if(use_data==1) is_data=true; |
2403 |
|
if(use_data==2) use_signal=true; |
2404 |
< |
int nbins=50;//100; |
2405 |
< |
if(is_data) nbins=50; |
2404 |
> |
int nbins=int(high/10);//100; |
2405 |
> |
if(is_data) nbins=int(high/10); |
2406 |
|
float low=0; |
2407 |
< |
float hi=500; |
2407 |
> |
float hi=high; |
2408 |
> |
|
2409 |
> |
stringstream cutpositiveS; |
2410 |
> |
cutpositiveS << "(" << jzb << ">0)"; |
2411 |
> |
TCut cutpositive(cutpositiveS.str().c_str()); |
2412 |
> |
stringstream cutnegativeS; |
2413 |
> |
cutnegativeS << "(" << jzb << "<0)"; |
2414 |
> |
TCut cutnegative(cutnegativeS.str().c_str()); |
2415 |
|
|
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()); |
2416 |
|
|
2417 |
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
2418 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
2419 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
2420 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
2421 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
2418 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2419 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2420 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2421 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2422 |
|
|
2423 |
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
2424 |
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
2433 |
|
|
2434 |
|
TH1F *RcorrJZBeemmNoS; |
2435 |
|
|
2436 |
< |
//these are for the ratio |
2437 |
< |
|
2438 |
< |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
2439 |
< |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
2440 |
< |
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); |
2436 |
> |
//these are for the ratio |
2437 |
> |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2438 |
> |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2439 |
> |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2440 |
> |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2441 |
|
|
2442 |
|
TH1F *JRcorrJZBSBem; |
2443 |
|
TH1F *JLcorrJZBSBem; |
2444 |
|
TH1F *JRcorrJZBSBeemm; |
2445 |
|
TH1F *JLcorrJZBSBeemm; |
2446 |
|
|
2447 |
< |
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); |
2447 |
> |
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); |
2448 |
|
|
2449 |
|
|
2450 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2451 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
2452 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
2453 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
2454 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
2450 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2451 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2452 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2453 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2454 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2455 |
|
|
2456 |
|
//these are for the ratio |
2457 |
< |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
2458 |
< |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
2459 |
< |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
2460 |
< |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
2457 |
> |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2458 |
> |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2459 |
> |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2460 |
> |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2461 |
|
} |
2462 |
|
|
2463 |
|
TH1F *lm4RcorrJZBeemm; |
2464 |
< |
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")); |
2464 |
> |
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")); |
2465 |
|
|
2466 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
2467 |
|
|
2470 |
|
|
2471 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
2472 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
2473 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2473 |
> |
|
2474 |
> |
TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]); |
2475 |
> |
ClearHisto(BpredSys); |
2476 |
> |
|
2477 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2478 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
2479 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
2480 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
2496 |
|
JBpred->Add(JLcorrJZBSBem,-1.0/3.); |
2497 |
|
JBpred->Add(JRcorrJZBSBeemm,1.0/3.); |
2498 |
|
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.); |
2499 |
+ |
|
2500 |
+ |
//Systematics: |
2501 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertONPEAK*zjetsestimateuncertONPEAK); |
2502 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
2503 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
2504 |
+ |
AddSquared(BpredSys,JRcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
2505 |
+ |
AddSquared(BpredSys,JLcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
2506 |
+ |
AddSquared(BpredSys,JRcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
2507 |
+ |
AddSquared(BpredSys,JLcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
2508 |
|
} else { |
2509 |
|
Bpred->Add(RcorrJZBem,1.0); |
2510 |
|
Bpred->Add(LcorrJZBem,-1.0); |
2514 |
|
//these are for the ratio |
2515 |
|
JBpred->Add(JRcorrJZBem,1.0); |
2516 |
|
JBpred->Add(JLcorrJZBem,-1.0); |
2517 |
+ |
|
2518 |
+ |
//Systematics |
2519 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertOFFPEAK*zjetsestimateuncertOFFPEAK); |
2520 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
2521 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
2522 |
+ |
|
2523 |
|
} |
2524 |
|
|
2525 |
< |
|
2526 |
< |
|
2525 |
> |
SQRT(BpredSys); |
2526 |
> |
BpredSys->Divide(JBpred); |
2527 |
> |
|
2528 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
2529 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
2530 |
|
Tpred->Add(LcorrJZBem,-1.0); |
2531 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2531 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2532 |
|
Tpred->Add(RcorrJZBSBem,1.0); |
2533 |
|
Tpred->Add(LcorrJZBSBem,-1.0); |
2534 |
|
Tpred->Add(RcorrJZBSBeemm,1.0); |
2568 |
|
blankback->Draw(); |
2569 |
|
if(use_data==1) |
2570 |
|
{ |
2571 |
+ |
//Bpred->SetLineWidth(3); //paper style.overruled. |
2572 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style.overruled. |
2573 |
|
analytical_function = do_extended_fit_to_plot(Bpred,Tpred,LcorrJZBeemm,LcorrJZBem,is_data); |
2574 |
|
kinpad->cd();//necessary because the extended fit function creates its own canvas |
2575 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
2576 |
|
|
2577 |
|
Bpred->Draw("hist,same"); |
2578 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
2578 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
2579 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
2580 |
< |
lm4RcorrJZBeemm->Draw("hist,same"); |
2580 |
> |
//lm4RcorrJZBeemm->Draw("hist,same"); |
2581 |
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p"); |
2582 |
|
legBpred->AddEntry(Bpred,"predicted","l"); |
2583 |
< |
legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
2584 |
< |
legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
2585 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
2583 |
> |
// legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
2584 |
> |
// legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
2585 |
> |
// legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l"); |
2586 |
|
legBpred->Draw(); |
2587 |
|
DrawPrelim(); |
2588 |
|
|
2592 |
|
Bpred->SetLineWidth(2); |
2593 |
|
predcomppad->cd(); |
2594 |
|
predcomppad->SetLogy(1); |
1034 |
– |
|
2595 |
|
TH1F *jzbnegative = (TH1F*)LcorrJZBeemm->Clone("jzbnegative"); |
2596 |
|
TH1F *sidebandsemu = (TH1F*)Bpred->Clone("sidebandsemu"); |
2597 |
|
sidebandsemu->Add(jzbnegative,-1); |
2610 |
|
Bpred->Draw("hist,same"); |
2611 |
|
// analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
2612 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
2613 |
< |
// TH1F *lm4RcorrJZBeemmC = (TH1F*)lm4RcorrJZBeemm->Clone("lm4RcorrJZBeemmC"); |
1054 |
< |
// lm4RcorrJZBeemmC->SetLineColor(kOrange+1); |
1055 |
< |
lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
1056 |
< |
// lm4RcorrJZBeemmC->Draw("histo,same"); |
2613 |
> |
// lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
2614 |
|
lm4RcorrJZBeemm->SetLineWidth(2); |
2615 |
< |
lm4RcorrJZBeemm->Draw("histo,same"); |
2615 |
> |
//lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled. |
2616 |
> |
// lm4RcorrJZBeemm->Draw("histo,same"); |
2617 |
|
DrawPrelim(); |
2618 |
|
TLegend *speciallegBpred = make_legend("",0.45,0.55); |
2619 |
+ |
//TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled. |
2620 |
|
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
2621 |
|
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
2622 |
|
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
2623 |
< |
speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
2623 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
2624 |
> |
else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f"); |
2625 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
2626 |
< |
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
2626 |
> |
// speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
2627 |
|
speciallegBpred->Draw(); |
2628 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,use_data!=1,"data/pred"); |
2628 |
> |
Save_With_Ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
2629 |
> |
delete predcomppad; |
2630 |
|
|
2631 |
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
2632 |
< |
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
2632 |
> |
specialcanv->SetLogy(1); |
2633 |
> |
// THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
2634 |
|
blankback->Draw(); |
2635 |
< |
kostack.Draw("same"); |
2635 |
> |
// kostack.Draw("same"); |
2636 |
> |
predcomposition.Draw("hist"); |
2637 |
|
Bpred->Draw("hist,same"); |
2638 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
2638 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
2639 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
2640 |
|
legBpred->Draw(); |
2641 |
|
DrawPrelim(); |
2642 |
|
CompleteSave(specialcanv,subdir+"Bpred_Data_____PredictionCompositioninMC"); |
2643 |
|
Bpred->SetLineWidth((int)CurrentBpredLineWidth); |
2644 |
|
|
2645 |
+ |
|
2646 |
+ |
//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; |
2647 |
+ |
|
2648 |
|
delete speciallegBpred; |
2649 |
|
delete Zjetspred; |
2650 |
|
delete TTbarpred; |
2653 |
|
} |
2654 |
|
if(use_data==0) { |
2655 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
2656 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
2657 |
|
Bpred->Draw("hist,same"); |
2658 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
2659 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
2660 |
< |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
2660 |
> |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
2661 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
2662 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
2663 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
2663 |
> |
// if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
2664 |
|
legBpred->Draw(); |
2665 |
|
DrawMCPrelim(); |
2666 |
|
Bpredsaveas="Bpred_MC"; |
2668 |
|
} |
2669 |
|
if(use_data==2) { |
2670 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
2671 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
2672 |
|
Bpred->Draw("hist,same"); |
2673 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
2674 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
2684 |
|
// CompleteSave(globalcanvas,"Bpred_MCwithS"); // done below in save_with_ratio |
2685 |
|
} |
2686 |
|
{ |
2687 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style. overruled. |
2688 |
+ |
//RcorrJZBeemmNoS->SetLineWidth(3); //paper style. overruled. |
2689 |
+ |
//lm4RcorrJZBeemm->SetLineStyle(2); //paper style. overruled. |
2690 |
+ |
//RcorrJZBeemmNoS->SetLineStyle(3); //paper style. overruled. |
2691 |
+ |
//lm4RcorrJZBeemm->SetLineColor(kOrange+1); //paper style. overruled. |
2692 |
+ |
|
2693 |
|
RcorrJZBeemmNoS->SetLineStyle(2); |
2694 |
|
legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l"); |
2695 |
< |
legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
2695 |
> |
// legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
2696 |
|
legBpred2->Draw(); |
2697 |
|
RcorrJZBeemmNoS->SetLineColor(TColor::GetColor("#61210B")); |
2698 |
|
RcorrJZBeemmNoS->Draw("histo,same"); |
2709 |
|
string ytitle("ratio"); |
2710 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
2711 |
|
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
2712 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle);//not extending the y range anymore up to 4 |
2712 |
> |
Save_With_Ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4 |
2713 |
> |
|
2714 |
> |
delete kinpad; |
2715 |
> |
|
2716 |
|
|
2717 |
|
|
2718 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2719 |
< |
/// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
2720 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2719 |
> |
// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
2720 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2721 |
|
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
2722 |
|
Bpredem->Add(RcorrJZBem); |
2723 |
|
Bpredem->Add(LcorrJZBem,-1); |
2772 |
|
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
2773 |
|
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
2774 |
|
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
2775 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
2775 |
> |
// if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
2776 |
|
legBpredc->Draw(); |
2777 |
|
CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison"); |
2778 |
|
} |
2779 |
|
} |
2780 |
|
|
2781 |
+ |
TFile *f = new TFile("tester.root","RECREATE"); |
2782 |
+ |
RcorrJZBeemm->Write(); |
2783 |
+ |
Bpred->Write(); |
2784 |
+ |
f->Close(); |
2785 |
+ |
|
2786 |
|
delete RcorrJZBeemm; |
2787 |
|
delete LcorrJZBeemm; |
2788 |
|
delete RcorrJZBem; |
2795 |
|
|
2796 |
|
delete blankback; |
2797 |
|
|
2798 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2798 |
> |
delete BpredSys; |
2799 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2800 |
|
delete RcorrJZBSBem; |
2801 |
|
delete LcorrJZBSBem; |
2802 |
|
delete RcorrJZBSBeemm; |
2808 |
|
delete JLcorrJZBSBeemm; |
2809 |
|
} |
2810 |
|
if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm; |
1228 |
– |
switch_overunderflow(false); |
2811 |
|
} |
2812 |
|
|
2813 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
2814 |
+ |
switch_overunderflow(true); |
2815 |
|
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
2816 |
< |
do_prediction_plot(datajzb,globalcanvas,DataSigma,jzbHigh ,data,overlay_signal); |
2817 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal); |
2818 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal); |
2819 |
< |
} |
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); |
2816 |
> |
do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
2817 |
> |
if ( !PlottingSetup::Approved ) { |
2818 |
> |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
2819 |
> |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
2820 |
|
} else { |
2821 |
< |
Bpred->Add(RcorrJZBem,1.0); |
1274 |
< |
Bpred->Add(LcorrJZBem,-1.0); |
2821 |
> |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
2822 |
|
} |
2823 |
< |
|
2824 |
< |
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 ); |
2823 |
> |
delete globalcanvas; |
2824 |
> |
switch_overunderflow(false); |
2825 |
|
} |
2826 |
|
|
2827 |
|
string give_jzb_expression(float peak, int type) { |
2908 |
|
eemmlegend->AddEntry(jmmd,"#mu#mu","l"); |
2909 |
|
eemmlegend->Draw(); |
2910 |
|
DrawPrelim(); |
2911 |
< |
save_with_ratio(jeed,jmmd,eemmpad->cd(),"lepton_comparison/jzb_Comparing_ee_mm_data"); |
2911 |
> |
Save_With_Ratio(jeed,jmmd,eemmpad->cd(),"lepton_comparison/jzb_Comparing_ee_mm_data"); |
2912 |
|
|
2913 |
|
TH1F *zjeed = allsamples.Draw("zjeed",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY")); |
2914 |
|
TH1F *zjmmd = allsamples.Draw("zjmmd",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY")); |
3009 |
|
datahisto->SetMinimum(0.1); |
3010 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
3011 |
|
datahisto->Draw("e1"); |
3012 |
< |
mcstack.Draw("same"); |
3012 |
> |
mcstack.Draw("histo,same"); |
3013 |
|
datahisto->Draw("same,e1"); |
3014 |
|
|
3015 |
|
TLegend *leg; |
3016 |
< |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
3017 |
< |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
3018 |
< |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
3019 |
< |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
3020 |
< |
else { |
3021 |
< |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
3022 |
< |
exit(-1); |
3023 |
< |
} |
3016 |
> |
if (!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
3017 |
> |
if(is_OF(cut)) leg = allsamples.allbglegend("Opposite flavor",datahisto); |
3018 |
> |
else leg = allsamples.allbglegend("Same flavor",datahisto); |
3019 |
> |
} else { |
3020 |
> |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
3021 |
> |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
3022 |
> |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
3023 |
> |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
3024 |
> |
else { |
3025 |
> |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
3026 |
> |
exit(-1); |
3027 |
> |
} |
3028 |
> |
} |
3029 |
|
leg->Draw(); |
3030 |
|
string write_cut = decipher_cut(cut,""); |
3031 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
3032 |
|
writeline1->SetTextSize(0.035); |
3033 |
|
writeline1->Draw(); |
3034 |
< |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
3035 |
< |
else save_with_ratio(datahisto,mcstack,jzbpad->cd(),savename); |
3034 |
> |
if(!Contains(savename,"Dibosons")) Save_With_Ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
3035 |
> |
else Save_With_Ratio(datahisto,mcstack,jzbpad->cd(),savename); |
3036 |
|
TPad *jzbpad2 = new TPad("jzbpad2","jzbpad2",0,0,1,1); |
3037 |
|
jzbpad2->cd(); |
3038 |
|
jzbpad2->SetLogy(1); |
3040 |
|
datahisto->SetMinimum(0.1); |
3041 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
3042 |
|
datahisto->Draw("e1"); |
3043 |
< |
mcstack.Draw("same"); |
3043 |
> |
mcstack.Draw("histo,same"); |
3044 |
|
datahisto->Draw("same,e1"); |
3045 |
|
leg->SetHeader(""); |
3046 |
|
leg->Draw(); |
3047 |
|
writeline1->SetTextSize(0.035); |
3048 |
|
writeline1->Draw(); |
3049 |
|
DrawPrelim(); |
3050 |
< |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
3051 |
< |
else save_with_ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
3050 |
> |
if(!Contains(savename,"Dibosons")) Save_With_Ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
3051 |
> |
else Save_With_Ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
3052 |
|
datahisto->Delete(); |
3053 |
|
mcstack.Delete(); |
3054 |
|
} |
3076 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning); |
3077 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning); |
3078 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning); |
3079 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
3080 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
3079 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
3080 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
3081 |
|
|
3082 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning); |
3083 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning); |
3084 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
3085 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
3084 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
3085 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
3086 |
|
|
3087 |
|
delete dican; |
3088 |
|
} |
3089 |
|
|
3090 |
|
|
3091 |
|
void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
3092 |
+ |
switch_overunderflow(true); |
3093 |
|
vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ"); |
3094 |
|
|
3095 |
|
if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) { |
3102 |
|
|
3103 |
|
|
3104 |
|
dout << "Going to increase the cross section for diboson samples ... " << endl; |
3105 |
< |
for(int i=0;i<SamplesToBeModified.size();i++) { |
3105 |
> |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
3106 |
|
float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
3107 |
|
(allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor; |
3108 |
|
dout << " Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl; |
3112 |
|
} |
3113 |
|
|
3114 |
|
dout << "Going to produce JZB plots" << endl; |
3115 |
< |
// produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
3115 |
> |
produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
3116 |
|
TCanvas *gloca = new TCanvas("gloca","gloca"); |
1667 |
– |
float sigma=123456; |
3117 |
|
|
3118 |
|
dout << "Going to produce prediction plots" << endl; |
3119 |
< |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
3120 |
< |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
3119 |
> |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
3120 |
> |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
3121 |
|
delete gloca; |
3122 |
|
|
3123 |
|
dout << "Going to reset the cross section for diboson samples ... " << endl; |
3124 |
< |
for(int i=0;i<SamplesToBeModified.size();i++) { |
3124 |
> |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
3125 |
|
float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
3126 |
|
(allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor); |
3127 |
|
string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename; |
3129 |
|
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; |
3130 |
|
|
3131 |
|
} |
3132 |
+ |
// switch_overunderflow(false); |
3133 |
+ |
} |
3134 |
+ |
|
3135 |
+ |
|
3136 |
+ |
void draw_normalized_data_vs_data_histo(TCut cut1, TCut cut2, string variable, string legentry1, string legentry2, string savename, TCanvas *can,vector<float> binning) { |
3137 |
+ |
TPad *jzbpad = new TPad("jzbpad","jzbpad",0,0,1,1); |
3138 |
+ |
jzbpad->cd(); |
3139 |
+ |
jzbpad->SetLogy(1); |
3140 |
+ |
string xlabel="JZB [GeV]"; |
3141 |
+ |
|
3142 |
+ |
TH1F *datahisto1 = allsamples.Draw("datahisto1",variable,binning, xlabel, "events",cut1,data,luminosity); |
3143 |
+ |
datahisto1->SetLineColor(kRed); |
3144 |
+ |
datahisto1->SetMarkerColor(kRed); |
3145 |
+ |
TH1F *datahisto2 = allsamples.Draw("datahisto2",variable,binning, xlabel, "events",cut2,data,luminosity); |
3146 |
+ |
datahisto2->SetLineColor(kBlue); |
3147 |
+ |
datahisto2->SetMarkerColor(kBlue); |
3148 |
+ |
|
3149 |
+ |
datahisto2->SetMarkerSize(DataMarkerSize); |
3150 |
+ |
datahisto1->DrawNormalized("e1"); |
3151 |
+ |
datahisto2->DrawNormalized("histo,same"); |
3152 |
+ |
datahisto1->DrawNormalized("same,e1"); |
3153 |
|
|
3154 |
+ |
TLegend *leg = make_legend(); |
3155 |
+ |
leg->AddEntry(datahisto1,legentry1.c_str()); |
3156 |
+ |
leg->AddEntry(datahisto2,legentry2.c_str()); |
3157 |
+ |
leg->Draw(); |
3158 |
+ |
|
3159 |
+ |
Save_With_Ratio(datahisto1,datahisto2,jzbpad->cd(),("jzb/"+savename)); |
3160 |
+ |
|
3161 |
+ |
datahisto1->Delete(); |
3162 |
+ |
datahisto2->Delete(); |
3163 |
|
} |
3164 |
+ |
|
3165 |
+ |
|
3166 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
3167 |
+ |
switch_overunderflow(true); |
3168 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
3169 |
|
float max=jzbHigh ; |
3170 |
|
float min=-120; |
3177 |
|
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
3178 |
|
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
3179 |
|
|
3180 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
3181 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
3182 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
3183 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
3184 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
3185 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
3186 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3187 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
3188 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
3180 |
> |
if ( !PlottingSetup::Approved ) { |
3181 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
3182 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
3183 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
3184 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
3185 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
3186 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
3187 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3188 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
3189 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
3190 |
> |
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); |
3191 |
> |
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); |
3192 |
> |
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); |
3193 |
> |
|
3194 |
> |
} |
3195 |
|
|
3196 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarse",can,coarse_binning); |
3197 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
3198 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3199 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
3200 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
3201 |
< |
|
3202 |
< |
// 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); |
3197 |
> |
if ( !PlottingSetup::Approved ) { |
3198 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
3199 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3200 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
3201 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
3202 |
> |
} |
3203 |
|
delete can; |
3204 |
+ |
switch_overunderflow(false); |
3205 |
|
} |
3206 |
|
|
3207 |
|
|
3251 |
|
TCanvas *yica = new TCanvas("yica","yield canvas"); |
3252 |
|
|
3253 |
|
int nRegions=4; |
3254 |
< |
if(!PlottingSetup::RestrictToMassPeak) nRegions=2; |
3254 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2; |
3255 |
|
string tsRegions[] = {"SFZP","OFZP","SFSB","OFSB"}; |
3256 |
|
string posneg[] = {"pos","neg"}; |
3257 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
3258 |
|
|
3259 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
3259 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
3260 |
|
TCut jzbMC[] = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") }; |
3261 |
|
dout << "_________________________________________________________" << endl; |
3262 |
|
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl; |
3263 |
< |
for(int isample=0;isample<(allsamples.collection).size();isample++) { |
3263 |
> |
for(int isample=0;isample<(int)(allsamples.collection).size();isample++) { |
3264 |
|
if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << " & "; |
3265 |
|
else dout << "Sample & "; |
3266 |
|
for(int iregion=0;iregion<nRegions;iregion++) { |
3519 |
|
|
3520 |
|
void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) { |
3521 |
|
int all_leptons=-1; |
2037 |
– |
int electrons_only=0; |
2038 |
– |
int mu_only=1; |
2039 |
– |
int twojetswith50gev=1; |
3522 |
|
int threejetswith30gev=0; |
3523 |
|
/* |
3524 |
+ |
int twojetswith50gev=1; |
3525 |
+ |
int electrons_only=0; |
3526 |
+ |
int mu_only=1; |
3527 |
+ |
|
3528 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev); |
3529 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev); |
3530 |
|
|
3538 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true); |
3539 |
|
} |
3540 |
|
|
3541 |
< |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
2056 |
< |
//first: colorful plots |
3541 |
> |
float find_one_correction_factor(string FindKeyword, bool dodata, TCut SpecialCut, string SaveAs) { |
3542 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
3543 |
|
cancorr->SetLogz(); |
3544 |
|
cancorr->SetRightMargin(0.13); |
3545 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3546 |
< |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"); |
3545 |
> |
TCut zptforresponsepresentation(Restrmasscut&&SpecialCut&&passtrig); |
3546 |
> |
|
3547 |
> |
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
3548 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
3549 |
< |
(allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation); |
3549 |
> |
niceresponseplotd->Sumw2(); |
3550 |
> |
TH2F* emuResponse = (TH2F*)niceresponseplotd->Clone("emuResponse"); |
3551 |
> |
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
3552 |
> |
for(int iSample=0;iSample<(int)SampleIndices.size();iSample++) { |
3553 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data && !dodata) continue; |
3554 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data ==false && dodata) continue; |
3555 |
> |
|
3556 |
> |
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl; |
3557 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",(zptforresponsepresentation&&cutOSSF)*cutWeight); |
3558 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+emuResponse",(zptforresponsepresentation&&cutOSOF)*cutWeight); |
3559 |
> |
} |
3560 |
> |
niceresponseplotd->Add(emuResponse,-1); |
3561 |
> |
|
3562 |
|
niceresponseplotd->SetStats(0); |
3563 |
|
niceresponseplotd->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
3564 |
|
niceresponseplotd->GetYaxis()->SetTitle("Response"); |
3566 |
|
niceresponseplotd->GetYaxis()->CenterTitle(); |
3567 |
|
niceresponseplotd->Draw("COLZ"); |
3568 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
3569 |
+ |
profd->Rebin(2); |
3570 |
|
profd->SetMarkerSize(DataMarkerSize); |
3571 |
< |
profd->Fit("pol0","","same,e1",30,400); |
3571 |
> |
profd->Fit("pol0","","same,e1",100,400); |
3572 |
|
DrawPrelim(); |
3573 |
< |
TText* title = write_text(0.5,0.7,"Data"); |
3573 |
> |
string stitle="Data"; |
3574 |
> |
if(!Contains(FindKeyword,"Data")) stitle="MC"; |
3575 |
> |
TText* title = write_text(0.5,0.7,stitle.c_str()); |
3576 |
|
title->SetTextAlign(12); |
3577 |
|
title->Draw(); |
3578 |
|
TF1 *datapol=(TF1*)profd->GetFunction("pol0"); |
3579 |
< |
float datacorrection=datapol->GetParameter(0); |
3580 |
< |
stringstream dataresstring; |
3581 |
< |
dataresstring<<"Response: "<<std::setprecision(2)<<100*datacorrection<<" %"; |
3582 |
< |
TText* restitle = write_text(0.5,0.65,dataresstring.str()); |
3579 |
> |
float correction=datapol->GetParameter(0); |
3580 |
> |
stringstream resstring; |
3581 |
> |
resstring<<"Response: "<<std::setprecision(2)<<100*correction<<" %"; |
3582 |
> |
TText* restitle = write_text(0.5,0.65,resstring.str()); |
3583 |
|
restitle->SetTextAlign(12); |
3584 |
|
restitle->SetTextSize(0.03); |
3585 |
|
restitle->Draw(); |
3586 |
< |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_Data"); |
3587 |
< |
|
3588 |
< |
TH2F *niceresponseplotm = new TH2F("niceresponseplotm","",100,0,600,100,0,5); |
3589 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation); |
3590 |
< |
niceresponseplotm->SetStats(0); |
3591 |
< |
niceresponseplotm->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
3592 |
< |
niceresponseplotm->GetYaxis()->SetTitle("Response"); |
3593 |
< |
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"); |
3586 |
> |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_New_"+SaveAs); |
3587 |
> |
delete cancorr; |
3588 |
> |
delete niceresponseplotd; |
3589 |
> |
delete profd; |
3590 |
> |
return correction; |
3591 |
> |
} |
3592 |
> |
|
3593 |
> |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
3594 |
|
|
3595 |
+ |
dout << "Computing response corrections: " << endl; |
3596 |
+ |
//Step 1 : Get results |
3597 |
+ |
float datacorrection=find_one_correction_factor("Data",true,"","Data"); |
3598 |
+ |
float mccorrection=find_one_correction_factor("DY",false,"","MC"); |
3599 |
+ |
|
3600 |
+ |
float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
3601 |
+ |
float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee"); |
3602 |
+ |
|
3603 |
+ |
float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm"); |
3604 |
+ |
float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm"); |
3605 |
+ |
|
3606 |
+ |
cout << "Corrections : " << endl; |
3607 |
+ |
cout << " Data : " << datacorrection << endl; |
3608 |
+ |
cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
3609 |
+ |
cout << " MC : " << mccorrection << endl; |
3610 |
+ |
cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
3611 |
|
|
3612 |
< |
//Step 2: Getting the result |
2115 |
< |
// TCut zptcutforresponse("pt>30&&pt<300&&TMath::Abs(91.2-mll)<20&&id1==id2&&(ch1*ch2<0)"); |
3612 |
> |
//Step 2: Processing the result and making it into something useful :-) |
3613 |
|
stringstream jzbvardatas; |
3614 |
< |
if(datacorrection>1) jzbvardatas<<"(jzb[1]-"<<datacorrection-1<<"*pt)"; |
3615 |
< |
if(datacorrection<1) jzbvardatas<<"(jzb[1]+"<<1-datacorrection<<"*pt)"; |
3614 |
> |
jzbvardatas << "("; |
3615 |
> |
|
3616 |
> |
if(dataEEcorrection>=1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]-" << dataEEcorrection-1 << "*pt))"; |
3617 |
> |
if(dataEEcorrection<1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-dataEEcorrection << "*pt))"; |
3618 |
> |
|
3619 |
> |
if(dataMMcorrection>=1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]-" << dataMMcorrection-1 << "*pt))"; |
3620 |
> |
if(dataMMcorrection<1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-dataMMcorrection << "*pt))"; |
3621 |
> |
|
3622 |
> |
float averagecorrection=(dataMMcorrection+dataEEcorrection)/2.0; |
3623 |
> |
|
3624 |
> |
if(datacorrection>=1) jzbvardatas<<"+((id1!=id2)*(jzb[1]-" << datacorrection-1 << "*pt))"; |
3625 |
> |
if(datacorrection<1) jzbvardatas<<"+((id1!=id2)*(jzb[1]+" << 1-datacorrection << "*pt))"; |
3626 |
> |
|
3627 |
> |
jzbvardatas << ")"; |
3628 |
|
jzbvardata=jzbvardatas.str(); |
3629 |
+ |
|
3630 |
|
stringstream jzbvarmcs; |
3631 |
< |
if(mccorrection>1) jzbvarmcs<<"(jzb[1]-"<<mccorrection-1<<"*pt)"; |
3632 |
< |
if(mccorrection<1) jzbvarmcs<<"(jzb[1]+"<<1-mccorrection<<"*pt)"; |
3631 |
> |
jzbvarmcs << "("; |
3632 |
> |
|
3633 |
> |
if(mcEEcorrection>=1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]-" << mcEEcorrection-1 << "*pt))"; |
3634 |
> |
if(mcEEcorrection<1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-mcEEcorrection << "*pt))"; |
3635 |
> |
|
3636 |
> |
if(mcMMcorrection>=1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]-" << mcMMcorrection-1 << "*pt))"; |
3637 |
> |
if(mcMMcorrection<1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-mcMMcorrection << "*pt))"; |
3638 |
> |
|
3639 |
> |
float averagemccorrection=(mcMMcorrection+mcEEcorrection)/2.0; |
3640 |
> |
|
3641 |
> |
if(mccorrection>=1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]-" << mccorrection-1 << "*pt))"; |
3642 |
> |
if(mccorrection<1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]+" << 1-mccorrection << "*pt))"; |
3643 |
> |
|
3644 |
> |
jzbvarmcs << ")"; |
3645 |
|
jzbvarmc=jzbvarmcs.str(); |
3646 |
+ |
|
3647 |
|
dout << "JZB Z pt correction summary : " << endl; |
3648 |
|
dout << " Data: The response is " << datacorrection << " --> jzb variable is now : " << jzbvardata << endl; |
3649 |
|
dout << " MC : The response is " << mccorrection << " --> jzb variable is now : " << jzbvarmc << endl; |
3650 |
+ |
|
3651 |
|
} |
3652 |
|
|
3653 |
< |
void pick_up_events(string cut) { |
3654 |
< |
dout << "Picking up events with cut " << cut << endl; |
2131 |
< |
allsamples.PickUpEvents(cut); |
3653 |
> |
void pick_up_events(string cut, string filename) { |
3654 |
> |
allsamples.PickUpEvents(cut,filename); |
3655 |
|
} |
3656 |
|
|
3657 |
< |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError) { |
3657 |
> |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) { |
3658 |
|
dout << "Saving configuration template!" << endl; |
3659 |
|
ofstream configfile; |
3660 |
|
configfile.open("../DistributedModelCalculations/last_configuration.C"); |
3674 |
|
configfile<<"string datajzb=\"datajzb_ERROR\";\n"; |
3675 |
|
configfile<<"string mcjzb=\"mcjzb_ERROR\";\n"; |
3676 |
|
configfile<<"vector<float>jzb_cuts;\n"; |
3677 |
+ |
configfile<<"vector<float>jzb_shape_limit_bins;\n"; |
3678 |
|
configfile<<"float MCPeakError=-999;\n"; |
3679 |
|
configfile<<"float DataPeakError=-999;\n"; |
3680 |
|
configfile<<"}\n\n"; |
3684 |
|
configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n"; |
3685 |
|
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n"; |
3686 |
|
configfile<<"DataPeakError="<<DataPeakError<<";\n\n"; |
3687 |
< |
for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
3687 |
> |
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"; |
3688 |
|
configfile<<"\n\n"; |
3689 |
< |
for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
3690 |
< |
for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
3691 |
< |
for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
3689 |
> |
for(int i=0;i<(int)Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
3690 |
> |
for(int i=0;i<(int)Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
3691 |
> |
for(int i=0;i<(int)Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
3692 |
> |
configfile<<"\n\n"; |
3693 |
> |
for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
3694 |
> |
for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
3695 |
> |
for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
3696 |
> |
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"; |
3697 |
|
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"; |
3698 |
|
configfile<<"\n\n"; |
3699 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
3700 |
|
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
3701 |
+ |
configfile<<"UseSidebandsForcJZB="<<UseSidebandsForcJZB<<";//tells us whether to use the sidebands or not\n"; |
3702 |
|
|
3703 |
|
configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n"; |
3704 |
|
|
3721 |
|
float max=histos[0]->GetMaximum(); |
3722 |
|
if(manualmin>=0) min=manualmin; |
3723 |
|
else { |
3724 |
< |
for(int i=1;i<histos.size();i++) { |
3724 |
> |
for(int i=1;i<(int)histos.size();i++) { |
3725 |
|
float curmin=get_nonzero_minimum(histos[i]); |
3726 |
|
float curmax=histos[i]->GetMaximum(); |
3727 |
|
if(curmin<min) min=curmin; |
3732 |
|
histos[0]->Draw(drawoption.c_str()); |
3733 |
|
stringstream drawopt; |
3734 |
|
drawopt << drawoption << ",same"; |
3735 |
< |
for(int i=1;i<histos.size();i++) { |
3735 |
> |
for(int i=1;i<(int)histos.size();i++) { |
3736 |
|
histos[i]->Draw(drawopt.str().c_str()); |
3737 |
|
} |
3738 |
|
} |
3741 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
3742 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
3743 |
|
TCut weightbackup=cutWeight; |
3744 |
< |
cutWeight="1.0"; |
3745 |
< |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
3744 |
> |
switch_overunderflow(true); |
3745 |
> |
|
3746 |
> |
bool doPURW=false; |
3747 |
|
|
3748 |
+ |
|
3749 |
+ |
if(!doPURW) { |
3750 |
+ |
dout << "Not doing PU reweighting for ttbar closure test" << endl; |
3751 |
+ |
cutWeight="1.0"; |
3752 |
+ |
// Do it without PU re-weighting |
3753 |
+ |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
3754 |
+ |
stringstream resultsNoPU; |
3755 |
+ |
stringstream noPUdatajzb; |
3756 |
+ |
stringstream noPUmcjzb; |
3757 |
+ |
|
3758 |
+ |
stringstream mcjzbnoPU; |
3759 |
+ |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
3760 |
+ |
mcjzb = noPUmcjzb.str(); |
3761 |
+ |
} |
3762 |
+ |
|
3763 |
+ |
|
3764 |
+ |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
3765 |
|
|
3766 |
< |
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
3767 |
< |
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
3766 |
> |
TH1F *TZem = allsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
3767 |
> |
TH1F *nTZem = allsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
3768 |
|
TH1F *TSem; |
3769 |
|
TH1F *nTSem; |
3770 |
< |
TH1F *TZeemm = systsamples.Draw("TZeemm",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
3771 |
< |
TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
3770 |
> |
TH1F *TZeemm = allsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
3771 |
> |
TH1F *nTZeemm = allsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
3772 |
|
TH1F *TSeemm; |
3773 |
|
TH1F *nTSeemm; |
3774 |
|
|
3775 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3776 |
< |
TSem = systsamples.Draw("TSem",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
3777 |
< |
nTSem = systsamples.Draw("nTSem","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
3778 |
< |
TSeemm = systsamples.Draw("TSeemm",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
3779 |
< |
nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
3775 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3776 |
> |
TSem = allsamples.Draw("TSem", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
3777 |
> |
nTSem = allsamples.Draw("nTSem", "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
3778 |
> |
TSeemm = allsamples.Draw("TSeemm", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
3779 |
> |
nTSeemm = allsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
3780 |
|
} |
3781 |
|
|
3782 |
|
TCanvas *tcan = new TCanvas("tcan","tcan"); |
2238 |
– |
|
3783 |
|
tcan->SetLogy(1); |
3784 |
|
|
3785 |
|
TZeemm->SetLineColor(kBlack); |
3788 |
|
TZem->SetMarkerColor(kRed); |
3789 |
|
|
3790 |
|
|
3791 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3791 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3792 |
|
TSem->SetLineColor(TColor::GetColor("#00A616")); |
3793 |
|
TSeemm->SetLineColor(kMagenta+2); |
3794 |
|
TSem->SetMarkerColor(TColor::GetColor("#00A616")); |
3798 |
|
} |
3799 |
|
|
3800 |
|
vector<TH1F*> histos; |
3801 |
+ |
TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
3802 |
+ |
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
3803 |
|
histos.push_back(TZem); |
3804 |
|
histos.push_back(TZeemm); |
3805 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3805 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3806 |
> |
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
3807 |
> |
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
3808 |
|
histos.push_back(TSem); |
3809 |
|
histos.push_back(TSeemm); |
3810 |
|
} |
3811 |
< |
draw_all_ttbar_histos(tcan,histos,"histo",0.04); |
3811 |
> |
draw_all_ttbar_histos(tcan,histos,"histo",8); |
3812 |
|
|
3813 |
|
TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false); |
3814 |
|
leg->AddEntry(TZeemm,"SFZP","l"); |
3815 |
|
leg->AddEntry(TZem,"OFZP","l"); |
3816 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3816 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3817 |
|
leg->AddEntry(TSeemm,"SFSB","l"); |
3818 |
|
leg->AddEntry(TSem,"OFSB","l"); |
3819 |
|
} |
3820 |
|
leg->Draw("same"); |
3821 |
|
DrawMCPrelim(simulatedlumi); |
3822 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
3823 |
< |
cout << __LINE__ << endl; |
3823 |
> |
|
3824 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
2277 |
– |
cout << __LINE__ << endl; |
3825 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
2279 |
– |
cout << __LINE__ << endl; |
3826 |
|
TH1F *TSeemmcopy; |
3827 |
|
TH1F *TSemcopy; |
3828 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3828 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3829 |
|
TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
3830 |
|
TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
3831 |
|
} |
3832 |
|
|
3833 |
|
TZem->Divide(TZeemm); |
3834 |
|
TZem->SetMarkerStyle(21); |
3835 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3835 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3836 |
|
TSem->Divide(TZeemm); |
3837 |
|
TSeemm->Divide(TZeemm); |
3838 |
|
TSem->SetMarkerStyle(24); |
3839 |
|
TSeemm->SetMarkerStyle(32); |
3840 |
< |
} |
3840 |
> |
} |
3841 |
|
|
3842 |
|
tcan->SetLogy(0); |
3843 |
|
TZem->GetYaxis()->SetRangeUser(0,2.5); |
3844 |
|
TZem->GetYaxis()->SetTitle("ratio"); |
3845 |
|
TZem->Draw(); |
3846 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3846 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3847 |
|
TSem->Draw("same"); |
3848 |
|
TSeemm->Draw("same"); |
3849 |
|
} |
3850 |
|
|
3851 |
< |
float linepos=0.25; |
3852 |
< |
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
3853 |
< |
if(!PlottingSetup::RestrictToMassPeak) linepos=0.1; //sys uncertainty for iJZB |
3851 |
> |
float linepos=emuncertONPEAK; |
3852 |
> |
if(!PlottingSetup::RestrictToMassPeak) linepos=emuncertOFFPEAK; |
3853 |
> |
|
3854 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
3855 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
3856 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
3873 |
|
|
3874 |
|
TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false); |
3875 |
|
leg2->AddEntry(TZem,"OFZP / SFZP","ple"); |
3876 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3876 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3877 |
|
leg2->AddEntry(TSeemm,"SFSB / SFZP","ple"); |
3878 |
|
leg2->AddEntry(TSem,"OFSB / SFZP","ple"); |
3879 |
|
} |
3886 |
|
DrawMCPrelim(simulatedlumi); |
3887 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
3888 |
|
|
3889 |
+ |
|
3890 |
+ |
if (0) { // Turn this off: we don't need this |
3891 |
|
|
3892 |
< |
///-------------- second part: only look at the quantity we actually care about! |
3893 |
< |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
3894 |
< |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
3895 |
< |
rightsfzp->Add(leftsfzp,-1); |
3896 |
< |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
3897 |
< |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
3898 |
< |
rightofzp->Add(leftofzp,-1); |
3899 |
< |
TH1F *leftofsb; |
3900 |
< |
TH1F *rightofsb; |
3901 |
< |
TH1F *leftsfsb; |
3902 |
< |
TH1F *rightsfsb; |
3903 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3904 |
< |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
3905 |
< |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
3906 |
< |
rightofsb->Add(leftofsb,-1); |
3907 |
< |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
3908 |
< |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
3909 |
< |
rightsfsb->Add(leftsfsb,-1); |
3910 |
< |
} |
3892 |
> |
///-------------- second part: only look at the quantity we actually care about! |
3893 |
> |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
3894 |
> |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
3895 |
> |
rightsfzp->Add(leftsfzp,-1); |
3896 |
> |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
3897 |
> |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
3898 |
> |
rightofzp->Add(leftofzp,-1); |
3899 |
> |
TH1F *leftofsb; |
3900 |
> |
TH1F *rightofsb; |
3901 |
> |
TH1F *leftsfsb; |
3902 |
> |
TH1F *rightsfsb; |
3903 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3904 |
> |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
3905 |
> |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
3906 |
> |
rightofsb->Add(leftofsb,-1); |
3907 |
> |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
3908 |
> |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
3909 |
> |
rightsfsb->Add(leftsfsb,-1); |
3910 |
> |
} |
3911 |
|
|
3912 |
< |
tcan->SetLogy(1); |
3913 |
< |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
3914 |
< |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
3915 |
< |
rightsfzp->Draw("histo"); |
3916 |
< |
rightofzp->Draw("histo,same"); |
3917 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3918 |
< |
rightofsb->Draw("histo,same"); |
3919 |
< |
rightsfsb->Draw("histo,same"); |
3920 |
< |
} |
3921 |
< |
DrawMCPrelim(simulatedlumi); |
3912 |
> |
tcan->SetLogy(1); |
3913 |
> |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
3914 |
> |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
3915 |
> |
rightsfzp->Draw("histo"); |
3916 |
> |
rightofzp->Draw("histo,same"); |
3917 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3918 |
> |
rightofsb->Draw("histo,same"); |
3919 |
> |
rightsfsb->Draw("histo,same"); |
3920 |
> |
} |
3921 |
> |
DrawMCPrelim(simulatedlumi); |
3922 |
|
|
3923 |
< |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
3924 |
< |
legA->AddEntry(rightsfzp,"SFZP","l"); |
3925 |
< |
legA->AddEntry(rightofzp,"OFZP","l"); |
3926 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3927 |
< |
legA->AddEntry(rightofsb,"SFSB","l"); |
3928 |
< |
legA->AddEntry(rightsfsb,"OFSB","l"); |
3929 |
< |
} |
3930 |
< |
legA->Draw(); |
3923 |
> |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
3924 |
> |
legA->AddEntry(rightsfzp,"SFZP","l"); |
3925 |
> |
legA->AddEntry(rightofzp,"OFZP","l"); |
3926 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3927 |
> |
legA->AddEntry(rightofsb,"SFSB","l"); |
3928 |
> |
legA->AddEntry(rightsfsb,"OFSB","l"); |
3929 |
> |
} |
3930 |
> |
legA->Draw(); |
3931 |
|
|
3932 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
3932 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
3933 |
|
|
3934 |
< |
tcan->SetLogy(0); |
3935 |
< |
rightofzp->Divide(rightsfzp); |
3936 |
< |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
3937 |
< |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.0); |
3938 |
< |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
3939 |
< |
rightofzp->Draw(); |
3940 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3941 |
< |
rightofsb->Divide(rightsfzp); |
3942 |
< |
rightsfsb->Divide(rightsfzp); |
3943 |
< |
rightofsb->Draw("same"); |
3944 |
< |
rightsfsb->Draw("same"); |
3945 |
< |
} |
3946 |
< |
|
3947 |
< |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
3948 |
< |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
3949 |
< |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
3950 |
< |
|
3951 |
< |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
3952 |
< |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
3953 |
< |
center2->SetLineColor(kBlue); |
3954 |
< |
|
3955 |
< |
top2->Draw("same"); |
3956 |
< |
center2->Draw("same"); |
3957 |
< |
bottom2->Draw("same"); |
3958 |
< |
|
3959 |
< |
rightofzp->SetMarkerStyle(21); |
3960 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3961 |
< |
rightofsb->SetMarkerStyle(24); |
3962 |
< |
rightsfsb->SetMarkerStyle(32); |
3963 |
< |
} |
3964 |
< |
|
3965 |
< |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
3966 |
< |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
3967 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3968 |
< |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
3969 |
< |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
3970 |
< |
} |
3971 |
< |
leg3->AddEntry(bottom,"syst. envelope","l"); |
3972 |
< |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
3973 |
< |
leg3->SetY1(0.65); |
3934 |
> |
tcan->SetLogy(0); |
3935 |
> |
rightofzp->Divide(rightsfzp); |
3936 |
> |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
3937 |
> |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
3938 |
> |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
3939 |
> |
rightofzp->Draw(); |
3940 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3941 |
> |
rightofsb->Divide(rightsfzp); |
3942 |
> |
rightsfsb->Divide(rightsfzp); |
3943 |
> |
rightofsb->Draw("same"); |
3944 |
> |
rightsfsb->Draw("same"); |
3945 |
> |
} |
3946 |
> |
|
3947 |
> |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
3948 |
> |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
3949 |
> |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
3950 |
> |
|
3951 |
> |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
3952 |
> |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
3953 |
> |
center2->SetLineColor(kBlue); |
3954 |
> |
|
3955 |
> |
top2->Draw("same"); |
3956 |
> |
center2->Draw("same"); |
3957 |
> |
bottom2->Draw("same"); |
3958 |
> |
|
3959 |
> |
rightofzp->SetMarkerStyle(21); |
3960 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3961 |
> |
rightofsb->SetMarkerStyle(24); |
3962 |
> |
rightsfsb->SetMarkerStyle(32); |
3963 |
> |
} |
3964 |
> |
|
3965 |
> |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
3966 |
> |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
3967 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3968 |
> |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
3969 |
> |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
3970 |
> |
} |
3971 |
> |
leg3->AddEntry(bottom,"syst. envelope","l"); |
3972 |
> |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
3973 |
> |
leg3->SetY1(0.65); |
3974 |
|
|
3975 |
< |
leg3->Draw("same"); |
3975 |
> |
leg3->Draw("same"); |
3976 |
|
|
3977 |
< |
DrawMCPrelim(simulatedlumi); |
3978 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
3977 |
> |
DrawMCPrelim(simulatedlumi); |
3978 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
3979 |
> |
|
3980 |
> |
} |
3981 |
|
|
3982 |
|
delete TZem; |
3983 |
|
delete nTZem; |
3984 |
|
delete TZeemm; |
3985 |
|
delete nTZeemm; |
3986 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3986 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3987 |
|
delete TSem; |
3988 |
|
delete nTSem; |
3989 |
|
delete TSeemm; |
3992 |
|
|
3993 |
|
delete tcan; |
3994 |
|
cutWeight=weightbackup; |
3995 |
+ |
switch_overunderflow(false); |
3996 |
|
} |
3997 |
|
|
3998 |
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) { |
3999 |
|
vector<float> nicer_binning; |
4000 |
< |
nicer_binning.push_back(-125); |
4000 |
> |
|
4001 |
> |
/* nicer_binning.push_back(-400); |
4002 |
> |
nicer_binning.push_back(-250); |
4003 |
> |
nicer_binning.push_back(-200); |
4004 |
> |
nicer_binning.push_back(-150); |
4005 |
> |
nicer_binning.push_back(-100); |
4006 |
> |
nicer_binning.push_back(-50); |
4007 |
> |
nicer_binning.push_back(-20); |
4008 |
> |
|
4009 |
> |
nicer_binning.push_back(0); |
4010 |
> |
nicer_binning.push_back(20); |
4011 |
> |
nicer_binning.push_back(50); |
4012 |
> |
nicer_binning.push_back(100); |
4013 |
> |
nicer_binning.push_back(150); |
4014 |
> |
nicer_binning.push_back(200); |
4015 |
> |
nicer_binning.push_back(250); |
4016 |
> |
nicer_binning.push_back(400);*/ |
4017 |
> |
|
4018 |
|
nicer_binning.push_back(-100); |
2451 |
– |
nicer_binning.push_back(-75); |
4019 |
|
nicer_binning.push_back(-50); |
4020 |
|
nicer_binning.push_back(-25); |
4021 |
|
nicer_binning.push_back(0); |
4025 |
|
nicer_binning.push_back(100); |
4026 |
|
nicer_binning.push_back(125); |
4027 |
|
nicer_binning.push_back(150); |
4028 |
< |
nicer_binning.push_back(175); |
4028 |
> |
//nicer_binning.push_back(175); |
4029 |
|
nicer_binning.push_back(200); |
4030 |
< |
nicer_binning.push_back(230); |
4031 |
< |
nicer_binning.push_back(280); |
4032 |
< |
nicer_binning.push_back(400); |
4030 |
> |
// nicer_binning.push_back(250); |
4031 |
> |
// nicer_binning.push_back(300); |
4032 |
> |
// nicer_binning.push_back(400); |
4033 |
> |
|
4034 |
|
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
4035 |
|
} |
4036 |
|
|
4037 |
|
|
4038 |
< |
void zjets_prediction_comparison() { |
4039 |
< |
// Do it without PU re-weighting |
4040 |
< |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
4041 |
< |
stringstream resultsNoPU; |
4042 |
< |
|
4043 |
< |
stringstream mcjzbnoPU; |
4044 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,false); |
4045 |
< |
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
4046 |
< |
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
4038 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa, TCut massregioncut, string massregionname) { |
4039 |
> |
cout << "****************************************************************************************************************************************************************" << endl; |
4040 |
> |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
4041 |
> |
// zcan->SetLogy(1); |
4042 |
> |
TCut weightbackup=cutWeight; |
4043 |
> |
|
4044 |
> |
bool UsePURW=true; |
4045 |
> |
|
4046 |
> |
|
4047 |
> |
string mcjzb; |
4048 |
> |
if(UsePURW) { |
4049 |
> |
mcjzb=mcjzbWithPUa; |
4050 |
> |
cout << "Using PURW peak positions" << endl; |
4051 |
> |
} else { |
4052 |
> |
// Do it without PU re-weighting |
4053 |
> |
cutWeight="1.0"; |
4054 |
> |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
4055 |
> |
stringstream resultsNoPU; |
4056 |
> |
stringstream noPUdatajzb; |
4057 |
> |
stringstream noPUmcjzb; |
4058 |
> |
|
4059 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,false,noPUdatajzb,noPUmcjzb); |
4060 |
> |
dout << "The peak corrected JZB expression for MC without pileup is : " << noPUmcjzb.str() << endl; |
4061 |
> |
|
4062 |
> |
mcjzb = noPUmcjzb.str(); |
4063 |
> |
|
4064 |
> |
} |
4065 |
|
|
4066 |
< |
string mcjzb = mcjzbnoPU.str(); |
4067 |
< |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
4066 |
> |
|
4067 |
> |
vector<float> binning; |
4068 |
> |
binning.push_back(0); |
4069 |
> |
binning.push_back(10); |
4070 |
> |
binning.push_back(20); |
4071 |
> |
binning.push_back(40); |
4072 |
> |
binning.push_back(60); |
4073 |
> |
// binning.push_back(50); |
4074 |
> |
// binning.push_back(60); |
4075 |
> |
// binning.push_back(70); |
4076 |
> |
// binning.push_back(80); |
4077 |
> |
// binning.push_back(90); |
4078 |
> |
binning.push_back(100); |
4079 |
|
|
2483 |
– |
TCut weightbackup=cutWeight; |
2484 |
– |
cutWeight="1.0"; |
2485 |
– |
float sbg_min=0.; |
2486 |
– |
float sbg_max=100.; |
2487 |
– |
int sbg_nbins=5; |
4080 |
|
float simulatedlumi = luminosity;//in pb please - adjust to your likings |
4081 |
|
|
4082 |
|
TCut kPos((mcjzb+">0").c_str()); |
4083 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
4084 |
|
string var( "abs("+mcjzb+")" ); |
4085 |
+ |
|
4086 |
+ |
TCut notTau("abs(genMID1)!=15"); |
4087 |
+ |
TCut ee_mm_tautau("mll>0"); |
4088 |
+ |
|
4089 |
|
|
4090 |
< |
TCut kcut(cutmass&&cutOSSF&&"pfJetGoodNum>2"); |
4091 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
4092 |
< |
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")); |
4090 |
> |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4091 |
> |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4092 |
> |
|
4093 |
|
hJZBpos->SetLineColor(kBlack); |
4094 |
|
hJZBneg->SetLineColor(kRed); |
4095 |
|
|
4096 |
< |
Int_t nbins = 5; |
2503 |
< |
Float_t xmax = 100.; |
2504 |
< |
|
2505 |
< |
|
2506 |
< |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2507 |
< |
zcan->SetLogy(1); |
2508 |
< |
|
4096 |
> |
hJZBpos->SetMinimum(1.0); |
4097 |
|
hJZBpos->Draw("e1"); |
4098 |
|
hJZBneg->Draw("same,hist"); |
4099 |
|
hJZBpos->Draw("same,e1"); // So it's on top... |
4100 |
|
|
4101 |
< |
TLegend *leg = make_legend("MC Z+jets",0.55,0.75,false); |
4101 |
> |
TLegend *leg = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.55,0.75,false); |
4102 |
|
leg->AddEntry(hJZBpos,"Observed","pe"); |
4103 |
|
leg->AddEntry(hJZBneg,"Predicted","l"); |
4104 |
|
leg->Draw("same"); |
4105 |
|
DrawMCPrelim(simulatedlumi); |
4106 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction"); |
4106 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction"+any2string(massregionname)); |
4107 |
|
|
4108 |
|
TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio"); |
4109 |
|
hratio->Divide(hJZBneg); |
4110 |
|
|
4111 |
< |
zcan->SetLogy(0); |
4111 |
> |
for(int i=1;i<=hJZBpos->GetNbinsX();i++) { |
4112 |
> |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << " (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << endl; |
4113 |
> |
} |
4114 |
> |
|
4115 |
> |
// zcan->SetLogy(0); |
4116 |
|
hratio->GetYaxis()->SetRangeUser(0,2.5); |
4117 |
|
hratio->GetYaxis()->SetTitle("Observed/Predicted"); |
4118 |
|
hratio->Draw("e1"); |
4119 |
|
|
4120 |
< |
TLine *top = new TLine(sbg_min,1.25,sbg_max,1.25); |
4121 |
< |
TLine *center = new TLine(sbg_min,1.0,sbg_max,1.0); |
4122 |
< |
TLine *bottom = new TLine(sbg_min,0.75,sbg_max,0.75); |
4120 |
> |
TLine *top = new TLine(binning[0],1.25,binning[binning.size()-1],1.25); |
4121 |
> |
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
4122 |
> |
TLine *bottom = new TLine(binning[0],0.75,binning[binning.size()-1],0.75); |
4123 |
|
|
4124 |
|
|
4125 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
4130 |
|
center->Draw("same"); |
4131 |
|
bottom->Draw("same"); |
4132 |
|
|
4133 |
< |
TLegend *leg2 = make_legend("MC Z+jets",0.25,0.75,false); |
4133 |
> |
TLegend *leg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
4134 |
|
leg2->AddEntry(hratio,"obs / pred","pe"); |
4135 |
|
leg2->AddEntry(bottom,"syst. envelope","l"); |
4136 |
|
leg2->Draw("same"); |
4137 |
|
DrawMCPrelim(simulatedlumi); |
4138 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction_ratio"); |
4138 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"+any2string(massregionname)); |
4139 |
> |
|
4140 |
> |
TCut reducedNJets(cutnJets); |
4141 |
> |
|
4142 |
> |
TH1F *TAUhJZBpos = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4143 |
> |
TH1F *LcorrJZBeemm = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4144 |
> |
TH1F *RcorrJZBem = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4145 |
> |
TH1F *LcorrJZBem = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4146 |
> |
|
4147 |
> |
TH1F *RcorrJZBSBem; |
4148 |
> |
TH1F *LcorrJZBSBem; |
4149 |
> |
TH1F *RcorrJZBSBeemm; |
4150 |
> |
TH1F *LcorrJZBSBeemm; |
4151 |
> |
|
4152 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4153 |
> |
RcorrJZBSBem = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4154 |
> |
LcorrJZBSBem = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4155 |
> |
RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4156 |
> |
LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4157 |
> |
} |
4158 |
> |
|
4159 |
> |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
4160 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4161 |
> |
Bpred->Add(RcorrJZBem,1.0/3.); |
4162 |
> |
Bpred->Add(LcorrJZBem,-1.0/3.); |
4163 |
> |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
4164 |
> |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
4165 |
> |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
4166 |
> |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
4167 |
> |
} else { |
4168 |
> |
Bpred->Add(RcorrJZBem,1.0); |
4169 |
> |
Bpred->Add(LcorrJZBem,-1.0); |
4170 |
> |
} |
4171 |
> |
|
4172 |
> |
Bpred->SetLineColor(kRed); |
4173 |
> |
|
4174 |
> |
TAUhJZBpos->SetLineColor(kBlack); |
4175 |
> |
Bpred->SetLineColor(kRed); |
4176 |
> |
|
4177 |
> |
TAUhJZBpos->SetMinimum(1.0); |
4178 |
> |
TAUhJZBpos->Draw("e1"); |
4179 |
> |
Bpred->Draw("same,hist"); |
4180 |
> |
TAUhJZBpos->Draw("same,e1"); |
4181 |
> |
|
4182 |
> |
TLegend *TAUleg = make_legend("MC Z+jets #rightarrow ee,#mu#mu,#tau#tau",0.55,0.75,false); |
4183 |
> |
TAUleg->AddEntry(TAUhJZBpos,"Observed","pe"); |
4184 |
> |
TAUleg->AddEntry(Bpred,"Predicted","l"); |
4185 |
> |
TAUleg->Draw("same"); |
4186 |
> |
DrawMCPrelim(simulatedlumi); |
4187 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction__"+any2string(massregionname)); |
4188 |
> |
|
4189 |
> |
TH1F* TAUhratio = (TH1F*)TAUhJZBpos->Clone("TAUhratio"); |
4190 |
> |
TAUhratio->Divide(Bpred); |
4191 |
> |
|
4192 |
> |
for(int i=1;i<=TAUhJZBpos->GetNbinsX();i++) { |
4193 |
> |
cout << "ee/mm/tautau observed: " << TAUhJZBpos->GetBinContent(i) << " vs predicted : " << Bpred->GetBinContent(i) << " (ratio : " << TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i) << endl; |
4194 |
> |
} |
4195 |
> |
|
4196 |
> |
zcan->SetLogy(0); |
4197 |
> |
TAUhratio->GetYaxis()->SetRangeUser(0,2.5); |
4198 |
> |
TAUhratio->GetYaxis()->SetTitle("Observed/Predicted"); |
4199 |
> |
TAUhratio->Draw("e1"); |
4200 |
> |
|
4201 |
> |
top->Draw("same"); |
4202 |
> |
center->Draw("same"); |
4203 |
> |
bottom->Draw("same"); |
4204 |
> |
|
4205 |
> |
TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
4206 |
> |
TAUleg2->AddEntry(TAUhratio,"obs / pred","pe"); |
4207 |
> |
TAUleg2->AddEntry(bottom,"syst. envelope","l"); |
4208 |
> |
TAUleg2->Draw("same"); |
4209 |
> |
DrawMCPrelim(simulatedlumi); |
4210 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio"+any2string(massregionname)); |
4211 |
> |
|
4212 |
> |
delete Bpred; |
4213 |
> |
delete TAUhJZBpos; |
4214 |
> |
delete LcorrJZBeemm; |
4215 |
> |
delete RcorrJZBem; |
4216 |
> |
delete LcorrJZBem; |
4217 |
> |
delete hJZBpos; |
4218 |
> |
delete hJZBneg; |
4219 |
> |
|
4220 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4221 |
> |
delete RcorrJZBSBem; |
4222 |
> |
delete LcorrJZBSBem; |
4223 |
> |
delete RcorrJZBSBeemm; |
4224 |
> |
delete LcorrJZBSBeemm; |
4225 |
> |
} |
4226 |
> |
|
4227 |
|
|
4228 |
|
delete zcan; |
4229 |
|
cutWeight=weightbackup; |
2550 |
– |
|
4230 |
|
} |
4231 |
|
|
4232 |
|
|
4233 |
< |
|
4233 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa) { |
4234 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut(""), "nomasscut"); |
4235 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)<20"), "Zwindow_20"); |
4236 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20&&mll<70"), "LowMassRegion2070"); |
4237 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>110"), "HighMassRegion110"); |
4238 |
> |
} |
4239 |
> |
|
4240 |
|
void sideband_assessment(string datajzb, float min=30.0, float max=50.0) { |
4241 |
|
tout << endl << endl; |
4242 |
|
stringstream bordercut; |
4254 |
|
tout << "\\begin{tabular}{l|cc}" << endl; |
4255 |
|
tout << "\\hline" << endl; |
4256 |
|
tout << "& {\\OFZP} & {\\OFSB} \\\\\\hline" << endl; |
4257 |
< |
tout << "\\#(events) & "<<OFSB<<" & "<<OFZP<<"\\\\ \\hline" << endl; |
4257 |
> |
tout << "\\#(events) & "<<OFZP<<" & "<<OFSB<<"\\\\ \\hline" << endl; |
4258 |
|
tout << "\\end{tabular}" << endl; |
4259 |
|
tout << "\\end{center}" << endl; |
4260 |
|
tout << "\\end{table}" << endl; |
4272 |
|
|
4273 |
|
TCanvas *cannie = new TCanvas("cannie","cannie"); |
4274 |
|
|
4275 |
< |
for(int icut=0;icut<jzb_cuts.size();icut++) { |
4275 |
> |
for(int icut=0;icut<(int)jzb_cuts.size();icut++) { |
4276 |
|
float currcut=jzb_cuts[icut]; |
4277 |
|
int nbins=1;float low=currcut; |
4278 |
|
vector<int> mysample; |
4287 |
|
TH1F *RcorrJZBSBeemm; |
4288 |
|
TH1F *LcorrJZBSBeemm; |
4289 |
|
|
4290 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4290 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4291 |
|
RcorrJZBSBem = coll.Draw("RcorrJZBSBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
4292 |
|
LcorrJZBSBem = coll.Draw("LcorrJZBSBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
4293 |
|
RcorrJZBSBeemm = coll.Draw("RcorrJZBSBeemm",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample); |
4295 |
|
} |
4296 |
|
|
4297 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
4298 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4298 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4299 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
4300 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
4301 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
4331 |
|
//prediction part |
4332 |
|
if(is_data) cout << "Data prediction & "; |
4333 |
|
if(subselection!="none") cout << subselection << " prediction &"; |
4334 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
4334 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
4335 |
|
|
4336 |
|
cout << endl; |
4337 |
|
//observation part |
4338 |
|
if(is_data) cout << "Data observation & "; |
4339 |
|
if(subselection!="none") cout << subselection << " observation &"; |
4340 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
4340 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
4341 |
|
cout << endl; |
4342 |
|
cout << "_________________________________________________________________" << endl; |
4343 |
|
delete cannie; |
4344 |
|
} |
4345 |
|
|
4346 |
|
void met_jzb_cut(string datajzb, string mcjzb, vector<float> jzb_cut) { |
4347 |
+ |
cout << "You probably don't want --met, you want --metplots ... " << endl; |
4348 |
+ |
assert(0); |
4349 |
|
/*we want a table like this: |
4350 |
|
__________________ 50 | 100 | ... |
4351 |
|
| Data prediction | a vs b | a vs b | ... |
4374 |
|
int nbins = sizeof(xbins)/sizeof(float)-1; |
4375 |
|
int markers[] = { 20, 26, 21, 24, 22, 25, 28 }; |
4376 |
|
|
4377 |
< |
TH1F* heff = new TH1F("heff", "JZB eff ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
4378 |
< |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
4379 |
< |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
4377 |
> |
|
4378 |
> |
TH1F* heff = new TH1F("heff", "JZB eff ; generator JZB [GeV]; efficiency",nbins,xbins); |
4379 |
> |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator JZB [GeV]; efficiency",nbins,xbins); |
4380 |
> |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator JZB [GeV]; efficiency",nbins,xbins); |
4381 |
|
|
4382 |
|
TCut kgen(genMassCut&&"genZPt>0&&genNjets>2&&abs(genMID)==23"&&cutOSSF); |
4383 |
|
TCut kreco(cutmass); |
4393 |
|
TCanvas *can = new TCanvas("can","Canvas for JZB Efficiency",600,600); |
4394 |
|
can->SetGridx(1); |
4395 |
|
can->SetGridy(1); |
4396 |
+ |
can->SetLeftMargin(0.16); |
4397 |
+ |
can->SetRightMargin(0.05); |
4398 |
|
TLegend *leg = make_legend("",0.6,0.2,false,0.89,0.5); |
4399 |
+ |
leg->SetBorderSize(1); |
4400 |
+ |
leg->SetLineColor(kBlack); |
4401 |
+ |
leg->SetTextFont(62); |
4402 |
|
|
4403 |
< |
|
2711 |
< |
|
2712 |
< |
for ( int icut=0; icut<jzb_bins.size(); ++icut ) { |
4403 |
> |
for ( int icut=0; icut<(int)jzb_bins.size(); ++icut ) { |
4404 |
|
|
4405 |
|
ostringstream selection; |
4406 |
|
selection << mcjzb << ">" << jzb_bins[icut]; |
4416 |
|
} |
4417 |
|
|
4418 |
|
heff->GetXaxis()->SetRangeUser(min, max); |
4419 |
+ |
// heff->GetXaxis()->SetLabelSize(0.05); // paper style. overruled. |
4420 |
+ |
// heff->GetYaxis()->SetLabelSize(0.05); // paper style. overruled. |
4421 |
+ |
// heff->GetXaxis()->SetTitleSize(0.06); // paper style. overruled. |
4422 |
+ |
// heff->GetYaxis()->SetTitleSize(0.06); // paper style. overruled. |
4423 |
|
heff->SetMarkerStyle(markers[icut]); |
4424 |
|
heff->Fit("func","Q+","same"); |
4425 |
|
|
4431 |
|
|
4432 |
|
// Store plot |
4433 |
|
TH1F* h = (TH1F*)heff->Clone(hname); |
4434 |
+ |
h->SetNdivisions(505,"X"); |
4435 |
|
if ( icut) h->Draw("same"); |
4436 |
|
else h->Draw(); |
4437 |
|
char htitle[256]; sprintf(htitle,"JZB > %3.0f GeV", jzb_bins[icut]); |
4452 |
|
// Calls the above function for each signal sample |
4453 |
|
void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins ) |
4454 |
|
{ |
4455 |
< |
for (int isignal=0; isignal<signalsamples.collection.size();isignal++) { |
4455 |
> |
for (int isignal=0; isignal<(int)signalsamples.collection.size();isignal++) { |
4456 |
|
dout << "JZB selection efficiency curve: " << std::endl; |
4457 |
|
JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples |
4458 |
|
} |
4495 |
|
TH1F *RcorrJZBSBeemm; |
4496 |
|
TH1F *LcorrJZBSBeemm; |
4497 |
|
|
4498 |
< |
TH1F *RcorrJZBeemmNoS; |
4498 |
> |
// TH1F *RcorrJZBeemmNoS; |
4499 |
|
|
4500 |
|
//these are for the ratio |
4501 |
|
TH1F *JRcorrJZBeemm = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
4508 |
|
TH1F *JRcorrJZBSBeemm; |
4509 |
|
TH1F *JLcorrJZBSBeemm; |
4510 |
|
|
4511 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4511 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4512 |
|
RcorrJZBSBem = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
4513 |
|
LcorrJZBSBem = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
4514 |
|
RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
4529 |
|
|
4530 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
4531 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
4532 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4532 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4533 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
4534 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
4535 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
4579 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
4580 |
|
string ytitle("ratio"); |
4581 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
4582 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,use_data!=1,ytitle); |
4582 |
> |
Save_With_Ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,false,ytitle); |
4583 |
> |
delete kinpad; |
4584 |
|
|
4585 |
|
TH1F *allevents = qcdsamples.Draw("allevents","pfJetGoodNum",1,0,100, "internal code", "events", "" ,mc, luminosity); |
4586 |
|
TH1F *ossf = qcdsamples.Draw("ossf","pfJetGoodNum",1,0,100, "internal code", "events", cutOSSF ,mc, luminosity); |
4600 |
|
dout << "______________________________________________" << endl; |
4601 |
|
dout << "How QCD shows up in the different regions: " << endl; |
4602 |
|
dout << "OSSF: " << endl; |
4603 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4603 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4604 |
|
dout << " Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
4605 |
|
dout << " sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl; |
4606 |
|
} else { |
4607 |
|
dout << " " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
4608 |
|
} |
4609 |
|
dout << "OSOF: " << endl; |
4610 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4610 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4611 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
4612 |
|
dout << " sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl; |
4613 |
|
} else { |
4614 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
4615 |
|
} |
4616 |
|
dout << "Therefore: " << endl; |
4617 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4617 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4618 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) "; |
4619 |
|
dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) "; |
4620 |
|
dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) "; |
4627 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral() << endl; |
4628 |
|
|
4629 |
|
dout << endl; |
4630 |
< |
for(int i=0;i<bins.size();i++) { |
4630 |
> |
for(int i=0;i<(int)bins.size();i++) { |
4631 |
|
dout << " JZB > " << bins[i] << " : " << endl; |
4632 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
4633 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4633 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4634 |
|
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; |
4635 |
|
} else { |
4636 |
|
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; |
4644 |
|
if(LcorrJZBem) delete LcorrJZBem; |
4645 |
|
if(RcorrJZBeemm) delete RcorrJZBeemm; |
4646 |
|
if(LcorrJZBeemm) delete LcorrJZBeemm; |
4647 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem; |
4648 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem; |
4649 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
4650 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
4647 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBem) delete RcorrJZBSBem; |
4648 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBem) delete LcorrJZBSBem; |
4649 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
4650 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
4651 |
|
} |
4652 |
|
|
4653 |
|
void check_ptsanity() { |
4675 |
|
leg->SetY2(1.0); |
4676 |
|
|
4677 |
|
|
4678 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
4678 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
4679 |
|
string nowname=(allsamples.collection)[isample].filename; |
4680 |
|
cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl; |
4681 |
|
individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
4699 |
|
ptsancan->cd(2); |
4700 |
|
fpt2->Draw(); |
4701 |
|
|
4702 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
4702 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
4703 |
|
ptsancan->cd(1); |
4704 |
|
individualpt1histos[isample]->DrawNormalized("same,histo"); |
4705 |
|
ptsancan->cd(2); |
4715 |
|
void do_mlls_plot(string mcjzb) { |
4716 |
|
cout << "At this point we'd plot the mll distribution" << endl; |
4717 |
|
TCanvas *sigcan = new TCanvas("sigcan","sigcan"); |
4718 |
< |
for(int isig=0;isig<(signalsamples.collection).size();isig++) { |
4718 |
> |
for(int isig=0;isig<(int)(signalsamples.collection).size();isig++) { |
4719 |
|
if(!(signalsamples.collection)[isig].events) continue; |
4720 |
|
string nowname=(signalsamples.collection)[isig].filename; |
4721 |
|
TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname)); |
4744 |
|
} |
4745 |
|
} |
4746 |
|
|
4747 |
< |
void met_vs_jzb_plots() { |
4747 |
> |
void met_vs_jzb_plots(string datajzb, string mcjzb) { |
4748 |
|
|
4749 |
|
TCanvas *canmetjzb = new TCanvas("canmet","MET vs JZB canvas"); |
4750 |
|
canmetjzb->SetRightMargin(0.16); |
4753 |
|
findme.push_back("DY"); |
4754 |
|
findme.push_back("TTJets"); |
4755 |
|
findme.push_back("LM"); |
4756 |
< |
|
4757 |
< |
for(int ifind=0;ifind<findme.size();ifind++) { |
4756 |
> |
/* |
4757 |
> |
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
4758 |
|
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
4759 |
|
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
4760 |
< |
for(int isel=0;isel<selsamples.size();isel++) { |
4761 |
< |
cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
4762 |
< |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF); |
4760 |
> |
for(int isel=0;isel<(int)selsamples.size();isel++) { |
4761 |
> |
dout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
4762 |
> |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF&&cutnJets); |
4763 |
|
} |
4764 |
|
metvsjzb->Scale(allsamples.collection[selsamples[0]].weight); |
4765 |
|
metvsjzb->SetStats(0); |
4773 |
|
title->Draw(); |
4774 |
|
CompleteSave(canmetjzb,(string)"METvsJZBplots/"+findme[ifind]); |
4775 |
|
} |
4776 |
+ |
*/ |
4777 |
+ |
|
4778 |
+ |
dout << "About to produce MET plot for DY split up by JZB" << endl; |
4779 |
+ |
|
4780 |
+ |
int nbins=14; |
4781 |
+ |
float low=0; |
4782 |
+ |
float high=140; |
4783 |
+ |
|
4784 |
+ |
stringstream sLEFT; |
4785 |
+ |
sLEFT << "((" << mcjzb << ")<0)"; |
4786 |
+ |
TCut LEFT(sLEFT.str().c_str()); |
4787 |
+ |
stringstream sRIGHT; |
4788 |
+ |
sRIGHT << "((" << mcjzb << ")>0)"; |
4789 |
+ |
TCut RIGHT(sRIGHT.str().c_str()); |
4790 |
+ |
|
4791 |
+ |
TH1F *metleft = allsamples.Draw("metleft","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
4792 |
+ |
TH1F *metleftO = allsamples.Draw("metleftO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
4793 |
+ |
TH1F *metright = allsamples.Draw("metright","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
4794 |
+ |
TH1F *metrightO = allsamples.Draw("metrightO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
4795 |
+ |
|
4796 |
+ |
|
4797 |
+ |
TH1F *Bpred = (TH1F*)metleft->Clone("Bpred"); |
4798 |
+ |
Bpred->Add(metleftO,-1); |
4799 |
+ |
Bpred->Add(metrightO); |
4800 |
+ |
TH1F *obs = (TH1F*)metright->Clone("obs"); |
4801 |
+ |
|
4802 |
+ |
metleft->Add(metleftO,-1); |
4803 |
+ |
metright->Add(metrightO,-1); |
4804 |
+ |
|
4805 |
+ |
metleft->SetLineColor(kRed); |
4806 |
+ |
metright->SetLineColor(kBlack); |
4807 |
+ |
TPad *metpad = new TPad("metpad","metpad",0,0,1,1); |
4808 |
+ |
metpad->cd(); |
4809 |
+ |
metpad->SetLogy(1); |
4810 |
+ |
metleft->Draw("histo"); |
4811 |
+ |
metright->Draw("same"); |
4812 |
+ |
TLegend *lg = make_legend(); |
4813 |
+ |
lg->SetX1(0.5); |
4814 |
+ |
lg->SetY1(0.7); |
4815 |
+ |
lg->AddEntry(metright,"JZB>0 (OSOF corrected)","P"); |
4816 |
+ |
lg->AddEntry(metleft,"JZB<0 (OSOF corrected)","L"); |
4817 |
+ |
lg->SetHeader("DY"); |
4818 |
+ |
|
4819 |
+ |
lg->Draw(); |
4820 |
+ |
Save_With_Ratio(metright,metleft,metpad->cd(),"METvsJZBplots/ComparingLeftToRightinMETspectrum"); |
4821 |
+ |
|
4822 |
+ |
TPad *metpad3 = new TPad("metpad3","metpad3",0,0,1,1); |
4823 |
+ |
metpad3->cd(); |
4824 |
+ |
metpad3->SetLogy(1); |
4825 |
+ |
Bpred->SetLineColor(kRed); |
4826 |
+ |
Bpred->Draw("histo"); |
4827 |
+ |
obs->SetLineColor(kBlack); |
4828 |
+ |
obs->Draw("same"); |
4829 |
+ |
TLegend *lg2 = make_legend(); |
4830 |
+ |
lg2->SetX1(0.5); |
4831 |
+ |
lg2->SetY1(0.7); |
4832 |
+ |
lg2->AddEntry(obs,"observed","P"); |
4833 |
+ |
lg2->AddEntry(Bpred,"predicted","L"); |
4834 |
+ |
lg2->SetHeader("DY"); |
4835 |
+ |
|
4836 |
+ |
lg2->Draw(); |
4837 |
+ |
|
4838 |
+ |
Save_With_Ratio(obs,Bpred,metpad3->cd(),"METvsJZBplots/ComparingPredObsinMET"); |
4839 |
+ |
|
4840 |
+ |
TPad *metpad2 = new TPad("metpad2","metpad2",0,0,1,1); |
4841 |
+ |
metpad2->cd(); |
4842 |
+ |
metpad2->SetLogy(1); |
4843 |
+ |
|
4844 |
+ |
TH1F *metlefta = allsamples.Draw("metlefta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
4845 |
+ |
TH1F *metleftOa = allsamples.Draw("metleftOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
4846 |
+ |
TH1F *metrighta = allsamples.Draw("metrighta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
4847 |
+ |
TH1F *metrightOa = allsamples.Draw("metrightOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
4848 |
+ |
|
4849 |
+ |
metlefta->Add(metleftOa,-1); |
4850 |
+ |
metrighta->Add(metrightOa,-1); |
4851 |
+ |
|
4852 |
+ |
metlefta->SetLineColor(kRed); |
4853 |
+ |
metpad2->cd(); |
4854 |
+ |
metlefta->Draw("histo"); |
4855 |
+ |
metrighta->Draw("same"); |
4856 |
+ |
lg->Draw(); |
4857 |
+ |
Save_With_Ratio(metrighta,metlefta,metpad2->cd(),"METvsJZBplots/ComparingLeftToRightinMET_type1_spectrum"); |
4858 |
+ |
|
4859 |
+ |
delete Bpred; |
4860 |
+ |
delete obs; |
4861 |
+ |
|
4862 |
+ |
float newhigh=300; |
4863 |
+ |
int newNBins=30; |
4864 |
+ |
|
4865 |
+ |
TPad *metpad4 = new TPad("metpad4","metpad4",0,0,1,1); |
4866 |
+ |
TH1F *Ametleft = allsamples.Draw("Ametleft","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity); |
4867 |
+ |
TH1F *AmetleftO = allsamples.Draw("AmetleftO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity); |
4868 |
+ |
TH1F *Ametright = allsamples.Draw("Ametright","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity); |
4869 |
+ |
TH1F *AmetrightO = allsamples.Draw("AmetrightO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity); |
4870 |
+ |
|
4871 |
+ |
TH1F *aBpred = (TH1F*)Ametleft->Clone("aBpred"); |
4872 |
+ |
aBpred->Add(AmetleftO,-1); |
4873 |
+ |
aBpred->Add(AmetrightO); |
4874 |
+ |
aBpred->SetLineColor(kRed); |
4875 |
+ |
|
4876 |
+ |
TH1F *aobs = (TH1F*)Ametright->Clone("aobs"); |
4877 |
+ |
metpad4->cd(); |
4878 |
+ |
metpad4->SetLogy(1); |
4879 |
+ |
aobs->Draw(); |
4880 |
+ |
aBpred->Draw("histo,same"); |
4881 |
+ |
aobs->Draw("same"); |
4882 |
+ |
lg->SetHeader("All MC"); |
4883 |
+ |
lg->Draw(); |
4884 |
+ |
Save_With_Ratio(aobs,aBpred,metpad4->cd(),"METvsJZBplots/ComparingPredObsinMET_ALLSAMPLES"); |
4885 |
+ |
|
4886 |
+ |
|
4887 |
+ |
delete lg; |
4888 |
+ |
delete canmetjzb; |
4889 |
+ |
delete metleft; |
4890 |
+ |
delete metleftO; |
4891 |
+ |
delete metright; |
4892 |
+ |
delete metrightO; |
4893 |
|
} |
4894 |
|
|
4895 |
|
|
4897 |
|
|
4898 |
|
TCanvas *testcanv = new TCanvas("testcanv","testcanv"); |
4899 |
|
testcanv->cd(); |
4900 |
< |
switch_overunderflow(true); |
4900 |
> |
// switch_overunderflow(true); |
4901 |
|
TH1F *ptdistr = allsamples.Draw("ptdistr","pt1",100,30,200, "p_{T} [GeV]", "events", cutOSSF,data,luminosity); |
4902 |
|
switch_overunderflow(false); |
4903 |
|
ptdistr->Draw(); |