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.

218 lines
6.1 KiB

  1. //main file for the angular analysis of the decay B+->Kst+mumu
  2. //Due to the large number of tests, this file beame obsolete.
  3. //I include it for legacy reasons
  4. //Renata Kopecna
  5. //david gerick
  6. #include "BDTSelection.cpp"
  7. #include "TMVAClassApp.cpp"
  8. #include "MVA.cpp"
  9. #include "MCtruthmatching.cpp"
  10. #include "nTrackWeights.cpp"
  11. #include "GlobalFunctions.hh"
  12. #include "Paths.hpp"
  13. #include "RooExpAndGauss/RooExpAndGauss.hpp"
  14. #include "RooDoubleCB/RooDoubleCB.h"
  15. using namespace std;
  16. using namespace RooFit;
  17. Int_t B2Kstmumu(Int_t Run = 1){
  18. if(Run != 1 && Run != 2){
  19. coutERROR("Invalid Run number given: " << Run << ". Exit program!");
  20. return 0;
  21. }
  22. //////////////////////////////
  23. /// Pre-Selection
  24. //////////////////////////////
  25. ///pre-select data samples
  26. if(runAllSignalData(Run) == 0){
  27. coutERROR("Preselection of data sample not successfull. Exit program!");
  28. return 0;
  29. }
  30. else coutInfo("Preselection of data sample: DONE!");
  31. ///pre-select signal MC
  32. if(runAllSignalMC(Run) == 0){
  33. coutERROR("Preselection of MC sample not successfull. Exit program!");
  34. return 0;
  35. }
  36. else coutInfo("Preselection of MC sample: DONE!");
  37. ///pre-select reference channel MC
  38. if(Run != 2 && Kst2Kspiplus){
  39. if(runAllRefMC(Run) == 0){
  40. coutERROR("Preselection of reference MC sample not successfull. Exit program!");
  41. return 0;
  42. }
  43. else coutInfo("Preselection of reference MC sample: DONE!");
  44. }
  45. else{
  46. if(runAllRefMC(Run) == 0){
  47. coutERROR("Preselection of reference MC sample not successfull. Exit program!");
  48. return 0;
  49. }
  50. else coutInfo("Preselection of reference MC sample: DONE!");
  51. }
  52. ///pre-select phase-space MC
  53. if(runAllPHSPMC(Run) == 0){
  54. coutERROR("Preselection of PHSP MC sample not successfull. Exit program!");
  55. return 0;
  56. }
  57. else coutInfo("Preselection of PHSP MC sample: DONE!");
  58. //////////////////////////////
  59. /// Truth-Matching of MC samples
  60. //////////////////////////////
  61. ///TM of signal decay MC
  62. if(TruthMatchAll(false, false, Run) == 0){
  63. coutERROR("Truthmatching of signal MC sample not successfull. Exit program!");
  64. return 0;
  65. }
  66. else coutInfo("Truthmatching of signal channel MC sample: DONE!");
  67. ///TM of reference channel MC
  68. if(Run != 2 && Kst2Kspiplus){
  69. if(TruthMatchAll(true, false, Run) == 0){
  70. coutERROR("Truthmatching of reference MC sample not successfull. Exit program!");
  71. return 0;
  72. }
  73. else coutInfo("Truthmatching of reference channel MC sample: DONE!");
  74. }
  75. else{
  76. if(TruthMatchAll(true, false, Run) == 0){
  77. coutERROR("Truthmatching of reference MC sample not successfull. Exit program!");
  78. return 0;
  79. }
  80. else coutInfo("Truthmatching of reference channel MC sample: DONE!");
  81. }
  82. ///TM of PHSP MC
  83. if(TruthMatchAll(false, true, Run) == 0){
  84. coutERROR("Truthmatching of PHSP MC sample not successfull. Exit program!");
  85. return 0;
  86. }
  87. else coutInfo("Truthmatching of PHSP MC sample: DONE!");
  88. //////////////////////////////
  89. /// Weighting of data and re-weighting of MC
  90. //////////////////////////////
  91. ///sWeights of data is produced and signal channel MC is re-weighted
  92. if(WeightAll(true, Run) == 0){
  93. coutERROR("Weighting the MC sample by nTracks and p_T(B+) of sWeighted data not successfull. Exit program!");
  94. return 0;
  95. }
  96. else coutInfo("Weighting the MC sample by nTracks and p_T(B+) of sWeighted data: DONE!");
  97. ///re-weight the reference channel MC against sWeighted data
  98. if(Run != 2 && Kst2Kspiplus){
  99. if(ReweightReferenceMC(true, Run) == 0){
  100. coutERROR("Reweighting of Reference MC did not succeed. Exit program!");
  101. return 0;
  102. }
  103. else coutInfo("Reweighting of Reference MC sample: DONE!");
  104. }
  105. else{
  106. if(ReweightReferenceMC(true, Run) == 0){
  107. coutERROR("Reweighting of Reference MC did not succeed. Exit program!");
  108. return 0;
  109. }
  110. else coutInfo("Reweighting of Reference MC sample: DONE!");
  111. }
  112. ///re-weight the phase-space MC against sWeighted data
  113. if(ReweightPHSPMC(true, Run) == 0){
  114. coutERROR("Reweighting of PHSP MC did not succeed. Exit program!");
  115. return 0;
  116. }
  117. ///compare all variables (signal channel MC vs. data) used for BDT training
  118. /* TODO: use python
  119. if(compareAll(Run) == 0){
  120. coutERROR("Comparing variables of interest in weighted MC and sWeighted data not successfull. Exit program!");
  121. return 0;
  122. }
  123. else coutInfo("Comparing variables of interest in weighted MC and sWeighted data: DONE!");
  124. */
  125. //////////////////////////////
  126. /// BDT training
  127. //////////////////////////////
  128. if (Kst2Kspiplus){
  129. if (RunDDandLLKshort(Run) ==0){
  130. coutERROR("BDT training not succesful. Exit program!");
  131. return 0;
  132. }
  133. else coutInfo("BDT training succesful: DONE!");
  134. }
  135. else{
  136. if (RunKplusPizeroResolved(Run) ==0){
  137. coutERROR("BDT training not succesful. Exit program!");
  138. return 0;
  139. }
  140. else coutInfo("BDT training succesful: DONE!");
  141. }
  142. //////////////////////////////
  143. /// BDT evaluation
  144. //////////////////////////////
  145. if(TMVAClassApp(Run) == 0){
  146. coutERROR("TMVAClassApp failed to evaluate BDT response. Exit program!");
  147. return 0;
  148. }
  149. else coutInfo("TMVAClassApp succesfully evaulatued the BDT response: DONE!");
  150. return 1;
  151. }
  152. Int_t CalculateAllEfficiencies(Int_t Run =1){ //TODO: WIP
  153. //BDT
  154. //MC
  155. //preSelection
  156. //TruthMatching
  157. return 1;
  158. }
  159. Int_t main(Int_t argc, char* argv[]){
  160. if(argc != 2){
  161. coutERROR("Give exactly 1 argument: (" << argc - 1 << " given): [1] Run number ! For example: ./B2Kstmumu 1");
  162. coutERROR("Exit program!");
  163. return 0;
  164. }
  165. Int_t Run = atoi(argv[1]);
  166. std::cout << "\tFor Run " << Run;
  167. if (smallSample) std::cout << ": small sample only";
  168. std::cout << "." << endl;
  169. return B2Kstmumu(Run);
  170. }