Angular analysis of B+->K*+(K+pi0)mumu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
4.7 KiB

  1. //Create tables of event numbers for B+->Kst+mumu
  2. //david gerick
  3. #include "../../GlobalFunctions.hh"
  4. #include "../../HeidelbergFitter/LHCbStyle.h"
  5. //#include "MVA_b2kmm.cc"
  6. using namespace std;
  7. using namespace RooFit ;
  8. //////////////////////////////////////////////////////
  9. /// GetEventNumbers()
  10. /// Load all tuples and print the event numbers in a table for latex
  11. /// Selection steps:
  12. /// - 0: After stripping
  13. /// - 1: After pre-selection
  14. /// - 2: After BDT cut
  15. Int_t GetEventNumbers(bool MC = false, bool Ref = false, bool PHSP = false, Int_t SelectionStep = 0) {
  16. if(SelectionStep < 0 || SelectionStep > 2){
  17. std::cout << "[ERROR]\t\tOnly use Selection Steps between 0 - 2 for after Stripping (0), Pre-Selection (1) or BDT cut (2)." << std::endl;
  18. return 0;
  19. }
  20. gStyle -> SetOptStat(0);
  21. gROOT->SetBatch(kTRUE);
  22. LHCbStyle();
  23. std::vector<Int_t> years;
  24. years.push_back(2011);
  25. years.push_back(2012);
  26. years.push_back(2015);
  27. years.push_back(2016);
  28. years.push_back(2017);
  29. years.push_back(2018);
  30. std::vector<std::string> Mag;
  31. if(SelectionStep == 0){
  32. Mag.push_back("down");
  33. Mag.push_back("up");
  34. }
  35. std::vector<bool> isLL;
  36. if(Kst2Kspiplus){
  37. isLL.push_back(true);
  38. isLL.push_back(false);
  39. }
  40. std::vector<UInt_t> EvNum[2][2]; //[Mag][DDLL].at(year)
  41. TChain * t;
  42. for(UInt_t y = 0; y < years.size(); y++){
  43. std::cout << "[LOADING]\tYear " << years.at(y) << std::endl;
  44. for(UInt_t m = 0; m < (SelectionStep == 0 ? 2 : 1); m++){
  45. for(UInt_t d = 0; d < (Kst2Kspiplus ? 2 : 1); d++){
  46. //init new tree:
  47. if(SelectionStep == 0)
  48. t = new TChain(Kst2Kpluspi0Resolved ? "b2KstKpi0mumuResolvedTuple/DecayTree" : "b2KstKs0pimumu_Tuple/DecayTree");
  49. else if(SelectionStep == 1)
  50. t = new TChain("DecayTree");
  51. else if(SelectionStep == 2)
  52. t = new TChain("SelectionOutput");
  53. //load all tuples:
  54. if(SelectionStep == 0)
  55. t->Add(Form("%s/data/%i%s/%i*_B2Kstmumu*.root", thePath.c_str(), years.at(y), Mag.at(m).c_str(), years.at(y)));
  56. else if(SelectionStep == 1){
  57. if(Kst2Kspiplus)
  58. t->Add(Form("%s/data/%i_KshortPiplus_%s_BDTinput.root", thePath.c_str(), years.at(y), d == 0 ? "DD" : "LL"));
  59. else
  60. t->Add(Form("%s/data/%i*BDTinput.root", thePath.c_str(), years.at(y)));
  61. }
  62. else if(SelectionStep == 2){
  63. t->Add(Form("%s/data/*BDToutputSelection_Run*%i.root", thePath.c_str(), years.at(y)));
  64. }
  65. if(Kst2Kspiplus){
  66. if(SelectionStep == 1)
  67. EvNum[m][d].push_back(t->GetEntries());
  68. else{
  69. EvNum[m][0].push_back(t->GetEntries("Ks_pi_minus_TRACK_Type != 3"));
  70. EvNum[m][1].push_back(t->GetEntries("Ks_pi_minus_TRACK_Type == 3"));
  71. delete t;
  72. break; //do not run DDLL loop for a second time!
  73. }
  74. }
  75. else
  76. EvNum[m][0].push_back(t->GetEntries());
  77. delete t;
  78. }
  79. }
  80. }
  81. //print LaTeX table:
  82. std::cout << "\\begin{tabular}{lc";
  83. for(UInt_t m = 0; m < Mag.size(); m++)
  84. std::cout << "c";
  85. if(Kst2Kspiplus)
  86. std::cout << "c";
  87. std::cout << "} \\hline" << std::endl;
  88. std::cout << "Year\t";
  89. if(Kst2Kspiplus)
  90. std::cout << "&track type\t";
  91. if(Mag.size() == 0)
  92. std::cout << "&both magnet polarities\\\\" << std::endl;
  93. else
  94. std::cout << "&magnet down\t&magnet up\t&combined\\\\" << std::endl;
  95. std::cout << "\\hline\\hline" << std::endl;
  96. for(UInt_t y = 0; y < years.size(); y++){
  97. std::cout << years.at(y);
  98. for(UInt_t d = 0; d < (Kst2Kspiplus ? 2 : 1); d++){
  99. std::cout << " \t";
  100. if(Kst2Kspiplus)
  101. std::cout << (d == 0 ? "&\\texttt{DD}\t" : "&\\texttt{LL}\t");
  102. if(Mag.size() == 0)
  103. std::cout << "&" << EvNum[0][d].at(y) << "\\\\" << std::endl;
  104. else
  105. std::cout << "&" << EvNum[0][d].at(y) << "\t&" << EvNum[1][d].at(y) << "\t&" << EvNum[0][d].at(y)+EvNum[1][d].at(y) << "\\\\" << std::endl;
  106. }
  107. if(Kst2Kspiplus){
  108. if(Mag.size() == 0)
  109. std::cout << "\t&total\t&" << EvNum[0][0].at(y)+EvNum[0][1].at(y) << "\\\\" << std::endl;
  110. else
  111. std::cout << "\t&total\t&" << EvNum[0][0].at(y)+EvNum[0][1].at(y)
  112. << "\t&" << EvNum[1][0].at(y)+EvNum[1][1].at(y)
  113. << "\t&" << EvNum[0][0].at(y)+EvNum[0][1].at(y)+EvNum[1][0].at(y)+EvNum[1][1].at(y) << "\\\\" << std::endl;
  114. }
  115. std::cout << "\\hline" << std::endl;
  116. }
  117. std::cout << "\\end{tabular}" << std::endl;
  118. return 1;
  119. }