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.20 by buchmann, Wed May 23 16:02:03 2012 UTC vs.
Revision 1.23 by buchmann, Thu Jun 7 08:16:28 2012 UTC

# Line 35 | Line 35 | void find_peaks(float &MCPeak,float &MCP
35    // Temporarily switch off PU reweighting, if asked
36    TCut weightbackup=cutWeight;
37    if ( !doPUreweighting ) cutWeight="1.0";
38 <
38 >  
39    TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations");
40    TH1F *rawJZBeemmMC      = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity);
41    TH1F *rawJZBeemmData    = allsamples.Draw("rawJZBeemmData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity);
# Line 269 | Line 269 | void make_kin_plot(string variable, stri
269    TCut cut;
270    cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut;
271    if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut;
272 +  if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut;
273    if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF;
274    if(filename=="mll") {
275          cut=cutOSSF&&cutnJets&&ibasiccut;
# Line 296 | Line 297 | void make_kin_plot(string variable, stri
297    THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity);
298    if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum());
299    if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum());
300 <  if(filename=="mll_inclusive") datahisto->SetMinimum(1);
300 >  if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1);
301    if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum());
302    if(filename=="mll_osof") datahisto->SetMinimum(9);
302
303    datahisto->SetMaximum(5.3*datahisto->GetMaximum());
304    datahisto->Draw("e1");
305    ckin->Update();
# 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",doPF,true);
446    make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
447    make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
448 <  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)((mll_hi-mll_low))/2,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
449    make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
450    make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF);
451 <  make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
452 <  make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
451 > //  make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
452 > //  make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
453    make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF);
454    make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF);
455    make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF);
456    make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF);
457    make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF);
458 <  make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF);
459 <  make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
458 >  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF);
459 >  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
460 >  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
461    if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
462    stringstream jzbcut;
463    jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))";
# Line 933 | Line 934 | void do_prediction_plot(string jzb, TCan
934      
935    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
936    TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred");
937 +    
938 +  TH1F *BpredSys = (TH1F*)LcorrJZBeemm->Clone("Bpredsys");
939 +  ClearHisto(BpredSys);
940 +    write_error(__FUNCTION__,"Implemented systematic error but NOT drawing it yet. Need to still implement drawing, particularly in ratio.");
941 +    
942    if(PlottingSetup::RestrictToMassPeak) {
943      Bpred->Add(RcorrJZBem,1.0/3.);
944      Bpred->Add(LcorrJZBem,-1.0/3.);
# Line 955 | Line 961 | void do_prediction_plot(string jzb, TCan
961      JBpred->Add(JLcorrJZBSBem,-1.0/3.);
962      JBpred->Add(JRcorrJZBSBeemm,1.0/3.);
963      JBpred->Add(JLcorrJZBSBeemm,-1.0/3.);
964 +      
965 +    //Systematics:
966 +    AddSquared(BpredSys,LcorrJZBeemm,zjetsestimateuncertONPEAK*zjetsestimateuncertONPEAK);
967 +    AddSquared(BpredSys,RcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9));
968 +    AddSquared(BpredSys,LcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9));
969 +    AddSquared(BpredSys,RcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9));
970 +    AddSquared(BpredSys,LcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9));
971 +    AddSquared(BpredSys,RcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9));
972 +    AddSquared(BpredSys,LcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9));
973    } else {
974      Bpred->Add(RcorrJZBem,1.0);
975      Bpred->Add(LcorrJZBem,-1.0);
# Line 964 | Line 979 | void do_prediction_plot(string jzb, TCan
979      //these are for the ratio
980      JBpred->Add(JRcorrJZBem,1.0);
981      JBpred->Add(JLcorrJZBem,-1.0);
982 +      
983 +    //Systematics
984 +    AddSquared(BpredSys,LcorrJZBeemm,zjetsestimateuncertOFFPEAK*zjetsestimateuncertOFFPEAK);
985 +    AddSquared(BpredSys,RcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK);
986 +    AddSquared(BpredSys,LcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK);
987 +
988    }
989      
990 <  
990 >  SQRT(BpredSys);
991 >
992    
993    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed
994    TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred");
# Line 2100 | Line 2122 | void find_correction_factors(string &jzb
2122    CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_Data");
2123    
2124    TH2F *niceresponseplotm = new TH2F("niceresponseplotm","",100,0,600,100,0,5);
2125 <  (allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation);
2125 >  (allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation*cutWeight);
2126    niceresponseplotm->SetStats(0);
2127    niceresponseplotm->GetXaxis()->SetTitle("Z p_{T} [GeV]");
2128    niceresponseplotm->GetYaxis()->SetTitle("Response");
# Line 2184 | Line 2206 | void save_template(string mcjzb, string
2206    configfile<<"\n\n";
2207    for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2208    for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2209 <  for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n\n";
2209 >  for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2210    for(int i=0;i<(int)jzb_shape_limit_bins.size();i++) configfile<<"jzb_shape_limit_bins.push_back("<<jzb_shape_limit_bins[i]<<"); // JZB shape bin boundary at " << jzb_shape_limit_bins[i] << "\n";
2211    configfile<<"\n\n";
2212    configfile<<"\n\n";
# Line 2232 | Line 2254 | void ttbar_sidebands_comparison(string m
2254    //in the case of the on peak analysis, we compare the 3 control regions to the real value
2255    //in the case of the OFF peak analysis, we compare our control region to the real value
2256    TCut weightbackup=cutWeight;
2257 <  cutWeight="1.0";
2257 > //  cutWeight="1.0";
2258    float simulatedlumi = luminosity; //in pb please - adjust to your likings
2259    
2260  
# Line 2290 | Line 2312 | void ttbar_sidebands_comparison(string m
2312    leg->Draw("same");
2313    DrawMCPrelim(simulatedlumi);
2314    CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison");
2293 cout << __LINE__ << endl;  
2315    TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy");
2295 cout << __LINE__ << endl;  
2316    TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy");
2297 cout << __LINE__ << endl;  
2317    TH1F *TSeemmcopy;
2318    TH1F *TSemcopy;
2319    if(PlottingSetup::RestrictToMassPeak) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines