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.19 by buchmann, Mon Jan 7 14:42:35 2013 UTC vs.
Revision 1.21 by buchmann, Thu Jan 17 21:58:22 2013 UTC

# Line 21 | Line 21 | using namespace std;
21   using namespace PlottingSetup;
22  
23   namespace ZbData {
24 vector<float> data_over_mc;
25
24   TCut ZplusBsel("pt1>20&&pt2>20&&mll>60&&mll<120&&id1==id2");
25   TCut LeadingB("ZbCHS3010_bTagProbCSVBP[0]>0.898");
26   TCut EtaB("abs(ZbCHS3010_pfJetGoodEta[0])<1.3");
# Line 104 | Line 102 | void SpecialCutFlow(string identifier);
102   //*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*            AND THIS LINE             /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*//
103  
104  
105 < void print_yield(TCut cut) {
105 > class CutYields{
106 > public:
107 >  float data;
108 >  float Zb;
109 >  float Zc;
110 >  float Zl;
111 >  float tt;
112 >  float SiTo;
113 >  float Dibosons;
114 >  float WJets;
115 >  float Other;
116 >  
117 >  CutYields();
118 > };
119 >
120 > CutYields::CutYields() {
121 >  this->data=0;
122 >  this->Zb=0;
123 >  this->Zc=0;
124 >  this->Zl=0;
125 >  this->tt=0;
126 >  this->SiTo=0;
127 >  this->Dibosons=0;
128 >  this->WJets=0;
129 >  this->Other=0;
130 > }
131 >
132 > std::ostream &operator<<(std::ostream &ostr, CutYields y)
133 > {
134 >  return ostr << y.data << ";" << y.Zb << ";" << y.Zc << ";" << y.Zl << ";" << y.tt << ";" << y.SiTo << ";" << y.Dibosons << ";" << y.WJets << ";" << endl;
135 > }
136 >
137 >
138 > CutYields print_yield(TCut cut) {
139 >  
140 >  CutYields Yield;
141    TH1F *data  = allsamples.Draw("data",    "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,data,luminosity);
142    dout << "  Yields for " << (const char*) cut << endl;
143 <  dout << "     data: " << data->Integral() << endl;
143 > //  dout << "     data: " << data->Integral() << endl;
144 >  
145 >  Yield.data=data->Integral();
146    THStack mcm = allsamples.DrawStack("mc", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,mc,luminosity);
147    int nhists = mcm.GetHists()->GetEntries();
113  dout << "Going to loop over " << nhists << " histograms " << endl;
148    TFile *test = new TFile("test.root","RECREATE");
149    mcm.Write();
150    test->Close();
151    for (int i = 0; i < nhists; i++) {
152      TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i));
153 <    cout << "     " << hist->GetName() << ": " << hist->Integral() << endl;
153 >    string name=hist->GetName();
154 >    if(Contains(name,"t_bar_t")) Yield.tt+=hist->Integral();
155 >    if(Contains(name,"W_Jets")) Yield.WJets+=hist->Integral();
156 >    if(Contains(name,"Single_top")) Yield.SiTo+=hist->Integral();
157 >    if(Contains(name,"Dibosons")) Yield.Dibosons+=hist->Integral();
158 >    if(Contains(name,"Z_l_")) Yield.Zl+=hist->Integral();
159 >    if(Contains(name,"Z_c_")) Yield.Zc+=hist->Integral();
160 >    if(Contains(name,"Z_b_")) Yield.Zb+=hist->Integral();
161    }
162 <    
162 >  
163 >  cout << Yield << endl;
164    cout << endl << endl;
165    
166    delete data;
167 +  CleanLegends();
168 +  DeleteStack(mcm);
169 +
170 +  return Yield;
171   }
172  
173   void draw_kin_variable(string variable, TCut cut, int nbins, float min, float max, string xlabel, string saveas, bool dologscale, string speciallabel="") {
128  
174    TCanvas *ckin = new TCanvas("ckin","kin variable canvas");
175 < //  ckin->SetLogy(dologscale);
175 >  if(dologscale) ckin->SetLogy(1);
176    TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity);
177    datahisto->SetMarkerSize(DataMarkerSize);
178    THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity);
179    if(dologscale) datahisto->SetMaximum(3*datahisto->GetMaximum());
180    else datahisto->SetMaximum(1.5*datahisto->GetMaximum());
181 <
181 >  
182 >  float SumMC=0.0;
183 >  TIter nextH(mcstack.GetHists());
184 >  TH1F* h;
185 >  while ( h = (TH1F*)nextH() ) {
186 >    SumMC += h->Integral();
187 >  }
188 >  float scale = datahisto->Integral()/SumMC;
189 >
190 >  // Re-scale stack to data integral
191 >  nextH = TIter(mcstack.GetHists());
192 >  
193 >  while ( h = (TH1F*)nextH() ) {
194 >    h->Scale(scale);
195 >  }
196 >  
197    TText *speciall;
198    datahisto->Draw("e1");
199    ckin->Update();
200    mcstack.Draw("histo,same");
201    datahisto->Draw("same,e1");
202    TLegend *kinleg = allsamples.allbglegend();
203 +
204    kinleg->Draw();
205  
206    TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
207    kinpad->cd();
208 <  kinpad->SetLogy(dologscale);
208 >  if(dologscale) kinpad->SetLogy(1);
209    datahisto->Draw("e1");
210    mcstack.Draw("histo,same");
211    datahisto->Draw("same,e1");
# Line 152 | Line 213 | void draw_kin_variable(string variable,
213    kinleg->Draw();
214    DrawPrelim();
215    saveas="kin/"+saveas;
216 +  kinpad->cd();
217 +  
218    if(speciallabel!="") {
219 <    speciall = new TText(0.2,0.8,speciallabel.c_str());
219 >    speciall = write_title(speciallabel);
220 >    speciall->SetX(0.18);
221 >    speciall->SetTextAlign(11);
222 >    speciall->SetTextSize(0.03);
223 >    speciall->SetY(0.85);
224      speciall->Draw();
225    }
159  save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas);
226    
227 <  
162 <  ZbData::data_over_mc.push_back(datahisto->Integral()/CollapseStack(mcstack)->Integral());
227 >  save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas);
228    
229    datahisto->Delete();
230 +  delete kinleg;
231    delete ckin;
232 +  CleanLegends();
233 +  DeleteStack(mcstack);
234   }
235 <  
235 >
236   void print_all_b_yields() {
237 +  vector<CutYields> yields;
238    cout << "Basic selection with a b jet" << endl;
239 <  print_yield(ZplusBsel&&"ZbCHS3010_pfJetGoodNumBtag>0");
239 >  yields.push_back(print_yield(ZplusBsel&&"ZbCHS3010_pfJetGoodNumBtag>0"));
240    cout << "Leading jet is a b-jet " << endl;
241 <  print_yield(ZplusBsel&&LeadingB);
241 >  yields.push_back(print_yield(ZplusBsel&&LeadingB));
242    cout << "|#eta_{b}|<1.3 " << endl;
243 <  print_yield(ZplusBsel&&LeadingB&&EtaB);
243 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB));
244    cout << "|#delta#phi(b<Z)|>2.7" << endl;
245 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
245 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut));
246    cout << "30<ptZ<1000 GeV" << endl;
247 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000");
247 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"));
248    cout << "#alpha < 0.35" << endl;
249 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.35");
249 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.35"));
250    cout << "#alpha < 0.3" << endl;
251 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.3");
252 <  cout << "#alpha < 0.2" << endl;
253 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.2");
251 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.3"));
252 > /*  cout << "#alpha < 0.2" << endl;
253 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.2"));
254    cout << "#alpha < 0.15" << endl;
255 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.15");
255 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.15"));
256    cout << "#alpha < 0.1" << endl;
257 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.1");
257 >  yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.1"));*/
258 >
259 >  for(int iy=0;iy<yields.size();iy++) {
260 >    cout << yields[iy] << endl;
261 >  }
262   }  
263  
264   void DrawEvilCutFlow() {
# Line 213 | Line 286 | void DrawEvilCutFlow() {
286    
287    
288    TH1F *data  = allsamples.Draw("data",    MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity);
289 <   THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
289 >  THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
290  
291    float runningsum=0;
292    for(int i=data->GetNbinsX();i>0;i--) {
# Line 263 | Line 336 | void DrawEvilCutFlow() {
336    DrawPrelim();
337    
338    CompleteSave(can,"CutFlow");
339 +  CleanLegends();
340 +  DeleteStack(mcm);
341 +
342   }
343  
344   void draw_Zb_kin_vars() {
345 <   draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",25,0,200,"Z p_{T}","Official/Zpt",1);
346 <   draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt",1);
347 <   draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt",1);
348 <   draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/SubLeadingJetPt_Over_ZPt",1);
349 <   draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<50",   40,0,2,"#alpha","Official/alpha_pt_30_to_50",1);
350 <   draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>50&&pt<75",  40,0,2,"#alpha","Official/alpha_50_to_75",1);
351 <   draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>75&&pt<125", 40,0,2,"#alpha","Official/alpha_pt_75_to_125",1);
352 <   draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>125&&pt<1000",40,0,2,"#alpha","Official/alpha_pt_125_to_1000",1);
353 <    draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",40,0,2,"#alpha","Official/alpha_pt_30_to_1000",1);
354 <  
355 <  draw_kin_variable("ZbCHS3010_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>30&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",0);
356 <  
281 < /*
282 <  draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,0,200,"p_{T}^{l1}","Lep/pt1",1);
283 <  draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id1==0",20,0,200,"p_{T}^{e1}","Lep/pt1_e",1);
284 <  draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id1==1",20,0,200,"p_{T}^{#mu1}","Lep/pt1_m",1);
285 <  draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,0,200,"p_{T}^{l2}","Lep/pt2",1);
286 <  draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id2==0",20,0,200,"p_{T}^{e2}","Lep/pt2_e",1);
287 <  draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id2==1",20,0,200,"p_{T}^{#mu2}","Lep/pt2_m",1);
288 <  draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta1",1);
289 <  draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id1==0",20,-3.1,3.1,"#eta^{e1}","Lep/eta1_e",1);
290 <  draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id1==1",20,-3.1,3.1,"#eta^{m1}","Lep/eta1_m",1);
291 <  draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta2",1);
292 <  draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id2==0",20,-3.1,3.1,"#eta^{e2}","Lep/eta2_e",1);
293 <  draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id2==1",20,-3.1,3.1,"#eta^{#mu2}","Lep/eta2_m",1);
294 <  draw_kin_variable("numVtx",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",30,0,30,"N(Vtx)","Lep/nVtx",1);
295 <  */
345 >  
346 >   draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Z p_{T}","Official/Zpt",1);
347 >   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);
348 >   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);
349 >   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);
350 >   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);
351 >   draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>50&&pt<75"),  40,0,2,"#alpha","Official/alpha_50_to_75",1);
352 >   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);
353 >   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);
354 >   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);
355 >  
356 >   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);
357   }
358  
359   void draw_mpf_vars() {
360 <  ZbData::data_over_mc.clear();
361 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.3",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV");
362 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.2",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 30 GeV < p_{T}^{Z} < 1000 GeV");
363 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.15",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 30 GeV < p_{T}^{Z} < 1000 GeV");
364 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.1",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 30 GeV < p_{T}^{Z} < 1000 GeV");
365 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.05",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 30 GeV < p_{T}^{Z} < 1000 GeV");
366 <  
367 <  draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.3",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3",0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV");
368 <  draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.2",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p2",0,"#alpha<0.2, 30 GeV < p_{T}^{Z} < 1000 GeV");
369 <  draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.15",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p15",0,"#alpha<0.15, 30 GeV < p_{T}^{Z} < 1000 GeV");
370 <  draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.1",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p1",0,"#alpha<0.1, 30 GeV < p_{T}^{Z} < 1000 GeV");
310 <  draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.05",20,0,2,"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");
360 >  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");
361 >  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");
362 >  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");
363 >  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");
364 >  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");
365 >  
366 >  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");
367 >  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");
368 >  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");
369 >  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");
370 >  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");
371   }  
372  
313 /*double GetMedian(TH1F *histo) {
314    int numBins = histo->GetXaxis()->GetNbins();
315    Double_t x[numBins];
316    Double_t y[numBins];
317    for (int i = 1; i <= numBins; i++) {
318        x[i] = histo->GetBinCenter(i);
319        y[i] = histo->GetBinContent(i);
320    }
321    return TMath::Median(numBins, &x, &y);
322 }*/
323
373   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) {
374   //  write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(3.1415,1.010101);
375    TCanvas *cn = new TCanvas("cn","cn");
# Line 331 | Line 380 | Value get_Zb_data_over_mc(string Contain
380    
381    
382    if(Contains(variable,"pfJetGood")) varname="R_{abs}";
383 <  TH1F *hdata  = allsamples.Draw("hdata",variable,1200,0,30, varname, "events",  cut,data,luminosity);
384 <  TH1F *hmc    = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc,  luminosity);
383 > //  TH1F *hdata  = allsamples.Draw("hdata",variable,1200,0,30, varname, "events",  cut,data,luminosity);
384 > //  TH1F *hmc    = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc,  luminosity);
385 >  TH1F *hdata  = allsamples.Draw("hdata",variable,1200,0.5,1.5, varname, "events",  cut,data,luminosity); // making it more precise
386 >  TH1F *hmc    = allsamples.Draw("hmc" , variable,1200,0.5,1.5, varname, "events", cut, mc,  luminosity); // making it more precise
387    hmc->SetLineColor(kBlue);
388    
389    float a=hdata->GetMean();
# Line 414 | Line 465 | Value get_Zb_data_over_mc(string Contain
465   }
466    
467   int nFakes=1;
468 < ZbResultContainer Fake_new_data_mc_agreement_2d(string AlphaVariable, string ContainerName, TCut BTagCut, TCut BTagWgt) {
469 <  write_warning(__FUNCTION__,"You are using the fake way to extract the correction ... ");
470 <  nFakes++;
471 <  ZbResultContainer results(ContainerName);
468 >
469 > float PurityInclusive=0.05;
470 > float PurityLoose=0.20;
471 > float PurityMedium=0.54;
472 > float PurityTight=0.82;
473 >
474 >
475 > void DeterminePurity(TCut basecut, int nptcuts, float ptcuts[], string AlphaVariable, string ContainerName, float FaceValueToBeTakenAt) {
476    
477 +  bool ComputePurity=false;
478    
479 <  results.MPF_Result_FaceValue=Value(1+nFakes*0.02,0.03);
480 <  results.Rabs_Result_FaceValue=Value(2,0.02);
481 <  results.MPF_Result_Extrapolated=Value(3,0.03);
482 <  results.Rabs_Result_Extrapolated=Value(4,0.04);
483 <  cout << "The fake result for " << ContainerName << " for the MPF face value is " << results.MPF_Result_FaceValue << endl;
484 <
485 <  return results;
479 >  if(ContainerName=="inclusive") ComputePurity=true;  
480 >  if(ContainerName=="loose") ComputePurity=true;
481 >  if(ContainerName=="medium") ComputePurity=true;
482 >  if(ContainerName=="reference") ComputePurity=true;
483 >  
484 >  if(!ComputePurity) return;
485 >  
486 >  stringstream specialcut;
487 >  specialcut << "((pt>30&& pt< 1000) && (" << AlphaVariable << "<" << FaceValueToBeTakenAt << "))";
488 >  
489 >  THStack mcm    = allsamples.DrawStack("mcm" , "mpf",1200,0,30, "MPF", "events", TCut(basecut && specialcut.str().c_str()), mc,  luminosity);
490 >  int nhists = mcm.GetHists()->GetEntries();
491 >  
492 >  float total=0;
493 >  float Zb=0;
494 >  
495 >  for (int i = 0; i < nhists; i++) {
496 >    TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i));
497 >    string name=hist->GetName();
498 >    if(Contains(name,"t_bar_t")) total+=hist->Integral();
499 >    if(Contains(name,"W_Jets")) total+=hist->Integral();
500 >    if(Contains(name,"Single_top")) total+=hist->Integral();
501 >    if(Contains(name,"Dibosons")) total+=hist->Integral();
502 >    if(Contains(name,"Z_l_")) total+=hist->Integral();
503 >    if(Contains(name,"Z_c_")) total+=hist->Integral();
504 >    if(Contains(name,"Z_b_")) {
505 >      total+=hist->Integral();
506 >      Zb+=hist->Integral();
507 >    }
508 >  }
509 >  
510 >  float purity=Zb/total;
511 >  dout << "Determined a purity of " << 100*purity << " % for the container " << ContainerName << endl;
512 >  
513 >  if(ContainerName=="inclusive") PurityInclusive=purity;
514 >  if(ContainerName=="loose") PurityLoose=purity;
515 >  if(ContainerName=="medium") PurityMedium=purity;
516 >  if(ContainerName=="reference") PurityTight=purity;
517 >  
518 >  DeleteStack(mcm);
519   }
520  
521  
522   ZbResultContainer new_data_mc_agreement_2d(bool gofast, string AlphaVariable, string ContainerName, TCut BTagCut, TCut BTagWgt, float FaceValueToBeTakenAt) {
523    
524 +  
525    if(gofast) write_info(__FUNCTION__,"Fast mode activated for "+ContainerName);
526    ZbResultContainer results(ContainerName);
527    
528    cutWeight=STDWEIGHT*BTagWgt;
529    LeadingB=BTagCut;
530    
531 +  
532    gStyle->SetOptFit(0);
533    TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
534    const int nalphacuts=6;
535    float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3,0.35};
536    
537 +  
538    const int nptcuts=5;
539    float ptcuts[nptcuts]={30,50,75,125,1000};
540    
541 <  
541 >  DeterminePurity(basecut, nptcuts,ptcuts, AlphaVariable, ContainerName, FaceValueToBeTakenAt);
542    
543    float MPF_Results[nalphacuts][nptcuts];
544    float MPF_Errors[nalphacuts][nptcuts];
# Line 537 | Line 629 | ZbResultContainer new_data_mc_agreement_
629      
630      
631      
540    
632      if(!gofast) {
633        can->cd();
634        mpf_gr->SetMarkerStyle(21);
# Line 631 | Line 722 | ZbResultContainer new_data_mc_agreement_
722        rabs_gr->Draw("P");
723        rabs_pol_complete->Draw("same");
724        
634      
725        float rabs_a=rabs_pol->GetParameter(0);
726        float rabs_b=rabs_pol->GetParameter(1);
727        RABS_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),rabs_a);
# Line 1285 | Line 1375 | void do_basic_ZB_analysis(bool DoComplet
1375   //   compare_selection("Zb40");
1376  
1377    if(!doquick) {
1378 <    print_all_b_yields();
1378 >    //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.)
1379 >    //print_all_b_yields();
1380      draw_mpf_vars();
1381 <    DrawEvilCutFlow();
1381 >    //DrawEvilCutFlow();
1382          
1383      draw_Zb_kin_vars();
1384          
# Line 1308 | Line 1399 | void do_basic_ZB_analysis(bool DoComplet
1399      
1400      ZbResultContainer inclusive = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","inclusive",TCut("mll>0"),TCut("1.0"),0.3);
1401      ZbResultContainer Reference = new_data_mc_agreement_2d(slow,"ZbCHS3010_alpha","reference",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3);
1402 +    
1403 +    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);
1404 +    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);
1405 +    
1406      ZbResultContainer effmistagUp = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","effmistagUp",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp"),0.3);
1407      ZbResultContainer effmistagDown = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","effmistagDown",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTDown"),0.3);
1408      ZbResultContainer medium = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","medium",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.679"),TCut("ZbCHS3010_BTagWgtM"),0.3);
# Line 1315 | Line 1410 | void do_basic_ZB_analysis(bool DoComplet
1410      ZbResultContainer AlphaUp = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaUp","AlphaUp",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3);
1411      ZbResultContainer AlphaDown = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaDown","AlphaDown",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3);
1412      
1413 <    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);
1414 <    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);
1415 <    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);
1416 <    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);
1413 >    ZbResultContainer L5inclusive = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaL5","L5inclusive",TCut("mll>0"),TCut("1.0"),0.3);
1414 >    ZbResultContainer L5Reference = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaL5","L5reference",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3);
1415 >    
1416 >    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);
1417 >    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);
1418 >    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);
1419 >    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);
1420 >    ZbResultContainer AlphaThresholdVariationDown10inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown10inc",TCut("mll>0"),                              TCut("1.0"),0.3-0.1*0.3);
1421 >    ZbResultContainer AlphaThresholdVariationUp10inc =   new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp10inc",  TCut("mll>0"),                              TCut("1.0"),0.3+0.1*0.3);
1422 >    ZbResultContainer AlphaThresholdVariationDown30inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown30inc",TCut("mll>0"),                              TCut("1.0"),0.3-0.3*0.3);
1423 >    ZbResultContainer AlphaThresholdVariationUp30inc =   new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp30inc",  TCut("mll>0"),                              TCut("1.0"),0.3+0.3*0.3);
1424  
1425      //and now let's compute some systematics!
1426      //1 alpha variation
# Line 1329 | Line 1431 | void do_basic_ZB_analysis(bool DoComplet
1431      float SysMPF_EFF_down = Reference.MPF_Result_FaceValue.getValue()-effmistagDown.MPF_Result_FaceValue.getValue();
1432      float SysMPF_EFF_up = Reference.MPF_Result_FaceValue.getValue()-effmistagUp.MPF_Result_FaceValue.getValue();
1433      
1434 <    //3 purity
1434 >    //3 Presence of soft muons (->neutrino question)
1435 >    float SysMPF_Neutrino_up = Reference.MPF_Result_FaceValue.getValue()-NeutrinoQ.MPF_Result_FaceValue.getValue();
1436 >    float SysMPF_Neutrino_down = Reference.MPF_Result_FaceValue.getValue()-ANeutrinoQ.MPF_Result_FaceValue.getValue();
1437 >    
1438 >    //4 purity
1439      zbcanvas->cd();
1440      gStyle->SetOptFit(0);
1441      write_info(__FUNCTION__,"Don't know the exact purity at the moment, still needs to be determined!");
# Line 1340 | Line 1446 | void do_basic_ZB_analysis(bool DoComplet
1446      purityhisto->GetYaxis()->CenterTitle();
1447      
1448      TGraphErrors *gSysMPF_Purity = new TGraphErrors();
1449 <    gSysMPF_Purity->SetPoint(0,0.05,inclusive.MPF_Result_FaceValue.getValue());
1449 >    
1450 >    gSysMPF_Purity->SetPoint(0,PurityInclusive,inclusive.MPF_Result_FaceValue.getValue());
1451      gSysMPF_Purity->SetPointError(0,0.0,inclusive.MPF_Result_FaceValue.getError());
1452      
1453 <    gSysMPF_Purity->SetPoint(1,0.20,loose.MPF_Result_FaceValue.getValue());//x value?
1453 >    gSysMPF_Purity->SetPoint(1,PurityLoose,loose.MPF_Result_FaceValue.getValue());//x value?
1454      gSysMPF_Purity->SetPointError(1,0.0,loose.MPF_Result_FaceValue.getError());
1455 <    gSysMPF_Purity->SetPoint(2,0.54,medium.MPF_Result_FaceValue.getValue());//x value?
1455 >    gSysMPF_Purity->SetPoint(2,PurityMedium,medium.MPF_Result_FaceValue.getValue());//x value?
1456      gSysMPF_Purity->SetPointError(2,0.0,medium.MPF_Result_FaceValue.getError());
1457 <    gSysMPF_Purity->SetPoint(3,0.82,Reference.MPF_Result_FaceValue.getValue());//x value?
1457 >    gSysMPF_Purity->SetPoint(3,PurityTight,Reference.MPF_Result_FaceValue.getValue());//x value?
1458      gSysMPF_Purity->SetPointError(3,0.0,Reference.MPF_Result_FaceValue.getError());
1459      
1460      
# Line 1394 | Line 1501 | void do_basic_ZB_analysis(bool DoComplet
1501  
1502      float SysMPF_Purity = abs(ExtrapolatedResult-Reference.MPF_Result_FaceValue.getValue());
1503      
1504 <    float sys_alpha  = abs(SysMPF_Alpha_down)>abs(SysMPF_Alpha_up)?abs(SysMPF_Alpha_down):abs(SysMPF_Alpha_up);
1505 <    float sys_eff    = abs(SysMPF_EFF_down)>abs(SysMPF_EFF_up)?abs(SysMPF_EFF_down):abs(SysMPF_EFF_up);
1506 <    float sys_purity = abs(SysMPF_Purity);
1507 <    float sys        = sqrt(sys_alpha*sys_alpha+sys_eff*sys_eff+sys_purity*sys_purity);
1504 >    float sys_alpha    = abs(SysMPF_Alpha_down)>abs(SysMPF_Alpha_up)?abs(SysMPF_Alpha_down):abs(SysMPF_Alpha_up);
1505 >    float sys_eff      = abs(SysMPF_EFF_down)>abs(SysMPF_EFF_up)?abs(SysMPF_EFF_down):abs(SysMPF_EFF_up);
1506 >    float sys_purity   = abs(SysMPF_Purity);
1507 >    float sys_neutrino = abs(SysMPF_Neutrino_down)>abs(SysMPF_Neutrino_up)?abs(SysMPF_Neutrino_down):abs(SysMPF_Neutrino_up);
1508 >    float sys          = sqrt(sys_alpha*sys_alpha+sys_eff*sys_eff+sys_purity*sys_purity+sys_neutrino*sys_neutrino);
1509      
1510      dout << "MPF METHOD:" << endl;
1511      dout << "   Systematics :    down    up     (selected)" << endl;
1512 <    dout << "      Alpha variation      : " << SysMPF_Alpha_down << "   ,  " << SysMPF_Alpha_up << "   ( " << sys_alpha << ") " << endl;
1512 >    dout << "      Oversmearing         : " << SysMPF_Alpha_down << "   ,  " << SysMPF_Alpha_up << "   ( " << sys_alpha << ") " << endl;
1513      dout << "      eff/mistag variation : " << SysMPF_EFF_down << "   ,  " << SysMPF_EFF_up << "   ( " << sys_eff << ") " << endl;
1514      dout << "      purity               : " << SysMPF_Purity << "   ( " << sys_purity << " )" << endl;
1515 <    dout << "      total                : " << sys << endl;
1515 >    dout << "      neutrino             : " << SysMPF_Neutrino_down << "   ,  " << SysMPF_Neutrino_up << "   ( " << sys_neutrino << ") " << endl;
1516 >    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;
1517      dout << endl << endl;
1518      dout << "   FINAL RESULTS : " << endl;
1519      dout << "     C_{abs}^{b}   = " << Reference.MPF_Result_FaceValue << " (stat) +/- " << sys << " (sys) " << endl;
# Line 1414 | Line 1523 | void do_basic_ZB_analysis(bool DoComplet
1523      sysfinal *= sqrt(sys*sys/(Reference.MPF_Result_FaceValue.getValue()*Reference.MPF_Result_FaceValue.getValue()));
1524      //yes, this could be simplified but it would look like a bug.
1525      
1526 +
1527 +    
1528 +    
1529 +    dout << "Note: Varying the alpha cut (->face value) we get the following results: " << endl;
1530 +    dout << "-30%: " << AlphaThresholdVariationDown30.MPF_Result_FaceValue/AlphaThresholdVariationDown30inc.MPF_Result_FaceValue << " (stat)" << endl;
1531 +    dout << "-10%: " << AlphaThresholdVariationDown10.MPF_Result_FaceValue/AlphaThresholdVariationDown10inc.MPF_Result_FaceValue << " (stat)" << endl;
1532 +    dout << "  0%: " << Reference.MPF_Result_FaceValue/inclusive.MPF_Result_FaceValue << " (stat) +/- " << endl;
1533 +    dout << "+10%: " << AlphaThresholdVariationUp10.MPF_Result_FaceValue/AlphaThresholdVariationUp10inc.MPF_Result_FaceValue << " (stat)" << endl;
1534 +    dout << "+30%: " << AlphaThresholdVariationUp30.MPF_Result_FaceValue/AlphaThresholdVariationUp30inc.MPF_Result_FaceValue << " (stat)" << endl;
1535 +    
1536 +    dout << "          XCheck for Rabs, varying the alpha cut (->face value) we get the following results: " << endl;
1537 +    dout << "             -30%: " << AlphaThresholdVariationDown30.Rabs_Result_FaceValue/AlphaThresholdVariationDown30inc.Rabs_Result_FaceValue << " (stat)" << endl;
1538 +    dout << "             -10%: " << AlphaThresholdVariationDown10.Rabs_Result_FaceValue/AlphaThresholdVariationDown10inc.Rabs_Result_FaceValue << " (stat)" << endl;
1539 +    dout << "               0%: " << Reference.Rabs_Result_FaceValue/inclusive.Rabs_Result_FaceValue << " (stat) +/- " << endl;
1540 +    dout << "             +10%: " << AlphaThresholdVariationUp10.Rabs_Result_FaceValue/AlphaThresholdVariationUp10inc.Rabs_Result_FaceValue << " (stat)" << endl;
1541 +    dout << "             +30%: " << AlphaThresholdVariationUp30.Rabs_Result_FaceValue/AlphaThresholdVariationUp30inc.Rabs_Result_FaceValue << " (stat)" << endl;
1542 +
1543 +    
1544 +    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());
1545 +    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());
1546 +    float sys_alphavar = sys_alphavar_up>sys_alphavar_down?sys_alphavar_up:sys_alphavar_down;
1547 +    
1548 +    dout << " -> Additional systematic (from 30%) : " << sys_alphavar << endl;
1549 +    sysfinal=sqrt(sysfinal*sysfinal+sys_alphavar*sys_alphavar);
1550 +    dout << "Final systematic is : " << sysfinal << endl;
1551 +    
1552 +    dout << "   ******************************************** <  FINAL RESULT > ******************************************** " << endl;
1553      dout << "     C_{corr}      = " << Reference.MPF_Result_FaceValue/inclusive.MPF_Result_FaceValue << " (stat) +/- " << sysfinal << " (sys) " << endl;
1554 +    dout << "   ******************************************** < /FINAL RESULT > ******************************************** " << endl;
1555 +    
1556 +    dout << "Note that if L5 corrections are applied, we get " << L5Reference.MPF_Result_FaceValue/L5inclusive.MPF_Result_FaceValue << " (stat) " << endl;
1557      
1558      LeadingB=TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898");
1559      
# Line 1465 | Line 1604 | void SpecialCutFlow(string identifier) {
1604    
1605    
1606    TH1F *data  = allsamples.Draw("data",    MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity);
1607 <   THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
1607 >  THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
1608  
1609    float runningsum=0;
1610    for(int i=data->GetNbinsX();i>0;i--) {
# Line 1534 | Line 1673 | void SpecialCutFlow(string identifier) {
1673    
1674    delete crap;
1675    delete data;
1676 <  
1676 >  CleanLegends();
1677 >  DeleteStack(mcm);
1678 >
1679    
1680   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines