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.57 by buchmann, Thu Sep 6 10:19:18 2012 UTC vs.
Revision 1.63 by fronga, Fri Sep 7 15:10:26 2012 UTC

# Line 373 | Line 373 | void draw_ratio_plot(TH1* hdata, THStack
373   }
374  
375   float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale,
376 <                        string xlabel, string filename, bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.55) {
376 >                        string xlabel, string filename, float legendPosition=0.55) {
377  
378    TCut ibasiccut=basiccut;
379    bool draw_separation_lines=false;
# Line 391 | Line 391 | float make_one_OFSF_plot(string variable
391    rcan->SetLogy(logscale);
392    rcan->cd();
393  
394 +  std::cout << "OF/SF comparison: variable = " << variable << ", cut = " << cutSF.GetTitle() << std::endl;
395    TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity);
396    TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity);
397 <  string signal("LM3");
398 <  TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max);
399 <  int idx = signalsamples.FindSample(signal)[0];
400 <  (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF);
401 <  signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
402 <  signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor);
403 <  signalhisto->SetLineStyle(2);
397 > //   string signal("LM3");
398 > //   TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max);
399 > //   int idx = signalsamples.FindSample(signal)[0];
400 > //   (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF);
401 > //   signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
402 > //   signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor);
403 > //   signalhisto->SetLineStyle(2);
404    datahistoSF->SetMarkerSize(DataMarkerSize);
405    datahistoOF->SetLineColor(kRed);
406  
# Line 429 | Line 430 | float make_one_OFSF_plot(string variable
430    } else {
431      mleg->AddEntry((TObject*)0, "", "");
432    }
433 <  mleg->AddEntry(signalhisto, "LM3", "L");
433 >  //mleg->AddEntry(signalhisto, "LM3", "L");
434  
435    datahistoSF->Draw("E1");
436    if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES");
437 <  signalhisto->Draw("HIST,SAMES");
437 >  //signalhisto->Draw("HIST,SAMES");
438    mleg->Draw();
439    DrawPrelim();
440 <  if (datahistoOF->Integral()>0) save_with_ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" );
441 <  else CompleteSave(ckin, "SFOF/" + filename);
440 >  if (datahistoOF->Integral()>0) {
441 >    save_with_ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" );
442 >  } else {
443 >    CompleteSave(rcan, "SFOF/" + filename);
444 >    delete rcan;
445 >  }
446  
447    datahistoSF->Delete();
448    datahistoOF->Delete();
449 <  signalhisto->Delete();
449 >  //signalhisto->Delete();
450    delete mleg;
451    delete ckin;
452  
# Line 488 | Line 493 | float make_data_comparison_plot(string v
493    data1->GetYaxis()->CenterTitle();
494  
495    TLegend *mleg = make_legend("",legendPosition,0.7,false,legendPosition+0.2);
496 <  mleg->AddEntry(data1, "Old 5/fb", "PL");
497 <  mleg->AddEntry(data2, "New x/fb", "L");
496 >  mleg->AddEntry(data1, "New 3.8/fb", "PL");
497 >  mleg->AddEntry(data2, "Old 5.1/fb", "L");
498  
499    data1->Draw("E1");
500    data2->Draw("HIST,SAMES");
# Line 507 | Line 512 | float make_data_comparison_plot(string v
512   void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale,
513                       string xlabel, string filename, float legendPosition=0.55) {
514  
515 <  string mllcuts[] = { "mll>20","mll>20&&mll<70", "mll>75&&mll<105", "mll>120" };
516 <  string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "75 < m_{ll} < 105 GeV", "m_{ll} > 120 GeV" };
515 >  string mllcuts[] = { "mll>15","mll>15&&mll<70", "mll>75&&mll<105", "mll>120" };
516 >  string mllcutname[] = { "m_{ll} > 15 GeV", "15 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 120 GeV" };
517    string plotname[] = {"_all","_low","_peak","_high"};
518    float ymax;
519  
# Line 518 | Line 523 | void make_OFSF_plots(string variable, st
523    for ( int i=start; i<4; ++i ) {
524      if ( addcut != "" ) mllcuts[i] += "&&"+addcut;
525      if ( i==start ) {
526 <      ymax = make_one_OFSF_plot(variable, mllcuts[i],            mllcutname[i], nbins, min, max, -1, logscale, xlabel,
526 >      ymax = make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, -1, logscale, xlabel,
527                           filename+plotname[i], legendPosition );
528      } else {
529 <      make_one_OFSF_plot(variable, mllcuts[i],            mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
529 >      make_one_OFSF_plot(variable, mllcuts[i],        mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
530                           filename+plotname[i], legendPosition );
531      }
532      make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
# Line 744 | Line 749 | void do_kinematic_plots(string mcjzb, st
749    bool dolog=true;
750    bool nolog=false;
751  
752 <  bool doOFSF = false;
753 <  bool doKin  = false;
752 >  bool doOFSF = true;
753 >  bool doKin  = true;
754    bool doDataComp = true;
755    
756  
# Line 760 | Line 765 | void do_kinematic_plots(string mcjzb, st
765    if ( doOFSF ) {
766      make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll");
767  
768 <    make_OFSF_plots("pfJetGoodNum40",     "met[4]>100", 7, 3, 10, true, "#(jets)", "njets");
769 <    make_OFSF_plots("pfJetGoodNum40",     "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
770 <    make_OFSF_plots("pfJetGoodNum40",     "met[4]>100&&pfJetGoodNumBtag30>0", 7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30");
768 >    make_OFSF_plots("pfJetGoodNum40", "met[4]>100",                        7, 3, 10, true, "#(jets)", "njets");
769 >    make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
770 >    make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30>0",  7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30");
771  
772      make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets");
773 +    make_OFSF_plots("pfJetGoodPtBtag[0]", "met[4]>100&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", "ptb1");
774 +
775      make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1");
776      make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2");
777      //  make_OFSF_plots("pt1",  "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1");
# Line 786 | Line 793 | void do_kinematic_plots(string mcjzb, st
793  
794    if ( doDataComp && !PlottingSetup::openBox ) {
795      TCut mllCut("");
796 <    if ( !PlottingSetup::openBox ) mllCut = "mll>120";
796 >    float massmin = 15.;
797 >    float massmax = 315;
798 >    int massnbins = 60;
799 >    if ( !PlottingSetup::openBox ) {
800 >      mllCut = "mll>120";
801 >      massmin = 120;
802 >      massmax = 360;
803 >      massnbins = 14;
804 >    }
805  
806      TCut cutSignal = cutmass&&cutnJets&&"met[4]>100";
807 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut,           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig");
808 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee");
794 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm");
795 <
796 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0",           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto");
797 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0&&pfJetGoodNumBtag30==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee_btagVeto");
798 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1&&pfJetGoodNumBtag30==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm_btagVeto");
799 <
800 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet");
801 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0&&pfJetGoodNumBtag30>0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee_AtLeastOneBJet");
802 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1&&pfJetGoodNumBtag30>0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm_AtLeastOneBJet");
807 >    make_data_comparison_plot("mll", cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive");
808 >    make_data_comparison_plot("mll", cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_inclusive");
809  
810 <    make_data_comparison_plot("mll", cutOSOF&&cutSignal, 60, 20., 320.,-1., false, "m_{ll}", "mll_OF_sig");
811 <    make_data_comparison_plot("mll", cutmass&&"met[4]>100&&met[4]<150&&pfJetGoodNum40<3", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_CR");
810 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut,           massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig");
811 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto");
812 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",  massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet");
813 >
814 >    make_data_comparison_plot("mll", mllCut&&cutOSOF&&cutSignal, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig");
815 >    make_data_comparison_plot("mll", cutmass&&cutOSSF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_CR");
816 >    make_data_comparison_plot("mll", cutmass&&cutOSOF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_CR");
817 >
818 >    make_data_comparison_plot("pfJetGoodNum40", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_SF_sig");
819 >    make_data_comparison_plot("pfJetGoodNum40", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_OF_sig");
820 >    make_data_comparison_plot("pfJetGoodNumBtag30", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_SF_sig");
821 >    make_data_comparison_plot("pfJetGoodNumBtag30", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_OF_sig");
822    }
823  
824  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines