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.26 by buchmann, Mon Mar 18 16:05:04 2013 UTC vs.
Revision 1.27 by buchmann, Mon Apr 15 16:46:02 2013 UTC

# Line 369 | Line 369 | void DrawEvilCutFlow() {
369  
370   void draw_Zb_kin_vars() {
371    
372 <   draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Z p_{T}","Official/Zpt",0);
372 >   draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Z p_{T}","Official/Zpt",1);
373     draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Z p_{T}","Official/Zpt_ee",1);
374     draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Z p_{T}","Official/Zpt_mm",1);
375     draw_kin_variable("pt",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Z p_{T}","Official/Zpt__nonBtagged",1);
# Line 457 | Line 457 | void make_RooFit(string ContainerName, T
457    string saveasFinal = saveas + "_Fit";
458    fcan->cd() ; gPad->SetLeftMargin(0.15) ; frame->GetYaxis()->SetTitleOffset(1.4) ; frame2->Draw();
459    
460 <  if(h->GetName()=="hdata") DrawPrelim();
460 >  if(Contains(saveas,"_data")) DrawPrelim();
461    else DrawMCPrelim();
462  
463    CompleteSave(fcan, ContainerName+"/Fit/"+saveasFinal);
# Line 468 | Line 468 | void make_RooFit(string ContainerName, T
468    delete thePeak;
469   }
470  
471 + //float bother=0.1;
472   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) {
473 < //  write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(3.1415,1.010101);
473 >  
474 > //  bother+=0.1;write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(bother*3.1415,bother*1.010101);
475    TCanvas *cn = new TCanvas("cn","cn");
476    string varname="MPF";
477    
478 +  if(a2<15.0/pt2 && a1>0) dout << "this bin ( " << a1 << " < alpha < " << a2 <<" and " << pt1 << " < p_{T}^{Z} < " << pt2 <<" ) is not expected to do a lot." << endl;
479 +  //note that "15.0" here is the subleading jet cut.
480 +  
481    bool DoFit=false;
482    bool UseFit=false;
483    bool DoRooFit=false;
# Line 481 | Line 486 | Value get_Zb_data_over_mc(string Contain
486    if(Contains(variable,"pfJetGood")) varname="R_{abs}";
487   //  TH1F *hdata  = allsamples.Draw("hdata",variable,1200,0,30, varname, "events",  cut,data,luminosity);
488   //  TH1F *hmc    = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc,  luminosity);
489 <  TH1F *hdata, hmc;
489 >  TH1F *hdata, *hmc;
490    if(!DoRooFit) {
491      hdata = allsamples.Draw("hdata",variable,1200,ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary, varname, "events",  cut,data,luminosity); // making it more precise
492      hmc    = allsamples.Draw("hmc" , variable,1200,ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary, varname, "events", cut, mc,  luminosity); // making it more precise
493 +  } else {
494 +    hdata  = allsamples.Draw("hdata",variable,7200,0.0,6.0, varname, "events",  cut,data,luminosity); // making it more precise
495 +    hmc    = allsamples.Draw("hmc" , variable,7200,0.0,6.0, varname, "events", cut, mc,  luminosity); // making it more precise
496    }
497    
498    hmc->SetLineColor(kBlue);
# Line 510 | Line 518 | Value get_Zb_data_over_mc(string Contain
518      hmc->Fit(gaus_mc);
519    }
520    if(DoRooFit) {
521 <    hdata  = allsamples.Draw("hdata",variable,7200,0.0,6.0, varname, "events",  cut,data,luminosity); // making it more precise
514 <    hmc    = allsamples.Draw("hmc" , variable,7200,0.0,6.0, varname, "events", cut, mc,  luminosity); // making it more precise
521 >    
522        if(hdata->Integral()>10) {
523          make_RooFit(ContainerName, hdata, a, da, saveas+"_data");
524          make_RooFit(ContainerName, hmc, b, db, saveas+"_mc");
# Line 712 | Line 719 | ZbResultContainer new_data_mc_agreement_
719        RABS_Results[ia][ipt]=RABS_data_over_mc.getValue();
720        RABS_Errors[ia][ipt]=RABS_data_over_mc.getError();
721        
722 <      dout << "alpha cut at " << alphacuts[ia+1] << " and pt range " << ptcuts[ipt] << " , " << ptcuts[ipt+1] << " \t : \t" << specialcut.str() << " \t \t --> " << MPF_data_over_mc << " (MPF) " << RABS_data_over_mc << " (RABS)" << endl;
722 >      dout << "alpha in [" << alow << " , " << ahigh << " and pt range [" << ptcuts[ipt] << " , " << ptcuts[ipt+1] << "] \t : \t" << specialcut.str() << " \t \t --> " << MPF_data_over_mc << " (MPF) " << RABS_data_over_mc << " (RABS)" << endl;
723      }
724    }
725    
# Line 734 | Line 741 | ZbResultContainer new_data_mc_agreement_
741      dout << "Going to create histo for " << filename.str() << endl;
742      TGraphErrors *mpf_gr =new TGraphErrors();
743      TGraphErrors *rabs_gr =new TGraphErrors();
744 +    mpf_gr->SetName("MPF_Graph");
745 +    rabs_gr->SetName("Rabs_Graph");
746      
747      int rabs_counter=0;
748      int mpf_counter=0;
# Line 779 | Line 788 | ZbResultContainer new_data_mc_agreement_
788        mpf_gr->SetMarkerColor(kBlue);
789        mpf_gr->Draw("AP");
790        
791 <      TF1 *mpf_pol = new TF1("mpf_pol","[0]+[1]*x",ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary);
791 >      TF1 *mpf_pol = new TF1("mpf_pol","[0]+[1]*x",0.0,0.4);
792        
793        mpf_gr->Fit(mpf_pol,"E"); // better error estimation using MINOS (E), quiet (Q) and using loglikelihood method
794 +      mpf_band = getBand(mpf_pol,"MPF_band");
795        mpf_gr->GetXaxis()->SetTitle("#alpha");
796        mpf_gr->GetXaxis()->CenterTitle();
797        mpf_gr->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
798        mpf_gr->GetYaxis()->CenterTitle();
799 <      //TF1 *mpf_pol=(TF1*)mpf_gr->GetFunction("pol1");
790 <      mpf_band = getBand(mpf_pol,"MPF_band");
799 >      mpf_band->SetMarkerSize(0);
800        mpf_pol->SetLineWidth(0);
801 +      mpf_pol->SetLineColor(mpf_band->GetFillColor());
802        TF1 *mpf_pol_complete = new TF1("mpf_pol_complete","[0]+[1]*x");
803        mpf_pol_complete->SetParameters(mpf_pol->GetParameters());
804 +      
805        mpf_pol_complete->SetLineWidth(1);
806        mpf_pol_complete->SetLineColor(kBlue);
807        
# Line 843 | Line 854 | ZbResultContainer new_data_mc_agreement_
854        CompleteSave(can,ContainerName+"/"+filename.str());
855        dout << "MPF : " << mpf_a << " + " << mpf_b << " * alpha " << endl;
856        
857 +      
858 +      TFile *sout = new TFile("sout.root","RECREATE");
859 +      histo->Write();
860 +      mpf_gr->Write();
861 +      mpf_band->Write();
862 +      mpf_pol_complete->Write();
863 +      sout->Close();
864 +      
865        filename.str("");
866        
867 <      TF1 *rabs_pol = new TF1("rabs_pol","[0]+[1]*x",ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary);
867 >      TF1 *rabs_pol = new TF1("rabs_pol","[0]+[1]*x",0.0,0.4);
868 >      rabs_gr->Fit(rabs_pol,"E");
869 >      rabs_band = getBand(rabs_pol,"Rabs_band");
870 >      rabs_pol->SetLineColor(rabs_band->GetFillColor());
871        rabs_gr->SetMarkerStyle(21);
872        rabs_gr->SetMarkerColor(kRed);
873        rabs_gr->Draw("AP");
874        //rabs_gr->Fit("pol1","E");
875 <      rabs_gr->Fit(rabs_pol,"E");
854 <      rabs_band = getBand(rabs_pol,"Rabs_band");
875 >      rabs_band->SetMarkerSize(0);
876        
877        
878        rabs_gr->GetXaxis()->SetTitle("#alpha");
# Line 870 | Line 891 | ZbResultContainer new_data_mc_agreement_
891        //TPolyLine *rabs_fit_uncert = GetFitUncertaintyShape(rabs_gr, "pol1", min, max,0.0,0.4);
892        rabs_pol->SetLineColor(TColor::GetColor("#F99C9C"));
893        rabs_pol->SetFillColor(TColor::GetColor("#F99C9C"));
894 <      rabs_band->SetLineColor(TColor::GetColor("#F99C9C"));
894 > //      rabs_band->SetLineColor(TColor::GetColor("#F99C9C"));
895        rabs_band->SetFillColor(TColor::GetColor("#F99C9C"));
896        //rabs_fit_uncert->SetLineColor(TColor::GetColor("#F99C9C"));
897        //rabs_fit_uncert->SetFillColor(TColor::GetColor("#F99C9C"));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines