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.21 by buchmann, Thu Jan 17 21:58:22 2013 UTC vs.
Revision 1.23 by buchmann, Thu Jan 24 08:17:53 2013 UTC

# Line 1 | Line 1
1   #include <iostream>
2   #include <vector>
3   #include <sys/stat.h>
4 + #include <math.h>
5  
6   #include <TCut.h>
7   #include <TROOT.h>
# Line 408 | Line 409 | Value get_Zb_data_over_mc(string Contain
409    }
410    
411    cn->cd();
412 <  hdata->GetYaxis()->SetTitle("events / 0.1");
412 >  hdata->Rebin(0.05*1200/(1.5-0.5));
413 >  hmc->Rebin(0.05*1200/(1.5-0.5));
414 >  hdata->GetYaxis()->SetTitle("events / 0.05");
415    hdata->SetMarkerColor(kRed);
416    if(DoFit) {
417      gaus_mc->SetLineColor(kBlue);
# Line 418 | Line 421 | Value get_Zb_data_over_mc(string Contain
421    hdata->GetXaxis()->SetRangeUser(0,2);
422    hdata->GetYaxis()->SetTitleOffset(1.3);
423    hdata->Draw("e1");
424 +  
425 +  hmc->Scale(hdata->Integral()/hmc->Integral());
426 +  if(hmc->GetMaximum()>hdata->GetMaximum()) hdata->SetMaximum((hmc->GetMaximum()+sqrt((double)hmc->GetMaximum()))*1.2);
427 +  
428    hmc->Draw("histo,same");
429    hdata->Draw("e1,same");
430    if(DoFit) {
# Line 518 | Line 525 | void DeterminePurity(TCut basecut, int n
525    DeleteStack(mcm);
526   }
527  
528 + string NiceAlphaPrint(float alpha) {
529 +  //get in : 0.3, return 0p3 ...
530 +  stringstream res;
531 +  res << int(alpha) << "p" << int(100*alpha);
532 +  return res.str();
533 + }
534  
535   ZbResultContainer new_data_mc_agreement_2d(bool gofast, string AlphaVariable, string ContainerName, TCut BTagCut, TCut BTagWgt, float FaceValueToBeTakenAt) {
536    
# Line 560 | Line 573 | ZbResultContainer new_data_mc_agreement_
573          ahigh=alphacuts[ia];
574        }
575        cout << specialcut.str() << endl;
576 <      Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia]), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh);
577 <      Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"ZbCHS3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia]), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh);
576 >      Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(NiceAlphaPrint(alphacuts[ia])), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh);
577 >      Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"ZbCHS3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(NiceAlphaPrint(alphacuts[ia])), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh);
578        
579        MPF_Results[ia][ipt]=MPF_data_over_mc.getValue();
580        MPF_Errors[ia][ipt]=MPF_data_over_mc.getError();
# Line 1009 | Line 1022 | void ScenarioComparison() {
1022      }
1023      
1024      
1025 +    gStyle->SetOptFit(0);
1026      gr[i]->SetTitle();
1027      gr[i]->GetXaxis()->SetTitle("N(Vtx)");
1028      gr[i]->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
# Line 1344 | Line 1358 | void TEST_GetNumberEventsInsideOutsideAl
1358   }
1359    
1360  
1361 <
1361 > void MetSpectrumDepletionIllustration(int isdata) {
1362 >  
1363 >  TCanvas *can = new TCanvas("can","can");
1364 >  TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
1365 >  
1366 >  cutWeight=STDWEIGHT*TCut("ZbCHS3010_BTagWgtTUp*(1.0)*(ZbCHS3010_bTagProbCSVBP[0]>0.898)");
1367 >  TH1F *standard  = allsamples.Draw("standard","met[1]",80,0,400, "MET [GeV]", "events", basecut,isdata,luminosity);
1368 >  
1369 >  cutWeight=STDWEIGHT*TCut("ZbCHS3010_BTagWgtTUp*(1.0*softMuon)*(ZbCHS3010_bTagProbCSVBP[0]>0.898)");
1370 >  TH1F *Neutrinos  = allsamples.Draw("Neutrinos","met[1]",80,0,400, "MET [GeV]", "events", basecut,isdata,luminosity);
1371 >  
1372 >  cutWeight=STDWEIGHT*TCut("ZbCHS3010_BTagWgtTUp*(1.0*(1.0-softMuon))*(ZbCHS3010_bTagProbCSVBP[0]>0.898)");
1373 >  TH1F *NoNeutrinos  = allsamples.Draw("NoNeutrinos","met[1]",80,0,400, "MET [GeV]", "events", basecut,isdata,luminosity);
1374 >  
1375 >  standard->Scale(1.0/standard->Integral());
1376 >  Neutrinos->Scale(1.0/Neutrinos->Integral());
1377 >  NoNeutrinos->Scale(1.0/NoNeutrinos->Integral());
1378 >  
1379 >  Neutrinos->SetLineColor(kGreen);
1380 >  NoNeutrinos->SetLineColor(kRed);
1381 >  
1382 >  can->SetLogy(1);
1383 >  TLegend *leg = make_legend();
1384 >  leg->AddEntry(standard,"Standard sample","ep");
1385 >  leg->AddEntry(Neutrinos,"#nu enriched sample","l");
1386 >  leg->AddEntry(NoNeutrinos,"#nu depleted sample","l");
1387 >  leg->SetX1(0.9*leg->GetX1());
1388 >  standard->Draw("e1");
1389 >  Neutrinos->Draw("histo,same");
1390 >  NoNeutrinos->Draw("histo,same");
1391 >  if(isdata==data) leg->SetHeader("Data:");
1392 >  else leg->SetHeader("MC:");
1393 >  leg->Draw();
1394 >  DrawPrelim();
1395 >  
1396 >  if(isdata==data) CompleteSave(can,"NeutrinoMetSpectrum__Data");
1397 >  else CompleteSave(can,"NeutrinoMetSpectrum__MC");
1398 >  delete standard;
1399 >  delete Neutrinos;
1400 >  delete NoNeutrinos;
1401 >  delete can;
1402 >  CleanLegends();
1403 > }
1404 >  
1405 >  
1406 >  
1407 >  
1408 >  
1409 >  
1410      
1411   void do_basic_ZB_analysis(bool DoCompleteAnalysis) {
1412    STDWEIGHT=TCut(cutWeight);
# Line 1354 | Line 1416 | void do_basic_ZB_analysis(bool DoComplet
1416    
1417     TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas");
1418    
1419 < //   ScenarioComparison();
1420 < //   ScenarioComparisonInclusive();
1421 <
1419 >  
1420 >   MetSpectrumDepletionIllustration(data);
1421 >   MetSpectrumDepletionIllustration(mc);
1422 >   assert(0);
1423 >  
1424   //   compare_selection("ZbCHS3010_p5Clean");
1425   //   compare_selection("ZbCHS3010");
1426   //   compare_selection("Zb30");
# Line 1375 | Line 1439 | void do_basic_ZB_analysis(bool DoComplet
1439   //   compare_selection("Zb40");
1440  
1441    if(!doquick) {
1442 <    //draw_kin_variable("mll","",28,60.0,200.0,"m_{ll}","mll",1,"");//nice and quick test to see if the normalization is ok (i.e. all data is processed etc.)
1442 >    draw_kin_variable("mll","",28,60.0,200.0,"m_{ll}","mll",1,"");//nice and quick test to see if the normalization is ok (i.e. all data is processed etc.)
1443      //print_all_b_yields();
1444 <    draw_mpf_vars();
1444 > //     draw_mpf_vars();
1445      //DrawEvilCutFlow();
1446          
1447 <    draw_Zb_kin_vars();
1447 > //     draw_Zb_kin_vars();
1448          
1449     }
1450    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines