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.64 by buchmann, Thu Sep 13 07:35:15 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines