crab_bindefs_qinv.cpp 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /* Set ABSOLUTE_MAXMOM so that program won't bother calculating correlations
  2. when rel. mom. is greater than ABSOLUTE_MAXMOM. This is ignored if
  3. "MIXED_PAIRS_FOR_DENOM" is defined in crab.cpp below */
  4. #define ABSOLUTE_MAXMOM 800
  5. /* Four Examples are presented here (A-D). For each binning, modifications
  6. must be made in four locations in this file as illustrated. One can
  7. add as many binnings as desired. Binnings are of two types:
  8. 1.) one-dimensional, where the answer will be given as C(x).
  9. 2.) three-dimensional, where the answer will be given as C(x,y,z). */
  10. /* One of the included routines is 'decompose(p1,p2,vs,
  11. long_comoving_boost,x_along_p,outwards_boost,
  12. &kmag,&kx,&ky,&kz)'. This routine returns the 3-dimensions of the
  13. relative momentum. ( If one only uses Qinv, one can skip calling this
  14. function since 'mom' equals 'Qinv' and is already fed into 'binner'. )
  15. When one calls decompose, three additional arguments,
  16. long_comoving_boost,x_along_p,outwards_boost, are used to determine the
  17. reference frame, (both relativistically and rotationally).
  18. 1.) If one chooses 'long_comoving_boost' equal to one,
  19. one boosts along the beam axis to the frame where pz1+pz2=0.
  20. If 'long_comoving_boost' is not equal to one, the longitudinal frame
  21. will be set by the value of 'vs'.
  22. 2.) If one chooses 'x_along_p' equal to one,
  23. one performs a rotation, in the reaction plane defined by the pairs
  24. momentum, such that the x-axis is parallel to the total momentum.
  25. 3.) If one chooses outwards_boost equal to one,
  26. one also boost along the direction of p1+p2 to the pair's c.o.m. frame. */
  27. /* Example A: Bin the correlation function according to Qinv */
  28. /* Example B: Bin the correlation function according to Qinv
  29. in 10 different pt bins */
  30. /* Example C: Bin the correlation function according to |Q|, where Q is
  31. determined in the longitudinally comoving frame. Make three binnings for
  32. three different directional cuts. */
  33. /* Example D: Save the correlation function in a 3-d binning, according
  34. to Qx, Qy, and Qz. */
  35. /* ********************************************************* */
  36. /* First define the binnings you will do. */
  37. /* A. */
  38. onedbin_class *qinv;
  39. /* B. */
  40. /*
  41. #define NPTCUTS 10
  42. #define DELPT 40
  43. onedbin_class *qinv_ptcut[NPTCUTS];
  44. */
  45. /* C */
  46. /*
  47. onedbin_class *q_outwards;
  48. onedbin_class *q_sidewards;
  49. onedbin_class *q_beam;
  50. */
  51. /* D. */
  52. threedbin_class *qinv3d;
  53. /* E */
  54. #define NMTCUTS 5
  55. threedbin_class *qinv3d_mt[NMTCUTS];
  56. const float mTarr[NMTCUTS] = {0.2, 0.4, 0.6, 0.7, 1.};
  57. const float partMass = 0.13957018; // pi
  58. /* ********************************************************* */
  59. /* Initialize binning objects with desired mesh sizes and momentum ranges */
  60. void bininit(void){
  61. int ipt,nkmax,nkxmax,nkymax,nkzmax;
  62. int nptmax;
  63. double maxmom,kxmax,kymax,kzmax;
  64. double pt;
  65. char title[80];
  66. /* A */
  67. nkmax=80;
  68. maxmom=800.0;
  69. qinv=new onedbin_class(nkmax,maxmom,"qinv.dat");
  70. /* B */
  71. /*
  72. nkmax=40;
  73. maxmom=400.0;
  74. for(ipt=0;ipt<NPTCUTS;ipt++){
  75. pt=(0.5+ipt)*maxmom/NPTCUTS;
  76. pt=floor(pt+0.5);
  77. sprintf(title,"qinv_pt%03g.dat",pt);
  78. qinv_ptcut[ipt]=new onedbin_class(nkmax,maxmom,title);
  79. }
  80. */
  81. /* C */
  82. /*
  83. nkmax=40;
  84. maxmom=400.0;
  85. q_outwards=new onedbin_class(nkmax,maxmom,"q_outwards.dat");
  86. q_sidewards=new onedbin_class(nkmax,maxmom,"q_sidewards.dat");
  87. q_beam=new onedbin_class(nkmax,maxmom,"q_beam.dat");
  88. */
  89. /* D */
  90. nkxmax = nkymax = nkzmax = 80;
  91. kxmax = kymax = kzmax = 800.0;
  92. qinv3d=new threedbin_class(nkxmax,nkymax,nkzmax,
  93. kxmax,kymax,kzmax,"qinv3d.dat");
  94. /* E */
  95. nkxmax = nkymax = nkzmax = 80;
  96. kxmax = kymax = kzmax = 800.0;
  97. for (int iMt = 0; iMt < NMTCUTS; iMt++) {
  98. sprintf(title, "qinv3d_%i.dat", iMt);
  99. qinv3d_mt[iMt]=new threedbin_class(nkxmax, nkymax, nkzmax,
  100. kxmax, kymax, kzmax, title);
  101. }
  102. }
  103. /* ********************************************************* */
  104. /* Bin |phi|^2 according to p1 and p2 */
  105. /* Use the routine "decompose" to get projections of rel. mom. if desired */
  106. void binner(int inumden,double mom,double corr,double *p1,double *p2){
  107. double pt,kx,ky,kz,kmag;
  108. int ipt;
  109. /* These 3 variables define conv.s used by decompose, 0=no, 1=yes */
  110. int long_comoving_boost,x_along_p,outwards_boost;
  111. double vs=0.0;
  112. /* A */
  113. qinv->bincorr(inumden,mom,corr);
  114. /* B */
  115. pt=sqrt(pow(p1[1]+p2[1], 2.)+pow(p1[2]+p2[2], 2.));
  116. /*
  117. ipt=(int)floor(pt/DELPT);
  118. if(ipt<NPTCUTS){
  119. qinv_ptcut[ipt]->bincorr(inumden,mom,corr);
  120. }
  121. */
  122. /* C */
  123. /*
  124. long_comoving_boost=1;
  125. x_along_p=0;
  126. outwards_boost=0;
  127. decompose(p1,p2,vs,
  128. long_comoving_boost,x_along_p,outwards_boost,
  129. &kmag,&kx,&ky,&kz);
  130. if(fabs(ky)<50.0 && fabs(kz)<50.0) q_outwards->bincorr(inumden,kmag,corr);
  131. if(fabs(kx)<50.0 && fabs(kz)<50.0) q_sidewards->bincorr(inumden,kmag,corr);
  132. if(fabs(kx)<50.0 && fabs(ky)<50.0) q_beam->bincorr(inumden,kmag,corr);
  133. */
  134. /* D */
  135. long_comoving_boost=1;
  136. x_along_p=0;
  137. outwards_boost=0;
  138. decompose(p1,p2,vs,
  139. long_comoving_boost,x_along_p,outwards_boost,
  140. &kmag,&kx,&ky,&kz);
  141. qinv3d->bincorr(inumden,kx,ky,kz,corr);
  142. /* E */
  143. float kT = pt*1.e-3/2.;
  144. float mT = sqrt(kT*kT + partMass*partMass);
  145. for (int iMt = 0; iMt < NMTCUTS; iMt++) {
  146. if (mT <= mTarr[iMt]) {
  147. long_comoving_boost=1;
  148. x_along_p=0;
  149. outwards_boost=0;
  150. decompose(p1,p2,vs,
  151. long_comoving_boost,x_along_p,outwards_boost,
  152. &kmag,&kx,&ky,&kz);
  153. qinv3d_mt[iMt]->bincorr(inumden,kx,ky,kz,corr);
  154. break;
  155. }
  156. }
  157. }
  158. void printstatements(int onlyzerob){
  159. int ipt;
  160. /* A */
  161. qinv->printcorr(onlyzerob);
  162. /* B */
  163. /*
  164. for(ipt=0;ipt<10;ipt++){
  165. qinv_ptcut[ipt]->printcorr(onlyzerob);
  166. }
  167. */
  168. /* C */
  169. /*
  170. q_outwards->printcorr(onlyzerob);
  171. q_sidewards->printcorr(onlyzerob);
  172. q_beam->printcorr(onlyzerob);
  173. */
  174. /* D */
  175. qinv3d->printcorr(onlyzerob);
  176. /* E */
  177. for (int iMt = 0; iMt < NMTCUTS; iMt++) {
  178. qinv3d_mt[iMt]->printcorr(onlyzerob);
  179. }
  180. }