21 #include "CLHEP/Random/RandFlat.h"
22 #include "CLHEP/Random/RandGaussQ.h"
23 #include "CLHEP/Vector/LorentzVector.h"
25 #include "GaudiKernel/PhysicalConstants.h"
33 float *par_float = (
float*)
params;
34 float phi_0 = par_float[0];
35 float *vn = par_float+1;
37 double val=
x +2*( vn[0]*
sin(1*(
x-psi_n[0]))/1.0 + vn[1]*
sin(2*(
x-psi_n[1]))/2.0 +
38 vn[2]*
sin(3*(
x-psi_n[2]))/3.0 + vn[3]*
sin(4*(
x-psi_n[3]))/4.0 +
39 vn[4]*
sin(5*(
x-psi_n[4]))/5.0 + vn[5]*
sin(6*(
x-psi_n[5]))/6.0 );
46 float *par_float = (
float*)
params;
47 float *vn = par_float+1;
49 double val=1 +2*( vn[0]*
cos(1*(
x-psi_n[0]))/1.0 + vn[1]*
cos(2*(
x-psi_n[1]))/2.0 +
50 vn[2]*
cos(3*(
x-psi_n[2]))/3.0 + vn[3]*
cos(4*(
x-psi_n[3]))/4.0 +
51 vn[4]*
cos(5*(
x-psi_n[4]))/5.0 + vn[5]*
cos(6*(
x-psi_n[5]))/6.0 );
60 for(
int ihar = 0; ihar< 6; ihar++){
69 ATH_MSG_INFO(
">>> AddFlowByShifting from Initialize <<<");
73 ATH_MSG_INFO(
"**********Settings for Afterburner************");
98 ATH_MSG_INFO(
"********************************r*************");
123 float b_lo[21]={ -1.00, 0.000, 1.483, 2.098, 2.569, 2.966, 3.317, 4.687, 5.739, 6.627, 7.409,
124 8.117, 8.767, 9.373, 9.943,10.479,10.991,11.479,11.947,15.00 ,100.0};
126 float b_hi[21]={ -1.00 , 1.483, 2.098, 2.569, 2.966, 3.317, 4.687, 5.739, 6.627, 7.409, 8.117,
127 8.767, 9.373, 9.943,10.479,10.991,11.479,11.947,12.399,15.00 ,100.0};
128 float val [21]={ 5.600, 5.600, 5.600,1.175 ,0.8253,0.7209,0.5324,0.4431,0.3984,0.3844,0.3847,
129 0.3935,0.4106,0.4310,0.4574,0.4674,0.4873,0.4796,0.4856,0.5130,0.5130};
131 for(
int i=0;
i<21;
i++) bimp_vals[
i]=(b_lo[
i]+b_hi[
i])/2.0;
136 return StatusCode::SUCCESS;
141 const EventContext& ctx)
const
145 rngWrapper->
setSeed( rngName, ctx );
153 const EventContext& ctx = Gaudi::Hive::currentContext();
157 if(
evtStore()->
retrieve(hijing_pars,
"Hijing_event_params").isFailure() ) {
159 return StatusCode::FAILURE;
162 " BPhi = " << hijing_pars->
get_bphi());
173 return StatusCode::FAILURE;
181 for (citr = mcCollptr->
begin(); citr!=mcCollptr->
end(); ++citr) {
182 mcFlowCollptr->
push_back(
new HepMC::GenEvent(*(*citr)));
188 for(
int ihar=0;ihar<6;ihar++){
189 m_psi_n[ihar] =(CLHEP::RandFlat::shoot(rndmEngine)-0.5)*2*
M_PI / (ihar+1);
195 ATH_MSG_DEBUG(
" Psi2 for event : "<<(*hijing_pars).get_psi(2));
200 for (itr = mcFlowCollptr->
begin(); itr!=mcFlowCollptr->
end(); ++itr) {
206 auto mainvtx=(*itr)->vertices().front();
208 int particles_in_event = (*itr)->particles().size();
210 for (
auto parent: mainvtx->particles_out())
212 auto mainvtx=*((*itr)->vertices_begin());
214 int particles_in_event = (*itr)->particles_size();
216 for (
auto parent: *mainvtx)
225 " Eta = " <<
momentum.pseudoRapidity()<<
254 ATH_MSG_INFO(
" Particles in event: " << particles_in_event <<
260 return StatusCode::FAILURE;
262 return StatusCode::SUCCESS;
267 ATH_MSG_INFO(
">>> AddFlowByShifting from finalize <<<");
269 return StatusCode::SUCCESS;
274 CLHEP::HepRandomEngine *rndmEngine)
280 double phi, phishift;
287 double rannum = CLHEP::RandFlat::shoot(rndmEngine);
288 double ranphi = (rannum-0.5)*2*
M_PI;
289 phishift = ranphi -
phi;
305 auto endvtx =
parent->end_vertex();
313 for ( HepMC::GenVertex::vertex_iterator
314 descvtxit = endvtx->vertices_begin(HepMC::descendants);
315 descvtxit != endvtx->vertices_end(HepMC::descendants);
317 auto descvtx = (*descvtxit);
323 if(std::abs(phishift) > 1
e-7) {
324 CLHEP::HepLorentzVector position(descvtx->position().x(),
325 descvtx->position().y(),
326 descvtx->position().z(),
327 descvtx->position().t());
329 descvtx->set_position(HepMC::FourVector( position.x(),position.y(),position.z(),position.t()) );
334 for (
auto descpart: descvtx->particles_out())
336 for (
auto descpart: *descvtx)
340 " Eta = " << descpart->momentum().pseudoRapidity() <<
341 " Phi = " << descpart->momentum().phi() );
356 double pt =
parent->momentum().perp();
357 double eta =
parent->momentum().pseudoRapidity();
358 double phi_0 =
parent->momentum().phi();
363 if(phi_0 !=phi_0) {
ATH_MSG_ERROR(
"ERROR phi of track is not defined");error_=1;}
366 <<
parent->momentum().py()<<
" "
367 <<
parent->momentum().pz()<<
" "
368 <<
parent->momentum().e() <<
" "
369 <<
parent->momentum().m() <<
" ");
376 for(
int ihar = 0; ihar< 6; ihar++){
m_v_n [ihar]=0.0;}
377 double b = hijing_pars->
get_b();
380 for(
int ihar = 0; ihar< 6; ihar++){
401 gsl_root_fsolver *
s = gsl_root_fsolver_alloc (
T);
404 for(
int ipar=0;ipar<13;ipar++) {
params[ipar]=0;}
408 gsl_root_fsolver_set (
s, &
F, x_lo, x_hi);
418 status = gsl_root_fsolver_iterate (
s);
419 phi = gsl_root_fsolver_root (
s);
420 x_lo = gsl_root_fsolver_x_lower (
s);
421 x_hi = gsl_root_fsolver_x_upper (
s);
422 status = gsl_root_test_interval (x_lo, x_hi,0, 0.00001);
424 while (
status == GSL_CONTINUE && iter < 1000);
425 gsl_root_fsolver_free (
s);
427 if (iter>=1000)
return 0;
429 phishift =
phi-phi_0;
432 if(std::abs(phishift) > 1
e-7) {
437 " V2 = " <<
m_v_n[1] <<
438 " V3 = " <<
m_v_n[2] <<
439 " V4 = " <<
m_v_n[3] <<
440 " V5 = " <<
m_v_n[4] <<
441 " V6 = " <<
m_v_n[5] <<
442 " Phi shift = " << phishift <<
443 " Phi shifted = " <<
momentum.phi() );
456 a1=0.4397*
std::exp(-(
b-4.526)*(
b-4.526)/72.0) + 0.636;
458 a3=4.79*0.0001*(
b-0.621)*(
b-10.172)*(
b-23)+1.2;
459 a4=0.135*
std::exp(-0.5*(
b-10.855)*(
b-10.855)/4.607/4.607) +0.0120;
463 float temp3 = 0.01 / (1+
std::exp(-(
pt-4.5)/a3));
467 float fb=0.97 +1.06*
std::exp(-0.5*
b*
b/3.2/3.2);
470 float gb= 1.096 +1.36 *
std::exp(-0.5*
b*
b/3.0/3.0);
471 gb=gb*sqrt(
m_v_n[1]);
485 a1=0.4397*
std::exp(-(
b-4.526)*(
b-4.526)/72.0) + 0.636;
487 a3=4.79*0.0001*(
b-0.621)*(
b-10.172)*(
b-23)+1.2;
488 a4=0.135*
std::exp(-0.5*(
b-10.855)*(
b-10.855)/4.607/4.607) +0.0120;
492 float temp3 = 0.01 / (1+
std::exp(-(
pt-4.5)/a3));
559 an_val[0][0] = 0.1149;
560 an_val[0][1] = 1.181;
561 an_val[0][2] = 0.3767;
563 an_val[1][0] = 0.0498;
564 an_val[1][1] = 1.688;
565 an_val[1][2] = 0.5046;
567 an_val[2][0] = 0.02095;
568 an_val[2][1] = 2.196;
569 an_val[2][2] = 0.6259;
571 an_val[3][0] = 0.00682*0.5;
572 an_val[3][1] = 4.938;
573 an_val[3][2] = 1.237;
585 int Total_Multiplicity=0;
589 for(
auto parent: *mainvtx) {
590 float eta=
parent->momentum().pseudoRapidity();
591 float pT =
parent->momentum().perp();
593 for(
int ihar = 0; ihar< 6; ihar++){
m_v_n [ihar]=0.0;}
595 for(
int ihar = 0; ihar< 6; ihar++){EbE_Vn[ihar] +=
m_v_n [ihar];}
596 Total_Multiplicity++;
600 for(
int ihar = 0; ihar< 6; ihar++){
m_v_n [ihar]=0.0;}
601 if(Total_Multiplicity<=0)
return;
604 for(
int ihar=0;ihar<6;ihar++){
605 EbE_Vn[ihar]/=Total_Multiplicity;
606 float vn_rp=0,delta=0;
612 if(ihar==0)
continue;
615 delta=EbE_Vn[ihar]/sqrt(2.0+alpha*alpha);
620 delta=EbE_Vn[ihar]/sqrt(2.0);
623 float X=CLHEP::RandGaussQ::shoot(rndmEngine,vn_rp,delta);
624 float Y=CLHEP::RandGaussQ::shoot(rndmEngine,0.0 ,delta);