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="q2>0.1 & q2<19";
  17.  
  18.  
  19. TString cut = cutnew + "&&"+fiducial_new;
  20. 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",
  21. "K_IPCHI2_OWNPV", "K_P", "K_PT", "K_PIDmu", "K_PIDK", "K_PIDp",
  22. "Pi_IPCHI2_OWNPV", "Pi_P", "Pi_PT", "Pi_PIDmu", "Pi_PIDK", "Pi_PIDp",
  23. "mu_plus_IPCHI2_OWNPV", "mu_plus_P", "mu_plus_PT", "mu_plus_PIDmu", "mu_plus_PIDK", "mu_plus_PIDp",
  24. "mu_minus_IPCHI2_OWNPV", "mu_minus_P", "mu_minus_PT", "mu_minus_PIDmu", "mu_minus_PIDK", "mu_minus_PIDp" };
  25.  
  26.  
  27.  
  28. 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)",
  29. "(100,0,200)", "(100,1000, 150000)", "(100,100, 5000)", "(100,-15,15)", "(100,-5,80)", "(100,-40,50)",
  30. "(100,0,200)", "(100,1000, 150000)", "(100,100, 5000)", "(100,-15,15)", "(100,-80,20)", "(100,-80,20)",
  31. "(100,0,200)", "(100,1000, 150000)", "(100,100, 5000)", "(100,-3,15)", "(100,-80,15)", "(100,-100,20)",
  32. "(100,0,200)","(100,1000, 150000)", "(100,100, 5000)", "(100,-3,15)", "(100,-80,15)", "(100,-100,20)"};
  33.  
  34. if(variables.size() != range.size())
  35. {
  36. cout<<"Wrong number of arguments!"<< variables.size()<<" "<< range.size()<<endl;
  37. }
  38.  
  39. for(int i=0;i< variables.size(); i++)
  40. {
  41.  
  42. ch_S21->Draw(variables[i]+">>"+variables[i]+range[i], cut);
  43. ch_S21_unique->Draw(variables[i]+">>"+variables[i]+"1"+range[i]);
  44. ch_S20_unique->Draw(variables[i]+">>"+variables[i]+"2"+range[i]);
  45.  
  46. TH1D* hist= (TH1D*)gROOT->FindObject(variables[i]);
  47. TH1D* hist1= (TH1D*)gROOT->FindObject(variables[i] +"1");
  48. TH1D* hist2= (TH1D*)gROOT->FindObject(variables[i]+"2");
  49.  
  50. hist->SetFillColor(0);
  51. hist1->SetFillColor(0);
  52. hist2->SetFillColor(0);
  53.  
  54. hist->SetLineColor(kRed);
  55. hist1->SetLineColor(kBlue+2);
  56. hist2->SetLineColor(kGreen+2);
  57.  
  58. hist->GetXaxis()->SetTitle(variables[i]);
  59. hist1->GetXaxis()->SetTitle(variables[i]);
  60. hist2->GetXaxis()->SetTitle(variables[i]);
  61. hist->SetMaximum(hist->GetMaximum()*1.5);
  62. hist1->SetMaximum(hist1->GetMaximum()*1.5);
  63. hist2->SetMaximum(hist2->GetMaximum()*1.5);
  64. hist->DrawNormalized();
  65. hist1->DrawNormalized("SAME");
  66. hist2->DrawNormalized("SAME");
  67.  
  68. //if(i==0)
  69. // {
  70. TLegend *leg= new TLegend(0.6, 0.8, 0.9, 0.9);
  71. leg->AddEntry(hist, "S21", "f");
  72. leg->AddEntry(hist1, "Unique in S21" ,"f");
  73. leg->AddEntry(hist2, "Unique in S20" ,"f");
  74. leg->Draw();
  75. // }
  76. c1->SaveAs(variables[i]+".pdf");
  77. }
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87. }