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.3 by buchmann, Thu Jul 12 12:53:41 2012 UTC vs.
Revision 1.5 by buchmann, Wed Aug 15 13:52:13 2012 UTC

# Line 24 | Line 24 | namespace ZbData {
24   vector<float> data_over_mc;
25  
26   TCut ZplusBsel("pt1>20&&pt2>20&&mll>60&&mll<120");
27 < TCut LeadingB("bTagProbCSVBP[0]>0.679");
28 < TCut EtaB("abs(pfJetGoodEta[0])<1.3");
29 < TCut PhiZcut("pfJetDphiZ[0]>2.7");
27 > TCut LeadingB("Zb30_bTagProbCSVBP[0]>0.679");
28 > TCut EtaB("abs(Zb30_pfJetGoodEta[0])<1.3");
29 > TCut PhiZcut("Zb30_pfJetDphiZ[0]>2.7");
30    
31   }
32  
# Line 170 | Line 170 | void data_mc_agreement_2d() {
170  
171   void print_all_b_yields() {
172    cout << "Basic selection with a b jet" << endl;
173 <  print_yield(ZplusBsel&&"pfJetGoodNumBtag>0");
173 >  print_yield(ZplusBsel&&"Zb30_pfJetGoodNumBtag>0");
174    cout << "Leading jet is a b-jet " << endl;
175    print_yield(ZplusBsel&&LeadingB);
176    cout << "|#eta_{b}|<1.3 " << endl;
# Line 180 | Line 180 | void print_all_b_yields() {
180    cout << "10<ptZ<1000 GeV" << endl;
181    print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000");
182    cout << "#alpha < 0.3" << endl;
183 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.3");
183 >  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.3");
184    cout << "#alpha < 0.2" << endl;
185 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.2");
185 >  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.2");
186    cout << "#alpha < 0.15" << endl;
187 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.15");
187 >  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.15");
188    cout << "#alpha < 0.1" << endl;
189 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.1");
189 >  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.1");
190    cout << "#alpha < 0.05" << endl;
191 <  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.05");
191 >  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.05");
192   }  
193  
194   void draw_Zb_kin_vars() {
195 <  draw_kin_variable("pfBJetDphiZ",ZplusBsel&&LeadingB,100,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",1);
195 >  draw_kin_variable("Zb30_pfBJetDphiZ",ZplusBsel&&LeadingB,100,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",1);
196    draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Z p_{T}","Zpt",1);
197 <  draw_kin_variable("pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Sub-Leading Jet Pt","Jet2Pt",1);
198 <  draw_kin_variable("pfJetGoodPtlBtag[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Leading Jet Pt (B)","LeadingJetPt",1);
199 <  draw_kin_variable("alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"#alpha","alpha",1);
197 >  draw_kin_variable("Zb30_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Sub-Leading Jet Pt","Jet2Pt",1);
198 >  draw_kin_variable("Zb30_pfJetGoodPtlBtag[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Leading Jet Pt (B)","LeadingJetPt",1);
199 >  draw_kin_variable("Zb30_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"#alpha","alpha",1);
200   }
201  
202   void draw_mpf_vars() {
203    ZbData::data_over_mc.clear();
204 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.3",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
205 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.2",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV");
206 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.15",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV");
207 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.1",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV");
208 <  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.05",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
209 <  
210 <  draw_kin_variable("pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.3",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
211 <  draw_kin_variable("pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.2",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV");
212 <  draw_kin_variable("pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.15",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV");
213 <  draw_kin_variable("pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.1",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV");
214 <  draw_kin_variable("pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.05",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
204 >  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.3",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
205 >  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.2",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV");
206 >  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.15",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV");
207 >  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.1",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV");
208 >  draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.05",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
209 >  
210 >  draw_kin_variable("Zb30_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.3",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
211 >  draw_kin_variable("Zb30_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.2",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV");
212 >  draw_kin_variable("Zb30_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.15",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV");
213 >  draw_kin_variable("Zb30_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.1",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV");
214 >  draw_kin_variable("Zb30_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.05",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
215   }  
216  
217   Value get_Zb_data_over_mc(string variable, TCut cut) {
# Line 238 | Line 238 | void new_data_mc_agreement_2d() {
238    
239    const int nalphacuts=5;
240    float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3};
241 +  int PointThree=-1;
242 +  for(int i=0;i<nalphacuts;i++) {
243 +    if((alphacuts[i]-0.3)<0.01) PointThree=i;
244 +  }
245 +  if(PointThree<0) {
246 +    write_warning(__FUNCTION__,"alpha=0.3 MUST BE ONE OF THE ALPHA VALUES!");
247 +    assert(PointThree<0);
248 +  }
249 +  
250    const int nptcuts=5;
251    float ptcuts[nptcuts]={10,50,100,200,1000};
252    
# Line 252 | Line 261 | void new_data_mc_agreement_2d() {
261        stringstream specialcut;
262        specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (alpha<" << alphacuts[ia] << "))";
263        Value MPF_data_over_mc = get_Zb_data_over_mc("mpf",TCut(basecut && specialcut.str().c_str()));
264 <      Value RABS_data_over_mc = get_Zb_data_over_mc("pfJetGoodPt[0]/pt",TCut(basecut && specialcut.str().c_str()));
264 >      Value RABS_data_over_mc = get_Zb_data_over_mc("Zb30_pfJetGoodPt[0]/pt",TCut(basecut && specialcut.str().c_str()));
265        
266        MPF_Results[ia][ipt]=MPF_data_over_mc.getValue();
267        MPF_Errors[ia][ipt]=MPF_data_over_mc.getError();
# Line 271 | Line 280 | void new_data_mc_agreement_2d() {
280    
281    TGraphErrors *MPF_FinalGraph = new TGraphErrors();
282    TGraphErrors *RABS_FinalGraph = new TGraphErrors();
283 +  TGraphErrors *FaceValueAtPoint3 = new TGraphErrors();
284    
285    for(int ipt=0;ipt<nptcuts-1;ipt++) {
286      
# Line 285 | Line 295 | void new_data_mc_agreement_2d() {
295        rabs_gr->SetPoint(ia,alphacuts[ia],RABS_Results[ia][ipt]);
296        rabs_gr->SetPointError(ia,0,RABS_Errors[ia][ipt]);
297      }
298 +    FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1]),MPF_Results[PointThree][ipt]);
299 +    FaceValueAtPoint3->SetPointError(ipt,0,MPF_Errors[PointThree][ipt]);
300      
301      mpf_gr->SetMarkerStyle(21);
302      mpf_gr->SetMarkerColor(kBlue);
# Line 374 | Line 386 | void new_data_mc_agreement_2d() {
386    rmpf_final_mark->SetTextSize(0.03);
387    rmpf_final_mark->Draw();
388    DrawPrelim();
389 +  float MPFResult=1/mpf_pol0->GetParameter(0);
390 +  float MPFResultError=mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0));
391    
392    stringstream filename2;
393    filename2 << "Extrapolation/FINAL_RESULT_MPF";
# Line 400 | Line 414 | void new_data_mc_agreement_2d() {
414    rabs_final_mark->Draw();
415    DrawPrelim();
416    
417 +  float RabsResult=1/rabs_pol0->GetParameter(0);
418 +  float RabsResultError=rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0));
419 +  
420 +  filename2.str("");
421 +  filename2 << "Extrapolation/FINAL_RESULT_RABS";
422 +  CompleteSave(can,filename2.str());
423 +  
424 +  
425 +  TCanvas *FaceValueCanvas = new TCanvas("FaceValueCanvas","FaceValueCanvas");
426 +  FaceValueAtPoint3->SetMarkerStyle(21);
427 +  FaceValueAtPoint3->SetMarkerStyle(21);
428 +  FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos
429 +  FaceValueAtPoint3->Draw("AP");
430 +  FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}");
431 +  FaceValueAtPoint3->GetXaxis()->CenterTitle();
432 +  FaceValueAtPoint3->GetYaxis()->SetTitle("data/mc for #alpha<0.3");
433 +  FaceValueAtPoint3->GetYaxis()->CenterTitle();
434 +  FaceValueAtPoint3->Draw("AP");
435 +  TF1 *faceval_pol0=(TF1*)FaceValueAtPoint3->GetFunction("pol0");
436 +  stringstream faceval_result;
437 +  faceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0)) << "}{ (MPF at #alpha<0.3)}";;
438 +  TText *faceval_final_mark = write_title(faceval_result.str());
439 +  faceval_final_mark->SetX(0.75);
440 +  faceval_final_mark->SetY(0.75);
441 +  faceval_final_mark->SetTextSize(0.03);
442 +  faceval_final_mark->Draw();
443 +  DrawPrelim();
444 +  
445 +  float FaceValResult=1/faceval_pol0->GetParameter(0);
446 +  float FaceValResultError=faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0));
447 +  
448    filename2.str("");
449    filename2 << "Extrapolation/FINAL_RESULT_RABS";
450    CompleteSave(can,filename2.str());
451    
452 +  cout << "FINAL RESULTS: " << endl;
453 +  cout << "MPF : " << MPFResult  << " +/- " << MPFResultError  << endl;
454 +  cout << "Rabs: " << RabsResult << " +/- " << RabsResultError << endl;
455 +  cout << "Face value at 0.3 :" << FaceValResult << " +/- " << FaceValResultError << endl;
456    
457    delete can;
458    
# Line 417 | Line 466 | void do_basic_ZB_analysis() {
466    write_warning(__FUNCTION__,"TESTING NEW DATA MC AGREEMENT");
467    
468    /*
420  write_warning(__FUNCTION__,"Not doing b yields (already implemented)");
469   //  print_all_b_yields();
422  write_warning(__FUNCTION__,"Not drawing mpf variables (already implemented)");
470   //  draw_mpf_vars();
424  write_warning(__FUNCTION__,"Not drawing mpf variables (already implemented)");
471    draw_Zb_kin_vars();
472    
473    data_mc_agreement_2d();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines