crab_bindefs_g3dtester.cpp 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 100
  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: one-d, where
  8. the answer will be given as C(x), and three-d, where the answer will
  9. 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. //#define NPTCUTS 10
  41. //#define DELPT 50
  42. //onedbin_class *qinv_ptcut[NPTCUTS];
  43. /* C */
  44. //onedbin_class *q_outwards;
  45. //onedbin_class *q_sidewards;
  46. //onedbin_class *q_beam;
  47. /* D. */
  48. threedbin_class *qinv3d;
  49. /* ********************************************************* */
  50. /* Initialize binning objects with desired mesh sizes and momentum ranges */
  51. void bininit(void){
  52. int ipt,nkmax,nkxmax,nkymax,nkzmax;
  53. int nptmax;
  54. double maxmom,kxmax,kymax,kzmax;
  55. double pt;
  56. char title[80];
  57. /* A */
  58. nkmax=100;
  59. maxmom=100.0;
  60. qinv=new onedbin_class(nkmax,maxmom,"qinv.dat");
  61. /* B */
  62. /* nkmax=100;
  63. maxmom=100.0;
  64. for(ipt=0;ipt<NPTCUTS;ipt++){
  65. pt=(0.5+ipt)*maxmom/NPTCUTS;
  66. pt=floor(pt+0.5);
  67. sprintf(title,"qinv_pt%03g.dat",pt);
  68. qinv_ptcut[ipt]=new onedbin_class(nkmax,maxmom,title);
  69. } */
  70. /* C */
  71. /* nkmax=100;
  72. maxmom=100.0;
  73. q_outwards=new onedbin_class(nkmax,maxmom,"q_outwards.dat");
  74. q_sidewards=new onedbin_class(nkmax,maxmom,"q_sidewards.dat");
  75. q_beam=new onedbin_class(nkmax,maxmom,"q_beam.dat"); */
  76. /* D */
  77. nkxmax=nkymax=nkzmax=20;
  78. kxmax=kymax=kzmax=80.0;
  79. qinv3d=new threedbin_class(nkxmax,nkymax,nkzmax,
  80. kxmax,kymax,kzmax,"qinv3d.dat");
  81. }
  82. /* ********************************************************* */
  83. /* Bin |phi|^2 according to p1 and p2 */
  84. /* Use the routine "decompose" to get projections of rel. mom. if desired */
  85. void binner(int inumden,double mom,double corr,double *p1,double *p2){
  86. double pt,kx,ky,kz,kmag;
  87. int ipt;
  88. /* These 3 variables define conv.s used by decompose, 0=no, 1=yes */
  89. int long_comoving_boost,x_along_p,outwards_boost;
  90. double vs=0.0;
  91. double original_corr;
  92. //if(inumden==0){
  93. //original_corr=corr;
  94. //corr=corr/get_gamow(mom);
  95. //}
  96. /* A */
  97. qinv->bincorr(inumden,mom,corr);
  98. /* B */
  99. /* pt=sqrt((p1[1]+p2[1])*(p1[1]+p2[1])+(p1[2]+p2[2])*(p1[2]+p2[2]));
  100. ipt=(int)floor(pt/DELPT);
  101. if(ipt<NPTCUTS){
  102. qinv_ptcut[ipt]->bincorr(inumden,mom,corr);
  103. } */
  104. /* C */
  105. /* long_comoving_boost=1;
  106. x_along_p=0;
  107. outwards_boost=0;
  108. decompose(p1,p2,vs,
  109. long_comoving_boost,x_along_p,outwards_boost,
  110. &kmag,&kx,&ky,&kz);
  111. if(fabs(ky)<5.0 && fabs(kz)<5.0) q_outwards->bincorr(inumden,kmag,corr);
  112. if(fabs(kx)<5.0 && fabs(kz)<5.0) q_sidewards->bincorr(inumden,kmag,corr);
  113. if(fabs(kx)<5.0 && fabs(ky)<5.0) q_beam->bincorr(inumden,kmag,corr); */
  114. /* D */
  115. long_comoving_boost=0;
  116. x_along_p=0;
  117. outwards_boost=0;
  118. decompose(p1,p2,vs,
  119. long_comoving_boost,x_along_p,outwards_boost,
  120. &kmag,&kx,&ky,&kz);
  121. qinv3d->bincorr(inumden,kx,ky,kz,corr);
  122. }
  123. void printstatements(int onlyzerob){
  124. int ipt;
  125. /* A */
  126. qinv->printcorr(onlyzerob);
  127. /* B */
  128. /* for(ipt=0;ipt<10;ipt++){
  129. qinv_ptcut[ipt]->printcorr(onlyzerob);
  130. } */
  131. /* C */
  132. /* q_outwards->printcorr(onlyzerob);
  133. q_sidewards->printcorr(onlyzerob);
  134. q_beam->printcorr(onlyzerob); */
  135. /* D */
  136. qinv3d->printcorr(onlyzerob);
  137. }