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.

224 lines
8.4 KiB

  1. //Renata Kopecna
  2. #include <options.hh>
  3. #include <iostream>
  4. #include <fstream>
  5. #include <sstream>
  6. #include <assert.h>
  7. #include <TStyle.h>
  8. #include <TMath.h>
  9. #include <spdlog.h>
  10. //https://github.com/gabime/spdlog
  11. #include <helpers.hh>
  12. ///Try to extract a number from the name (option given on command line)
  13. int fcnc::options::get_job_id() {
  14. return job_id;
  15. };
  16. //reset the ranges of all three angles back to full_angular configuration
  17. void fcnc::options::reset_angle_ranges(){
  18. ctl_min = CTK_MIN;
  19. ctl_max = CTL_MAX;
  20. ctk_min = CTK_MIN;
  21. ctk_max = CTK_MAX;
  22. phi_min = PHI_MIN;
  23. phi_max = PHI_MAX;
  24. //spdlog::debug( "Reset angles: ctl=[ {0:0.2f} - {1:0.2f}]", ctl_min ,ctl_max);
  25. //spdlog::debug( "Reset angles: ctk=[ {0:0.2f} - {1:0.2f}]", ctk_min ,ctk_max);
  26. //spdlog::debug( "Reset angles: phi=[ {0:0.2f} - {1:0.2f}]", phi_min ,phi_max);
  27. }
  28. bool fcnc::options::canIFold(){
  29. //Check the ranges of the angles, if the ranges are smaller than the full ones, do not perform folding
  30. if (folding == -1) return true;
  31. if (PHI_MIN != -1.0*TMath::Pi() || PHI_MAX != 1.0*TMath::Pi()) return false;
  32. if (folding > 1 && (CTL_MIN != -1.0 || CTL_MAX != 1.0)) return false;
  33. return true;
  34. }
  35. void fcnc::options::update_angle_ranges(){
  36. reset_angle_ranges();
  37. if(full_angular || folding == -1)return;
  38. //Check the ranges of the angles, if the ranges are smaller than the full ones, do not perform folding
  39. if (!canIFold()){
  40. spdlog::warn("Range of the angles is assymetric, cannot perform update of folded angle ranges!");
  41. return;
  42. }
  43. switch(folding){
  44. case 0:
  45. phi_min = 0.;
  46. break;
  47. case 1:
  48. phi_min = 0.;
  49. ctl_min = 0.;
  50. break;
  51. case 2:
  52. phi_min = 0.;
  53. ctl_min = 0.;
  54. break;
  55. case 3:
  56. phi_min = -MY_PI/2.;
  57. phi_max = +MY_PI/2.;
  58. ctl_min = 0.;
  59. break;
  60. case 4:
  61. phi_min = -MY_PI/2.;
  62. phi_max = +MY_PI/2.;
  63. ctl_min = 0.;
  64. ctk_max = std::min(fabs(CTK_MIN), fabs(CTK_MAX)); //Take smaller value from abs(max), abs(min) = M
  65. ctk_min = -ctk_max; //And take range (-M,M)
  66. break;
  67. }
  68. spdlog::debug( "Update angles: ctl=[{0:0.2f} - {1:0.2f}]", ctl_min ,ctl_max);
  69. spdlog::debug( "Update angles: ctk=[{0:0.2f} - {1:0.2f}]", ctk_min ,ctk_max);
  70. spdlog::debug( "Update angles: phi=[{0:0.2f} - {1:0.2f}]", phi_min ,phi_max);
  71. }
  72. ///This method prints the used options.
  73. void fcnc::options::print(){
  74. spdlog::info( "Options:");
  75. spdlog::info( "Number of threads:\t\t {0:d}", ncores);
  76. spdlog::info( "Use angular acceptance: " + boolToString(use_angular_acc));
  77. spdlog::info( "Fit angular corr. coefficients "+ boolToString(angularacceptance));
  78. spdlog::info( "Do projections: "+ boolToString(project));
  79. spdlog::info( "Write eps files: "+ boolToString(write_eps));
  80. spdlog::info( "Write C files: "+ boolToString(write_C));
  81. spdlog::info( "Load only truthmatched: "+ boolToString(only_truthmatched));
  82. spdlog::info( "Use only true quantities: "+ boolToString(use_truth));
  83. spdlog::info( "Shift likelihood: "+ boolToString(shift_lh));
  84. spdlog::info( "Repeat on error: "+ boolToString(repeat_on_fail));
  85. spdlog::info( "Use asymmetric Minos errors: "+ boolToString(minos_errors));
  86. spdlog::info( "Run Simplex before Migrad: "+ boolToString(simplex_prerun));
  87. spdlog::info( "Run Hesse after Migrad: "+ boolToString(hesse_postrun));
  88. spdlog::info( "Perform weighted fit: "+ boolToString(weighted_fit));
  89. spdlog::info( "Verbosity: "+ spdlog::default_logger_raw()->level());
  90. spdlog::info( "Static seed: "+ boolToString(static_seed));
  91. spdlog::info( "Always static seed: "+ boolToString(always_static_seed));
  92. spdlog::info( "Refit the same data set: "+ boolToString(refitting_nominal));
  93. }
  94. std::vector<std::string> fcnc::options::getAllPlotTypes(){
  95. std::vector<std::string> ext;
  96. if (write_C) ext.push_back("C");
  97. if (write_eps) ext.push_back("eps");
  98. if (write_jpg) ext.push_back("jpg");
  99. if (write_pdf) ext.push_back("pdf");
  100. return ext;
  101. }
  102. //Get the number of Q2 bins from the lenght of ThQ2binsmin vector
  103. unsigned int fcnc::options::get_nQ2bins(){
  104. return TheQ2binsmin.size();
  105. }
  106. //////////////////////////////
  107. // Set systematics options //
  108. //////////////////////////////
  109. void which_systematics( fcnc::options opts, int job_id){
  110. if(opts.systematic == 1){
  111. spdlog::info( "Run systematic study #1: BOOTSTRAPPING of PHSP MC");
  112. opts.write_eps = job_id == -1;
  113. }
  114. if(opts.systematic == 2){
  115. spdlog::info( "Run systematic study #2: Forced symmetric acceptance correction in cos(Theta_L)");
  116. opts.write_eps = false;
  117. }
  118. opts.orderincrease = 2;
  119. if(opts.systematic == 3){
  120. spdlog::info( "Run systematic study #3: Increase of Legendre order of PHSP MC parametrization");
  121. opts.eff_order_costhetal += opts.orderincrease;
  122. opts.eff_order_costhetak += opts.orderincrease;
  123. opts.eff_order_phi += opts.orderincrease;
  124. opts.eff_order_q2 += opts.orderincrease;
  125. }
  126. if(opts.systematic == 4){
  127. spdlog::info( "Run systematic study #4: Vary PHSP MC reweights within their uncertainty");
  128. opts.write_eps = false;
  129. }
  130. if(opts.systematic == 5){
  131. spdlog::info( "Run systematic study #5: Vary S-wave fraction FS in q2bin within its uncertainty");
  132. opts.write_eps = false;
  133. }
  134. if(opts.systematic == 6){
  135. spdlog::info( "Run systematic study #6: Vary angles (ctk, ctl and phi) within the angular resoluation");
  136. opts.write_eps = false;
  137. }
  138. if(opts.systematic == 7){
  139. spdlog::info( "Run systematic study #7: Generate toy events with double-gaussian profile and fit with CB");
  140. opts.write_eps = false;
  141. }
  142. if(opts.systematic == 8){
  143. spdlog::info( "Run systematic study #8: Systematic study on angular background model");
  144. opts.write_eps = false;
  145. }
  146. if(opts.systematic == 9){
  147. spdlog::info( "Run systematic study #9: Investigate systematic effects due to trigger selection");
  148. opts.write_eps = false;
  149. }
  150. if(opts.systematic == 10){
  151. spdlog::info( "Run systematic study #10: Reweight the PHSP MC according to discrepancy in Kshort PT distributions for DD tracks");
  152. opts.write_eps = false;
  153. }
  154. if(opts.systematic == 11){
  155. spdlog::info( "Run systematic study #11: Remove a gaussian shaped hole in the upper mass sideband of the background to mimic the B0 veto");
  156. opts.write_eps = false;
  157. }
  158. }
  159. std::vector<std::string> get_observables_vec (fcnc::options opts){
  160. std::vector<std::string> obs;
  161. if(opts.fit_fl) obs.push_back("Fl");
  162. else obs.push_back("S1s");
  163. obs.push_back("S3");
  164. if(opts.full_angular || opts.folding == 1) obs.push_back("S4");
  165. if(opts.full_angular || opts.folding == 2) obs.push_back("S5");
  166. if(opts.full_angular || opts.folding == 0){
  167. if(opts.fit_afb) obs.push_back("Afb");
  168. else obs.push_back("S6s");
  169. }
  170. if(opts.full_angular || opts.folding == 3) obs.push_back("S7");
  171. if(opts.full_angular || opts.folding == 4) obs.push_back("S8");
  172. if(opts.full_angular || opts.folding == 0) obs.push_back("S9");
  173. return obs;
  174. }
  175. void set_ang_year_options(fcnc::options &opts){
  176. //Takes care of setting the year/run options for angular corrections
  177. //use data from run 1 and run 2 combined
  178. opts.angacccorrbothruns = (opts.run == 12);
  179. //use 2015+2016 or 2017+2018
  180. opts.angacccorrpertwoyears = (opts.run == 21 || opts.run == 22);
  181. //If run/two years are used, turn off the per-year correction
  182. if (opts.angacccorrbothruns || opts.angacccorrpertwoyears) opts.angacccorrperyear = false;
  183. return;
  184. }
  185. bool is_param_folded(int param, fcnc::options *opts){
  186. //int param is the number of the parameter according to get_angObser_withTeX_vec()
  187. //if the parameter is folded, return true
  188. if (param==5) return !(opts->full_angular || opts->folding == 1);
  189. if (param==6) return !(opts->full_angular || opts->folding == 2);
  190. if (param==7) return !(opts->full_angular || opts->folding == 0);
  191. if (param==8) return !(opts->full_angular || opts->folding == 0);
  192. if (param==9) return !(opts->full_angular || opts->folding == 3);
  193. if (param==10) return !(opts->full_angular || opts->folding == 4);
  194. if (param==11) return !(opts->full_angular || opts->folding == 0);
  195. return false;
  196. }