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.30 by buchmann, Tue Jun 19 16:13:35 2012 UTC vs.
Revision 1.32 by buchmann, Fri Jun 29 15:01:28 2012 UTC

# Line 86 | Line 86 | void find_one_peak_combination(TCut spec
86  
87   void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb)
88   {
89 +  
90 +  bool DoInvidualeemmPeaks=false;
91 +  
92    float mcpeak, datapeak;
93    float mcpeakerr, datapeakerr;
94    
# Line 100 | Line 103 | void find_peaks(float &MCPeak,float &MCP
103    dout << "Finding global peak : " << endl;
104    find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma, dataSigma,result,doPUreweighting,"");
105    
106 <  dout << "Finding peak for electrons : " << endl;
107 <  find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr, dataeepeak,dataeepeakerr,mcSigma, dataSigma,result,doPUreweighting,"_ele");
108 <  dout << "Finding peak for muons : " << endl;
109 <  find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr, datammpeak,datammpeakerr,mcSigma, dataSigma,result,doPUreweighting,"_mu");
110 <  
111 <  datajzb << "(" << jzbvariabledata;
112 <  mcjzb << "(" << jzbvariablemc;
113 <  
114 <  if(dataeepeak>0) datajzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " ";
115 <  else datajzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " ";
116 <  
117 <  if(datammpeak>0) datajzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " ";
118 <  else datajzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " ";
119 <  
120 <  if(datapeak>0) datajzb << "- (id1!=id2)*" << TMath::Abs(datapeak) << " ";
121 <  else datajzb << "+ (id1!=id2)*" << TMath::Abs(datapeak) << " ";
122 <  
123 <  datajzb << ")";
124 <  
125 <  if(mceepeak>0) mcjzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " ";
126 <  else mcjzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " ";
127 <  
128 <  if(mcmmpeak>0) mcjzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " ";
129 <  else mcjzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " ";
130 <  
131 <  if(mcpeak>0) mcjzb << "- (id1!=id2)*" << TMath::Abs(mcpeak) << " ";
132 <  else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " ";
133 <  
134 <  mcjzb << ")";
106 >  if(DoInvidualeemmPeaks) {
107 >    dout << "Finding peak for electrons : " << endl;
108 >    find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr, dataeepeak,dataeepeakerr,mcSigma, dataSigma,result,doPUreweighting,"_ele");
109 >    dout << "Finding peak for muons : " << endl;
110 >    find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr, datammpeak,datammpeakerr,mcSigma, dataSigma,result,doPUreweighting,"_mu");
111 >    
112 >    datajzb << "(" << jzbvariabledata;
113 >    mcjzb << "(" << jzbvariablemc;
114 >    
115 >    if(dataeepeak>0) datajzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " ";
116 >    else datajzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " ";
117 >    
118 >    if(datammpeak>0) datajzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " ";
119 >    else datajzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " ";
120 >    
121 >    if(datapeak>0) datajzb << "- (id1!=id2)*" << TMath::Abs(datapeak) << " ";
122 >    else datajzb << "+ (id1!=id2)*" << TMath::Abs(datapeak) << " ";
123 >    
124 >    datajzb << ")";
125 >    
126 >    if(mceepeak>0) mcjzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " ";
127 >    else mcjzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " ";
128 >    
129 >    if(mcmmpeak>0) mcjzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " ";
130 >    else mcjzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " ";
131 >    
132 >    if(mcpeak>0) mcjzb << "- (id1!=id2)*" << TMath::Abs(mcpeak) << " ";
133 >    else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " ";
134 >    
135 >    mcjzb << ")";
136 >  } else {
137 >    datajzb << "(" << jzbvariabledata;
138 >    mcjzb << "(" << jzbvariablemc;
139 >    
140 >    if(datapeak>0) datajzb << "- " << TMath::Abs(datapeak) << " ";
141 >    else datajzb << "+ " << TMath::Abs(datapeak) << " ";
142 >    
143 >    datajzb << ")";
144 >    
145 >    if(mcpeak>0) mcjzb << "- " << TMath::Abs(mcpeak) << " ";
146 >    else mcjzb << "+ " << TMath::Abs(mcpeak) << " ";
147 >    
148 >    mcjzb << ")";
149 >  }
150 >    
151    
152   }
153  
# Line 1290 | Line 1309 | void do_prediction_plot(string jzb, TCan
1309      }
1310    }
1311    
1312 +  TFile *f = new TFile("tester.root","RECREATE");
1313 +  RcorrJZBeemm->Write();
1314 +  Bpred->Write();
1315 +  f->Close();
1316 +  
1317    delete RcorrJZBeemm;
1318    delete LcorrJZBeemm;
1319    delete RcorrJZBem;
# Line 2144 | Line 2168 | void draw_ttbar_and_zjets_shape(string m
2168    draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true);
2169   }
2170  
2171 < float find_one_correction_factor(string FindKeyword, TCut SpecialCut, string SaveAs) {
2171 > float find_one_correction_factor(string FindKeyword, bool dodata, TCut SpecialCut, string SaveAs) {
2172    TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction");
2173    cancorr->SetLogz();
2174    cancorr->SetRightMargin(0.13);
# Line 2153 | Line 2177 | float find_one_correction_factor(string
2177    TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5);
2178    vector<int> SampleIndices=allsamples.FindSample(FindKeyword);
2179    for(int iSample=0;iSample<SampleIndices.size();iSample++) {
2180 +    if((allsamples.collection)[SampleIndices[iSample]].is_data && !dodata) continue;
2181 +    if((allsamples.collection)[SampleIndices[iSample]].is_data ==false && dodata) continue;
2182 +    
2183      dout << "   Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl;
2184      (allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",zptforresponsepresentation*cutWeight);
2185    }
# Line 2190 | Line 2217 | void find_correction_factors(string &jzb
2217    
2218    dout << "Computing response corrections: " << endl;
2219    //Step 1 : Get results
2220 <  float datacorrection=find_one_correction_factor("Data","","Data");
2221 <  float mccorrection=find_one_correction_factor("DY","","MC");
2220 >  float datacorrection=find_one_correction_factor("Data",true,"","Data");
2221 >  float mccorrection=find_one_correction_factor("DY",false,"","MC");
2222    
2223 <  float dataEEcorrection=find_one_correction_factor("Data","id1==0","Data_ee");
2224 <  float mcEEcorrection=find_one_correction_factor("DY","id1==0","MC_ee");
2223 >  float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee");
2224 >  float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee");
2225    
2226 <  float dataMMcorrection=find_one_correction_factor("Data","id1==1","Data_mm");
2227 <  float mcMMcorrection=find_one_correction_factor("DY","id1==1","MC_mm");
2226 >  float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm");
2227 >  float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm");
2228    
2229    cout << "Corrections : " << endl;
2230    cout << "   Data : " << datacorrection << endl;
# Line 2337 | Line 2364 | void ttbar_sidebands_comparison(string m
2364    //in the case of the on peak analysis, we compare the 3 control regions to the real value
2365    //in the case of the OFF peak analysis, we compare our control region to the real value
2366    TCut weightbackup=cutWeight;
2367 < //  cutWeight="1.0";
2367 >  cutWeight="1.0";
2368    float simulatedlumi = luminosity; //in pb please - adjust to your likings
2342  
2369  
2370    TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2371    TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
# Line 2377 | Line 2403 | void ttbar_sidebands_comparison(string m
2403    }
2404    
2405    vector<TH1F*> histos;
2406 +  TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2407 +  TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2408    histos.push_back(TZem);
2409    histos.push_back(TZeemm);
2410    if(PlottingSetup::RestrictToMassPeak) {
2411 +    TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2412 +    TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2413      histos.push_back(TSem);
2414      histos.push_back(TSeemm);
2415    }
# Line 2566 | Line 2596 | void ttbar_sidebands_comparison(string m
2596  
2597   void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) {
2598    vector<float> nicer_binning;
2599 <  nicer_binning.push_back(-125);
2599 >  
2600 >  nicer_binning.push_back(-400);
2601 >  nicer_binning.push_back(-250);
2602 >  nicer_binning.push_back(-200);
2603 >  nicer_binning.push_back(-150);
2604 >  nicer_binning.push_back(-100);
2605 >  nicer_binning.push_back(-50);
2606 >  nicer_binning.push_back(-20);
2607 >  
2608 >  nicer_binning.push_back(0);
2609 >  nicer_binning.push_back(20);
2610 >  nicer_binning.push_back(50);
2611 >  nicer_binning.push_back(100);
2612 >  nicer_binning.push_back(150);
2613 >  nicer_binning.push_back(200);
2614 >  nicer_binning.push_back(250);
2615 >  nicer_binning.push_back(400);
2616 >  /*
2617    nicer_binning.push_back(-100);
2571  nicer_binning.push_back(-75);
2618    nicer_binning.push_back(-50);
2619    nicer_binning.push_back(-25);
2620    nicer_binning.push_back(0);
# Line 2583 | Line 2629 | void ttbar_sidebands_comparison(string m
2629    nicer_binning.push_back(230);
2630    nicer_binning.push_back(280);
2631    nicer_binning.push_back(400);
2632 +  */
2633    ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/");
2634   }
2635  
# Line 2604 | Line 2651 | void zjets_prediction_comparison(string
2651  
2652    string mcjzb = mcjzbnoPU.str();
2653    dout << "The peak corrected JZB expression for MC without pileup is : " <<  mcjzb << endl;
2607
2608  cutWeight="1.0";
2654   */
2655 +  cutWeight="1.0";
2656 +
2657    string mcjzb = mcjzbWithPU; // this is with PURW, if you want without it you have to uncomment the part above (and comment out this line)
2658    
2659    vector<float> binning;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines