/* Directed flow (v1) analysis through the generating-function zeros method. */ /* The input is a file 'events.dat' following the structure of the file generated by 'generator.cc', i.e.: - first, the number of events; - then, for each event, the (detected) multiplicity, and for each particle the transverse momentum (in MeV) and the azimuth (in radians). */ /* The program then reconstructs integrated elliptic flow (V2) and integrated (V1) & differential (v1) directed flows. */ /* The results are stored in the output file 'zeros2.txt' */ /* Throughout the paper, references are made to the paper: N. Borghini, J.-Y. Ollitrault, Nucl. Phys. A 742 (2004) 130 [nucl-th/0404087]. */ #include #include #include #include #include "Bessel.h" #include "distributions.h" /* */ #define Pi (2.*acos(0.)) #define sqr(x) ((x)*(x)) #define rad2deg (180./Pi) #define rootJ0 2.4048256 /* First zero of the modified Bessel function J0 */ #define J1rootJ0 0.519147 /* J1(rootJ0) */ /* PARAMETERS USED IN THE RECONSTRUCTION */ /* kr is the number of r values at which one computes the generating function in the reconstruction of integrated elliptic flow V2; kt1, kt2 are the numbers of theta1, theta2 values used in the analysis. */ #define kr 80 #define kt1 5 #define kt2 5 #define eps 0.05 /* the arbitrary parameter epsilon: see Eq.(6) and the discussion below. */ #define v2max 0.101 /* maximal possible integrated elliptic flow value */ #define v2step 0.001 #define v2min 0.021 /* minimal possible integrated flow value: check that v2min + kr*v2step = v2max!! */ #define Nbins 60 /* number of bins for differential flow. Check that it is consistent with the number in distributions.cc! */ /* */ FILE *input, *data, *output, *plotVint, *plotvdiff; main() { /* main() */ /* Variable declaration */ const complex i(0,1); long neve; /* Number of events, running event index */ long rmult; /* Detected multiplicity in an event, particle index */ double rpmult[Nbins]; /* Detected multiplicity per bin */ double rmultmean; /* Average detected multiplicity */ float phi, pT; /* particle azimuth and transverse momentum */ int binpT; double theta1[kt1], theta2[kt2]; /* theta values */ double RZ[kr]; /* tabulation points for each theta1, theta2 values */ /* Generating functions evaluated at the tabulation points: - g[k2][k3] is the generating function g_0^{0,theta2[k2]} evaluated at r=RZ[k3]; - G[][] is its average over events; - modGsq[k2][k3] is the squared modulus of G[k2][k3]. */ complex g[kt2][kr], G[kt2][kr]; double modGsq[kt2][kr]; double r0[kt2]; /* RZ values which minimize G[k2][] */ double V2[kt2]; /* Integrated elliptic flow value for theta=theta2[k2]... */ double V2mean; /* ... and averaged over the angle theta2. */ /* - geps[k1][k2] is the generating function g_eps^{theta1[k1], theta2[k2]} evaluated at r0[k2]; Geps[][] is its average over events; - g0[k2] is the generating function g_0^{0, theta2[k2]} at r0[k2]; - dlng_dz[k2] is the logarithmic derivative of g_0^{0, theta2[k2]} with respect to z, evaluated at r0[k2]; - dG_dz[] is its average over events of the derivative with respect to z of g_0^{0, theta2[k2]} at r0[k2]; - dlngeps_dw1[k1][k2][bin] is the logarithmic derivative with respect to w1[bin] of g_eps^{theta1[k1], theta2[k2]}, evaluated at r0[k2], for differential particles in bin "bin"; - dGeps_dw1[][][] is the average over events of the derivative of geps with respect to w1 at r0[k2]. */ complex geps[kt1][kt2], Geps[kt1][kt2]; complex g0[kt2]; complex dlng_dz[kt2], dG_dz[kt2]; complex dlngeps_dw1[kt1][kt2][Nbins], dGeps_dw1[kt1][kt2][Nbins]; double V1; /* Reconstructed integrated directed flow */ double V1sq; /* "Squared" V1 (including the sign of V2) */ double vd1[Nbins]; /* Differential directed flow v1 in each bin. */ double v1av; /* Average v1, obtained by averaging the vd1[bin]. */ double w1[Nbins], w2[Nbins]; /* weights */ /* Event flow vectors, useful for the computation of statistical errors: - Q1/Q2 is the (weighted) flow vector in each event in harmonics n=1/2; - Q1mean/Q2mean is its average over events; - modQsqmean is the average over event of the squared modulus |Q|^2. */ complex Q1, Q1mean, Q2, Q2mean; double modQ1sqmean, modQ2sqmean; /* - chi1, chi2 are the so-called "resolution parameters", following the definition by J.-Y. Ollitrault in nucl-ex/9711003; - err2[kt2], is the statistical error bar on the integrated flow estimate V2[kt2]; err2mean is the error on V2mean; - err1m, err1p are the (asymmetric) error bars on V1; - err2mean is the average (over the angle theta2) of the err2[kt2]; - err11[] is the statistical error bar on the differential flow estimate vd1[] in the corresponding differential bin. */ double chi2, err2[kt2], err2mean; double chi1, err1m, err1p, err11[Nbins]; /* Maximal expected integrated elliptic flow V2 & step between successive V2 values investigated */ double V2max, V2step; int k; double temp1, temp2, temp3[Nbins]; struct timeval Time; int debut, fin; /* Initializations */ gettimeofday (&Time, 0); debut=Time.tv_sec; /* Initialization of angles: for theta1, kt1 angles equally spaced between 0 and 2 Pi (radians) for theta2, kt2 angles equally spaced between 0 and Pi/2 */ for(int k1=0; k1=%G\n", rmultmean); fprintf(output, " mean detected particle multiplicity =%G\n", rmultmean); fprintf(output, " Minimum measurable elliptic flow v2=%.3g\n\n", rootJ0/sqrt(2.*rmultmean*log(0.5*neve))); /* v = j_{01}/Sqrt(2M ln(Neve/2)) */ /* RECONSTRUCTION OF INTEGRATED ELLIPTIC FLOW */ V2mean=0.; for(int k2=0; k2modGsq[k2][k+1]) k++; /* Interpolate the value of V2[k2], see footnote 3 in Nucl. Phys. A 727, 373 and derive the corresponding position of the first zero of G */ V2[k2]=V2max-V2step*(k+(modGsq[k2][k-1]-modGsq[k2][k+1])/2./ (modGsq[k2][k-1]-2.*modGsq[k2][k]+modGsq[k2][k+1])); r0[k2]=rootJ0/V2[k2]; /* cf. Eq.(4) */ V2mean+=V2[k2]; /* Average V2 */ } /* End of the loop over theta2 angles */ V2mean/=kt2; /* Average V2 over angles */ /* Compute the resolution parameter chi, in harmonic 2, using Eqs.(59),(62) of Nucl. Phys. A 727 (2003) 373. */ chi2=V2mean/ sqrt(modQ2sqmean-sqr(real(Q2mean)/neve)-sqr(imag(Q2mean)/neve)-sqr(V2mean)); plotVint=fopen("plot_V2inf.grf", "w"); temp2=0.; for(int k2=0; k2... */ modQ1sqmean+=sqr(abs(Q1)); /* and the average of its square modulus */ } /* End of the loop over events */ fclose(input); modQ1sqmean/=neve; /* Average square moduli of the event flow vector Q1 */ /* Average of the generating functions... */ for(int k2=0; k2_{theta1;evts} = _evts>_theta1, so that one can average g_eps over events now, and perform the average over the theta1 angles later; */ for(int bin=0; bin_psi), while the average over theta1 will come later. */ } } for(int bin=0; bin_evts / _evts, where both functions are evaluated at i*r_0^theta2. Here I use the fact that the quantity Re(_evts>_theta1 / _evts) in Eq.(7) can be rewritten _evts>/_evts)>_theta1. */ temp1=0.; /* Similarly, the real part appearing in Eq.(9) can be cast in the form _psi>/_evts)>_theta1, and temp3[] will be, for each differential bin, the sum over theta1 of the product of the cosine times the real part of the ratio of generating functions. */ for(int bin=0; bin:\t%.3g +/- %.3g\n", V2mean/rmultmean, err2mean/rmultmean); /* Directed flow v1 */ fprintf(output, "\nINTEGRATED DIRECTED FLOW V1\n"); fprintf(output, " V1/:\t%.3g +%.3g / -%.3g\n", V1/rmultmean, err1p/rmultmean, err1m/rmultmean); plotvdiff=fopen("plot_v1inf.grf", "w"); fprintf(output, "\nDIFFERENTIAL DIRECTED FLOW\n"); for(int bin=0; bin=%G\n", bin, rpmult[bin]); fprintf(output, " v1=%.3g +/- %.3g\n", vd1[bin], err11[bin]); fprintf(plotvdiff, "%i\t%g\t%.3g\t%.3g\n", bin, rpmult[bin], vd1[bin], err11[bin]); } fclose(plotvdiff); fprintf(output, "\nAVERAGE DIRECTED FLOW =%.3g\n", v1av); fprintf(output, "\nRESOLUTION PARAMETERS chi1=%.2g, chi2=%.2g\n", chi1, chi2); gettimeofday (&Time, 0); fin=Time.tv_sec; fprintf(output, "\nEnd of the analysis, elapsed time=%d s\n", fin-debut); fclose(output); } /* main() */