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.15 by buchmann, Wed Apr 18 13:04:08 2012 UTC vs.
Revision 1.16 by buchmann, Mon Apr 30 08:38:11 2012 UTC

# Line 102 | Line 102 | void make_special_obs_pred_mll_plot(stri
102    TH1F *RcorrJZBSBeemm;
103    TH1F *LcorrJZBSBeemm;
104    
105 <  TH1F *RcorrJZBeemmNoS;
105 > //  TH1F *RcorrJZBeemmNoS;
106  
107    if(PlottingSetup::RestrictToMassPeak) {
108      RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",  "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,data, luminosity);
# Line 189 | Line 189 | void make_special_mll_plot(int nbins, fl
189    TIter next(bgleg->GetListOfPrimitives());
190    TObject* obj;
191    // Copy the nice bkgd legend skipping the "data"
192 <  while ( obj = next() )
192 >  while ( (obj = next()) )
193      if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") )
194        kinleg->GetListOfPrimitives()->Add(obj);
195  
# Line 208 | Line 208 | void draw_ratio_plot(TH1* hdata, THStack
208    TIter next(hmc.GetHists());
209    TObject* obj;
210    TH1* hratio = NULL;
211 <  while ( obj = next() ) {
211 >  while ( (obj = next()) ) {
212      if ( !hratio ) {
213        hratio = (TH1*)obj->Clone();
214        hratio->SetName("hratio");
# Line 436 | Line 436 | void do_kinematic_plots(string mcjzb, st
436          mll_low=10;
437          mll_hi=210;
438    }
439 <  /*
439 >  
440    make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true);
441    make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true);
442    make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true);
# Line 445 | Line 445 | void do_kinematic_plots(string mcjzb, st
445    make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
446    make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
447    make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
448 <  make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);/*
448 >  make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
449    make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF);
450    make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
451    make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
# Line 455 | Line 455 | void do_kinematic_plots(string mcjzb, st
455    make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF);
456    make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF);
457    make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF);
458 <  make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);*//*
458 >  make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
459    if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
460    stringstream jzbcut;
461    jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))";
# Line 470 | Line 470 | void do_kinematic_plots(string mcjzb, st
470    stringstream jzbcut3;
471    jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))";
472    make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true);   make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true);
473 <  */
473 >  
474 >  make_special_obs_pred_mll_plot(mcjzb,0);
475    make_special_obs_pred_mll_plot(mcjzb,50);
476    make_special_obs_pred_mll_plot(mcjzb,100);
477    make_special_obs_pred_mll_plot(mcjzb,150);
# Line 547 | Line 548 | void region_comparison_plots(string mcjz
548      
549    
550      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed
551 <  for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) {
551 >  for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) {
552      float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut
553      float mll_low=50;float mll_high=170;
554      if(!PlottingSetup::RestrictToMassPeak) {
# Line 1665 | Line 1666 | void diboson_plots(string mcjzb, string
1666    
1667    
1668    dout << "Going to increase the cross section for diboson samples ... " << endl;
1669 <  for(int i=0;i<SamplesToBeModified.size();i++) {
1669 >  for(int i=0;i<(int)SamplesToBeModified.size();i++) {
1670      float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs;
1671      (allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor;
1672      dout << "     Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl;
# Line 1685 | Line 1686 | void diboson_plots(string mcjzb, string
1686    delete gloca;
1687  
1688    dout << "Going to reset the cross section for diboson samples ... " << endl;
1689 <  for(int i=0;i<SamplesToBeModified.size();i++) {
1689 >  for(int i=0;i<(int)SamplesToBeModified.size();i++) {
1690      float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs;
1691      (allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor);
1692      string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename;
# Line 1782 | Line 1783 | void compute_MC_yields(string mcjzb,vect
1783    string posneg[] = {"pos","neg"};
1784    TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut};
1785  
1786 <  for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) {
1786 >  for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) {
1787      TCut jzbMC[]  = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") };
1788      dout << "_________________________________________________________" << endl;
1789      dout << "Table for JZB> " << jzb_cuts[ijzb] << endl;
1790 <    for(int isample=0;isample<(allsamples.collection).size();isample++) {
1790 >    for(int isample=0;isample<(int)(allsamples.collection).size();isample++) {
1791        if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << "  &  ";
1792        else dout << "Sample & ";
1793        for(int iregion=0;iregion<nRegions;iregion++) {
# Line 2045 | Line 2046 | void draw_ttbar_and_zjets_shape_for_one_
2046  
2047   void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) {
2048    int all_leptons=-1;
2048  int electrons_only=0;
2049  int mu_only=1;
2050  int twojetswith50gev=1;
2049    int threejetswith30gev=0;
2050   /*  
2051 +  int twojetswith50gev=1;
2052 +  int electrons_only=0;
2053 +  int mu_only=1;
2054 +
2055    draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev);
2056    draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev);
2057    
# Line 2171 | Line 2173 | void save_template(string mcjzb, string
2173    configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n";
2174    configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n";
2175    configfile<<"DataPeakError="<<DataPeakError<<";\n\n";
2176 <  for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2176 >  for(int i=0;i<(int)jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2177    configfile<<"\n\n";
2178 <  for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2179 <  for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2180 <  for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2178 >  for(int i=0;i<(int)Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2179 >  for(int i=0;i<(int)Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2180 >  for(int i=0;i<(int)Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2181    configfile<<"\n\n";
2182 <  for(int i=0;i<flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2183 <  for(int i=0;i<flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2184 <  for(int i=0;i<flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2182 >  for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2183 >  for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2184 >  for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2185    configfile<<"\n\n";
2186    configfile<<"luminosity="<<luminosity<<";\n";
2187    configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n";
# Line 2205 | Line 2207 | void draw_all_ttbar_histos(TCanvas *can,
2207    float max=histos[0]->GetMaximum();
2208    if(manualmin>=0) min=manualmin;
2209    else {
2210 <    for(int i=1;i<histos.size();i++) {
2210 >    for(int i=1;i<(int)histos.size();i++) {
2211        float curmin=get_nonzero_minimum(histos[i]);
2212        float curmax=histos[i]->GetMaximum();
2213        if(curmin<min) min=curmin;
# Line 2216 | Line 2218 | void draw_all_ttbar_histos(TCanvas *can,
2218    histos[0]->Draw(drawoption.c_str());
2219    stringstream drawopt;
2220    drawopt << drawoption << ",same";
2221 <  for(int i=1;i<histos.size();i++) {
2221 >  for(int i=1;i<(int)histos.size();i++) {
2222      histos[i]->Draw(drawopt.str().c_str());
2223    }
2224   }
# Line 2510 | Line 2512 | void zjets_prediction_comparison() {
2512    hJZBpos->SetLineColor(kBlack);
2513    hJZBneg->SetLineColor(kRed);
2514    
2513  Int_t nbins = 5;
2514  Float_t xmax = 100.;
2515
2516  
2515    TCanvas *zcan = new TCanvas("zcan","zcan");  
2516    zcan->SetLogy(1);
2517  
# Line 2598 | Line 2596 | void make_table(samplecollection &coll,
2596    
2597    TCanvas *cannie = new TCanvas("cannie","cannie");
2598    
2599 <  for(int icut=0;icut<jzb_cuts.size();icut++) {
2599 >  for(int icut=0;icut<(int)jzb_cuts.size();icut++) {
2600      float currcut=jzb_cuts[icut];
2601      int nbins=1;float low=currcut;
2602      vector<int> mysample;
# Line 2657 | Line 2655 | void make_table(samplecollection &coll,
2655    //prediction part
2656    if(is_data) cout << "Data prediction & ";
2657    if(subselection!="none") cout << subselection << " prediction &";
2658 <  for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & ";
2658 >  for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & ";
2659    
2660    cout << endl;
2661    //observation part
2662    if(is_data) cout << "Data observation & ";
2663    if(subselection!="none") cout << subselection << " observation &";
2664 <  for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & ";
2664 >  for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & ";
2665    cout << endl;
2666    cout << "_________________________________________________________________" << endl;
2667    delete cannie;
# Line 2724 | Line 2722 | void JZBSelEff(string mcjzb, TTree* even
2722    leg->SetLineColor(kBlack);
2723    leg->SetTextFont(62);
2724  
2725 <  for ( int icut=0; icut<jzb_bins.size(); ++icut ) {
2725 >  for ( int icut=0; icut<(int)jzb_bins.size(); ++icut ) {
2726  
2727      ostringstream selection;
2728      selection << mcjzb << ">" << jzb_bins[icut];
# Line 2776 | Line 2774 | void JZBSelEff(string mcjzb, TTree* even
2774   // Calls the above function for each signal sample
2775   void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins )
2776   {  
2777 <  for (int isignal=0; isignal<signalsamples.collection.size();isignal++) {
2777 >  for (int isignal=0; isignal<(int)signalsamples.collection.size();isignal++) {
2778      dout << "JZB selection efficiency curve: " << std::endl;
2779      JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples
2780    }
# Line 2819 | Line 2817 | void qcd_plots(string datajzb, string mc
2817    TH1F *RcorrJZBSBeemm;
2818    TH1F *LcorrJZBSBeemm;
2819    
2820 <  TH1F *RcorrJZBeemmNoS;
2820 > //  TH1F *RcorrJZBeemmNoS;
2821  
2822      //these are for the ratio
2823    TH1F *JRcorrJZBeemm   = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
# Line 2950 | Line 2948 | void qcd_plots(string datajzb, string mc
2948    dout << "    Observation increases by : " << RcorrJZBeemm->Integral() << endl;
2949    
2950    dout << endl;
2951 <  for(int i=0;i<bins.size();i++) {
2951 >  for(int i=0;i<(int)bins.size();i++) {
2952      dout << " JZB > " << bins[i] << " : " << endl;
2953      dout << "    Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl;
2954      if(PlottingSetup::RestrictToMassPeak) {
# Line 2998 | Line 2996 | void check_ptsanity() {
2996    leg->SetY2(1.0);
2997    
2998    
2999 <  for(int isample=0;isample<allsamples.collection.size();isample++) {
2999 >  for(int isample=0;isample<(int)allsamples.collection.size();isample++) {
3000      string nowname=(allsamples.collection)[isample].filename;
3001      cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl;
3002      individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname));
# Line 3022 | Line 3020 | void check_ptsanity() {
3020    ptsancan->cd(2);
3021    fpt2->Draw();
3022  
3023 <  for(int isample=0;isample<allsamples.collection.size();isample++) {
3023 >  for(int isample=0;isample<(int)allsamples.collection.size();isample++) {
3024      ptsancan->cd(1);
3025      individualpt1histos[isample]->DrawNormalized("same,histo");
3026      ptsancan->cd(2);
# Line 3038 | Line 3036 | void check_ptsanity() {
3036   void do_mlls_plot(string mcjzb) {
3037    cout << "At this point we'd plot the mll distribution" << endl;
3038    TCanvas *sigcan = new TCanvas("sigcan","sigcan");
3039 <  for(int isig=0;isig<(signalsamples.collection).size();isig++) {
3039 >  for(int isig=0;isig<(int)(signalsamples.collection).size();isig++) {
3040      if(!(signalsamples.collection)[isig].events) continue;
3041      string nowname=(signalsamples.collection)[isig].filename;
3042      TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname));
# Line 3077 | Line 3075 | void met_vs_jzb_plots() {
3075    findme.push_back("TTJets");
3076    findme.push_back("LM");
3077    
3078 <  for(int ifind=0;ifind<findme.size();ifind++) {
3078 >  for(int ifind=0;ifind<(int)findme.size();ifind++) {
3079      vector<int> selsamples = allsamples.FindSample(findme[ifind]);
3080      TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100);
3081 <    for(int isel=0;isel<selsamples.size();isel++) {
3081 >    for(int isel=0;isel<(int)selsamples.size();isel++) {
3082        cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl;
3083        allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF);
3084      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines