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.

201 lines
5.2 KiB

  1. //Renata Kopecna
  2. #include <folder.hh>
  3. #include <TRandom3.h>
  4. #include <event.hh>
  5. #include <helpers.hh>
  6. #include <spdlog.h>
  7. ///fold the set of angles according to the chosen folding scheme
  8. void fcnc::folder::fold(event* e){
  9. //make sure, that the full angular information was saved before into the correct parameters:
  10. assert(e->costhetal == e->costhetal_fa);
  11. assert(e->costhetak == e->costhetak_fa);
  12. assert(e->phi == e->phi_fa);
  13. double pi = TMath::Pi();
  14. switch(this->scheme){
  15. case -1:
  16. return;
  17. case 0:
  18. if(e->phi < 0)e->phi = e->phi + pi;
  19. break;
  20. case 1:
  21. if(e->phi < 0){
  22. e->phi = -e->phi;
  23. }
  24. if(e->costhetal < 0){
  25. e->phi = pi - e->phi;
  26. e->costhetal = -e->costhetal;
  27. }
  28. break;
  29. case 2:
  30. if(e->phi < 0) e->phi = -e->phi;
  31. if(e->costhetal < 0) e->costhetal = -e->costhetal;
  32. break;
  33. case 3:
  34. if(e->phi > pi/2.) e->phi = pi - e->phi;
  35. if(e->phi < -pi/2.) e->phi = -pi - e->phi;
  36. if(e->costhetal < 0) e->costhetal = -e->costhetal;
  37. break;
  38. case 4:
  39. if(e->phi > pi/2.) e->phi = pi - e->phi;
  40. if(e->phi < -pi/2.) e->phi = -pi - e->phi;
  41. if(e->costhetal < 0){
  42. e->costhetal = -e->costhetal;
  43. e->costhetak = -e->costhetak;
  44. }
  45. break;
  46. }
  47. return;
  48. }
  49. ///inverse fold the set of angles according to the chosen folding scheme
  50. void fcnc::folder::invers_fold(const event* e, event *u_phi, event *u_ctl, event *u_full){
  51. /*
  52. phi /^\
  53. | :
  54. | (2) : (4)
  55. | :
  56. |---------+--------
  57. | :
  58. | (1) : (3)
  59. |_________________>
  60. cos(theta)
  61. (1): original event (e)
  62. (2): unfolded in phi (u_phi)
  63. (3): unfolded in ctl (u_ctl)
  64. (4): twice unfolded (u_full)
  65. */
  66. *u_phi = *e; //only inversly folded in dependence of phi
  67. *u_ctl = *e; //only inversly folded in dependence of ctl
  68. *u_full = *e; //full inversly folded
  69. double pi = TMath::Pi();
  70. switch(this->scheme){
  71. case -1:
  72. return;
  73. case 0:
  74. assert(e->phi > 0.0);
  75. u_phi->phi = u_phi->phi - pi;
  76. u_full->phi = u_full->phi - pi;
  77. break;
  78. case 1:
  79. assert(e->phi > 0.0);
  80. assert(e->costhetal > 0.0);
  81. u_ctl->phi = pi - u_ctl->phi;
  82. u_full->phi = pi - u_full->phi;
  83. u_ctl->costhetal = -u_ctl->costhetal;
  84. u_full->costhetal = -u_full->costhetal;
  85. u_phi->phi = -u_phi->phi;
  86. u_full->phi = -u_full->phi;
  87. break;
  88. case 2:
  89. assert(e->phi > 0.0);
  90. assert(e->costhetal > 0.0);
  91. u_phi->phi = -u_phi->phi;
  92. u_full->phi = -u_full->phi;
  93. u_ctl->costhetal = -u_ctl->costhetal;
  94. u_full->costhetal = -u_full->costhetal;
  95. break;
  96. case 3:
  97. assert(e->phi < pi/2.);
  98. assert(e->phi > -pi/2.);
  99. assert(e->costhetal > 0.0);
  100. if(e->phi > 0.0){
  101. u_phi->phi = pi - u_phi->phi;
  102. u_full->phi = pi - u_full->phi;
  103. }
  104. else{
  105. u_phi->phi = -pi - u_phi->phi;
  106. u_full->phi = -pi - u_full->phi;
  107. }
  108. u_ctl->costhetal = -u_ctl->costhetal;
  109. u_full->costhetal = -u_full->costhetal;
  110. break;
  111. case 4:
  112. assert(e->phi < pi/2.);
  113. assert(e->phi > -pi/2.);
  114. assert(e->costhetal > 0.0);
  115. if(e->phi > 0.0){
  116. u_phi->phi = pi - u_phi->phi;
  117. u_full->phi = pi - u_full->phi;
  118. }
  119. else{
  120. u_phi->phi = -pi - u_phi->phi;
  121. u_full->phi = -pi - u_full->phi;
  122. }
  123. u_ctl->costhetal = -u_ctl->costhetal;
  124. u_ctl->costhetak = -u_ctl->costhetak;
  125. u_full->costhetal = -u_full->costhetal;
  126. u_full->costhetak = -u_full->costhetak;
  127. break;
  128. }
  129. }
  130. void fcnc::folder::test_inv_folding(){
  131. fcnc::event e;
  132. e.m = 5286.0;
  133. TRandom3 * r = new TRandom3(0);
  134. for(int i = 0; i < 10000; i++){
  135. if(i % 100 == 0 && spdlog_info())std::cout << i / 100. << "%" << std::endl;
  136. //generate a folded event:
  137. e.costhetal = r->Rndm() * 2. - 1.;
  138. e.costhetak = r->Rndm() * 2. - 1.;
  139. e.phi = (r->Rndm() * 2. - 1.) * TMath::Pi();
  140. e.costhetal_fa = e.costhetal;
  141. e.costhetak_fa = e.costhetak;
  142. e.phi_fa = e.phi;
  143. this->fold(&e);
  144. //get 3 events for (partial-)inverse folding:
  145. fcnc::event inv_e[3];
  146. this->invers_fold(&e, &inv_e[0], &inv_e[1], &inv_e[2]);
  147. for(int j = 0; j < 3; j++){
  148. inv_e[j].costhetal_fa = inv_e[j].costhetal;
  149. inv_e[j].costhetak_fa = inv_e[j].costhetak;
  150. inv_e[j].phi_fa = inv_e[j].phi;
  151. this->fold(&inv_e[j]);
  152. assert(abs(e.phi - inv_e[j].phi ) < 1e-7);
  153. assert(abs(e.costhetal - inv_e[j].costhetal) < 1e-7);
  154. assert(abs(e.costhetak - inv_e[j].costhetak) < 1e-7);
  155. }
  156. }
  157. spdlog::info("[DONE]\t\tInverse folding #{0:d} works!", this->scheme);
  158. }
  159. int fcnc::folder::get_scheme(){
  160. return this->scheme;
  161. }
  162. void fcnc::folder::set_scheme(int s){
  163. this->scheme = s;
  164. }