Newer
Older
Presentations / Kstarmumu_Run2 / Overlaps / images / JPSIREGION / compare.cc
@Marcin Chrzaszcz Marcin Chrzaszcz on 12 Feb 2018 3 KB overlap slides
  1. void compare()
  2. {
  3.  
  4. gROOT->ProcessLine(".L lhcbStyle.C");
  5. TCanvas *c1= new TCanvas("c1", "c1", 800,600);
  6. TChain *ch_S21= new TChain();
  7. TChain *ch_S21_unique= new TChain();
  8. TChain *ch_S20_unique= new TChain();
  9.  
  10. ch_S21->Add("/storage4/ntuples/lhcb/KstarMuMu/data_reduced/Run1/Kstarmumu_Data_Run1.root/Reduced");
  11. ch_S21_unique->Add("NEW.root/NEW");
  12. ch_S20_unique->Add("OLD.root/OLD");
  13.  
  14.  
  15. TString cutnew= "B0_M>5050 && B0_M<5700 && Kstar_M>795.9 && Kstar_M < 995.9 && K_TRACK_GhostProb<0.4 && Pi_TRACK_GhostProb<0.4 && mu_plus_TRACK_GhostProb<0.4 && mu_minus_TRACK_GhostProb<0.4 && (!((B0_ID>0)&&(B0_swapMass>3626)&&(B0_swapMass<3746)&&(Pi_PIDmu>5||Pi_isMuon==1))&&!((B0_ID<0)&&(B0_swapMass>3626)&&(B0_swapMass<3746)&&(Pi_PIDmu>5||Pi_isMuon==1))&&!((B0_ID>0)&&(B0_kmuswapMass>3626)&&(B0_kmuswapMass<3746)&&(K_PIDmu>5||K_isMuon==1)))" ;
  16. TString fiducial_new="J_psi_M>3037 && J_psi_M <3157.";
  17.  
  18.  
  19.  
  20. TString cut = cutnew + "&&"+fiducial_new;
  21. vector<TString> variables={"B0_M", "Kstar_M", "J_psi_M", "B0_DiraAngle", "B0_ENDVERTEX_CHI2", "B0_IP_OWNPV", "B0_IPCHI2_OWNPV", "B0_P", "B0_PT",
  22. "K_IPCHI2_OWNPV", "K_P", "K_PT", "K_PIDmu", "K_PIDK", "K_PIDp",
  23. "Pi_IPCHI2_OWNPV", "Pi_P", "Pi_PT", "Pi_PIDmu", "Pi_PIDK", "Pi_PIDp",
  24. "mu_plus_IPCHI2_OWNPV", "mu_plus_P", "mu_plus_PT", "mu_plus_PIDmu", "mu_plus_PIDK", "mu_plus_PIDp",
  25. "mu_minus_IPCHI2_OWNPV", "mu_minus_P", "mu_minus_PT", "mu_minus_PIDmu", "mu_minus_PIDK", "mu_minus_PIDp" };
  26.  
  27.  
  28.  
  29. vector<TString> range={ "(100,5060,6000)", "(100,795.9, 995.9)","(100,100,4000)", "(100,0,0.014)", "(100,0,30)", "(100,0,0.12)", "(100,0., 16.)", "(100,10000, 300000)", "(100,100, 30000)",
  30. "(100,0,200)", "(100,1000, 150000)", "(100,100, 5000)", "(100,-15,15)", "(100,-5,80)", "(100,-40,50)",
  31. "(100,0,200)", "(100,1000, 150000)", "(100,100, 5000)", "(100,-15,15)", "(100,-80,20)", "(100,-80,20)",
  32. "(100,0,200)", "(100,1000, 150000)", "(100,100, 5000)", "(100,-3,15)", "(100,-80,15)", "(100,-100,20)",
  33. "(100,0,200)","(100,1000, 150000)", "(100,100, 5000)", "(100,-3,15)", "(100,-80,15)", "(100,-100,20)"};
  34.  
  35. if(variables.size() != range.size())
  36. {
  37. cout<<"Wrong number of arguments!"<< variables.size()<<" "<< range.size()<<endl;
  38. }
  39.  
  40. for(int i=0;i< variables.size(); i++)
  41. {
  42.  
  43. ch_S21->Draw(variables[i]+">>"+variables[i]+range[i], cut);
  44. ch_S21_unique->Draw(variables[i]+">>"+variables[i]+"1"+range[i]);
  45. ch_S20_unique->Draw(variables[i]+">>"+variables[i]+"2"+range[i]);
  46.  
  47. TH1D* hist= (TH1D*)gROOT->FindObject(variables[i]);
  48. TH1D* hist1= (TH1D*)gROOT->FindObject(variables[i] +"1");
  49. TH1D* hist2= (TH1D*)gROOT->FindObject(variables[i]+"2");
  50.  
  51. hist->SetFillColor(0);
  52. hist1->SetFillColor(0);
  53. hist2->SetFillColor(0);
  54.  
  55. hist->SetLineColor(kRed);
  56. hist1->SetLineColor(kBlue+2);
  57. hist2->SetLineColor(kGreen+2);
  58.  
  59. hist->GetXaxis()->SetTitle(variables[i]);
  60. hist1->GetXaxis()->SetTitle(variables[i]);
  61. hist2->GetXaxis()->SetTitle(variables[i]);
  62. hist->SetMaximum(hist->GetMaximum()*1.5);
  63. hist1->SetMaximum(hist1->GetMaximum()*1.5);
  64. hist2->SetMaximum(hist2->GetMaximum()*1.5);
  65. hist->DrawNormalized();
  66. hist1->DrawNormalized("SAME");
  67. hist2->DrawNormalized("SAME");
  68.  
  69. //if(i==0)
  70. // {
  71. TLegend *leg= new TLegend(0.6, 0.8, 0.9, 0.9);
  72. leg->AddEntry(hist, "S21", "f");
  73. leg->AddEntry(hist1, "Unique in S21" ,"f");
  74. leg->AddEntry(hist2, "Unique in S20" ,"f");
  75. leg->Draw();
  76. // }
  77. c1->SaveAs(variables[i]+".pdf");
  78. }
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. }