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

Comparing UserCode/cbrown/Development/Plotting/Modules/Plotting_Functions.C (file contents):
Revision 1.42 by fronga, Thu Jul 26 11:18:37 2012 UTC vs.
Revision 1.49 by fronga, Wed Aug 15 11:46:28 2012 UTC

# Line 196 | Line 196 | void make_special_obs_pred_mll_plot(stri
196    }
197    
198    // Separate predictions
199 <  TH1F* Zpred = (TH1F*)LcorrJZBeemm->Clone("Zpred");
200 <  TH1F* OSpred = (TH1F*)RcorrJZBem->Clone("OSpred");
201 <  if(PlottingSetup::RestrictToMassPeak) {
202 <    OSpred->Scale(1.0/3.0);
203 <    OSpred->Add(RcorrJZBSBem,1.0/3.);
204 <    OSpred->Add(RcorrJZBSBeemm,1.0/3.);
205 <    Zpred->Add(LcorrJZBem,-1.0/3.);
206 <    Zpred->Add(LcorrJZBSBem,-1.0/3.);
207 <    Zpred->Add(LcorrJZBSBeemm,-1.0/3.);
208 <  } else {
209 <    Zpred->Add(LcorrJZBem,-1.0);
210 <  }
211 <
212 <  TH1F* Bpred = (TH1F*)Zpred->Clone("Bpred");
213 <  Bpred->Add(OSpred);
199 >  TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN");
200 >  TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP");
201 >  TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN");
202 >  if(PlottingSetup::RestrictToMassPeak) {
203 >    OFP->Scale(1.0/3.0);
204 >    OFP->Add(RcorrJZBSBem,1.0/3.);
205 >    OFP->Add(RcorrJZBSBeemm,1.0/3.);
206 >    OFN->Scale(1.0/3.0);
207 >    OFN->Add(LcorrJZBSBem,1.0/3.);
208 >    OFN->Add(LcorrJZBSBeemm,1.0/3.);
209 >  }
210 >
211 >  TH1F* Bpred = (TH1F*)SFN->Clone("Bpred");
212 >  Bpred->Add(OFP);
213 >  Bpred->Add(OFN,-1);
214    Bpred->SetLineColor(kRed);
215    
216  // Problem with negative bins: add contents to OSpred
217  for ( unsigned int i=0; i<=Zpred->GetNbinsX(); ++i ) {
218    if ( Zpred->GetBinContent(i)<0 ) {
219      OSpred->SetBinContent(i,OSpred->GetBinContent(i)+Zpred->GetBinContent(i));
220      Zpred->SetBinContent(i,0);
221    }
222  }
223
216    RcorrJZBeemm->SetTitleOffset(1.3,"y");
217    RcorrJZBeemm->Draw();
218    mcRcorrJZBeemm.Draw("same");
# Line 238 | Line 230 | void make_special_obs_pred_mll_plot(stri
230    CompleteSave(ckin,saveas.str());
231    
232    // Draw all predictions overlayed
233 <  Zpred->SetLineColor(kGreen+1);
234 <  Zpred->SetLineStyle(2);
235 <  OSpred->SetLineColor(kBlue-2);
236 <  OSpred->SetLineStyle(3);
233 >  unsigned int w = gStyle->GetHistLineWidth()+1; // Make line a bit wider, since we dash it
234 >  SFN->SetLineColor(kGreen+2);
235 >  SFN->SetLineStyle(2);
236 >  SFN->SetLineWidth(w);
237 >  OFP->SetLineColor(kBlue+2);
238 >  OFP->SetLineStyle(2);
239 >  OFP->SetLineWidth(w);
240 >  OFN->SetLineColor(kMagenta+2);
241 >  OFN->SetLineStyle(3);
242 >  OFN->SetLineWidth(w);
243    
244    RcorrJZBeemm->Draw();
245 <  OSpred->Draw("histo,same");
246 <  Zpred->Draw("histo,same");
245 >  SFN->Draw("histo,same");
246 >  OFP->Draw("histo,same");
247 >  OFN->Draw("histo,same");
248    Bpred->Draw("histo,same");
249    RcorrJZBeemm->Draw("same");
250    
251    TLegend *leg2 = make_legend("",0.52,0.7);
252    leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp");
253    leg2->AddEntry(Bpred,"predicted (data)","l");
254 <  leg2->AddEntry(Zpred, "  bkgd w/Z (data)","l");
255 <  leg2->AddEntry(OSpred,"  bkgd w/o Z (data)","l");
254 >  leg2->AddEntry(SFN,  "  SF JZB<0","l");
255 >  leg2->AddEntry(OFN,  "  OF JZB<0","l");
256 >  leg2->AddEntry(OFP,  "  OF JZB>0","l");
257    leg2->Draw("same");
258    
259    saveas.str("");
260    saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold << "_nomc";
261    CompleteSave(ckin,saveas.str());
262    
263  
264
263    delete RcorrJZBeemm;
264    delete LcorrJZBeemm;
265    delete RcorrJZBem;
# Line 360 | Line 358 | void draw_ratio_plot(TH1* hdata, THStack
358    oneline->Draw("same");
359   }
360  
361 + float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale,
362 +                        string xlabel, string filename, bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.55) {
363 +
364 +  TCut ibasiccut=basiccut;
365 +  bool draw_separation_lines=false;
366 +
367 +  if(addcut != "") ibasiccut = ibasiccut && addcut.c_str();
368 +
369 +  TCut cutSF;
370 +  TCut cutOF;
371 +
372 +  cutOF = cutOSOF&&cutnJets&&ibasiccut;
373 +  cutSF = cutOSSF&&cutnJets&&ibasiccut;
374 +
375 +  TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
376 +  ckin->SetLogy(logscale);
377 +  TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity);
378 +  TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity);
379 +  string signal("LM3");
380 +  TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max);
381 +  int idx = signalsamples.FindSample(signal)[0];
382 +  (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF);
383 +  signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
384 +  signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor);
385 +  signalhisto->SetLineStyle(2);
386 +  datahistoSF->SetMarkerSize(DataMarkerSize);
387 +  datahistoOF->SetLineColor(kRed);
388 +
389 +  if ( !logscale ) {
390 +    datahistoSF->SetMinimum(0); // Defaults
391 +  } else {
392 +    datahistoSF->SetMinimum(0.5);
393 +  }
394 +  if (ymax<0) {
395 +    if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum());
396 +    else datahistoSF->SetMaximum(1.5*datahistoSF->GetMaximum());
397 +  } else {
398 +    datahistoSF->SetMaximum(ymax);
399 +  }
400 +
401 +  float ymaxSet = datahistoSF->GetMaximum();
402 +
403 +  datahistoSF->GetXaxis()->SetTitle(xlabel.c_str());
404 +  datahistoSF->GetYaxis()->SetTitle("Events");
405 +  datahistoSF->GetXaxis()->CenterTitle();
406 +  datahistoSF->GetYaxis()->CenterTitle();
407 +
408 +  TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.7,false,legendPosition+0.2);
409 +  mleg->AddEntry(datahistoSF, "Same-flavor", "PL");
410 +  if (datahistoOF->Integral()>0) {
411 +    mleg->AddEntry(datahistoOF, "Opposite-flavor", "L");
412 +  } else {
413 +    mleg->AddEntry((TObject*)0, "", "");
414 +  }
415 +  mleg->AddEntry(signalhisto, "LM3", "L");
416 +
417 +  datahistoSF->Draw("E1");
418 +  if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES");
419 +  signalhisto->Draw("HIST,SAMES");
420 +  mleg->Draw();
421 +  DrawPrelim();
422 +  CompleteSave(ckin, "SFOF/" + filename);
423 +
424 +  datahistoSF->Delete();
425 +  datahistoOF->Delete();
426 +  signalhisto->Delete();
427 +  delete mleg;
428 +  delete ckin;
429 +
430 +  return ymaxSet;
431 +
432 + }
433 +
434 + void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale, string xlabel, string filename,
435 +                bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.55) {
436 +
437 +  string mllcuts[] = { "mll>20","mll>20&&mll<70", "mll>70&&mll<110", "mll>110" };
438 +  string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 110 GeV" };
439 +  string plotname[] = {"_all","_low","_peak","_high"};
440 +  float ymax;
441 +  for ( int i=0; i<4; ++i ) {
442 +    if ( addcut != "" ) mllcuts[i] += "&&"+addcut;
443 +    if ( i==0 ) {
444 +      ymax = make_one_OFSF_plot(variable, mllcuts[i],            mllcutname[i], nbins, min, max, -1, logscale, xlabel,
445 +                         filename+plotname[i], plotratio, loadlastminmax, legendPosition );
446 +    } else {
447 +      make_one_OFSF_plot(variable, mllcuts[i],            mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
448 +                         filename+plotname[i], plotratio, loadlastminmax, legendPosition );
449 +    }
450 +    make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
451 +                       filename+plotname[i]+"_mm", plotratio, loadlastminmax, legendPosition );
452 +    make_one_OFSF_plot(variable, "id1==0&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
453 +                       filename+plotname[i]+"_ee", plotratio, loadlastminmax, legendPosition );
454 +  }
455 +
456 + }
457 +
458 +
459   float lastrange_min=0;
460   float lastrange_max=0;
461  
# Line 429 | Line 525 | void make_kin_plot(string variable, stri
525    if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum());
526    else datahisto->SetMaximum(1.3*datahisto->GetMaximum());
527  
528 +  cout << "******** Cut used : " << (const char*) cut << endl;
529    if(loadlastminmax) {
530          datahisto->SetMinimum(lastrange_min);
531          datahisto->SetMaximum(lastrange_max);
# Line 576 | Line 673 | void do_kinematic_plots(string mcjzb, st
673          mll_hi=300;
674    }
675  
676 <  make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
676 >  make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll", false, false);
677 >  make_OFSF_plots("pfJetGoodNum40", "met[4]>100", 7, 3, 10, true, "#(jets)", "njets", false, false);
678 >  make_OFSF_plots("pt1",  "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1", false, false);
679 >  make_OFSF_plots("pt2",  "met[4]>100", 22, 0., 220., true, "p_{T,2}", "pt2", false, false);
680 >  make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", false, false, 0.15);
681 >  make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", false, false, 0.15);
682 >  make_OFSF_plots("phi1", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", "phi1", false, false, 0.2);
683 >  make_OFSF_plots("phi2", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", "phi2", false, false, 0.2);
684 >  make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", false, false, 0.2);
685 >  make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphij1met", false, false, 0.0);
686 >  make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", false, false, 0.2);
687 >  make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", false, false, 0.2);
688 >  make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", false, false, 0.2);
689 >  make_OFSF_plots("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", "dphilc", false, false, 0.2);
690 >  make_OFSF_plots("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", "dphijc", false, false, 0.2);
691 >  make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", "met[4]>100", 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(l,MET)|)", "dphilco", false, false, 0.2);
692 >  make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", "met[4]>100", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(jet,MET)|)", "dphijco", false, false, 0.2);
693  
694 +  make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
695    make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true);
696    make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true);
697    make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true);
# Line 623 | Line 737 | void do_kinematic_plots(string mcjzb, st
737    make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB50",doPF,true);  
738    make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB50",doPF,true);  
739  
740 <  make_kin_plot("mll","met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV] (MET>100GeV)","mll_met100",doPF,true);
740 >  make_kin_plot("mll","met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV] (MET>100GeV)","mll_met100_ll",doPF,true);
741 >  //make_kin_plot("mll","met[4]>150&&id1==0",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ee} [GeV] (MET>150GeV)","mll_met150_ee",doPF,true);
742 >  //make_kin_plot("mll","met[4]>150&&id1==1",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{#mu#mu} [GeV] (MET>150GeV)","mll_met150_mm",doPF,true);
743  
744    make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
745    make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
# Line 635 | Line 751 | void do_kinematic_plots(string mcjzb, st
751  
752    make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
753    make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof");
754 <
754 >  
755 >  string regioncut[4] =    {"mll>0&&","mll>20&&mll<70&&","mll>70&&mll<110&&","mll>110&&"};
756 >  string regionname[4] = {"global","lowmass","Zregion","highmass"};
757 >  bool StoreRatioPlots=false;
758 >  for(int iregion=0;iregion<4;iregion++) {
759 >    cout << regionname[iregion] << " : " << regioncut[iregion] << endl;
760 >
761 >    //Z properties
762 >    make_kin_plot("pt","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),40,0,200,dolog,"p_{T}^{ee} [GeV] (MET>100GeV)","Z/ZPT_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots);
763 >    make_kin_plot("pt","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),40,0,200,dolog,"p_{T}^{#mu#mu} [GeV] (MET>100GeV)","Z/ZPT_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots);
764 >    
765 >    make_kin_plot("phi","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),32,-3.2,3.2,nolog,"#phi^{ee} (MET>100GeV)","Z/ZPhi_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots);
766 >    make_kin_plot("phi","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu#mu} (MET>100GeV)","Z/ZPhi_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots);
767 >    
768 >    make_kin_plot("eta","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),30,-3.0,3.0,nolog,"#eta^{ee} (MET>100GeV)","Z/ZEta_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots);
769 >    make_kin_plot("eta","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu#mu} (MET>100GeV)","Z/ZEta_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots);
770 >    
771 >    // lepton properties
772 >    make_kin_plot("pt1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{e1} [GeV] (MET>100GeV)","Lepton/LeadingElectronPt_met100_"+regionname[iregion],doPF,StoreRatioPlots);
773 >    make_kin_plot("pt1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{#mu1} [GeV] (MET>100GeV)","Lepton/LeadingMuonPt_met100_"+regionname[iregion],doPF,StoreRatioPlots);
774 >    make_kin_plot("pt2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{e2} [GeV] (MET>100GeV)","Lepton/SubLeadingElectronPt_met100_"+regionname[iregion],doPF,StoreRatioPlots);
775 >    make_kin_plot("pt2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{#mu2} [GeV] (MET>100GeV)","Lepton/SubLeadingMuonPt_met100_"+regionname[iregion],doPF,StoreRatioPlots);
776 >    
777 >    make_kin_plot("phi1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{e1} (MET>100GeV)","Lepton/LeadingElectronPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots);
778 >    make_kin_plot("phi1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu1} (MET>100GeV)","Lepton/LeadingMuonPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots);
779 >    make_kin_plot("phi2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{e2} (MET>100GeV)","Lepton/SubLeadingElectronPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots);
780 >    make_kin_plot("phi2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu2} (MET>100GeV)","Lepton/SubLeadingMuonPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots);
781 >    
782 >    make_kin_plot("eta1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{e1} (MET>100GeV)","Lepton/LeadingElectronEta_met100_"+regionname[iregion],doPF,StoreRatioPlots);
783 >    make_kin_plot("eta1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu1} (MET>100GeV)","Lepton/LeadingMuonEta_met100_"+regionname[iregion],doPF,StoreRatioPlots);
784 >    make_kin_plot("eta2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{e2} (MET>100GeV)","Lepton/SubLeadingElectronEta_met100_"+regionname[iregion],doPF,StoreRatioPlots);
785 >    make_kin_plot("eta2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu2} (MET>100GeV)","Lepton/SubLeadingMuonEta_met100_"+regionname[iregion],doPF,StoreRatioPlots);
786 >    
787 >    
788 >  }
789  
790   }
791  
# Line 3486 | Line 3636 | void do_mlls_plot(string mcjzb) {
3636    }
3637   }
3638  
3639 < void met_vs_jzb_plots() {
3639 > void met_vs_jzb_plots(string datajzb, string mcjzb) {
3640    
3641    TCanvas *canmetjzb = new TCanvas("canmet","MET vs JZB canvas");
3642    canmetjzb->SetRightMargin(0.16);
# Line 3495 | Line 3645 | void met_vs_jzb_plots() {
3645    findme.push_back("DY");
3646    findme.push_back("TTJets");
3647    findme.push_back("LM");
3648 <  
3648 >  /*
3649    for(int ifind=0;ifind<(int)findme.size();ifind++) {
3650      vector<int> selsamples = allsamples.FindSample(findme[ifind]);
3651      TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100);
3652      for(int isel=0;isel<(int)selsamples.size();isel++) {
3653 <      cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl;
3654 <      allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF);
3653 >      dout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl;
3654 >      allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF&&cutnJets);
3655      }
3656      metvsjzb->Scale(allsamples.collection[selsamples[0]].weight);
3657      metvsjzb->SetStats(0);
# Line 3515 | Line 3665 | void met_vs_jzb_plots() {
3665      title->Draw();
3666      CompleteSave(canmetjzb,(string)"METvsJZBplots/"+findme[ifind]);
3667    }
3668 +  */
3669 +  
3670 +  dout << "About to produce MET plot for DY split up by JZB" << endl;
3671 +  
3672 +  int nbins=14;
3673 +  float low=0;
3674 +  float high=140;
3675 +  
3676 +  stringstream sLEFT;
3677 +  sLEFT << "((" << mcjzb << ")<0)";
3678 +  TCut LEFT(sLEFT.str().c_str());
3679 +  stringstream sRIGHT;
3680 +  sRIGHT << "((" << mcjzb << ")>0)";
3681 +  TCut RIGHT(sRIGHT.str().c_str());
3682 +  
3683 +  TH1F *metleft   = allsamples.Draw("metleft","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets"));
3684 +  TH1F *metleftO  = allsamples.Draw("metleftO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets"));
3685 +  TH1F *metright  = allsamples.Draw("metright","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets"));
3686 +  TH1F *metrightO = allsamples.Draw("metrightO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets"));
3687 +  
3688 +  
3689 +  TH1F *Bpred =  (TH1F*)metleft->Clone("Bpred");
3690 +  Bpred->Add(metleftO,-1);
3691 +  Bpred->Add(metrightO);
3692 +  TH1F *obs = (TH1F*)metright->Clone("obs");
3693 +  
3694 +  metleft->Add(metleftO,-1);
3695 +  metright->Add(metrightO,-1);
3696 +  
3697 +  metleft->SetLineColor(kRed);
3698 +  metright->SetLineColor(kBlack);
3699 +  TPad *metpad = new TPad("metpad","metpad",0,0,1,1);
3700 +  metpad->cd();
3701 +  metpad->SetLogy(1);
3702 +  metleft->Draw("histo");
3703 +  metright->Draw("same");
3704 +  TLegend *lg = make_legend();
3705 +  lg->SetX1(0.5);
3706 +  lg->SetY1(0.7);
3707 +  lg->AddEntry(metright,"JZB>0 (OSOF corrected)","P");
3708 +  lg->AddEntry(metleft,"JZB<0 (OSOF corrected)","L");
3709 +  lg->SetHeader("DY");
3710 +  
3711 +  lg->Draw();
3712 +  save_with_ratio(metright,metleft,metpad->cd(),"METvsJZBplots/ComparingLeftToRightinMETspectrum");
3713 +  
3714 +  TPad *metpad3 = new TPad("metpad3","metpad3",0,0,1,1);
3715 +  metpad3->cd();
3716 +  metpad3->SetLogy(1);
3717 +  Bpred->SetLineColor(kRed);
3718 +  Bpred->Draw("histo");
3719 +  obs->SetLineColor(kBlack);
3720 +  obs->Draw("same");
3721 +  TLegend *lg2 = make_legend();
3722 +  lg2->SetX1(0.5);
3723 +  lg2->SetY1(0.7);
3724 +  lg2->AddEntry(obs,"observed","P");
3725 +  lg2->AddEntry(Bpred,"predicted","L");
3726 +  lg2->SetHeader("DY");
3727 +
3728 +  lg2->Draw();
3729 +  
3730 +  save_with_ratio(obs,Bpred,metpad3->cd(),"METvsJZBplots/ComparingPredObsinMET");
3731 +  
3732 +  TPad *metpad2 = new TPad("metpad2","metpad2",0,0,1,1);
3733 +  metpad2->cd();
3734 +  metpad2->SetLogy(1);
3735 +  
3736 +  TH1F *metlefta   = allsamples.Draw("metlefta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets"));
3737 +  TH1F *metleftOa  = allsamples.Draw("metleftOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets"));
3738 +  TH1F *metrighta  = allsamples.Draw("metrighta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets"));
3739 +  TH1F *metrightOa = allsamples.Draw("metrightOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets"));
3740 +  
3741 +  metlefta->Add(metleftOa,-1);
3742 +  metrighta->Add(metrightOa,-1);
3743 +  
3744 +  metlefta->SetLineColor(kRed);
3745 +  metpad2->cd();
3746 +  metlefta->Draw("histo");
3747 +  metrighta->Draw("same");
3748 +  lg->Draw();
3749 +  save_with_ratio(metrighta,metlefta,metpad2->cd(),"METvsJZBplots/ComparingLeftToRightinMET_type1_spectrum");
3750 +  
3751 +  delete Bpred;
3752 +  delete obs;
3753 +  
3754 +  float newhigh=300;
3755 +  int newNBins=30;
3756 +  
3757 +  TPad *metpad4 = new TPad("metpad4","metpad4",0,0,1,1);
3758 +  TH1F *Ametleft   = allsamples.Draw("Ametleft","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity);
3759 +  TH1F *AmetleftO  = allsamples.Draw("AmetleftO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity);
3760 +  TH1F *Ametright  = allsamples.Draw("Ametright","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity);
3761 +  TH1F *AmetrightO = allsamples.Draw("AmetrightO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity);
3762 +  
3763 +  TH1F *aBpred = (TH1F*)Ametleft->Clone("aBpred");
3764 +  aBpred->Add(AmetleftO,-1);
3765 +  aBpred->Add(AmetrightO);
3766 +  aBpred->SetLineColor(kRed);
3767 +  
3768 +  TH1F *aobs = (TH1F*)Ametright->Clone("aobs");
3769 +  metpad4->cd();
3770 +  metpad4->SetLogy(1);
3771 +  aobs->Draw();
3772 +  aBpred->Draw("histo,same");
3773 +  aobs->Draw("same");
3774 +  lg->SetHeader("All MC");
3775 +  lg->Draw();
3776 +  save_with_ratio(aobs,aBpred,metpad4->cd(),"METvsJZBplots/ComparingPredObsinMET_ALLSAMPLES");
3777 +  
3778 +  
3779 +  delete lg;
3780 +  delete canmetjzb;
3781 +  delete metleft;
3782 +  delete metleftO;
3783 +  delete metright;
3784 +  delete metrightO;
3785   }
3786      
3787  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines