crab_bindefs_dircuts.cpp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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=25;
  59. maxmom=100.0;
  60. qinv=new onedbin_class(nkmax,maxmom,"qinv.dat");
  61. /* B */
  62. /* nkmax=50;
  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=25;
  72. maxmom=50.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=10;
  78. kxmax=kymax=kzmax=50.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. /* A */
  92. qinv->bincorr(inumden,mom,corr);
  93. /* B */
  94. /* pt=sqrt(pow(p1[1]+p2[1],2)+pow(p1[2]+p2[2],2));
  95. ipt=(int)floor(pt/DELPT);
  96. if(ipt<NPTCUTS){
  97. qinv_ptcut[ipt]->bincorr(inumden,mom,corr);
  98. } */
  99. /* C */
  100. long_comoving_boost=0;
  101. x_along_p=1;
  102. outwards_boost=0;
  103. decompose(p1,p2,vs,
  104. long_comoving_boost,x_along_p,outwards_boost,
  105. &kmag,&kx,&ky,&kz);
  106. if(fabs(ky)<5.0 && fabs(kz)<5.0) q_outwards->bincorr(inumden,kmag,corr);
  107. if(fabs(kx)<5.0 && fabs(kz)<5.0) q_sidewards->bincorr(inumden,kmag,corr);
  108. if(fabs(kx)<5.0 && fabs(ky)<5.0) q_beam->bincorr(inumden,kmag,corr);
  109. /* D */
  110. /*long_comoving_boost=1;
  111. x_along_p=0;
  112. outwards_boost=0;
  113. decompose(p1,p2,vs,
  114. long_comoving_boost,x_along_p,outwards_boost,
  115. &kmag,&kx,&ky,&kz);
  116. qinv3d->bincorr(inumden,kx,ky,kz,corr); */
  117. }
  118. void printstatements(int onlyzerob){
  119. int ipt;
  120. /* A */
  121. qinv->printcorr(onlyzerob);
  122. /* B */
  123. /* for(ipt=0;ipt<10;ipt++){
  124. qinv_ptcut[ipt]->printcorr(onlyzerob);
  125. } */
  126. /* C */
  127. q_outwards->printcorr(onlyzerob);
  128. q_sidewards->printcorr(onlyzerob);
  129. q_beam->printcorr(onlyzerob);
  130. /* D */
  131. /* qinv3d->printcorr(onlyzerob); */
  132. }