ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/ZbTools.C
(Generate patch)

Comparing UserCode/cbrown/Development/Plotting/Modules/ZbTools.C (file contents):
Revision 1.16 by buchmann, Wed Nov 28 17:51:14 2012 UTC vs.
Revision 1.26 by buchmann, Mon Mar 18 16:05:04 2013 UTC

# Line 1 | Line 1
1   #include <iostream>
2   #include <vector>
3   #include <sys/stat.h>
4 + #include <math.h>
5  
6   #include <TCut.h>
7   #include <TROOT.h>
# Line 16 | Line 17
17   #include <TProfile.h>
18   #include <TLegendEntry.h>
19  
20 + #include <RooRealVar.h>
21 + #include <RooArgSet.h>
22 + #include <RooDataSet.h>
23 + #include <RooDataHist.h>
24 + #include <RooMCStudy.h>
25 + #include <RooCategory.h>
26 +
27 + #include <RooPlot.h>
28 + #include <RooSimultaneous.h>
29 + #include <RooAddPdf.h>
30 + #include <RooFitResult.h>
31 + #include <RooVoigtian.h>
32 + #include <RooChebychev.h>
33 + #include <RooMsgService.h>
34 +
35 + #include <RooStats/ModelConfig.h>
36 + #include "RooStats/ProfileLikelihoodCalculator.h"
37 + #include "RooStats/LikelihoodInterval.h"
38 + #include "RooStats/HypoTestResult.h"
39 + #include "RooStats/SimpleLikelihoodRatioTestStat.h"
40 + #include "RooStats/ProfileLikelihoodTestStat.h"
41 + #include "RooStats/HybridCalculatorOriginal.h"
42 + #include "RooStats/HypoTestInverterOriginal.h"
43 +
44 +
45 +
46   using namespace std;
47  
48   using namespace PlottingSetup;
49  
50   namespace ZbData {
24 vector<float> data_over_mc;
25
51   TCut ZplusBsel("pt1>20&&pt2>20&&mll>60&&mll<120&&id1==id2");
52 < TCut LeadingB("Zb3010_bTagProbCSVBP[0]>0.898");
53 < TCut EtaB("abs(Zb3010_pfJetGoodEta[0])<1.3");
54 < TCut PhiZcut("abs(Zb3010_pfJetDphiZ[0])>2.7");
55 <  
52 > TCut LeadingB("ZbCHS3010_bTagProbCSVBP[0]>0.898");
53 > TCut EtaB("abs(ZbCHS3010_pfJetGoodEta[0])<1.3");
54 > TCut PhiZcut("abs(ZbCHS3010_pfJetDphiZ[0])>2.7");
55 > float LowerHistoBoundary=0.5; // where to cut on MPF (or Rabs)
56 > float UpperHistoBoundary=1.5; // where to cut on MPF (or Rabs)
57 >
58   }
59  
60 + TCut STDWEIGHT;
61 +
62   class ZbPointResult {
63   public:
64    ZbPointResult(string var, float ptlow, float pthigh, float alphalow, float alphahigh, Value Data, Value MC);
# Line 63 | Line 92 | public:
92    Value Rabs_Result_FaceValue;
93    Value MPF_Result_Extrapolated;
94    Value Rabs_Result_Extrapolated;
95 +  void Print();
96    
97    ZbResultContainer(string name);
68  ZbResultContainer(const ZbResultContainer &old);
98   };
99  
100  
101   ZbResultContainer::ZbResultContainer(string _name) {
102    name=_name;
103 <  cout<< "Result Container for \"" << name << "\" has been initialized" << endl;
103 >  dout<< "Result Container for \"" << name << "\" has been initialized" << endl;
104    
105   }
106  
107 < std::ostream &operator<<(std::ostream &ostr, ZbResultContainer &b)
107 > void ZbResultContainer::Print()
108   {
109 <  ostr << "Results for " << b.name << endl;
110 <  ostr << " MPF and Rabs locations: " << endl;
111 <  for(int i=0;i<b.MPF_Rabs_location.size();i++) ostr << "   " << b.MPF_Rabs_location[i] << endl;
112 <  ostr << " Results: " << endl;
113 <  ostr << "   Face Value: " << endl;
114 <  ostr << "     MPF " << b.MPF_Result_FaceValue << endl;
115 <  ostr << "     Rabs " << b.Rabs_Result_FaceValue << endl;
116 <  ostr << "   Extrapolated: " << endl;
117 <  ostr << "     MPF " << b.MPF_Result_Extrapolated << endl;
118 <  ostr << "             Rabs " << b.Rabs_Result_Extrapolated << endl;
90 <  
91 <  return ostr;
109 >  dout << "Results for " << this->name << endl;
110 >  dout << " MPF and Rabs locations: " << endl;
111 >  for(int i=0;i<this->MPF_Rabs_location.size();i++) dout << "   " << this->MPF_Rabs_location[i] << endl;
112 >  dout << " Results: " << endl;
113 >  dout << "   Face Value: " << endl;
114 >  dout << "     MPF " << this->MPF_Result_FaceValue << endl;
115 >  dout << "     Rabs " << this->Rabs_Result_FaceValue << endl;
116 >  dout << "   Extrapolated: " << endl;
117 >  dout << "     MPF " << this->MPF_Result_Extrapolated << endl;
118 >  dout << "             Rabs " << this->Rabs_Result_Extrapolated << endl;
119   }
120  
121  
95
122   using namespace ZbData;
123  
124  
# Line 102 | Line 128 | void SpecialCutFlow(string identifier);
128   //*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*            AND THIS LINE             /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*//
129  
130  
131 < void print_yield(TCut cut) {
131 > class CutYields{
132 > public:
133 >  float data;
134 >  float Zb;
135 >  float Zc;
136 >  float Zl;
137 >  float tt;
138 >  float SiTo;
139 >  float Dibosons;
140 >  float WJets;
141 >  float Other;
142 >  
143 >  CutYields();
144 > };
145 >
146 > CutYields::CutYields() {
147 >  this->data=0;
148 >  this->Zb=0;
149 >  this->Zc=0;
150 >  this->Zl=0;
151 >  this->tt=0;
152 >  this->SiTo=0;
153 >  this->Dibosons=0;
154 >  this->WJets=0;
155 >  this->Other=0;
156 > }
157 >
158 > std::ostream &operator<<(std::ostream &ostr, CutYields y)
159 > {
160 >  return ostr << y.data << ";" << y.Zb << ";" << y.Zc << ";" << y.Zl << ";" << y.tt << ";" << y.SiTo << ";" << y.Dibosons << ";" << y.WJets << ";" << endl;
161 > }
162 >
163 >
164 > CutYields print_yield(TCut cut) {
165 >  
166 >  CutYields Yield;
167    TH1F *data  = allsamples.Draw("data",    "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,data,luminosity);
168    dout << "  Yields for " << (const char*) cut << endl;
169 <  dout << "     data: " << data->Integral() << endl;
169 > //  dout << "     data: " << data->Integral() << endl;
170 >  
171 >  Yield.data=data->Integral();
172    THStack mcm = allsamples.DrawStack("mc", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,mc,luminosity);
173    int nhists = mcm.GetHists()->GetEntries();
111  dout << "Going to loop over " << nhists << " histograms " << endl;
174    TFile *test = new TFile("test.root","RECREATE");
175    mcm.Write();
176    test->Close();
177    for (int i = 0; i < nhists; i++) {
178      TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i));
179 <    cout << "     " << hist->GetName() << ": " << hist->Integral() << endl;
179 >    string name=hist->GetName();
180 >    if(Contains(name,"t_bar_t")) Yield.tt+=hist->Integral();
181 >    if(Contains(name,"W_Jets")) Yield.WJets+=hist->Integral();
182 >    if(Contains(name,"Single_top")) Yield.SiTo+=hist->Integral();
183 >    if(Contains(name,"Dibosons")) Yield.Dibosons+=hist->Integral();
184 >    if(Contains(name,"Z_l_")) Yield.Zl+=hist->Integral();
185 >    if(Contains(name,"Z_c_")) Yield.Zc+=hist->Integral();
186 >    if(Contains(name,"Z_b_")) Yield.Zb+=hist->Integral();
187    }
188 <    
189 <  cout << endl << endl;
188 >  
189 >  dout << Yield << endl;
190 >  dout << endl << endl;
191    
192    delete data;
193 +  CleanLegends();
194 +  DeleteStack(mcm);
195 +
196 +  return Yield;
197   }
198  
199   void draw_kin_variable(string variable, TCut cut, int nbins, float min, float max, string xlabel, string saveas, bool dologscale, string speciallabel="") {
126  
200    TCanvas *ckin = new TCanvas("ckin","kin variable canvas");
201 <  ckin->SetLogy(dologscale);
201 >  if(dologscale) ckin->SetLogy(1);
202    TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity);
203    datahisto->SetMarkerSize(DataMarkerSize);
204    THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity);
205    if(dologscale) datahisto->SetMaximum(3*datahisto->GetMaximum());
206    else datahisto->SetMaximum(1.5*datahisto->GetMaximum());
207 <  TText *speciall;
208 <  if(speciallabel!="") {
209 <    speciall = new TText(0.2,0.8,speciallabel.c_str());
210 <    speciall->Draw();
207 >  
208 >  float SumMC=0.0;
209 >  TIter nextH(mcstack.GetHists());
210 >  TH1F* h;
211 >  while ( h = (TH1F*)nextH() ) {
212 >    SumMC += h->Integral();
213 >  }
214 >  float scale = datahisto->Integral()/SumMC;
215 >
216 >  // Re-scale stack to data integral
217 >  nextH = TIter(mcstack.GetHists());
218 >  
219 >  while ( h = (TH1F*)nextH() ) {
220 >    h->Scale(scale);
221    }
222 +  
223 +  TText *speciall;
224    datahisto->Draw("e1");
225    ckin->Update();
226 <  mcstack.Draw("same");
226 >  mcstack.Draw("histo,same");
227    datahisto->Draw("same,e1");
228    TLegend *kinleg = allsamples.allbglegend();
229 +
230    kinleg->Draw();
231  
232    TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
233    kinpad->cd();
234 <  kinpad->SetLogy(dologscale);
234 >  if(dologscale) kinpad->SetLogy(1);
235    datahisto->Draw("e1");
236 <  mcstack.Draw("same");
236 >  mcstack.Draw("histo,same");
237    datahisto->Draw("same,e1");
238    datahisto->Draw("same,axis");
239    kinleg->Draw();
240    DrawPrelim();
241    saveas="kin/"+saveas;
242 <  save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas);
157 <
158 <  
242 >  kinpad->cd();
243    
244 +  if(speciallabel!="") {
245 +    speciall = write_title(speciallabel);
246 +    speciall->SetX(0.18);
247 +    speciall->SetTextAlign(11);
248 +    speciall->SetTextSize(0.03);
249 +    speciall->SetY(0.85);
250 +    speciall->Draw();
251 +  }
252    
253 <  ZbData::data_over_mc.push_back(datahisto->Integral()/CollapseStack(mcstack)->Integral());
253 >  Save_With_Ratio(datahisto,mcstack,kinpad->cd(),saveas);
254    
255    datahisto->Delete();
256 +  delete kinleg;
257    delete ckin;
258 +  CleanLegends();
259 +  DeleteStack(mcstack);
260   }
261 <  
261 >
262   void print_all_b_yields() {
263 <  cout << "Basic selection with a b jet" << endl;
264 <  print_yield(ZplusBsel&&"Zb3010_pfJetGoodNumBtag>0");
265 <  cout << "Leading jet is a b-jet " << endl;
266 <  print_yield(ZplusBsel&&LeadingB);
267 <  cout << "|#eta_{b}|<1.3 " << endl;
268 <  print_yield(ZplusBsel&&LeadingB&&EtaB);
269 <  cout << "|#delta#phi(b<Z)|>2.7" << endl;
270 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
271 <  cout << "10<ptZ<1000 GeV" << endl;
272 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000");
273 <  cout << "#alpha < 0.35" << endl;
274 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.35");
275 <  cout << "#alpha < 0.3" << endl;
276 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.3");
277 <  cout << "#alpha < 0.2" << endl;
278 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.2");
279 <  cout << "#alpha < 0.15" << endl;
280 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.15");
281 <  cout << "#alpha < 0.1" << endl;
282 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.1");
283 < //  cout << "#alpha < 0.05" << endl;
284 < //  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.05");
263 >  vector<CutYields> yields;
264 >  dout << "Basic selection with a b jet" << endl;
265 >  yields.push_back(print_yield(ZplusBsel&&"ZbCHS3010_pfJetGoodNumBtag>0"));
266 >  dout << "Leading jet is a b-jet " << endl;
267 >  yields.push_back(print_yield(ZplusBsel&&LeadingB));
268 >  dout << "|#eta_{b}|<1.3 " << endl;
269 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB));
270 >  dout << "|#delta#phi(b<Z)|>2.7" << endl;
271 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut));
272 >  dout << "30<ptZ<1000 GeV" << endl;
273 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"));
274 >  dout << "#alpha < 0.35" << endl;
275 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.35"));
276 >  dout << "#alpha < 0.3" << endl;
277 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.3"));
278 > /*  dout << "#alpha < 0.2" << endl;
279 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.2"));
280 >  dout << "#alpha < 0.15" << endl;
281 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.15"));
282 >  dout << "#alpha < 0.1" << endl;
283 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.1"));*/
284 >
285 >  for(int iy=0;iy<yields.size();iy++) {
286 >    dout << yields[iy] << endl;
287 >  }
288   }  
289  
290 < void TEST_DrawEvilCutFlow() {
290 > void DrawEvilCutFlow() {
291    stringstream MegaCut;
292    
293 <  MegaCut << "   1*(" << (const char*) (ZplusBsel&&TCut("Zb3010_pfJetGoodNumBtag>0")) << ")";
293 >  MegaCut << "   1*(" << (const char*) (ZplusBsel&&TCut("ZbCHS3010_pfJetGoodNumBtag>0")) << ")";
294    MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB) << ")";
295    MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB) << ")";
296    MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut) << ")";
297 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000")) << ")";
298 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.3")) << ")";
299 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.2")) << ")";
300 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.15")) << ")";
301 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.1")) << ")";
302 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.05")) << ")";
297 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000")) << ")";
298 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.3")) << ")";
299 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.2")) << ")";
300 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.15")) << ")";
301 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.1")) << ")";
302 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.05")) << ")";
303    MegaCut << " ";
304    
305    TCanvas *can = new TCanvas("can","can");
# Line 214 | Line 312 | void TEST_DrawEvilCutFlow() {
312    
313    
314    TH1F *data  = allsamples.Draw("data",    MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity);
315 <   THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
315 >  THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
316  
317    float runningsum=0;
318    for(int i=data->GetNbinsX();i>0;i--) {
# Line 245 | Line 343 | void TEST_DrawEvilCutFlow() {
343    data->GetXaxis()->SetBinLabel(3,"Leading jet is b-jet");
344    data->GetXaxis()->SetBinLabel(4,"|#eta_{b}|<1.3 ");
345    data->GetXaxis()->SetBinLabel(5,"|#delta#phi(b,Z)|>2.7");
346 <  data->GetXaxis()->SetBinLabel(6,"10<p_{T}^{Z}<1000 GeV");
346 >  data->GetXaxis()->SetBinLabel(6,"30<p_{T}^{Z}<1000 GeV");
347    data->GetXaxis()->SetBinLabel(7,"#alpha < 0.3");
348    data->GetXaxis()->SetBinLabel(8,"#alpha < 0.2");
349    data->GetXaxis()->SetBinLabel(9,"#alpha < 0.15");
# Line 254 | Line 352 | void TEST_DrawEvilCutFlow() {
352    data->GetXaxis()->LabelsOption("v");
353    
354    data->Draw("e1");
355 <  mcm.Draw("same");
355 >  mcm.Draw("histo,same");
356    data->Draw("same,e1,axis");
357    data->Draw("same,e1");
358   //  data->Draw("same,TEXT");
# Line 264 | Line 362 | void TEST_DrawEvilCutFlow() {
362    DrawPrelim();
363    
364    CompleteSave(can,"CutFlow");
365 +  CleanLegends();
366 +  DeleteStack(mcm);
367 +
368   }
369  
370   void draw_Zb_kin_vars() {
371 <   draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Z p_{T}","Official/Zpt",1);
372 <   draw_kin_variable("Zb3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt",1);
373 <   draw_kin_variable("Zb3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt",1);
374 <   draw_kin_variable("Zb3010_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/SubLeadingJetPt_Over_ZPt",1);
375 <   draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<50",   40,0,2,"#alpha","Official/alpha_pt_30_to_50",1);
376 <   draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>50&&pt<75",  40,0,2,"#alpha","Official/alpha_50_to_75",1);
377 <   draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>75&&pt<125", 40,0,2,"#alpha","Official/alpha_pt_75_to_125",1);
378 <   draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>125&&pt<1000",40,0,2,"#alpha","Official/alpha_pt_125_to_1000",1);
379 <    draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",40,0,2,"#alpha","Official/alpha_pt_30_to_1000",1);
380 <  
381 <  draw_kin_variable("Zb3010_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>10&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",0);
382 <  
383 < /*
384 <  draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,200,"p_{T}^{l1}","Lep/pt1",1);
385 <  draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==0",20,0,200,"p_{T}^{e1}","Lep/pt1_e",1);
386 <  draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==1",20,0,200,"p_{T}^{#mu1}","Lep/pt1_m",1);
387 <  draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,200,"p_{T}^{l2}","Lep/pt2",1);
388 <  draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==0",20,0,200,"p_{T}^{e2}","Lep/pt2_e",1);
389 <  draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==1",20,0,200,"p_{T}^{#mu2}","Lep/pt2_m",1);
390 <  draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta1",1);
391 <  draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==0",20,-3.1,3.1,"#eta^{e1}","Lep/eta1_e",1);
392 <  draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==1",20,-3.1,3.1,"#eta^{m1}","Lep/eta1_m",1);
393 <  draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta2",1);
394 <  draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==0",20,-3.1,3.1,"#eta^{e2}","Lep/eta2_e",1);
395 <  draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==1",20,-3.1,3.1,"#eta^{#mu2}","Lep/eta2_m",1);
396 <  draw_kin_variable("numVtx",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",30,0,30,"N(Vtx)","Lep/nVtx",1);
397 <  */
371 >  
372 >   draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Z p_{T}","Official/Zpt",0);
373 >   draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Z p_{T}","Official/Zpt_ee",1);
374 >   draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Z p_{T}","Official/Zpt_mm",1);
375 >   draw_kin_variable("pt",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Z p_{T}","Official/Zpt__nonBtagged",1);
376 >   draw_kin_variable("pt",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Z p_{T}","Official/Zpt__nonBtagged_ee",1);
377 >   draw_kin_variable("pt",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Z p_{T}","Official/Zpt__nonBtagged_mm",1);
378 >  
379 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt",1);
380 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt_ee",1);
381 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt_mm",1);
382 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt__nonBtagged",1);
383 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt__nonBtagged_ee",1);
384 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt__nonBtagged_mm",1);
385 >  
386 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt",1);
387 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt_ee",1);
388 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt_mm",1);
389 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt__nonBtagged",1);
390 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt__nonBtagged_ee",1);
391 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt__nonBtagged_mm",1);
392 >  
393 >  
394 >   draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/SubLeadingJetPt_Over_ZPt",1);
395 >   draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<50"),   40,0,2,"#alpha","Official/alpha_pt_30_to_50",1);
396 >   draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>50&&pt<75"),  40,0,2,"#alpha","Official/alpha_50_to_75",1);
397 >   draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>75&&pt<125"), 40,0,2,"#alpha","Official/alpha_pt_75_to_125",1);
398 >   draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>125&&pt<1000"),40,0,2,"#alpha","Official/alpha_pt_125_to_1000",1);
399 >   draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),40,0,2,"#alpha","Official/alpha_pt_30_to_1000",1);
400 >  
401 >   draw_kin_variable("ZbCHS3010_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&TCut("pt>30&&pt<1000&&pfBJetDphiZ[0]>0"),30,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",0);
402   }
403  
404   void draw_mpf_vars() {
405 <  ZbData::data_over_mc.clear();
406 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.3",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
407 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.2",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV");
408 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.15",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV");
409 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.1",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV");
410 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.05",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
411 <  
412 <  draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.3",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
413 <  draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.2",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV");
414 <  draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.15",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV");
415 <  draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.1",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV");
311 <  draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.05",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
405 >  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.3"), 20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV");
406 >  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.2"), 20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 30 GeV < p_{T}^{Z} < 1000 GeV");
407 >  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.15"),20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 30 GeV < p_{T}^{Z} < 1000 GeV");
408 >  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.1"), 20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 30 GeV < p_{T}^{Z} < 1000 GeV");
409 >  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.05"),20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 30 GeV < p_{T}^{Z} < 1000 GeV");
410 >  
411 >  draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.3"), 20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3",    0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV");
412 >  draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.2"), 20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p2",    0,"#alpha<0.2, 30 GeV < p_{T}^{Z} < 1000 GeV");
413 >  draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.15"),20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p15",   0,"#alpha<0.15, 30 GeV < p_{T}^{Z} < 1000 GeV");
414 >  draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.1"), 20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p1",    0,"#alpha<0.1, 30 GeV < p_{T}^{Z} < 1000 GeV");
415 >  draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.05"),20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 30 GeV < p_{T}^{Z} < 1000 GeV");
416   }  
417  
418 < /*double GetMedian(TH1F *histo) {
419 <    int numBins = histo->GetXaxis()->GetNbins();
420 <    Double_t x[numBins];
421 <    Double_t y[numBins];
422 <    for (int i = 1; i <= numBins; i++) {
423 <        x[i] = histo->GetBinCenter(i);
424 <        y[i] = histo->GetBinContent(i);
425 <    }
426 <    return TMath::Median(numBins, &x, &y);
427 < }*/
418 > void make_RooFit(string ContainerName, TH1F *h, float &peak, float &error_peak, string saveas) {
419 >  TCanvas *fcan = new TCanvas("fcan","fcan");
420 >  RooRealVar mpf("mpf","mpf", -5, 5, "");
421 >  RooDataHist AllData("AllData", "CMS Real Dataset", mpf , h);
422 >
423 >  RooRealVar fraction("fraction", "fraction", 0.8, 0, 1);
424 >  RooRealVar mean("mean", "mean", 1, 0, 3);
425 >  RooRealVar sigma("sigma", "sigma", 1, 0, 5);
426 >  RooRealVar width("width", "width", 2.4, 0, 5);
427 >  RooRealVar chevvar1("chevvar1", "chevvar1", 0.2,-1.0, 1.0);
428 >  RooRealVar chevvar2("chevvar2", "chevvar2", 0.2,-1.0, 1.0);
429 >
430 >  RooVoigtian signal("signal", "signal", mpf, mean, width, sigma);
431 >  RooChebychev background("background_", "background", mpf, RooArgList(chevvar1, chevvar2));
432 >
433 >  RooAddPdf pdf("pdf",  "pdf", RooArgList(signal, background), fraction);
434 >
435 >  RooFitResult *result = pdf.fitTo(AllData, RooFit::Save());
436 >  RooPlot* frame = mpf.frame(RooFit::Bins(30), RooFit::Title("MPF")) ;
437 >  AllData.plotOn(frame);
438 >  pdf.plotOn(frame, RooFit::LineColor(kBlue)) ;
439 >  pdf.plotOn(frame, RooFit::Components(RooArgSet(background)), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)) ;
440 >  pdf.plotOn(frame, RooFit::Components(RooArgSet(signal)), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)) ;
441 >
442 >  RooRealVar* thePeak = (RooRealVar*) result->floatParsFinal().find("mean");
443 >  peak = thePeak->getVal();
444 >  error_peak = thePeak->getError();
445 >  
446 >  ///******************* just making it beautiful ....
447 >  RooPlot* frame2 = mpf.frame(RooFit::Bins(30), RooFit::Title("MPF")) ;
448 >  TH1F *hcopy = (TH1F*)h->Clone("hcopy");
449 >  hcopy->Rebin(40);
450 >  RooDataHist AllRData("AllRData", "CMS Dataset", mpf , hcopy);
451 >  
452 >  AllRData.plotOn(frame2);
453 >  pdf.plotOn(frame2, RooFit::LineColor(kBlue)) ;
454 >  pdf.plotOn(frame2, RooFit::Components(RooArgSet(background)), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)) ;
455 >  pdf.plotOn(frame2, RooFit::Components(RooArgSet(signal)), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)) ;
456 >
457 >  string saveasFinal = saveas + "_Fit";
458 >  fcan->cd() ; gPad->SetLeftMargin(0.15) ; frame->GetYaxis()->SetTitleOffset(1.4) ; frame2->Draw();
459 >  
460 >  if(h->GetName()=="hdata") DrawPrelim();
461 >  else DrawMCPrelim();
462 >
463 >  CompleteSave(fcan, ContainerName+"/Fit/"+saveasFinal);
464 >  
465 >  delete hcopy;
466 >  delete fcan;
467 >  delete frame;
468 >  delete thePeak;
469 > }
470  
471   Value get_Zb_data_over_mc(string ContainerName, ZbResultContainer &res, string variable, string variable2, TCut cut, string saveas, float pt1, float pt2, float a1, float a2) {
472   //  write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(3.1415,1.010101);
473    TCanvas *cn = new TCanvas("cn","cn");
474    string varname="MPF";
475 +  
476 +  bool DoFit=false;
477 +  bool UseFit=false;
478 +  bool DoRooFit=false;
479 +  
480 +  
481    if(Contains(variable,"pfJetGood")) varname="R_{abs}";
482 <  TH1F *hdata  = allsamples.Draw("hdata",variable,1200,0,30, varname, "events",  cut,data,luminosity);
483 <  TH1F *hmc    = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc,  luminosity);
482 > //  TH1F *hdata  = allsamples.Draw("hdata",variable,1200,0,30, varname, "events",  cut,data,luminosity);
483 > //  TH1F *hmc    = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc,  luminosity);
484 >  TH1F *hdata, hmc;
485 >  if(!DoRooFit) {
486 >    hdata = allsamples.Draw("hdata",variable,1200,ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary, varname, "events",  cut,data,luminosity); // making it more precise
487 >    hmc    = allsamples.Draw("hmc" , variable,1200,ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary, varname, "events", cut, mc,  luminosity); // making it more precise
488 >  }
489 >  
490    hmc->SetLineColor(kBlue);
491    
492    float a=hdata->GetMean();
# Line 339 | Line 497 | Value get_Zb_data_over_mc(string Contain
497    float error = TMath::Sqrt(  (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db);
498    
499    TF1 *gaus_data = new TF1("gaus_data","gaus",0.7,1.3);
342  gaus_data->SetParameter(0,hdata->GetMaximum());
343  gaus_data->SetParameter(2,hdata->GetMean());
344  gaus_data->SetParameter(1,hdata->GetRMS());
345  hdata->Fit(gaus_data);
500    TF1 *gaus_mc = new TF1("gaus_mc","gaus",0.7,1.3);
501 <  gaus_mc->SetParameter(0,hmc->GetMaximum());
502 <  gaus_mc->SetParameter(1,hmc->GetMean());
503 <  gaus_mc->SetParameter(2,hmc->GetRMS());
504 <  hmc->Fit(gaus_mc);
505 <  
506 <  
501 >  if(DoFit) {
502 >    gaus_data->SetParameter(0,hdata->GetMaximum());
503 >    gaus_data->SetParameter(2,hdata->GetMean());
504 >    gaus_data->SetParameter(1,hdata->GetRMS());
505 >    hdata->Fit(gaus_data);
506 >    
507 >    gaus_mc->SetParameter(0,hmc->GetMaximum());
508 >    gaus_mc->SetParameter(1,hmc->GetMean());
509 >    gaus_mc->SetParameter(2,hmc->GetRMS());
510 >    hmc->Fit(gaus_mc);
511 >  }
512 >  if(DoRooFit) {
513 >    hdata  = allsamples.Draw("hdata",variable,7200,0.0,6.0, varname, "events",  cut,data,luminosity); // making it more precise
514 >    hmc    = allsamples.Draw("hmc" , variable,7200,0.0,6.0, varname, "events", cut, mc,  luminosity); // making it more precise
515 >      if(hdata->Integral()>10) {
516 >        make_RooFit(ContainerName, hdata, a, da, saveas+"_data");
517 >        make_RooFit(ContainerName, hmc, b, db, saveas+"_mc");
518 >        factor = a / b;
519 >        error = TMath::Sqrt(  (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db);
520 >      } else {
521 >        factor=NAN;//set to nan
522 >        error=NAN;//set to nan
523 >      }
524 >  }
525 >
526    cn->cd();
527 <  hdata->GetYaxis()->SetTitle("events / 0.1");
527 >  hdata->Rebin(int(0.05*1200/(ZbData::UpperHistoBoundary-ZbData::LowerHistoBoundary)));
528 >  hmc->Rebin(int(0.05*1200/(ZbData::UpperHistoBoundary-ZbData::LowerHistoBoundary)));
529 >  hdata->GetYaxis()->SetTitle("events / 0.05");
530    hdata->SetMarkerColor(kRed);
531 < /*  hdata->Rebin(4);
532 <  hmc->Rebin(4);
533 <  
534 <  gaus_mc->SetParameter(0,gaus_mc->GetParameter(0)*4);//rebinning
360 <  gaus_data->SetParameter(0,gaus_data->GetParameter(0)*4);//rebinning
361 < */
362 <  gaus_mc->SetLineColor(kBlue);
363 <  gaus_data->SetLineColor(kRed);
531 >  if(DoFit) {
532 >    gaus_mc->SetLineColor(kBlue);
533 >    gaus_data->SetLineColor(kRed);
534 >  }
535    
536    hdata->GetXaxis()->SetRangeUser(0,2);
537    hdata->GetYaxis()->SetTitleOffset(1.3);
538    hdata->Draw("e1");
539 +  
540 +  hmc->Scale(hdata->Integral()/hmc->Integral());
541 +  if(hmc->GetMaximum()>hdata->GetMaximum()) hdata->SetMaximum((hmc->GetMaximum()+sqrt((double)hmc->GetMaximum()))*1.2);
542 +  
543    hmc->Draw("histo,same");
544    hdata->Draw("e1,same");
545 <  gaus_data->Draw("same");
546 <  gaus_mc->Draw("same");
545 >  if(DoFit) {
546 >    gaus_data->Draw("same");
547 >    gaus_mc->Draw("same");
548 >  }
549 >  
550    stringstream summary;
551    summary << "#splitline{#bf{" << varname << "}}{#splitline{" << pt1 << " < p_{T}^{Z} < " << pt2 << ", " << a1 << " #leq #alpha < " << a2 << "}{#splitline{data: " << std::setprecision(4) << a << " #pm " << std::setprecision(4) << da << "}{";
552    summary << "#splitline{mc:   " << std::setprecision(4) << b << " #pm " << std::setprecision(4) << db << "}{#splitline{ratio: " << factor;
553 <  summary << " #pm " << error << "}{#splitline{}{#splitline{data fit: " << std::setprecision(4) << gaus_data->GetParameter(1) << "+/-";
554 <  summary << std::setprecision(4) << gaus_data->GetParError(1) << "}{#splitline{";
555 <  summary << "mc fit:" << std::setprecision(4) << gaus_mc->GetParameter(1) << "+/-" << std::setprecision(4) << gaus_mc->GetParError(1) << "}{ratio: ";
556 <  summary << gaus_data->GetParameter(1)/gaus_mc->GetParameter(1) << "+/-" << gaus_data->GetParameter(1)/gaus_mc->GetParameter(1) * sqrt((gaus_data->GetParError(1) * gaus_data->GetParError(1))/(gaus_data->GetParameter(1)*gaus_data->GetParameter(1)) + (gaus_mc->GetParError(1) * gaus_mc->GetParError(1))/(gaus_mc->GetParameter(1)*gaus_mc->GetParameter(1)) ) << "}}}}}}}}";
553 >  summary << " #pm " << error;
554 >  if(DoFit) {
555 >    summary << "}{#splitline{}{#splitline{data fit: " << std::setprecision(4) << gaus_data->GetParameter(1) << "+/-";
556 >    summary << std::setprecision(4) << gaus_data->GetParError(1) << "}{#splitline{";
557 >    summary << "mc fit:" << std::setprecision(4) << gaus_mc->GetParameter(1) << "#pm" << std::setprecision(4) << gaus_mc->GetParError(1) << "}{ratio: ";
558 >    summary << gaus_data->GetParameter(1)/gaus_mc->GetParameter(1) << "#pm" << gaus_data->GetParameter(1)/gaus_mc->GetParameter(1) * sqrt((gaus_data->GetParError(1) * gaus_data->GetParError(1))/(gaus_data->GetParameter(1)*gaus_data->GetParameter(1)) + (gaus_mc->GetParError(1) * gaus_mc->GetParError(1))/(gaus_mc->GetParameter(1)*gaus_mc->GetParameter(1)) ) << "}}}}";
559 >    summary << "}}}}";
560 >  } else {
561 >    summary << "}{}}}}}";
562 >  }
563 >  
564 >  if(UseFit) {
565 >    write_error(__FUNCTION__,"Requested using fit result for final result - not implemented yet!");
566 >    assert(0);
567 >  }
568 >    
569    
570    TText *infobox = write_title(summary.str());
571    infobox->SetX(0.75);
# Line 388 | Line 578 | Value get_Zb_data_over_mc(string Contain
578    CompleteSave(cn,ContainerName+"/ResponsePlots/"+saveas);
579    
580    res.MPF_Rabs_location.push_back(ZbPointResult(variable,pt1,pt2,a1,a2,Value(a,da),Value(b,db)));
581 <  cout << "Data;" << a << ";"<<da<<";MC"<<b<<";"<<db<<endl;
581 >  dout << "Data;" << a << ";"<<da<<";MC;"<<b<<";"<<db<<endl;
582    delete cn;
583    delete hdata;
584    delete hmc;
# Line 396 | Line 586 | Value get_Zb_data_over_mc(string Contain
586    return Value(factor,error);
587   }
588    
589 < ZbResultContainer new_data_mc_agreement_2d(string AlphaVariable, string ContainerName, TCut BTagCut, TCut BTagWgt) {
589 > int nFakes=1;
590 >
591 > float PurityInclusive=0.05;
592 > float PurityLoose=0.20;
593 > float PurityMedium=0.54;
594 > float PurityTight=0.82;
595 >
596 >
597 > void GetPtPointPosition(float AvPos[], const int nptcuts,string AlphaVariable, TCut basecut, float FaceValueToBeTakenAt, float ptcuts[]) {
598 >  for(int i=0;i<nptcuts-1;i++) {
599 >    stringstream specialcut;
600 >    specialcut << "((pt>30&& pt< 1000) && (" << AlphaVariable << "<" << FaceValueToBeTakenAt << "))";
601 >    TH1F *hdata  = allsamples.Draw("hada", "pt",100,ptcuts[i],ptcuts[i+1], "MPF", "events", TCut(basecut && specialcut.str().c_str()), data,  luminosity);
602 >    AvPos[i]=hdata->GetMean();
603 >    dout << AvPos[i] << " : ";
604 >    delete hdata;
605 >  }
606 >  dout << endl;
607 > }
608 >    
609 >
610 > void DeterminePurity(TCut basecut, int nptcuts, float ptcuts[], string AlphaVariable, string ContainerName, float FaceValueToBeTakenAt) {
611 >  
612 >  bool ComputePurity=false;
613 >  
614 >  if(ContainerName=="inclusive") ComputePurity=true;  
615 >  if(ContainerName=="loose") ComputePurity=true;
616 >  if(ContainerName=="medium") ComputePurity=true;
617 >  if(ContainerName=="reference") ComputePurity=true;
618 >  
619 >  if(!ComputePurity) return;
620 >  
621 >  stringstream specialcut;
622 >  specialcut << "((pt>30&& pt< 1000) && (" << AlphaVariable << "<" << FaceValueToBeTakenAt << "))";
623 >  
624 >  THStack mcm    = allsamples.DrawStack("mcm" , "mpf",1200,0,30, "MPF", "events", TCut(basecut && specialcut.str().c_str()), mc,  luminosity);
625 >  int nhists = mcm.GetHists()->GetEntries();
626 >  
627 >  float total=0;
628 >  float Zb=0;
629 >  
630 >  for (int i = 0; i < nhists; i++) {
631 >    TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i));
632 >    string name=hist->GetName();
633 >    if(Contains(name,"t_bar_t")) total+=hist->Integral();
634 >    if(Contains(name,"W_Jets")) total+=hist->Integral();
635 >    if(Contains(name,"Single_top")) total+=hist->Integral();
636 >    if(Contains(name,"Dibosons")) total+=hist->Integral();
637 >    if(Contains(name,"Z_l_")) total+=hist->Integral();
638 >    if(Contains(name,"Z_c_")) total+=hist->Integral();
639 >    if(Contains(name,"Z_b_")) {
640 >      total+=hist->Integral();
641 >      Zb+=hist->Integral();
642 >    }
643 >  }
644 >  
645 >  float purity=Zb/total;
646 >  dout << "Determined a purity of " << 100*purity << " % for the container \"" << ContainerName << "\"" << endl;
647 >  
648 >  if(ContainerName=="inclusive") PurityInclusive=purity;
649 >  if(ContainerName=="loose") PurityLoose=purity;
650 >  if(ContainerName=="medium") PurityMedium=purity;
651 >  if(ContainerName=="reference") PurityTight=purity;
652 >  
653 >  DeleteStack(mcm);
654 > }
655 >
656 > string NiceAlphaPrint(float alpha) {
657 >  //get in : 0.3, return 0p3 ...
658 >  stringstream res;
659 >  res << int(alpha) << "p" << int(100*alpha);
660 >  return res.str();
661 > }
662 >
663 > ZbResultContainer new_data_mc_agreement_2d(bool gofast, string AlphaVariable, string ContainerName, TCut BTagCut, TCut BTagWgt, float FaceValueToBeTakenAt) {
664 >  
665 >  if(gofast) write_info(__FUNCTION__,"Fast mode activated for "+ContainerName);
666    ZbResultContainer results(ContainerName);
667    
668 <  cutWeight=TCut("(weight*(weight<1000)*(is_data+(!is_data)))")*BTagWgt;
668 >  cutWeight=STDWEIGHT*BTagWgt;
669    LeadingB=BTagCut;
670    
671 +  
672    gStyle->SetOptFit(0);
673    TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
674 < //  const int nalphacuts=6;
675 < //  float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3,0.35};
674 >  const int nalphacuts=6;
675 >  float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3,0.35};
676    
410 //  const int nptcuts=5;
411 //  float ptcuts[nptcuts]={30,50,75,125,1000};
677    
678 <  write_info(__FUNCTION__,"JUST TESTING - PLEASE REMOVE THIS LINE");const int nalphacuts=2;float alphacuts[nalphacuts] = {0.1,0.3};const int nptcuts=3;float ptcuts[nptcuts]={30,75,1000};
678 >  const int nptcuts=5;
679 >  float ptcuts[nptcuts]={30,50,75,125,1000};
680 >  float ptPointPosition[nptcuts];
681 >  GetPtPointPosition(ptPointPosition,nptcuts,AlphaVariable,basecut,FaceValueToBeTakenAt,ptcuts);
682    
683    
684 +  DeterminePurity(basecut, nptcuts,ptcuts, AlphaVariable, ContainerName, FaceValueToBeTakenAt);
685 +  
686    float MPF_Results[nalphacuts][nptcuts];
687    float MPF_Errors[nalphacuts][nptcuts];
688    float RABS_Results[nalphacuts][nptcuts];
689    float RABS_Errors[nalphacuts][nptcuts];
690    
691    
692 <  for(int ia=0;ia<nalphacuts;ia++) {
692 >  for(int ia=0;ia<nalphacuts && !gofast;ia++) {
693      for(int ipt=0;ipt<nptcuts-1;ipt++) {
694        stringstream specialcut;
695        float alow,ahigh;
# Line 432 | Line 702 | ZbResultContainer new_data_mc_agreement_
702          alow=0;
703          ahigh=alphacuts[ia];
704        }
705 <      cout << specialcut.str() << endl;
706 <      Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia]), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh);
707 <      Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"Zb3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia]), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh);
705 >      dout << specialcut.str() << endl;
706 >      Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(NiceAlphaPrint(alphacuts[ia])), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh);
707 >      Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"ZbCHS3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(NiceAlphaPrint(alphacuts[ia])), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh);
708        
709        MPF_Results[ia][ipt]=MPF_data_over_mc.getValue();
710        MPF_Errors[ia][ipt]=MPF_data_over_mc.getError();
# Line 442 | Line 712 | ZbResultContainer new_data_mc_agreement_
712        RABS_Results[ia][ipt]=RABS_data_over_mc.getValue();
713        RABS_Errors[ia][ipt]=RABS_data_over_mc.getError();
714        
715 <      cout << "alpha cut at " << alphacuts[ia+1] << " and pt range " << ptcuts[ipt] << " , " << ptcuts[ipt+1] << " \t : \t" << specialcut.str() << " \t \t --> " << MPF_data_over_mc << " (MPF) " << RABS_data_over_mc << " (RABS)" << endl;
715 >      dout << "alpha cut at " << alphacuts[ia+1] << " and pt range " << ptcuts[ipt] << " , " << ptcuts[ipt+1] << " \t : \t" << specialcut.str() << " \t \t --> " << MPF_data_over_mc << " (MPF) " << RABS_data_over_mc << " (RABS)" << endl;
716      }
717    }
718    
# Line 461 | Line 731 | ZbResultContainer new_data_mc_agreement_
731      
732      stringstream filename;
733      filename << "Extrapolation/Zplusb_data_over_mc___" << ptcuts[ipt] << "_to_" << ptcuts[ipt+1];
734 <    cout << "Going to create histo for " << filename.str() << endl;
734 >    dout << "Going to create histo for " << filename.str() << endl;
735      TGraphErrors *mpf_gr =new TGraphErrors();
736      TGraphErrors *rabs_gr =new TGraphErrors();
737      
738      int rabs_counter=0;
739      int mpf_counter=0;
740      
741 <    for(int ia=0;ia<nalphacuts;ia++) {
742 <      cout << "Setting a point for an alpha cut at " << alphacuts[ia] << " with value " << MPF_Results[ia][ipt] << " (MPF) and " << RABS_Results[ia][ipt] << " (RABS)" << endl;
741 >    for(int ia=0;ia<nalphacuts && !gofast;ia++) {
742 >      dout << "Setting a point for an alpha cut at " << alphacuts[ia] << " with value " << MPF_Results[ia][ipt] << " (MPF) and " << RABS_Results[ia][ipt] << " (RABS)" << endl;
743        if(MPF_Results[ia][ipt]==MPF_Results[ia][ipt] && MPF_Errors[ia][ipt]==MPF_Errors[ia][ipt]) { // remove nan's
744         mpf_gr->SetPoint(mpf_counter,alphacuts[ia],MPF_Results[ia][ipt]);
745         mpf_gr->SetPointError(mpf_counter,0,MPF_Errors[ia][ipt]);
# Line 477 | Line 747 | ZbResultContainer new_data_mc_agreement_
747        } else {
748          dout << "Detected BS for MPF method (bin ignored) : " << endl;
749          dout << "       alpha: " << alphacuts[ia] << " , pt range: " << ptcuts[ipt] << " < pt < " << ptcuts[ipt+1] << endl;
750 <        cout << "       value (MPF) : " << MPF_Results[ia][ipt] << " +/- " << MPF_Errors[ia][ipt] << endl;
750 >        dout << "       value (MPF) : " << MPF_Results[ia][ipt] << " +/- " << MPF_Errors[ia][ipt] << endl;
751        }
752        if(RABS_Results[ia][ipt]==RABS_Results[ia][ipt] && RABS_Errors[ia][ipt]==RABS_Errors[ia][ipt]) {
753         rabs_gr->SetPoint(rabs_counter,alphacuts[ia],RABS_Results[ia][ipt]);
# Line 486 | Line 756 | ZbResultContainer new_data_mc_agreement_
756        } else {
757          dout << "Detected BS for RABS method (bin ignored) : " << endl;
758          dout << "       alpha: " << alphacuts[ia] << " , pt range: " << ptcuts[ipt] << " < pt < " << ptcuts[ipt+1] << endl;
759 <        cout << "       value (RABS) : " << RABS_Results[ia][ipt] << " +/- " << RABS_Errors[ia][ipt] << endl;
759 >        dout << "       value (RABS) : " << RABS_Results[ia][ipt] << " +/- " << RABS_Errors[ia][ipt] << endl;
760        }
761      }
762      
763      stringstream specialcut;
764 <    specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (" << AlphaVariable << "<0.3))";
765 <    Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_0.3",ptcuts[ipt],ptcuts[ipt+1],0,0.3);
766 <    Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"Zb3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_0.3",ptcuts[ipt],ptcuts[ipt+1],0,0.3);
767 <    cout << "About to add a point in pt (" << (ptcuts[ipt]+ptcuts[ipt+1])/2 << " ) to face value : " << MPF_data_over_mc << " (MPF) , " <<  RABS_data_over_mc << "(RABS)" << endl;
764 >    specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (" << AlphaVariable << "<" << FaceValueToBeTakenAt << "))";
765 >    Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_"+any2string(FaceValueToBeTakenAt),ptcuts[ipt],ptcuts[ipt+1],0,FaceValueToBeTakenAt);
766 >    Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"ZbCHS3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_"+any2string(FaceValueToBeTakenAt),ptcuts[ipt],ptcuts[ipt+1],0,FaceValueToBeTakenAt);
767 >    dout << "About to add a point in pt (" << (ptcuts[ipt]+ptcuts[ipt+1])/2 << " ) to face value : " << MPF_data_over_mc << " (MPF) , " <<  RABS_data_over_mc << "(RABS)" << endl;
768      MPF_FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1])/2,MPF_data_over_mc.getValue());
769      MPF_FaceValueAtPoint3->SetPointError(ipt,0,MPF_data_over_mc.getError());
770      RABS_FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1])/2,RABS_data_over_mc.getValue());
771      RABS_FaceValueAtPoint3->SetPointError(ipt,0,RABS_data_over_mc.getError());
772      
503    can->cd();
504    mpf_gr->SetMarkerStyle(21);
505    mpf_gr->SetMarkerColor(kBlue);
506    mpf_gr->Draw("AP");
507    mpf_gr->Fit("pol1","");
508    mpf_gr->GetXaxis()->SetTitle("#alpha");
509    mpf_gr->GetXaxis()->CenterTitle();
510    mpf_gr->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
511    mpf_gr->GetYaxis()->CenterTitle();
512    TF1 *mpf_pol=(TF1*)mpf_gr->GetFunction("pol1");
513    mpf_pol->SetLineWidth(0);
514    TF1 *mpf_pol_complete = new TF1("mpf_pol_complete","[0]+[1]*x");
515    mpf_pol_complete->SetParameters(mpf_pol->GetParameters());
516    mpf_pol_complete->SetLineWidth(1);
517    mpf_pol_complete->SetLineColor(kBlue);
518    float min,max;
519    FindMinMax(mpf_gr,min,max);
520    TH1F *histo = new TH1F("histo","histo",1,0,0.4);
521    histo->GetXaxis()->SetTitle("#alpha");
522    histo->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
523    histo->GetXaxis()->CenterTitle();
524    histo->GetYaxis()->CenterTitle();
525    histo->GetYaxis()->SetTitleOffset(1.3);
526    histo->SetStats(0);
527    histo->GetXaxis()->SetRangeUser(0,0.4);
528    histo->GetYaxis()->SetRangeUser(min,max);
529    mpf_gr->GetYaxis()->SetRangeUser(min,max);
530    
531    TPolyLine *mpf_fit_uncert = GetFitUncertaintyShape(mpf_gr, "pol1", min, max,0.0,0.4);
532    mpf_pol->SetLineColor(TColor::GetColor("#0101DF"));
533    mpf_fit_uncert->SetFillColor(TColor::GetColor("#5353FC"));
534    histo->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
535    histo->Draw();
536    mpf_fit_uncert->Draw("F");
537    mpf_fit_uncert->Draw("");
538    mpf_gr->Draw("P");
539    mpf_pol_complete->Draw("same");
540    
541    float mpf_a=mpf_pol->GetParameter(0);
542    float mpf_b=mpf_pol->GetParameter(1);
543    MPF_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),mpf_a);
544    MPF_FinalGraph->SetPointError(ipt,0,mpf_pol->GetParError(0));
545    
546    MPF_ExtraPolatedResults[ipt]=mpf_a;
547    
548    stringstream mpf_info;
549    mpf_info <<  "#splitline{#splitline{#splitline{" << ptcuts[ipt] << " GeV < p_{T}^{Z} < " << ptcuts[ipt+1] << " GeV }{ (MPF) }}{Extrapolated value: " << std::setprecision(4) << mpf_a << "}}{#chi^{2}/NDF : " << mpf_pol->GetChisquare() << " / " << mpf_pol->GetNDF() << "}";
550    
551    TText *mpf_mark = write_title(mpf_info.str());
552    mpf_mark->SetX(0.75);
553    mpf_mark->SetTextSize(0.03);
554    mpf_mark->SetY(0.75);
555    mpf_mark->Draw();
773      
774 <    string filenamebkp=filename.str();
558 <    filename << "__MPF";
559 <    DrawPrelim();
560 <    CompleteSave(can,ContainerName+"/"+filename.str());
561 <    cout << "MPF : " << mpf_a << " + " << mpf_b << " * alpha " << endl;
774 >    TH1D *mpf_band, *rabs_band;
775      
776 <    filename.str("");
776 >    if(!gofast) {
777 >      can->cd();
778 >      mpf_gr->SetMarkerStyle(21);
779 >      mpf_gr->SetMarkerColor(kBlue);
780 >      mpf_gr->Draw("AP");
781 >      
782 >      TF1 *mpf_pol = new TF1("mpf_pol","[0]+[1]*x",ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary);
783 >      
784 >      mpf_gr->Fit(mpf_pol,"E"); // better error estimation using MINOS (E), quiet (Q) and using loglikelihood method
785 >      mpf_gr->GetXaxis()->SetTitle("#alpha");
786 >      mpf_gr->GetXaxis()->CenterTitle();
787 >      mpf_gr->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
788 >      mpf_gr->GetYaxis()->CenterTitle();
789 >      //TF1 *mpf_pol=(TF1*)mpf_gr->GetFunction("pol1");
790 >      mpf_band = getBand(mpf_pol,"MPF_band");
791 >      mpf_pol->SetLineWidth(0);
792 >      TF1 *mpf_pol_complete = new TF1("mpf_pol_complete","[0]+[1]*x");
793 >      mpf_pol_complete->SetParameters(mpf_pol->GetParameters());
794 >      mpf_pol_complete->SetLineWidth(1);
795 >      mpf_pol_complete->SetLineColor(kBlue);
796 >      
797 >      float min,max;
798 >      FindMinMax(mpf_gr,min,max);
799 >      TH1F *histo = new TH1F("histo","histo",1,0,0.4);
800 >      histo->GetXaxis()->SetTitle("#alpha");
801 >      histo->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
802 >      histo->GetXaxis()->CenterTitle();
803 >      histo->GetYaxis()->CenterTitle();
804 >      histo->GetYaxis()->SetTitleOffset(1.3);
805 >      histo->SetStats(0);
806 >      histo->GetXaxis()->SetRangeUser(0,0.4);
807 >      histo->GetYaxis()->SetRangeUser(min,max);
808 >      mpf_gr->GetYaxis()->SetRangeUser(min,max);
809 >      
810 >      //TPolyLine *mpf_fit_uncert = GetFitUncertaintyShape(mpf_gr, "pol1", min, max,0.0,0.4);
811 >      
812 >      mpf_pol->SetLineColor(TColor::GetColor("#0101DF"));
813 >      //mpf_fit_uncert->SetFillColor(TColor::GetColor("#A2A2FA"));
814 >      mpf_band->SetFillColor(TColor::GetColor("#A2A2FA"));
815 >      histo->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
816 >      histo->Draw();
817 >      //mpf_fit_uncert->Draw("F");
818 >      //mpf_fit_uncert->Draw("");
819 >      mpf_gr->Draw("P");
820 >      mpf_band->Draw("C E3 SAME");
821 >      mpf_gr->Draw("P");
822 >      mpf_pol_complete->Draw("same");
823 >      
824 >      float mpf_a=mpf_pol->GetParameter(0);
825 >      float mpf_b=mpf_pol->GetParameter(1);
826 >      MPF_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),mpf_a);
827 >      MPF_FinalGraph->SetPointError(ipt,0,mpf_pol->GetParError(0));
828 >      
829 >      MPF_ExtraPolatedResults[ipt]=mpf_a;
830 >      
831 >      stringstream mpf_info;
832 >      mpf_info <<  "#splitline{#splitline{#splitline{" << ptcuts[ipt] << " GeV < p_{T}^{Z} < " << ptcuts[ipt+1] << " GeV }{ (MPF) }}{Extrapolated value: " << std::setprecision(4) << mpf_a << "}}{#chi^{2}/NDF : " << mpf_pol->GetChisquare() << " / " << mpf_pol->GetNDF() << "}";
833 >      
834 >      TText *mpf_mark = write_title(mpf_info.str());
835 >      mpf_mark->SetX(0.75);
836 >      mpf_mark->SetTextSize(0.03);
837 >      mpf_mark->SetY(0.75);
838 >      mpf_mark->Draw();
839 >      
840 >      string filenamebkp=filename.str();
841 >      filename << "__MPF";
842 >      DrawPrelim();
843 >      CompleteSave(can,ContainerName+"/"+filename.str());
844 >      dout << "MPF : " << mpf_a << " + " << mpf_b << " * alpha " << endl;
845 >      
846 >      filename.str("");
847 >      
848 >      TF1 *rabs_pol = new TF1("rabs_pol","[0]+[1]*x",ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary);
849 >      rabs_gr->SetMarkerStyle(21);
850 >      rabs_gr->SetMarkerColor(kRed);
851 >      rabs_gr->Draw("AP");
852 >      //rabs_gr->Fit("pol1","E");
853 >      rabs_gr->Fit(rabs_pol,"E");
854 >      rabs_band = getBand(rabs_pol,"Rabs_band");
855 >      
856 >      
857 >      rabs_gr->GetXaxis()->SetTitle("#alpha");
858 >      rabs_gr->GetXaxis()->CenterTitle();
859 >      rabs_gr->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}");
860 >      rabs_gr->GetYaxis()->CenterTitle();
861 >      //TF1 *rabs_pol=(TF1*)rabs_gr->GetFunction("pol1");
862 >      rabs_pol->SetLineWidth(0);
863 >      TF1 *rabs_pol_complete = new TF1("rabs_pol_complete","[0]+[1]*x");
864 >      rabs_pol_complete->SetParameters(rabs_pol->GetParameters());
865 >      rabs_pol_complete->SetLineColor(kRed);
866 >      rabs_pol_complete->SetLineWidth(1);
867 >      FindMinMax(rabs_gr,min,max);
868 >      rabs_gr->GetYaxis()->SetRangeUser(min,max);
869 >      histo->GetYaxis()->SetRangeUser(min,max);
870 >      //TPolyLine *rabs_fit_uncert = GetFitUncertaintyShape(rabs_gr, "pol1", min, max,0.0,0.4);
871 >      rabs_pol->SetLineColor(TColor::GetColor("#F99C9C"));
872 >      rabs_pol->SetFillColor(TColor::GetColor("#F99C9C"));
873 >      rabs_band->SetLineColor(TColor::GetColor("#F99C9C"));
874 >      rabs_band->SetFillColor(TColor::GetColor("#F99C9C"));
875 >      //rabs_fit_uncert->SetLineColor(TColor::GetColor("#F99C9C"));
876 >      //rabs_fit_uncert->SetFillColor(TColor::GetColor("#F99C9C"));
877 >      histo->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}");
878 >      histo->Draw();
879 >      rabs_band->Draw("C E3 SAME");
880 >      //rabs_fit_uncert->Draw("F");
881 >      //rabs_fit_uncert->Draw("");
882 >      rabs_gr->Draw("P");
883 >      rabs_pol_complete->Draw("same");
884 >      
885 >      float rabs_a=rabs_pol->GetParameter(0);
886 >      float rabs_b=rabs_pol->GetParameter(1);
887 >      RABS_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),rabs_a);
888 >      RABS_FinalGraph->SetPointError(ipt,0,rabs_pol->GetParError(0));
889 >      
890 >      dout << "!+!+!+!+!+!+!+!+!+ Just added a point to the final plot : " << rabs_a << " +/- " << rabs_pol->GetParError(0) << endl;
891 >      
892 >      stringstream rabs_info;
893 >      rabs_info << "#splitline{#splitline{#splitline{" << ptcuts[ipt] << " GeV < p_{T}^{Z} < " << ptcuts[ipt+1] << " GeV }{ (R_{abs}) }}{Extrapolated value: " << std::setprecision(4) << rabs_a << "}}{#chi^{2}/NDF : " << rabs_pol->GetChisquare() << " / " << rabs_pol->GetNDF() << "}";
894 >      TText *rabs_mark = write_title(rabs_info.str());
895 >      rabs_mark->SetX(0.75);
896 >      rabs_mark->SetTextSize(0.03);
897 >      rabs_mark->SetY(0.75);
898 >      rabs_mark->Draw();
899 >      
900 >      RABS_ExtraPolatedResults[ipt]=rabs_a;
901 >      filename << filenamebkp << "__RABS";
902 >      DrawPrelim();
903 >      CompleteSave(can,ContainerName+"/"+filename.str());
904 >      dout << "RABS : " << rabs_a << " + " << rabs_b << " * alpha " << endl;
905 >    }
906 >  }
907 >  
908 >  float MPFResult;
909 >  float MPFResultError;
910 >  
911 >  float RabsResult;
912 >  float RabsResultError;
913 >
914 >  if(!gofast) {
915 >    MPF_FinalGraph->SetMarkerStyle(21);
916 >    MPF_FinalGraph->SetMarkerColor(kBlue);
917 >    MPF_FinalGraph->Fit("pol0",""); // quiet, use minos
918 >    
919 >    TF1 *mpf_pol0=(TF1*)MPF_FinalGraph->GetFunction("pol0");
920 >    TF1 *mpf_pol0_complete = new TF1("mpf_pol0_complete","[0]+[1]*x");
921 >    mpf_pol0_complete->SetLineWidth(1);
922 >    mpf_pol0_complete->SetLineColor(kBlue);
923 >    mpf_pol0->SetLineColor(kBlue);
924 >    MPF_FinalGraph->Draw("AP");
925 >    MPF_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}");
926 >    MPF_FinalGraph->GetXaxis()->CenterTitle();
927 >    MPF_FinalGraph->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
928 >    MPF_FinalGraph->GetYaxis()->CenterTitle();
929 >    MPF_FinalGraph->Draw("AP");
930 >    mpf_pol0_complete->Draw("same");
931 >    
932 >    stringstream mpf_result;
933 >    mpf_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/mpf_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0)) << "}{ (MPF)}";
934 >    TText *rmpf_final_mark = write_title(mpf_result.str());
935 >    rmpf_final_mark->SetX(0.75);
936 >    rmpf_final_mark->SetY(0.75);
937 >    rmpf_final_mark->SetTextSize(0.03);
938 >    rmpf_final_mark->Draw();
939 >    DrawPrelim();
940 >    MPFResult=1/mpf_pol0->GetParameter(0);
941 >    MPFResultError=mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0));
942      
943 <    rabs_gr->SetMarkerStyle(21);
944 <    rabs_gr->SetMarkerColor(kRed);
945 <    rabs_gr->Draw("AP");
946 <    rabs_gr->Fit("pol1","");
947 <    rabs_gr->GetXaxis()->SetTitle("#alpha");
948 <    rabs_gr->GetXaxis()->CenterTitle();
949 <    rabs_gr->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}");
950 <    rabs_gr->GetYaxis()->CenterTitle();
951 <    TF1 *rabs_pol=(TF1*)rabs_gr->GetFunction("pol1");
952 <    rabs_pol->SetLineWidth(0);
953 <    TF1 *rabs_pol_complete = new TF1("rabs_pol_complete","[0]+[1]*x");
954 <    rabs_pol_complete->SetParameters(rabs_pol->GetParameters());
955 <    rabs_pol_complete->SetLineColor(kRed);
956 <    rabs_pol_complete->SetLineWidth(1);
957 <    FindMinMax(rabs_gr,min,max);
958 <    rabs_gr->GetYaxis()->SetRangeUser(min,max);
959 <    histo->GetYaxis()->SetRangeUser(min,max);
960 <    TPolyLine *rabs_fit_uncert = GetFitUncertaintyShape(rabs_gr, "pol1", min, max,0.0,0.4);
961 <    rabs_pol->SetLineColor(TColor::GetColor("#FA5858"));
962 <    rabs_pol->SetFillColor(TColor::GetColor("#FA5858"));
963 <    rabs_fit_uncert->SetLineColor(TColor::GetColor("#FA5858"));
964 <    rabs_fit_uncert->SetFillColor(TColor::GetColor("#FA5858"));
965 <    histo->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}");
588 <    histo->Draw();
589 <    rabs_fit_uncert->Draw("F");
590 <    rabs_fit_uncert->Draw("");
591 <    rabs_gr->Draw("P");
592 <    rabs_pol_complete->Draw("same");
593 <
594 <    
595 <    float rabs_a=rabs_pol->GetParameter(0);
596 <    float rabs_b=rabs_pol->GetParameter(1);
597 <    RABS_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),rabs_a);
598 <    RABS_FinalGraph->SetPointError(ipt,0,rabs_pol->GetParError(0));
599 <    
600 <    cout << "!+!+!+!+!+!+!+!+!+ Just added a point to the final plot : " << rabs_a << " +/- " << rabs_pol->GetParError(0) << endl;
601 <    
602 <    stringstream rabs_info;
603 <    rabs_info << "#splitline{#splitline{#splitline{" << ptcuts[ipt] << " GeV < p_{T}^{Z} < " << ptcuts[ipt+1] << " GeV }{ (R_{abs}) }}{Extrapolated value: " << std::setprecision(4) << rabs_a << "}}{#chi^{2}/NDF : " << rabs_pol->GetChisquare() << " / " << rabs_pol->GetNDF() << "}";
604 <    TText *rabs_mark = write_title(rabs_info.str());
605 <    rabs_mark->SetX(0.75);
606 <    rabs_mark->SetTextSize(0.03);
607 <    rabs_mark->SetY(0.75);
608 <    rabs_mark->Draw();
943 >    stringstream filename2;
944 >    filename2 << "Extrapolation/FINAL_RESULT_MPF";
945 >    CompleteSave(can,ContainerName+"/"+filename2.str());
946 >    
947 >    RABS_FinalGraph->SetMarkerStyle(21);
948 >    RABS_FinalGraph->SetMarkerStyle(21);
949 >    RABS_FinalGraph->SetMarkerColor(kRed);
950 >    RABS_FinalGraph->Fit("pol0","QE"); // quiet, use minos
951 >    RABS_FinalGraph->Draw("AP");
952 >    RABS_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}");
953 >    RABS_FinalGraph->GetXaxis()->CenterTitle();
954 >    RABS_FinalGraph->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}");
955 >    RABS_FinalGraph->GetYaxis()->CenterTitle();
956 >    RABS_FinalGraph->Draw("AP");
957 >    TF1 *rabs_pol0=(TF1*)RABS_FinalGraph->GetFunction("pol0");
958 >    stringstream rabs_result;
959 >    rabs_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/rabs_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0)) << "}{ (R_{abs})}";;
960 >    TText *rabs_final_mark = write_title(rabs_result.str());
961 >    rabs_final_mark->SetX(0.75);
962 >    rabs_final_mark->SetY(0.75);
963 >    rabs_final_mark->SetTextSize(0.03);
964 >    rabs_final_mark->Draw();
965 >    DrawPrelim();
966      
967 +    RabsResult=1/rabs_pol0->GetParameter(0);
968 +    RabsResultError=rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0));
969      
970 <    RABS_ExtraPolatedResults[ipt]=rabs_a;
971 <    filename << filenamebkp << "__RABS";
972 <    DrawPrelim();
614 <    CompleteSave(can,ContainerName+"/"+filename.str());
615 <    cout << "RABS : " << rabs_a << " + " << rabs_b << " * alpha " << endl;
970 >    filename2.str("");
971 >    filename2 << "Extrapolation/FINAL_RESULT_RABS";
972 >    CompleteSave(can,ContainerName+"/"+filename2.str());
973    }
974 <  
618 <  MPF_FinalGraph->SetMarkerStyle(21);
619 <  MPF_FinalGraph->SetMarkerColor(kBlue);
620 <  MPF_FinalGraph->Fit("pol0",""); // quiet, use minos
621 <  
622 <  TF1 *mpf_pol0=(TF1*)MPF_FinalGraph->GetFunction("pol0");
623 <  TF1 *mpf_pol0_complete = new TF1("mpf_pol0_complete","[0]+[1]*x");
624 <  mpf_pol0_complete->SetLineWidth(1);
625 <  mpf_pol0_complete->SetLineColor(kBlue);
626 <  mpf_pol0->SetLineColor(kBlue);
627 <  MPF_FinalGraph->Draw("AP");
628 <  MPF_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}");
629 <  MPF_FinalGraph->GetXaxis()->CenterTitle();
630 <  MPF_FinalGraph->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
631 <  MPF_FinalGraph->GetYaxis()->CenterTitle();
632 <  MPF_FinalGraph->Draw("AP");
633 <  mpf_pol0_complete->Draw("same");
634 <  
635 <  stringstream mpf_result;
636 <  mpf_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/mpf_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0)) << "}{ (MPF)}";
637 <  TText *rmpf_final_mark = write_title(mpf_result.str());
638 <  rmpf_final_mark->SetX(0.75);
639 <  rmpf_final_mark->SetY(0.75);
640 <  rmpf_final_mark->SetTextSize(0.03);
641 <  rmpf_final_mark->Draw();
642 <  DrawPrelim();
643 <  float MPFResult=1/mpf_pol0->GetParameter(0);
644 <  float MPFResultError=mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0));
645 <  
646 <  stringstream filename2;
647 <  filename2 << "Extrapolation/FINAL_RESULT_MPF";
648 <  CompleteSave(can,ContainerName+"/"+filename2.str());
649 <  
650 <  
651 <  RABS_FinalGraph->SetMarkerStyle(21);
652 <  RABS_FinalGraph->SetMarkerStyle(21);
653 <  RABS_FinalGraph->SetMarkerColor(kRed);
654 <  RABS_FinalGraph->Fit("pol0","QE"); // quiet, use minos
655 <  RABS_FinalGraph->Draw("AP");
656 <  RABS_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}");
657 <  RABS_FinalGraph->GetXaxis()->CenterTitle();
658 <  RABS_FinalGraph->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}");
659 <  RABS_FinalGraph->GetYaxis()->CenterTitle();
660 <  RABS_FinalGraph->Draw("AP");
661 <  TF1 *rabs_pol0=(TF1*)RABS_FinalGraph->GetFunction("pol0");
662 <  stringstream rabs_result;
663 <  rabs_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/rabs_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0)) << "}{ (R_{abs})}";;
664 <  TText *rabs_final_mark = write_title(rabs_result.str());
665 <  rabs_final_mark->SetX(0.75);
666 <  rabs_final_mark->SetY(0.75);
667 <  rabs_final_mark->SetTextSize(0.03);
668 <  rabs_final_mark->Draw();
669 <  DrawPrelim();
670 <  
671 <  float RabsResult=1/rabs_pol0->GetParameter(0);
672 <  float RabsResultError=rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0));
673 <  
674 <  filename2.str("");
675 <  filename2 << "Extrapolation/FINAL_RESULT_RABS";
676 <  CompleteSave(can,ContainerName+"/"+filename2.str());
677 <  
974 >
975    can->cd();
976    MPF_FaceValueAtPoint3->SetMarkerStyle(21);
977    MPF_FaceValueAtPoint3->SetMarkerColor(kBlue);
# Line 682 | Line 979 | ZbResultContainer new_data_mc_agreement_
979    MPF_FaceValueAtPoint3->Draw("AP");
980    MPF_FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}");
981    MPF_FaceValueAtPoint3->GetXaxis()->CenterTitle();
982 <  MPF_FaceValueAtPoint3->GetYaxis()->SetTitle("<MPF>__{data}/<MPF>_{mc} for #alpha<0.3");
982 >  MPF_FaceValueAtPoint3->GetYaxis()->SetTitle(((string)"<MPF>__{data}/<MPF>_{mc} for #alpha<"+any2string(FaceValueToBeTakenAt)).c_str());
983    MPF_FaceValueAtPoint3->GetYaxis()->CenterTitle();
984    MPF_FaceValueAtPoint3->Draw("AP");
985    TF1 *faceval_pol0=(TF1*)MPF_FaceValueAtPoint3->GetFunction("pol0");
# Line 692 | Line 989 | ZbResultContainer new_data_mc_agreement_
989    TF1 *faceval_pol0_complete = new TF1("faceval_pol0_complete","[0]+[1]*x");
990    faceval_pol0_complete->SetParameters(faceval_pol0->GetParameters());
991    stringstream faceval_result;
992 <  faceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0)) << "}{ (MPF at #alpha<0.3)}";;
992 >  faceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0)) << "}{ (MPF at #alpha<" << FaceValueToBeTakenAt << ")}";;
993    TText *faceval_final_mark = write_title(faceval_result.str());
994    faceval_final_mark->SetX(0.75);
995    faceval_final_mark->SetY(0.75);
# Line 703 | Line 1000 | ZbResultContainer new_data_mc_agreement_
1000    float FaceValResult=1/faceval_pol0->GetParameter(0);
1001    float FaceValResultError=faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0));
1002    
1003 +  stringstream filename2;
1004    filename2.str("");
1005    filename2 << "Extrapolation/FINAL_RESULT_MPF_FaceValp3";
1006    CompleteSave(can,ContainerName+"/"+filename2.str());
# Line 714 | Line 1012 | ZbResultContainer new_data_mc_agreement_
1012    RABS_FaceValueAtPoint3->Draw("AP");
1013    RABS_FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}");
1014    RABS_FaceValueAtPoint3->GetXaxis()->CenterTitle();
1015 <  RABS_FaceValueAtPoint3->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc} for #alpha<0.3");
1015 >  RABS_FaceValueAtPoint3->GetYaxis()->SetTitle(((string)"<R_{abs}>_{data}/<R_{abs}>_{mc} for #alpha<"+any2string(FaceValueToBeTakenAt)).c_str());
1016    RABS_FaceValueAtPoint3->GetYaxis()->CenterTitle();
1017    RABS_FaceValueAtPoint3->Draw("AP");
1018    TF1 *faceval_pol0RABS=(TF1*)RABS_FaceValueAtPoint3->GetFunction("pol0");
# Line 724 | Line 1022 | ZbResultContainer new_data_mc_agreement_
1022    faceval_pol0RABS->SetLineColor(kRed);
1023    faceval_pol0RABS_complete->Draw("same");
1024    stringstream RABSfaceval_result;
1025 <  RABSfaceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0RABS->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0RABS->GetParError(0)/(faceval_pol0RABS->GetParameter(0)*faceval_pol0RABS->GetParameter(0)) << "}{ (R_{abs} at #alpha<0.3)}";;
1025 >  RABSfaceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0RABS->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0RABS->GetParError(0)/(faceval_pol0RABS->GetParameter(0)*faceval_pol0RABS->GetParameter(0)) << "}{ (R_{abs} at #alpha<" << FaceValueToBeTakenAt << ")}";;
1026    TText *RABSfaceval_final_mark = write_title(RABSfaceval_result.str());
1027    RABSfaceval_final_mark->SetX(0.75);
1028    RABSfaceval_final_mark->SetY(0.75);
# Line 739 | Line 1037 | ZbResultContainer new_data_mc_agreement_
1037    filename2 << "Extrapolation/FINAL_RESULT_RABS_FaceValp3";
1038    CompleteSave(can,ContainerName+"/"+filename2.str());
1039    
1040 <  cout << "FINAL RESULTS: " << endl;
1041 <  cout << "MPF : " << MPFResult  << " +/- " << MPFResultError  << endl;
1042 <  cout << "Rabs: " << RabsResult << " +/- " << RabsResultError << endl;
1043 <  cout << "Face value at 0.3 :" << FaceValResult << " +/- " << FaceValResultError << "  (MPF) " << endl;
1044 <  cout << "Face value at 0.3 :" << RABSFaceValResult << " +/- " << RABSFaceValResultError << "  (RABS) " << endl;
1040 >  dout << "FINAL RESULTS: " << endl;
1041 >  if(!gofast) dout << "MPF : " << MPFResult  << " +/- " << MPFResultError  << endl;
1042 >  if(!gofast) dout << "Rabs: " << RabsResult << " +/- " << RabsResultError << endl;
1043 >  dout << "Face value at " << FaceValueToBeTakenAt << " :" << FaceValResult << " +/- " << FaceValResultError << "  (MPF) " << endl;
1044 >  dout << "Face value at " << FaceValueToBeTakenAt << " :" << RABSFaceValResult << " +/- " << RABSFaceValResultError << "  (RABS) " << endl;
1045    
1046    delete can;
1047    
1048    results.MPF_Result_FaceValue=Value(FaceValResult,FaceValResultError);
1049    results.Rabs_Result_FaceValue=Value(RABSFaceValResult,RABSFaceValResultError);
1050 <  results.MPF_Result_Extrapolated=Value(MPFResult,MPFResultError);
1051 <  results.Rabs_Result_Extrapolated=Value(RabsResult,RabsResultError);
1052 <  cout << results << endl;
1050 >  if(!gofast) results.MPF_Result_Extrapolated=Value(MPFResult,MPFResultError);
1051 >  if(!gofast) results.Rabs_Result_Extrapolated=Value(RabsResult,RabsResultError);
1052 >  results.Print();
1053    return results;
1054   }
1055  
1056  
1057 < void TEST_DoPUStudy(string identifier) {
1057 > void DoPUStudy(string identifier) {
1058    
1059    float numVtxcuts[7]={0,10,15,20};
1060    
1061    TCanvas *can = new TCanvas("can","can");
1062    TH1F *malpha[8];
1063    TH1F *dalpha[8];
1064 <  cout << identifier << ";";
1065 <  cout << endl;
1064 >  dout << identifier << ";";
1065 >  dout << endl;
1066    for(int i=1;i<5;i++) {
1067      stringstream sSpecialCut;
1068      if(i<4) {
1069        sSpecialCut << "numVtx>" << numVtxcuts[i-1] << " && numVtx<" << numVtxcuts[i];
1070 <      cout << numVtxcuts[i-1] << "  < nVtx < " << numVtxcuts[i] << ";";
1070 >      dout << numVtxcuts[i-1] << "  < nVtx < " << numVtxcuts[i] << ";";
1071      } else {
1072        sSpecialCut << "numVtx>" << numVtxcuts[i-1];
1073 <      cout << numVtxcuts[i-1] << ";";
1073 >      dout << numVtxcuts[i-1] << ";";
1074      }
1075      
1076 +    sSpecialCut << " && " << identifier << "_alpha<0.3";
1077      TCut SpecialCut(sSpecialCut.str().c_str());
1078      
1079      
1080 <    malpha[i] = allsamples.Draw("malpha"+any2string(i),"mpf",1000,0,10,"MPF","events",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&SpecialCut,mc,luminosity);
1081 <    dalpha[i] = allsamples.Draw("dalpha"+any2string(i),"mpf",1000,0,10,"MPF","events",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&SpecialCut,data,luminosity);
1080 >    malpha[i] = allsamples.Draw("malpha"+any2string(i),"mpf",1000,0,2,"MPF","events",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&SpecialCut,mc,luminosity);
1081 >    dalpha[i] = allsamples.Draw("dalpha"+any2string(i),"mpf",1000,0,2,"MPF","events",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&SpecialCut,data,luminosity);
1082      
1083      
1084      float a=dalpha[i]->GetMean();
# Line 789 | Line 1088 | void TEST_DoPUStudy(string identifier) {
1088      float factor = a / b;
1089      float error = TMath::Sqrt(  (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db);
1090    
1091 <    cout << malpha[i]->GetMean() << ";" << malpha[i]->GetMeanError() << ";" << dalpha[i]->GetMean() << ";" << dalpha[i]->GetMeanError() << ";" << malpha[i]->Integral()<<";"<<dalpha[i]->Integral() << ";"<<factor << ";" << error <<  endl;
793 <    malpha[i]->SetLineColor(i+1);
794 <    if(i==0) malpha[i]->Draw("histo");
795 <    else malpha[i]->Draw("histo,same");
796 <  }
797 <  
798 <  CompleteSave(can,"AlphaOverview_"+identifier);
799 <  delete can;
800 <  
801 < /*  for(int i=1;i<8;i++) {
1091 >    dout << malpha[i]->GetMean() << ";" << malpha[i]->GetMeanError() << ";" << dalpha[i]->GetMean() << ";" << dalpha[i]->GetMeanError() << ";" << malpha[i]->Integral()<<";"<<dalpha[i]->Integral() << ";"<<factor << ";" << error <<  endl;
1092      delete malpha[i];
1093      delete dalpha[i];
1094    }
1095 <  */
1095 >  
1096 >  delete can;
1097    
1098   }
1099  
1100 < void TEST_ScenarioComparison() {
1100 > void ScenarioComparison() {
1101   //very dumb way to do this.
1102 +
1103    TGraphAsymmErrors *gr[5];
1104    TF1 *fit[5];
1105 <  bool dofit=false;
1105 >  bool dofit=true;
1106    
1107    TCanvas *can = new TCanvas("can","can",500,500);
1108    
# Line 818 | Line 1110 | void TEST_ScenarioComparison() {
1110    leg->SetBorderSize(0);
1111    leg->SetFillColor(kWhite);
1112    
1113 <  for(int i=0;i<5;i++) {
1113 >  for(int i=0;i<6;i++) {
1114      gr[i] = new TGraphAsymmErrors();
1115 <    double x[4]   = {5,12.5,17.5,20};
1116 <    double dxl[4] = {5,2.5,2.5,2.5};
1115 >    double x[4]   = {5,12.5,17.5,25};
1116 >    double dxl[4] = {5,2.5,2.5,5};
1117      double dxh[4] = {5,2.5,2.5,10};
1118      
1119      string name="";
1120      string color="";
1121      
1122      if(i==0) {
1123 <      double y[4]   = {1.008,1.013,1.003,1.007};
1124 <      double dyl[4] = {0.011,0.009,0.013,0.020};
1125 <      double dyh[4] = {0.011,0.009,0.013,0.020};
1123 >      double y[4]   = {1.01935,1.01558,0.996438,1.01901};
1124 >      double dyl[4] = {0.0132973,0.0131661,0.017629,0.0319767};
1125 >      double dyh[4] = {0.0132973,0.0131661,0.017629,0.0319767};
1126        name="30/30";
1127        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1128        color="#a01d99";
1129      }
1130      if(i==1) {
1131 <      double y[4]   = {1.008+0.001,1.013+0.001,1.003+0.001,1.007+0.001};
1132 <      double dyl[4] = {0.011,0.009,0.013,0.020};
1133 <      double dyh[4] = {0.011,0.009,0.013,0.020};
1131 >      double y[4]   = {1.00577,1.00706,0.991029,0.954098};
1132 >      double dyl[4] = {0.0135575,0.0136548,0.0170778,0.0263919};
1133 >      double dyh[4] = {0.0135575,0.0136548,0.0170778,0.0263919};
1134        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1135        name="30/15";
1136        color="#2464bc";
1137      }
1138      if(i==2) {
1139 <      double y[4]   = {1.014,1.026,1.014,1.059};
1140 <      double dyl[4] = {0.011,0.010,0.014,0.023};
1141 <      double dyh[4] = {0.011,0.010,0.014,0.023};
1139 >      double y[4]   = {1.023,1.00648,1.02217,1.03181};
1140 >      double dyl[4] = {0.0157372,0.0187778,0.0261512,0.0422295};
1141 >      double dyh[4] = {0.0157372,0.0187778,0.0261512,0.0422295};
1142        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1143        name="15/15";
1144        color="#f49230";
1145      }
1146      if(i==3) {
1147 <      double y[4]   = {1.015,1.020,1.008,1.050};
1148 <      double dyl[4] = {0.011,0.010,0.014,0.022};
1149 <      double dyh[4] = {0.011,0.010,0.014,0.022};
1147 >      double y[4]   = {1.02029,1.01338,0.999769,1.00357};
1148 >      double dyl[4] = {0.0129509,0.0120127,0.0160537,0.0268972};
1149 >      double dyh[4] = {0.0129509,0.0120127,0.0160537,0.0268972};
1150        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1151 <      name="20/15";
1151 >      name="CHS 30/30";
1152        color="#c72f3c";
1153      }
1154      if(i==4) {
1155 <      double y[4]   = {1.015+0.001,1.020+0.001,1.008+0.001,1.050+0.001};
1156 <      double dyl[4] = {0.011,0.010,0.014,0.022};
1157 <      double dyh[4] = {0.011,0.010,0.014,0.022};
1155 >      double y[4]   = {1.00274,1.01056,0.993214,0.997963};
1156 >      double dyl[4] = {0.0127179,0.0140344,0.0162814,0.0278914};
1157 >      double dyh[4] = {0.0127179,0.0140344,0.0162814,0.0278914};
1158        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1159 <      name="20/20";
1159 >      name="CHS 30/15";
1160        color="#7cb433";
1161      }
1162 <    
1163 <    
1162 >    if(i==5) {
1163 >      double y[4]   = {1.04103,1.03726,1.04649,1.05383};
1164 >      double dyl[4] = {0.0156465,0.0168194,0.0231982,0.0376114};
1165 >      double dyh[4] = {0.0156465,0.0168194,0.0231982,0.0376114};
1166 >      gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1167 >      name="CHS 15/15";
1168 >      color="#DF013A";
1169 >    }
1170 >    
1171 >    
1172 >    gStyle->SetOptFit(0);
1173      gr[i]->SetTitle();
1174      gr[i]->GetXaxis()->SetTitle("N(Vtx)");
1175      gr[i]->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
# Line 896 | Line 1197 | void TEST_ScenarioComparison() {
1197    
1198   }
1199  
1200 < void TEST_ScenarioComparisonInclusive() {
1200 > void ScenarioComparisonInclusive() {
1201    //dumbest way ever to do this. but ok we only need to do it once.
1202    TGraphAsymmErrors *gr[5];
1203    TF1 *fit[5];
# Line 904 | Line 1205 | void TEST_ScenarioComparisonInclusive()
1205    
1206    TCanvas *can = new TCanvas("can","can",500,500);
1207    
1208 <  TLegend *leg = new TLegend(0.2,0.2,0.5,0.45);
1208 >  TLegend *leg = new TLegend(0.2,0.2,0.65,0.45);
1209    leg->SetBorderSize(0);
1210    leg->SetFillColor(kWhite);
1211    
1212 <  for(int i=0;i<5;i++) {
1212 >  for(int i=0;i<6;i++) {
1213      gr[i] = new TGraphAsymmErrors();
1214 <    double x[4]   = {5,12.5,17.5,20};
1215 <    double dxl[4] = {5,2.5,2.5,2.5};
1216 <    double dxh[4] = {5,2.5,2.5,10};
1214 >    double x[4]   = {5,12.5,17.5,25};
1215 >    double dxl[4] = {5,2.5,2.5,5};
1216 >    double dxh[4] = {5,2.5,2.5,5};
1217      
1218      string name="";
1219      string color="";
1220      
1221      if(i==0) {
1222 <      double y[4]   = {1.01103,1.01496,1.01486,1.02785};
1223 <      double dyl[4] = {0.00235044,0.00225264,0.00313574,0.00541047};
1224 <      double dyh[4] = {0.00235044,0.00225264,0.00313574,0.00541047};
1222 >      double y[4]   = {1.01093,1.01379,1.0147,1.02766};
1223 >      double dyl[4] = {0.00243596,0.00242534,0.00341941,0.00600663};
1224 >      double dyh[4] = {0.00243596,0.00242534,0.00341941,0.00600663};
1225        name="30/30";
1226        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1227        color="#a01d99";
1228      }
1229      if(i==1) {
1230 <      double y[4]   = {1.01103+0.001,1.01496+0.001,1.01486+0.001,1.02785+0.001};
1231 <      double dyl[4] = {0.00235044,0.00225264,0.00313574,0.00541047};
1232 <      double dyh[4] = {0.00235044,0.00225264,0.00313574,0.00541047};
1230 >      double y[4]   = {1.0068,1.00779,0.999692,0.994484};
1231 >      double dyl[4] = {0.00249233,0.00257169,0.00371399,0.00631138};
1232 >      double dyh[4] = {0.00249233,0.00257169,0.00371399,0.00631138};
1233        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1234        name="30/15";
1235        color="#2464bc";
1236      }
1237      if(i==2) {
1238 <      double y[4]   = {1.01575,1.02879,1.0325,1.05456};
1239 <      double dyl[4] = {0.00288281,0.00278536,0.00367451,0.00590421};
1240 <      double dyh[4] = {0.00288281,0.00278536,0.00367451,0.00590421};
1238 >      double y[4]   = {1.01208,1.01991,1.02185,1.03479};
1239 >      double dyl[4] = {0.00366745,0.00400001,0.00584054,0.0104661};
1240 >      double dyh[4] = {0.00366745,0.00400001,0.00584054,0.0104661};
1241        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1242        name="15/15";
1243        color="#f49230";
1244      }
1245      if(i==3) {
1246 <      double y[4]   = {1.01221,1.01922,1.02396,1.04677};
1247 <      double dyl[4] = {0.00263821,0.00260853,0.00353673,0.00584728};
1248 <      double dyh[4] = {0.00263821,0.00260853,0.00353673,0.00584728};
1246 >      double y[4]   = {1.01177,1.01568,1.01616,1.03211};
1247 >      double dyl[4] = {0.00217317,0.00203014,0.00276838,0.00465643};
1248 >      double dyh[4] = {0.00217317,0.00203014,0.00276838,0.00465643};
1249        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1250 <      name="20/15";
1250 >      name="CHS 30/30";
1251        color="#c72f3c";
1252      }
1253      if(i==4) {
1254 <      double y[4]   = {1.01221+0.001,1.01922+0.001,1.02396+0.001,1.04677+0.001};
1255 <      double dyl[4] = {0.00263821,0.00260853,0.00353673,0.00584728};
1256 <      double dyh[4] = {0.00263821,0.00260853,0.00353673,0.00584728};
1254 >      double y[4]   = {1.00751,1.00964,1.00804,1.01073};
1255 >      double dyl[4] = {0.00224851,0.00215563,0.0029592,0.00499805};
1256 >      double dyh[4] = {0.00224851,0.00215563,0.0029592,0.00499805};
1257        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1258 <      name="20/20";
1258 >      name="CHS 30/15";
1259        color="#7cb433";
1260      }
1261 +    if(i==5) {
1262 +      double y[4]   = {1.01557,1.0318,1.03535,1.06331};
1263 +      double dyl[4] = {0.00300783,0.00302486,0.00421064,0.00739416};
1264 +      double dyh[4] = {0.00300783,0.00302486,0.00421064,0.00739416};
1265 +      gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
1266 +      name="CHS 15/15";
1267 +      color="#DF013A";
1268 +    }
1269      
1270 <    
1270 >    gStyle->SetOptFit(0);
1271      gr[i]->SetTitle();
1272      gr[i]->GetXaxis()->SetTitle("N(Vtx)");
1273      gr[i]->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
# Line 974 | Line 1283 | void TEST_ScenarioComparisonInclusive()
1283        fit[i] = (TF1*)gr[i]->GetFunction("pol1");
1284        fit[i]->SetLineColor(TColor::GetColor(color.c_str()));
1285      }
1286 <    leg->AddEntry(gr[i],name.c_str(),"l");
1286 >    
1287 >    stringstream nameplus;
1288 >    nameplus << name << " (slope: " << std::setprecision(3) << fit[i]->GetParameter(1) << ")";
1289 >    
1290 >    leg->AddEntry(gr[i],nameplus.str().c_str(),"l");
1291      if(i==0) gr[i]->Draw("AP*");
1292      else gr[i]->Draw("P");
1293    }
# Line 986 | Line 1299 | void TEST_ScenarioComparisonInclusive()
1299    
1300   }
1301  
1302 < void TEST_compare_selection(string identifier) {
1302 > void compare_selection(string identifier) {
1303    bool recognized_scenario=false;
1304    
1305 <  cout << "Running with identifier " << identifier << endl;
1305 >  dout << "Running with identifier " << identifier << endl;
1306 >  if(identifier=="Zb30") {
1307 >      LeadingB=TCut ("Zb30_bTagProbCSVBP[0]>0.898");
1308 >      EtaB=TCut("abs(Zb30_pfJetGoodEta[0])<1.3");
1309 >      PhiZcut=TCut("abs(Zb30_pfJetDphiZ[0])>2.7");
1310 >      recognized_scenario=true;
1311 >  }
1312    if(identifier=="Zb3010") {
1313        LeadingB=TCut ("Zb3010_bTagProbCSVBP[0]>0.898");
1314        EtaB=TCut("abs(Zb3010_pfJetGoodEta[0])<1.3");
# Line 997 | Line 1316 | void TEST_compare_selection(string ident
1316        recognized_scenario=true;
1317    }
1318    
1319 <  if(identifier=="Zb3010") {
1320 <      LeadingB=TCut ("Zb3010_bTagProbCSVBP[0]>0.898");
1321 <      EtaB=TCut("abs(Zb3010_pfJetGoodEta[0])<1.3");
1322 <      PhiZcut=TCut("abs(Zb3010_pfJetDphiZ[0])>2.7");
1319 >  if(identifier=="ZbCHS3010") {
1320 >      LeadingB=TCut ("ZbCHS1510_bTagProbCSVBP[0]>0.898");
1321 >      EtaB=TCut("abs(ZbCHS1510_pfJetGoodEta[0])<1.3");
1322 >      PhiZcut=TCut("abs(ZbCHS1510_pfJetDphiZ[0])>2.7");
1323        recognized_scenario=true;
1324    }
1325    
# Line 1011 | Line 1330 | void TEST_compare_selection(string ident
1330        recognized_scenario=true;
1331    }
1332    
1333 <  if(identifier=="Zb301030") {
1334 <      LeadingB=TCut ("Zb301030_bTagProbCSVBP[0]>0.898");
1335 <      EtaB=TCut("abs(Zb301030_pfJetGoodEta[0])<1.3");
1336 <      PhiZcut=TCut("abs(Zb301030_pfJetDphiZ[0])>2.7");
1333 >  if(identifier=="ZbCHS301030") {
1334 >      LeadingB=TCut ("ZbCHS301030_bTagProbCSVBP[0]>0.898");
1335 >      EtaB=TCut("abs(ZbCHS301030_pfJetGoodEta[0])<1.3");
1336 >      PhiZcut=TCut("abs(ZbCHS301030_pfJetDphiZ[0])>2.7");
1337        recognized_scenario=true;
1338    }
1339    
# Line 1025 | Line 1344 | void TEST_compare_selection(string ident
1344        recognized_scenario=true;
1345    }
1346    
1347 <  if(identifier=="Zb301010") {
1348 <      LeadingB=TCut ("Zb301010_bTagProbCSVBP[0]>0.898");
1349 <      EtaB=TCut("abs(Zb301010_pfJetGoodEta[0])<1.3");
1350 <      PhiZcut=TCut("abs(Zb301010_pfJetDphiZ[0])>2.7");
1347 >  if(identifier=="ZbCHS301010") {
1348 >      LeadingB=TCut ("ZbCHS301010_bTagProbCSVBP[0]>0.898");
1349 >      EtaB=TCut("abs(ZbCHS301010_pfJetGoodEta[0])<1.3");
1350 >      PhiZcut=TCut("abs(ZbCHS301010_pfJetDphiZ[0])>2.7");
1351        recognized_scenario=true;
1352    }
1353    
# Line 1039 | Line 1358 | void TEST_compare_selection(string ident
1358        recognized_scenario=true;
1359    }
1360    
1361 <  if(identifier=="Zb301010") {
1362 <      LeadingB=TCut ("Zb301010_bTagProbCSVBP[0]>0.898");
1363 <      EtaB=TCut("abs(Zb301010_pfJetGoodEta[0])<1.3");
1364 <      PhiZcut=TCut("abs(Zb301010_pfJetDphiZ[0])>2.7");
1361 >  if(identifier=="ZbCHS301010") {
1362 >      LeadingB=TCut ("ZbCHS301010_bTagProbCSVBP[0]>0.898");
1363 >      EtaB=TCut("abs(ZbCHS301010_pfJetGoodEta[0])<1.3");
1364 >      PhiZcut=TCut("abs(ZbCHS301010_pfJetDphiZ[0])>2.7");
1365        recognized_scenario=true;
1366    }
1367    
# Line 1053 | Line 1372 | void TEST_compare_selection(string ident
1372        recognized_scenario=true;
1373    }
1374    
1375 <  if(identifier=="Zb3010_SecEta3") {
1376 <      LeadingB=TCut ("Zb3010_SecEta3_bTagProbCSVBP[0]>0.898");
1377 <      EtaB=TCut("abs(Zb3010_SecEta3_pfJetGoodEta[0])<1.3");
1378 <      PhiZcut=TCut("abs(Zb3010_SecEta3_pfJetDphiZ[0])>2.7");
1375 >  if(identifier=="ZbCHS3010_SecEta3") {
1376 >      LeadingB=TCut ("ZbCHS3010_SecEta3_bTagProbCSVBP[0]>0.898");
1377 >      EtaB=TCut("abs(ZbCHS3010_SecEta3_pfJetGoodEta[0])<1.3");
1378 >      PhiZcut=TCut("abs(ZbCHS3010_SecEta3_pfJetDphiZ[0])>2.7");
1379        recognized_scenario=true;
1380    }
1381    
1382 <  if(identifier=="Zb3010_SecEta5") {
1383 <      LeadingB=TCut ("Zb3010_SecEta5_bTagProbCSVBP[0]>0.898");
1384 <      EtaB=TCut("abs(Zb3010_SecEta5_pfJetGoodEta[0])<1.3");
1385 <      PhiZcut=TCut("abs(Zb3010_SecEta5_pfJetDphiZ[0])>2.7");
1382 >  if(identifier=="ZbCHS3010_SecEta5") {
1383 >      LeadingB=TCut ("ZbCHS3010_SecEta5_bTagProbCSVBP[0]>0.898");
1384 >      EtaB=TCut("abs(ZbCHS3010_SecEta5_pfJetGoodEta[0])<1.3");
1385 >      PhiZcut=TCut("abs(ZbCHS3010_SecEta5_pfJetDphiZ[0])>2.7");
1386        recognized_scenario=true;
1387    }
1388    
1389 <  if(identifier=="Zb3010_p5Clean") {
1390 <      LeadingB=TCut ("Zb3010_p5Clean_bTagProbCSVBP[0]>0.898 && Zb3010_p5Clean_IsClean");
1391 <      EtaB=TCut("abs(Zb3010_p5Clean_pfJetGoodEta[0])<1.3 && Zb3010_p5Clean_IsClean");
1392 <      PhiZcut=TCut("abs(Zb3010_p5Clean_pfJetDphiZ[0])>2.7 && Zb3010_p5Clean_IsClean");
1389 >  if(identifier=="ZbCHS3010_p5Clean") {
1390 >      LeadingB=TCut ("ZbCHS3010_p5Clean_bTagProbCSVBP[0]>0.898 && ZbCHS3010_p5Clean_IsClean");
1391 >      EtaB=TCut("abs(ZbCHS3010_p5Clean_pfJetGoodEta[0])<1.3 && ZbCHS3010_p5Clean_IsClean");
1392 >      PhiZcut=TCut("abs(ZbCHS3010_p5Clean_pfJetDphiZ[0])>2.7 && ZbCHS3010_p5Clean_IsClean");
1393        recognized_scenario=true;
1394    }
1395    
1396 <  if(identifier=="Zb3010CHS") {
1397 <      LeadingB=TCut ("Zb3010CHS_bTagProbCSVBP[0]>0.898");
1398 <      EtaB=TCut("abs(Zb3010CHS_pfJetGoodEta[0])<1.3");
1399 <      PhiZcut=TCut("abs(Zb3010CHS_pfJetDphiZ[0])>2.7");
1396 >  if(identifier=="ZbCHS3010") {
1397 >      LeadingB=TCut ("ZbCHS3010_bTagProbCSVBP[0]>0.898");
1398 >      EtaB=TCut("abs(ZbCHS3010_pfJetGoodEta[0])<1.3");
1399 >      PhiZcut=TCut("abs(ZbCHS3010_pfJetDphiZ[0])>2.7");
1400 >      recognized_scenario=true;
1401 >  }
1402 >  if(identifier=="ZbCHS3010") {
1403 >      LeadingB=TCut ("ZbCHS3010_bTagProbCSVBP[0]>0.898");
1404 >      EtaB=TCut("abs(ZbCHS3010_pfJetGoodEta[0])<1.3");
1405 >      PhiZcut=TCut("abs(ZbCHS3010_pfJetDphiZ[0])>2.7");
1406 >      recognized_scenario=true;
1407 >  }
1408 >  if(identifier=="ZbCHS30") {
1409 >      LeadingB=TCut ("ZbCHS30_bTagProbCSVBP[0]>0.898");
1410 >      EtaB=TCut("abs(ZbCHS30_pfJetGoodEta[0])<1.3");
1411 >      PhiZcut=TCut("abs(ZbCHS30_pfJetDphiZ[0])>2.7");
1412        recognized_scenario=true;
1413    }
1414    
1415    assert(recognized_scenario);
1416    
1417 <  cout << "Cuts: " << endl;
1418 <  cout << "   " << (const char*) LeadingB << endl;
1419 <  cout << "   " << (const char*) EtaB << endl;
1420 <  cout << "   " << (const char*) PhiZcut << endl;
1421 <  
1422 <  cout << endl << endl;
1423 <  
1424 < //    ScenarioComparison();
1425 < //    ScenarioComparisonInclusive();
1426 <  
1427 <  
1428 < //     DoPUStudy(identifier);
1429 <  
1430 < //   SpecialCutFlow(identifier);
1431 < //    draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",17000,30,200,"Z p_{T}","Official/"+identifier+"/Zpt__"+identifier,1);
1432 < //   draw_kin_variable(identifier+"_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",40,0,200,"Leading Jet Pt (B)","Official/"+identifier+"/LeadingJetPt__"+identifier,1);
1433 < //   draw_kin_variable(identifier+"_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",40,0,200,"Sub-Leading Jet Pt [GeV]","Official/"+identifier+"/Jet2Pt__"+identifier,1);
1103 < //   draw_kin_variable(identifier+"_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/"+identifier+"/SubLeadingJetPt_Over_ZPt__"+identifier,1);
1417 >  dout << "Cuts: " << endl;
1418 >  dout << "   " << (const char*) LeadingB << endl;
1419 >  dout << "   " << (const char*) EtaB << endl;
1420 >  dout << "   " << (const char*) PhiZcut << endl;
1421 >  
1422 >  dout << endl << endl;
1423 >
1424 > //  ScenarioComparison();
1425 > //  ScenarioComparisonInclusive();
1426 >
1427 > //    DoPUStudy(identifier);
1428 > //    SpecialCutFlow(identifier);
1429 >  
1430 > //    draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",17000,30,200,"Z p_{T}","Official/"+identifier+"/Zpt__"+identifier,1);
1431 > //    draw_kin_variable(identifier+"_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",40,0,200,"Leading Jet Pt (B)","Official/"+identifier+"/LeadingJetPt__"+identifier,1);
1432 > //    draw_kin_variable(identifier+"_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",40,0,200,"Sub-Leading Jet Pt [GeV]","Official/"+identifier+"/Jet2Pt__"+identifier,1);
1433 > //    draw_kin_variable(identifier+"_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/"+identifier+"/SubLeadingJetPt_Over_ZPt__"+identifier,1);
1434    draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<50"),20,0,2,"#alpha","Official/"+identifier+"/alpha_pt_30_to_50__"+identifier,1);
1435    draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>50&&pt<75"),20,0,2,"#alpha","Official/"+identifier+"/alpha_50_to_75__"+identifier,1);
1436    draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>75&&pt<125"),20,0,2,"#alpha","Official/"+identifier+"/alpha_pt_75_to_125__"+identifier,1);
1437    draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>125&&pt<1000"),20,0,2,"#alpha","Official/"+identifier+"/alpha_pt_125_to_1000__"+identifier,1);
1438    draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut,20,0,2,"#alpha","Official/"+identifier+"/alpha_full__"+identifier,1);
1439 < //   draw_kin_variable(identifier+"_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>10&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","Official/"+identifier+"/DeltaPhiZBlead__"+identifier,0);
1439 >   draw_kin_variable(identifier+"_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>30&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","Official/"+identifier+"/DeltaPhiZBlead__"+identifier,0);
1440    
1441 < //   draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.3").c_str()),20,0,2,"Z+b MPF","Official/"+identifier+"/mpf_alpha_smaller_0p3___"+identifier,0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
1442 < //   draw_kin_variable(identifier+"_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.3").c_str()),20,0,2,"p_{T} b-jet / p_{T} Z","Official/"+identifier+"/ptb_over_ptz___alpha_smaller_0p3______"+identifier,0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
1443 <
1114 <  
1115 < //   */
1441 >   draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.3").c_str()),20,0,2,"Z+b MPF","Official/"+identifier+"/mpf_alpha_smaller_0p3___"+identifier,0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV");
1442 >   draw_kin_variable(identifier+"_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.3").c_str()),20,0,2,"p_{T} b-jet / p_{T} Z","Official/"+identifier+"/ptb_over_ptz___alpha_smaller_0p3______"+identifier,0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV");
1443 >   draw_kin_variable(identifier+"_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<50&&"+identifier+"_alpha<0.3").c_str()),20,0,2,"p_{T} b-jet / p_{T} Z","Official/"+identifier+"/ptb_over_ptz___alpha_smaller_0p3___pt3050___"+identifier,0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV}{30<p_{T}^{Z}<50 GeV}");
1444    
1445   }
1446  
1447   void GetNumberEventsInsideOutsideAlphaWindow(TCut specialcut, string title) {
1448    
1449 < //  TCut cut =  ZplusBsel&&LeadingB&&PhiZcut&&specialcut&&TCut("Zb3010_alpha<0.3");
1449 > //  TCut cut =  ZplusBsel&&LeadingB&&PhiZcut&&specialcut&&TCut("ZbCHS3010_alpha<0.3");
1450    TCut cut = specialcut;
1451    TCut in  =  EtaB;
1452 <  TCut out =  TCut("abs(Zb3010_pfJetGoodEta[0])>1.3");
1452 >  TCut out =  TCut("abs(ZbCHS3010_pfJetGoodEta[0])>1.3");
1453  
1454    TH1F *data_IN  = allsamples.Draw("data_IN",    "mll",1,0,150, "nothing [GeV]", "events", cut&&in, data,luminosity);
1455    TH1F *data_OUT = allsamples.Draw("data_OUT",   "mll",1,0,150, "nothing [GeV]", "events", cut&&out,data,luminosity);
# Line 1146 | Line 1474 | void TEST_GetNumberEventsInsideOutsideAl
1474   //   GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==1"), "mm");
1475   //   GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2"), "ee/mm");
1476    
1477 <  cout << "BASE SELECTION" << endl;
1477 >  dout << "BASE SELECTION" << endl;
1478    GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==0"), "ee");
1479    GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==1"), "mm");
1480    GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2"), "ee/mm");
1481  
1482 <  cout << "BASE SELECTION: Z+b" << endl;
1482 >  dout << "BASE SELECTION: Z+b" << endl;
1483    GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2&&id1==0"), "ee");
1484    GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2&&id1==1"), "mm");
1485    GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2"), "ee/mm");
1486    
1487 <  cout << "Leading B" << endl;
1487 >  dout << "Leading B" << endl;
1488    GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0"), "ee");
1489    GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1"), "mm");
1490    GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2"), "ee/mm");
1491    
1492 <  cout << "PhiZcut" << endl;
1492 >  dout << "PhiZcut" << endl;
1493    GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0"), "ee");
1494    GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1"), "mm");
1495    GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2"), "ee/mm");
1496    
1497 <  cout << "alpha cut" << endl;
1498 <  GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0")&&TCut("Zb3010_alpha<0.3"), "ee");
1499 <  GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1")&&TCut("Zb3010_alpha<0.3"), "mm");
1500 <  GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2")&&TCut("Zb3010_alpha<0.3"), "ee/mm");
1497 >  dout << "alpha cut" << endl;
1498 >  GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0")&&TCut("ZbCHS3010_alpha<0.3"), "ee");
1499 >  GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1")&&TCut("ZbCHS3010_alpha<0.3"), "mm");
1500 >  GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2")&&TCut("ZbCHS3010_alpha<0.3"), "ee/mm");
1501    
1502    delete ca;
1503    
# Line 1177 | Line 1505 | void TEST_GetNumberEventsInsideOutsideAl
1505   }
1506    
1507  
1508 <
1509 <    
1510 < void do_basic_ZB_analysis(bool DoCompleteAnalysis) {
1508 > void MetSpectrumDepletionIllustration(int isdata) {
1509 >  
1510 >  TCanvas *can = new TCanvas("can","can");
1511 >  TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
1512 >  
1513 >  cutWeight=STDWEIGHT*TCut("ZbCHS3010_BTagWgtTUp*(1.0)*(ZbCHS3010_bTagProbCSVBP[0]>0.898)");
1514 >  TH1F *standard  = allsamples.Draw("standard","met[1]",80,0,400, "MET [GeV]", "events", basecut,isdata,luminosity);
1515 >  
1516 >  cutWeight=STDWEIGHT*TCut("ZbCHS3010_BTagWgtTUp*(1.0*softMuon)*(ZbCHS3010_bTagProbCSVBP[0]>0.898)");
1517 >  TH1F *Neutrinos  = allsamples.Draw("Neutrinos","met[1]",80,0,400, "MET [GeV]", "events", basecut,isdata,luminosity);
1518 >  
1519 >  cutWeight=STDWEIGHT*TCut("ZbCHS3010_BTagWgtTUp*(1.0*(1.0-softMuon))*(ZbCHS3010_bTagProbCSVBP[0]>0.898)");
1520 >  TH1F *NoNeutrinos  = allsamples.Draw("NoNeutrinos","met[1]",80,0,400, "MET [GeV]", "events", basecut,isdata,luminosity);
1521    
1522 <  //https://twiki.cern.ch/twiki/bin/viewauth/CMS/BtagPOG#2011_Data_and_MC
1523 <  //https://twiki.cern.ch/twiki/pub/CMS/BtagPOG/SFb-ttbar_payload.txt
1522 >  standard->Scale(1.0/standard->Integral());
1523 >  Neutrinos->Scale(1.0/Neutrinos->Integral());
1524 >  NoNeutrinos->Scale(1.0/NoNeutrinos->Integral());
1525    
1526 <  cout << "The lepton requirement is " << (const char*) leptoncut << endl;
1527 <  bool doquick=true;
1526 >  Neutrinos->SetLineColor(kGreen);
1527 >  NoNeutrinos->SetLineColor(kRed);
1528    
1529 <  TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas");
1529 >  can->SetLogy(1);
1530 >  TLegend *leg = make_legend();
1531 >  leg->AddEntry(standard,"Standard sample","ep");
1532 >  leg->AddEntry(Neutrinos,"#nu enriched sample","l");
1533 >  leg->AddEntry(NoNeutrinos,"#nu depleted sample","l");
1534 >  leg->SetX1(0.9*leg->GetX1());
1535 >  standard->Draw("e1");
1536 >  Neutrinos->Draw("histo,same");
1537 >  NoNeutrinos->Draw("histo,same");
1538 >  if(isdata==data) leg->SetHeader("Data:");
1539 >  else leg->SetHeader("MC:");
1540 >  leg->Draw();
1541 >  DrawPrelim();
1542    
1543 < //     compare_selection("Zb3010_p5Clean");
1544 < //     compare_selection("Zb3010CHS");
1545 < //     compare_selection("Zb3010");
1546 < //     compare_selection("Zb301030");
1547 < //     compare_selection("Zb1530");
1548 < //     compare_selection("Zb301010");
1549 < //     compare_selection("Zb3010_SecEta3");
1550 < //     compare_selection("Zb3010_SecEta5");
1551 < //     compare_selection("Zb1510");
1552 < //     compare_selection("Zb301010");
1553 < //     compare_selection("ZbMikko");
1554 < //     compare_selection("Zb3010");
1555 < //     compare_selection("Zb40");
1543 >  if(isdata==data) CompleteSave(can,"NeutrinoMetSpectrum__Data");
1544 >  else CompleteSave(can,"NeutrinoMetSpectrum__MC");
1545 >  delete standard;
1546 >  delete Neutrinos;
1547 >  delete NoNeutrinos;
1548 >  delete can;
1549 >  CleanLegends();
1550 > }
1551 >    
1552 > void do_basic_ZB_analysis(bool DoCompleteAnalysis) {
1553 >  STDWEIGHT=TCut(cutWeight);
1554 >  cutWeight=TCut(STDWEIGHT*TCut("ZbCHS3010_BTagWgtT"));
1555 >  dout << "The lepton requirement is " << (const char*) leptoncut << endl;
1556 >  bool doquick=false;
1557 >  
1558 >   TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas");
1559 >  
1560 >  
1561 > //   MetSpectrumDepletionIllustration(data);
1562 > //   MetSpectrumDepletionIllustration(mc);
1563 >  
1564 > //   compare_selection("ZbCHS3010_p5Clean");
1565 > //   compare_selection("ZbCHS3010");
1566 > //   compare_selection("Zb30");
1567 > //   compare_selection("Zb3010");
1568 > //   compare_selection("Zb1510");
1569 > //   compare_selection("ZbCHS30");
1570 > //   compare_selection("ZbCHS3010");
1571 > //   compare_selection("ZbCHS3010");
1572 > //   compare_selection("ZbCHS301010");
1573 > //   compare_selection("ZbCHS3010_SecEta3");
1574 > //   compare_selection("ZbCHS3010_SecEta5");
1575 > //   compare_selection("Zb1510");
1576 > //   compare_selection("ZbCHS301010");
1577 > //   compare_selection("ZbMikko");
1578 > //   compare_selection("ZbCHS3010");
1579 > //   compare_selection("Zb40");
1580  
1581    if(!doquick) {
1582 <    print_all_b_yields();
1583 <    draw_mpf_vars();
1584 <    //  DrawEvilCutFlow();
1582 > //    draw_kin_variable("mll","",28,60.0,200.0,"m_{ll}","mll",1,"");//nice and quick test to see if the normalization is ok (i.e. all data is processed etc.)
1583 > //    print_all_b_yields();
1584 > //     draw_mpf_vars();
1585 > //    DrawEvilCutFlow();
1586          
1587 <    draw_Zb_kin_vars();
1587 > //     draw_Zb_kin_vars();
1588          
1589     }
1590    
1591   //  GetNumberEventsInsideOutsideAlphaWindow();
1592    
1217  dout <<"THIS IS WHERE IT GETS REALLY INTERESTING!!!!" << endl;
1593    if(DoCompleteAnalysis) {
1594      /* need to run the following scenarios:
1595       * - normal
# Line 1224 | Line 1599 | void do_basic_ZB_analysis(bool DoComplet
1599       * - alpha down
1600       */
1601      
1602 <    ZbResultContainer inclusive = new_data_mc_agreement_2d("Zb3010_alpha","inclusive",TCut("Zb3010_bTagProbCSVBP[0]>-10000"),TCut("1.0"));
1228 <    ZbResultContainer Reference = new_data_mc_agreement_2d("Zb3010_alpha","reference",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"));
1229 <    ZbResultContainer effmistagUp = new_data_mc_agreement_2d("Zb3010_alpha","effmistagUp",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp"));
1230 <    ZbResultContainer effmistagDown = new_data_mc_agreement_2d("Zb3010_alpha","effmistagDown",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTDown"));
1231 <    ZbResultContainer medium = new_data_mc_agreement_2d("Zb3010_alpha","medium",TCut("Zb3010_bTagProbCSVBP[0]>0.679"),TCut("ZbCHS3010_BTagWgtM"));
1232 <    ZbResultContainer loose = new_data_mc_agreement_2d("Zb3010_alpha","loose",TCut("Zb3010_bTagProbCSVBP[0]>0.244"),TCut("ZbCHS3010_BTagWgtL"));
1233 <    ZbResultContainer AlphaUp = new_data_mc_agreement_2d("Zb3010_alphaUp","AlphaUp",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"));
1234 <    ZbResultContainer AlphaDown = new_data_mc_agreement_2d("Zb3010_alphaDown","AlphaDown",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"));
1602 >    bool fast=true;bool slow=false;//don't change these
1603      
1604 +    ZbResultContainer inclusive = new_data_mc_agreement_2d(slow,"ZbCHS3010_alpha","inclusive",TCut("mll>0"),TCut("1.0"),0.3);
1605 +    ZbResultContainer Reference = new_data_mc_agreement_2d(slow,"ZbCHS3010_alpha","reference",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3);
1606 +    
1607 +    
1608 +    ZbResultContainer NeutrinoQ = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","NeutrinoQ",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp*(1.0*softMuon)"),0.3);
1609 +    ZbResultContainer ANeutrinoQ = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","ANeutrinoQ",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp*(1.0*(1.0-softMuon))"),0.3);
1610 +    
1611 +    ZbResultContainer effmistagUp = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","effmistagUp",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp"),0.3);
1612 +    ZbResultContainer effmistagDown = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","effmistagDown",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTDown"),0.3);
1613 +    ZbResultContainer medium = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","medium",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.679"),TCut("ZbCHS3010_BTagWgtM"),0.3);
1614 +    ZbResultContainer loose = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","loose",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.244"),TCut("ZbCHS3010_BTagWgtL"),0.3);
1615 +    ZbResultContainer AlphaUp = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaUp","AlphaUp",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3);
1616 +    ZbResultContainer AlphaDown = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaDown","AlphaDown",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3);
1617 +    
1618 +    ZbResultContainer L5inclusive = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaL5","L5inclusive",TCut("mll>0"),TCut("1.0"),0.3);
1619 +    ZbResultContainer L5Reference = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaL5","L5reference",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3);
1620 +    
1621 +    ZbResultContainer AlphaThresholdVariationDown10 =    new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown10",   TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),   TCut("ZbCHS3010_BTagWgtT"),0.3-0.1*0.3);
1622 +    ZbResultContainer AlphaThresholdVariationUp10 =      new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp10",     TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),   TCut("ZbCHS3010_BTagWgtT"),0.3+0.1*0.3);
1623 +    ZbResultContainer AlphaThresholdVariationDown30 =    new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown30",   TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),   TCut("ZbCHS3010_BTagWgtT"),0.3-0.3*0.3);
1624 +    ZbResultContainer AlphaThresholdVariationUp30 =      new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp30",     TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),   TCut("ZbCHS3010_BTagWgtT"),0.3+0.3*0.3);
1625 +    ZbResultContainer AlphaThresholdVariationDown10inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown10inc",TCut("mll>0"),                              TCut("1.0"),0.3-0.1*0.3);
1626 +    ZbResultContainer AlphaThresholdVariationUp10inc =   new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp10inc",  TCut("mll>0"),                              TCut("1.0"),0.3+0.1*0.3);
1627 +    ZbResultContainer AlphaThresholdVariationDown30inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown30inc",TCut("mll>0"),                              TCut("1.0"),0.3-0.3*0.3);
1628 +    ZbResultContainer AlphaThresholdVariationUp30inc =   new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp30inc",  TCut("mll>0"),                              TCut("1.0"),0.3+0.3*0.3);
1629 +
1630      //and now let's compute some systematics!
1631      //1 alpha variation
1632      float SysMPF_Alpha_down = Reference.MPF_Result_FaceValue.getValue()-AlphaDown.MPF_Result_FaceValue.getValue();
# Line 1242 | Line 1636 | void do_basic_ZB_analysis(bool DoComplet
1636      float SysMPF_EFF_down = Reference.MPF_Result_FaceValue.getValue()-effmistagDown.MPF_Result_FaceValue.getValue();
1637      float SysMPF_EFF_up = Reference.MPF_Result_FaceValue.getValue()-effmistagUp.MPF_Result_FaceValue.getValue();
1638      
1639 <    //3 purity
1639 >    //3 Presence of soft muons (->neutrino question)
1640 >    float SysMPF_Neutrino_up = Reference.MPF_Result_FaceValue.getValue()-NeutrinoQ.MPF_Result_FaceValue.getValue();
1641 >    float SysMPF_Neutrino_down = Reference.MPF_Result_FaceValue.getValue()-ANeutrinoQ.MPF_Result_FaceValue.getValue();
1642 >    
1643 >    //4 purity
1644      zbcanvas->cd();
1645 +    gStyle->SetOptFit(0);
1646      write_info(__FUNCTION__,"Don't know the exact purity at the moment, still needs to be determined!");
1647 +    TH1F *purityhisto = new TH1F("purityhisto","purityhisto",1,0,1);
1648 +    purityhisto->GetXaxis()->SetTitle("Purity");
1649 +    purityhisto->GetYaxis()->SetTitle("C_{abs}");
1650 +    purityhisto->GetXaxis()->CenterTitle();
1651 +    purityhisto->GetYaxis()->CenterTitle();
1652 +    
1653      TGraphErrors *gSysMPF_Purity = new TGraphErrors();
1654 <    gSysMPF_Purity->SetPoint(0,0.05,inclusive.MPF_Result_FaceValue.getValue());
1654 >    
1655 >    gSysMPF_Purity->SetPoint(0,PurityInclusive,inclusive.MPF_Result_FaceValue.getValue());
1656      gSysMPF_Purity->SetPointError(0,0.0,inclusive.MPF_Result_FaceValue.getError());
1657 <    gSysMPF_Purity->SetPointError(1,0.20,loose.MPF_Result_FaceValue.getError());//x value?
1657 >    
1658 >    gSysMPF_Purity->SetPoint(1,PurityLoose,loose.MPF_Result_FaceValue.getValue());//x value?
1659      gSysMPF_Purity->SetPointError(1,0.0,loose.MPF_Result_FaceValue.getError());
1660 <    gSysMPF_Purity->SetPointError(2,0.54,medium.MPF_Result_FaceValue.getError());//x value?
1660 >    gSysMPF_Purity->SetPoint(2,PurityMedium,medium.MPF_Result_FaceValue.getValue());//x value?
1661      gSysMPF_Purity->SetPointError(2,0.0,medium.MPF_Result_FaceValue.getError());
1662 <    gSysMPF_Purity->SetPointError(3,0.82,Reference.MPF_Result_FaceValue.getError());//x value?
1662 >    gSysMPF_Purity->SetPoint(3,PurityTight,Reference.MPF_Result_FaceValue.getValue());//x value?
1663      gSysMPF_Purity->SetPointError(3,0.0,Reference.MPF_Result_FaceValue.getError());
1664      
1665 <    gSysMPF_Purity->GetXaxis()->SetTitle("Purity");
1666 <    gSysMPF_Purity->GetXaxis()->CenterTitle();
1667 <    gSysMPF_Purity->GetYaxis()->SetTitle("C_{abs}");
1668 <    gSysMPF_Purity->GetYaxis()->CenterTitle();
1665 >    
1666 >    float min,max;
1667 >    FindMinMax(gSysMPF_Purity,min,max);
1668 >    purityhisto->SetStats(0);
1669 >    purityhisto->GetYaxis()->SetRangeUser(min,max);
1670      
1671      gSysMPF_Purity->Fit("pol1");
1672 <    gSysMPF_Purity->Draw();
1672 >    TPolyLine *purity_fit_uncert = GetFitUncertaintyShape(gSysMPF_Purity, "pol1", min, max,0.0,1.0);
1673 >    TF1* pufit = (TF1*)gSysMPF_Purity->GetFunction("pol1");
1674 >    
1675 >    TF1* pufit_c = new TF1("pufit_c","[0]+[1]*x");
1676 >    pufit_c->SetParameters(pufit->GetParameters());
1677 >    pufit_c->SetLineColor(TColor::GetColor("#0101DF"));
1678 >    purity_fit_uncert->SetFillColor(TColor::GetColor("#5353FC"));
1679 >    pufit->SetLineColor(TColor::GetColor("#5353FC"));
1680 >    
1681 >    purityhisto->Draw();
1682 >    purity_fit_uncert->Draw("f");
1683 >    gSysMPF_Purity->Draw("P*");
1684 >    pufit_c->Draw("same");
1685 >    DrawPrelim();
1686 >    
1687 >    float ExtrapolatedResult=pufit->GetParameter(0)+1.0*pufit->GetParameter(1);
1688 >    float dExtrapolatedResult=sqrt(pufit->GetParError(0)*pufit->GetParError(0)+1.0*1.0*pufit->GetParError(1)*pufit->GetParError(1));
1689 >    
1690 >    stringstream summary;
1691 >    summary << "#splitline{Reference: " << std::setprecision(4) << Reference.MPF_Result_FaceValue.getValue() << "+/-" << std::setprecision(4) << Reference.MPF_Result_FaceValue.getError() << "}{";
1692 >    summary << "Extrapolation: " << std::setprecision(4) << ExtrapolatedResult << " +/- " << std::setprecision(4) << dExtrapolatedResult << "}";
1693 >    
1694 >    dout << "Have found an extrapolated result at 1.0 of " << ExtrapolatedResult << " ;  will use the difference between this result and the face value as ";
1695 >    dout << "purity-related systematic uncertainty" << endl;
1696 >    
1697 >    TText *infobox = write_title(summary.str());
1698 >    infobox->SetX(0.75);
1699 >    infobox->SetTextSize(0.03);
1700 >    infobox->SetY(0.75);
1701 >    infobox->Draw();
1702 >    
1703      CompleteSave(zbcanvas,"Systematics/Purity");
1704      
1267    TF1 *PurityFit = (TF1*)gSysMPF_Purity->GetFunction("pol1");
1268    float ExtrapolatedResult=PurityFit->GetParameter(0)+1.0*PurityFit->GetParameter(1);
1705      
1706 +
1707      float SysMPF_Purity = abs(ExtrapolatedResult-Reference.MPF_Result_FaceValue.getValue());
1708      
1709 <    float sys_alpha  = abs(SysMPF_Alpha_down)>abs(SysMPF_Alpha_up)?abs(SysMPF_Alpha_down):abs(SysMPF_Alpha_up);
1710 <    float sys_eff    = abs(SysMPF_EFF_down)>abs(SysMPF_EFF_up)?abs(SysMPF_EFF_down):abs(SysMPF_EFF_up);
1711 <    float sys_purity = abs(SysMPF_Purity);
1712 <    float sys        = sqrt(sys_alpha*sys_alpha+sys_eff*sys_eff+sys_purity*sys_purity);
1709 >    float sys_alpha    = abs(SysMPF_Alpha_down)>abs(SysMPF_Alpha_up)?abs(SysMPF_Alpha_down):abs(SysMPF_Alpha_up);
1710 >    float sys_eff      = abs(SysMPF_EFF_down)>abs(SysMPF_EFF_up)?abs(SysMPF_EFF_down):abs(SysMPF_EFF_up);
1711 >    float sys_purity   = abs(SysMPF_Purity);
1712 >    float sys_neutrino = abs(SysMPF_Neutrino_down)>abs(SysMPF_Neutrino_up)?abs(SysMPF_Neutrino_down):abs(SysMPF_Neutrino_up);
1713 >    float sys          = sqrt(sys_alpha*sys_alpha+sys_eff*sys_eff+sys_purity*sys_purity+sys_neutrino*sys_neutrino);
1714      
1715      dout << "MPF METHOD:" << endl;
1716 <    dout << "   Systematics : " << endl;
1717 <    dout << "      Alpha variation      : " << SysMPF_Alpha_down << "   ,  " << SysMPF_Alpha_up << "   ( " << sys_alpha << ") " << endl;
1716 >    dout << "   Systematics :    down    up     (selected)" << endl;
1717 >    dout << "      Oversmearing         : " << SysMPF_Alpha_down << "   ,  " << SysMPF_Alpha_up << "   ( " << sys_alpha << ") " << endl;
1718      dout << "      eff/mistag variation : " << SysMPF_EFF_down << "   ,  " << SysMPF_EFF_up << "   ( " << sys_eff << ") " << endl;
1719      dout << "      purity               : " << SysMPF_Purity << "   ( " << sys_purity << " )" << endl;
1720 <    dout << "      total                : " << sys << endl;
1720 >    dout << "      neutrino             : " << SysMPF_Neutrino_down << "   ,  " << SysMPF_Neutrino_up << "   ( " << sys_neutrino << ") " << endl;
1721 >    dout << "      total                : " << sys << "     (note that this is the sys on C_{abs}^{b}, not yet on C_{corr} - there will also be an additional source!)" << endl;
1722      dout << endl << endl;
1723 <    dout << "   FINAL RESULT : " << endl;
1724 <    dout << "     " << Reference.MPF_Result_FaceValue/inclusive.MPF_Result_FaceValue << " (stat) +/- " << sys << " (sys) " << endl;
1723 >    dout << "   FINAL RESULTS : " << endl;
1724 >    dout << "     C_{abs}^{b}   = " << Reference.MPF_Result_FaceValue << " (stat) +/- " << sys << " (sys) " << endl;
1725 >    dout << "     C_{abs}^{inc} = " << inclusive.MPF_Result_FaceValue << " (stat) " << endl;
1726 >    
1727 >    float sysfinal = Reference.MPF_Result_FaceValue.getValue()/inclusive.MPF_Result_FaceValue.getValue();
1728 >    sysfinal *= sqrt(sys*sys/(Reference.MPF_Result_FaceValue.getValue()*Reference.MPF_Result_FaceValue.getValue()));
1729 >    //yes, this could be simplified but it would look like a bug.
1730 >    
1731 >
1732 >    
1733 >    
1734 >    dout << "Note: Varying the alpha cut (->face value) we get the following results: " << endl;
1735 >    dout << "-30%: " << AlphaThresholdVariationDown30.MPF_Result_FaceValue/AlphaThresholdVariationDown30inc.MPF_Result_FaceValue << " (stat)" << endl;
1736 >    dout << "-10%: " << AlphaThresholdVariationDown10.MPF_Result_FaceValue/AlphaThresholdVariationDown10inc.MPF_Result_FaceValue << " (stat)" << endl;
1737 >    dout << "  0%: " << Reference.MPF_Result_FaceValue/inclusive.MPF_Result_FaceValue << " (stat) +/- " << endl;
1738 >    dout << "+10%: " << AlphaThresholdVariationUp10.MPF_Result_FaceValue/AlphaThresholdVariationUp10inc.MPF_Result_FaceValue << " (stat)" << endl;
1739 >    dout << "+30%: " << AlphaThresholdVariationUp30.MPF_Result_FaceValue/AlphaThresholdVariationUp30inc.MPF_Result_FaceValue << " (stat)" << endl;
1740 >    
1741 >    dout << "          XCheck for Rabs, varying the alpha cut (->face value) we get the following results: " << endl;
1742 >    dout << "             -30%: " << AlphaThresholdVariationDown30.Rabs_Result_FaceValue/AlphaThresholdVariationDown30inc.Rabs_Result_FaceValue << " (stat)" << endl;
1743 >    dout << "             -10%: " << AlphaThresholdVariationDown10.Rabs_Result_FaceValue/AlphaThresholdVariationDown10inc.Rabs_Result_FaceValue << " (stat)" << endl;
1744 >    dout << "               0%: " << Reference.Rabs_Result_FaceValue/inclusive.Rabs_Result_FaceValue << " (stat) +/- " << endl;
1745 >    dout << "             +10%: " << AlphaThresholdVariationUp10.Rabs_Result_FaceValue/AlphaThresholdVariationUp10inc.Rabs_Result_FaceValue << " (stat)" << endl;
1746 >    dout << "             +30%: " << AlphaThresholdVariationUp30.Rabs_Result_FaceValue/AlphaThresholdVariationUp30inc.Rabs_Result_FaceValue << " (stat)" << endl;
1747 >
1748 >    
1749 >    float sys_alphavar_up   = abs(AlphaThresholdVariationUp30.MPF_Result_FaceValue.getValue()/AlphaThresholdVariationUp30inc.MPF_Result_FaceValue.getValue() - Reference.MPF_Result_FaceValue.getValue()/inclusive.MPF_Result_FaceValue.getValue());
1750 >    float sys_alphavar_down = abs(AlphaThresholdVariationDown30.MPF_Result_FaceValue.getValue()/AlphaThresholdVariationDown30inc.MPF_Result_FaceValue.getValue() - Reference.MPF_Result_FaceValue.getValue()/inclusive.MPF_Result_FaceValue.getValue());
1751 >    float sys_alphavar = sys_alphavar_up>sys_alphavar_down?sys_alphavar_up:sys_alphavar_down;
1752 >    
1753 >    dout << " -> Additional systematic (from 30%) : " << sys_alphavar << endl;
1754 >    sysfinal=sqrt(sysfinal*sysfinal+sys_alphavar*sys_alphavar);
1755 >    dout << "Final systematic is : " << sysfinal << endl;
1756 >    
1757 >    dout << "   ******************************************** <  FINAL RESULT > ******************************************** " << endl;
1758 >    dout << "     C_{corr}      = " << Reference.MPF_Result_FaceValue/inclusive.MPF_Result_FaceValue << " (stat) +/- " << sysfinal << " (sys) " << endl;
1759 >    dout << "   ******************************************** < /FINAL RESULT > ******************************************** " << endl;
1760      
1761 <    LeadingB=TCut("Zb3010_bTagProbCSVBP[0]>0.898");
1761 >    dout << "Note that if L5 corrections are applied, we get " << L5Reference.MPF_Result_FaceValue/L5inclusive.MPF_Result_FaceValue << " (stat) " << endl;
1762 >    
1763 >    LeadingB=TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898");
1764      
1765    } else {
1766 <    ZbResultContainer Reference = new_data_mc_agreement_2d("Zb3010_alpha","reference",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgt"));
1766 >    ZbResultContainer Reference = new_data_mc_agreement_2d(false,"ZbCHS3010_alpha","reference",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3);
1767    }
1768    
1769    
# Line 1315 | Line 1791 | void SpecialCutFlow(string identifier) {
1791    MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB) << ")";
1792    MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB) << ")";
1793    MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut) << ")";
1794 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000").c_str())) << ")";
1795 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.3").c_str())) << ")";
1796 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.2").c_str())) << ")";
1797 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.15").c_str())) << ")";
1798 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.1").c_str())) << ")";
1799 <  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.05").c_str())) << ")";
1794 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000").c_str())) << ")";
1795 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.3").c_str())) << ")";
1796 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.2").c_str())) << ")";
1797 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.15").c_str())) << ")";
1798 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.1").c_str())) << ")";
1799 >  MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.05").c_str())) << ")";
1800    MegaCut << " ";
1801    
1802    TCanvas *can = new TCanvas("can","can");
# Line 1333 | Line 1809 | void SpecialCutFlow(string identifier) {
1809    
1810    
1811    TH1F *data  = allsamples.Draw("data",    MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity);
1812 <   THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
1812 >  THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
1813  
1814    float runningsum=0;
1815    for(int i=data->GetNbinsX();i>0;i--) {
# Line 1371 | Line 1847 | void SpecialCutFlow(string identifier) {
1847    data->GetXaxis()->SetBinLabel(3,"Leading jet is b-jet");
1848    data->GetXaxis()->SetBinLabel(4,"|#eta_{b}|<1.3 ");
1849    data->GetXaxis()->SetBinLabel(5,"|#delta#phi(b,Z)|>2.7");
1850 <  data->GetXaxis()->SetBinLabel(6,"10<p_{T}^{Z}<1000 GeV");
1850 >  data->GetXaxis()->SetBinLabel(6,"30<p_{T}^{Z}<1000 GeV");
1851    data->GetXaxis()->SetBinLabel(7,"#alpha < 0.3");
1852    data->GetXaxis()->SetBinLabel(8,"#alpha < 0.2");
1853    data->GetXaxis()->SetBinLabel(9,"#alpha < 0.15");
# Line 1389 | Line 1865 | void SpecialCutFlow(string identifier) {
1865    leg->AddEntry(crap,neventsinfo.str().c_str(),"l");
1866    
1867    data->Draw("e1");
1868 <  mcm.Draw("same");
1868 >  mcm.Draw("histo,same");
1869    data->Draw("same,e1,axis");
1870    data->Draw("same,e1");
1871   //  data->Draw("same,TEXT");
# Line 1402 | Line 1878 | void SpecialCutFlow(string identifier) {
1878    
1879    delete crap;
1880    delete data;
1881 <  
1881 >  CleanLegends();
1882 >  DeleteStack(mcm);
1883 >
1884    
1885   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines