ATLAS Offline Software
Loading...
Searching...
No Matches
AddFlowByShifting Class Reference

#include <AddFlowByShifting.h>

Inheritance diagram for AddFlowByShifting:
Collaboration diagram for AddFlowByShifting:

Public Member Functions

 AddFlowByShifting (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static double vn_func (double x, void *params)

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

enum  Harmonic {
  NumHar =6 , v1 =0 , v2 =1 , v3 =2 ,
  v4 =3 , v5 =4 , v6 =5
}
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

CLHEP::HepRandomEngine * getRandomEngine (const std::string &streamName, const EventContext &ctx) const
double SetParentToRanPhi (HepMC::GenParticlePtr parent, CLHEP::HepRandomEngine *rndmEngine)
double AddFlowToParent (HepMC::GenParticlePtr parent, const HijingEventParams *hijing_pars)
void MoveDescendantsToParent (HepMC::GenParticlePtr parent, double phishift)
void jjia_minbias_new (double b, double eta, double pt)
void jjia_minbias_new_v2only (double b, double eta, double pt)
void fixed_vn (double b, double eta, double pt)
void fixed_v2 (double b, double eta, double pt)
void jjia_minbias_old (double b, double eta, double pt)
void ao_test (double b, double eta, double pt)
void custom_vn (double b, double eta, double pt)
void p_Pb_cent_eta_indep (double b, double eta, double pt)
void OO_eta_indep (double b, double eta, double pt)
void Set_EbE_Fluctuation_Multipliers (HepMC::GenVertexPtr mainvtx, float b, CLHEP::HepRandomEngine *rndmEngine)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

void(AddFlowByShifting::* m_flow_function )(double b, double eta, double pt)
TGraph * m_graph_fluc {}
ServiceHandle< IAthRNGSvcm_rndmSvc {this, "RndmSvc", "AthRNGSvc"}
StringProperty m_inkey {this, "McTruthKey" , "GEN_EVENT" }
StringProperty m_outkey {this, "McFlowKey" , "FLOW_EVENT" }
IntegerProperty m_ranphi_sw {this, "RandomizePhi" , 0 }
StringProperty m_flow_function_name {this, "FlowFunctionName" , "jjia_minbias_new"}
StringProperty m_flow_implementation {this, "FlowImplementation", "exact" }
int m_flow_implementation_type {0}
BooleanProperty m_flow_fluctuations {this, "FlowFluctuations" , false }
IntegerProperty m_floweta_sw {this, "FlowEtaSwitch" , 0 }
FloatProperty m_flow_maxeta {this, "FlowMaxEtaCut" , 10.0 }
FloatProperty m_flow_mineta {this, "FlowMinEtaCut" , 0.f }
IntegerProperty m_flowpt_sw {this, "FlowPtSwitch" , 0 }
FloatProperty m_flow_maxpt {this, "FlowMaxPtCut" , 1000000.f }
FloatProperty m_flow_minpt {this, "FlowMinPtCut" , 0.f }
IntegerProperty m_flowb_sw {this, "FlowBSwitch" , 0 }
FloatProperty m_custom_v1 {this, "custom_v1" , 0.f }
FloatProperty m_custom_v2 {this, "custom_v2" , 0.f }
FloatProperty m_custom_v3 {this, "custom_v3" , 0.f }
FloatProperty m_custom_v4 {this, "custom_v4" , 0.f }
FloatProperty m_custom_v5 {this, "custom_v5" , 0.f }
FloatProperty m_custom_v6 {this, "custom_v6" , 0.f }
int m_particles_processed {0}
float m_psi_n [Harmonic::NumHar]
float m_v_n [Harmonic::NumHar]
float m_EbE_Multiplier_vn [Harmonic::NumHar]
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 39 of file AddFlowByShifting.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ Harmonic

Enumerator
NumHar 
v1 
v2 
v3 
v4 
v5 
v6 

Definition at line 101 of file AddFlowByShifting.h.

Constructor & Destructor Documentation

◆ AddFlowByShifting()

AddFlowByShifting::AddFlowByShifting ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 56 of file AddFlowByShifting.cxx.

56 :
57 AthAlgorithm(name, pSvcLocator)
58{
59 m_flow_function= NULL;
60 for(int ihar = 0; ihar< Harmonic::NumHar; ihar++){
61 m_psi_n[ihar] =0.0;
62 m_v_n [ihar] =0.0;
63 m_EbE_Multiplier_vn[ihar]=1.0;
64 }
65}
float m_psi_n[Harmonic::NumHar]
void(AddFlowByShifting::* m_flow_function)(double b, double eta, double pt)
float m_EbE_Multiplier_vn[Harmonic::NumHar]
float m_v_n[Harmonic::NumHar]
AthAlgorithm()
Default constructor:

Member Function Documentation

◆ AddFlowToParent()

double AddFlowByShifting::AddFlowToParent ( HepMC::GenParticlePtr parent,
const HijingEventParams * hijing_pars )
private

Definition at line 483 of file AddFlowByShifting.cxx.

484{
486 CLHEP::HepLorentzVector momentum(parent->momentum().px(),
487 parent->momentum().py(),
488 parent->momentum().pz(),
489 parent->momentum().e());
490 double pt = parent->momentum().perp();
491 double eta = parent->momentum().pseudoRapidity();
492 double phi_0 = parent->momentum().phi();
493
494 int error_=0;
495 if(pt !=pt) {ATH_MSG_ERROR("ERROR pt of track is not defined");error_=1;} //true if pt==nan
496 if(eta !=eta) {ATH_MSG_ERROR("ERROR eta of track is not defined");error_=1;}
497 if(phi_0 !=phi_0) {ATH_MSG_ERROR("ERROR phi of track is not defined");error_=1;}
498 if(error_==1){
499 ATH_MSG_ERROR("Original Particle Momentum(px,py,pz,e,m)="<<parent->momentum().px()<<" "
500 <<parent->momentum().py()<<" "
501 <<parent->momentum().pz()<<" "
502 <<parent->momentum().e() <<" "
503 <<parent->momentum().m() <<" ");
504 }
505
506
507
508
509 //Call the appropriate function to set the vn values
510 for(int ihar = 0; ihar< Harmonic::NumHar; ihar++){m_v_n [ihar]=0.0;} //reset the vn for this particle
511 double b = hijing_pars->get_b();
512 (*this.*m_flow_function)(b,eta,pt);//Set the vn for this particle
513
514 //add EbE fluctuations
516 for(int ihar = 0; ihar< Harmonic::NumHar; ihar++){
517 m_v_n[ihar] *= m_EbE_Multiplier_vn[ihar];
518 if(m_v_n[ihar]>0.5){
519 ATH_MSG_WARNING(" Vn Too large "<<ihar+1<<" "<<m_EbE_Multiplier_vn[ihar]<<" "<<m_v_n[ihar]);m_v_n[ihar]=0.5;
520 }
521 }
522 }
523
524 double phishift=0;
525
526 // Old fashioned rotation(approximate)
528 float phi=phi_0;
529 phishift= -2*( m_v_n[Harmonic::v1]*sin(1*(phi-m_psi_n[Harmonic::v1]))/1.0 +
535
536 }
537
538 // New fashioned rotation(exact)
539 else if (m_flow_implementation_type==1){
540 // Thread-safe according to https://www.gnu.org/software/gsl/doc/html/roots.html
541 const gsl_root_fsolver_type *T ATLAS_THREAD_SAFE = gsl_root_fsolver_brent;
542 gsl_root_fsolver *s = gsl_root_fsolver_alloc (T);
543 double x_lo=-2*M_PI,x_hi=2*M_PI;
544 float params[13];
545 for(int ipar=0;ipar<13;ipar++) {params[ipar]=0;}
546 gsl_function F;
547 F.function = &(AddFlowByShifting::vn_func);
548 F.params =&params;
549 gsl_root_fsolver_set (s, &F, x_lo, x_hi);
550 int iter=0;
551 params[ 0]=phi_0;
564 int status;
565 double phi=phi_0;
566 do
567 {
568 iter++;
569 status = gsl_root_fsolver_iterate (s);
570 phi = gsl_root_fsolver_root (s);
571 x_lo = gsl_root_fsolver_x_lower (s);
572 x_hi = gsl_root_fsolver_x_upper (s);
573 status = gsl_root_test_interval (x_lo, x_hi,0, 0.00001);
574 }
575 while (status == GSL_CONTINUE && iter < 1000);
576 gsl_root_fsolver_free (s);
577
578 if (iter>=1000) return 0;
579
580 phishift = phi-phi_0;
581 }
582
583 if(std::abs(phishift) > 1e-7) {
584 momentum.rotateZ(phishift*Gaudi::Units::rad);
585 parent->set_momentum( HepMC::FourVector(momentum.px(),momentum.py(),momentum.pz(),momentum.e()) );
586 }
587 ATH_MSG_DEBUG( "Parent particle:" <<
588 " V1 = " << m_v_n[Harmonic::v1] <<
589 " V2 = " << m_v_n[Harmonic::v2] <<
590 " V3 = " << m_v_n[Harmonic::v3] <<
591 " V4 = " << m_v_n[Harmonic::v4] <<
592 " V5 = " << m_v_n[Harmonic::v5] <<
593 " V6 = " << m_v_n[Harmonic::v6] <<
594 " Phi shift = " << phishift <<
595 " Phi shifted = " << momentum.phi() );
596
597 return phishift;
598}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define F(x, y, z)
Definition MD5.cxx:112
#define ATLAS_THREAD_SAFE
static double vn_func(double x, void *params)
BooleanProperty m_flow_fluctuations
unsigned long long T
status
Definition merge.py:16

◆ ao_test()

void AddFlowByShifting::ao_test ( double b,
double eta,
double pt )
private

Definition at line 680 of file AddFlowByShifting.cxx.

681{
682 for(int ihar=0;ihar<Harmonic::NumHar;ihar++){
683 m_v_n[ihar]=0.0;
684 }
685
686 pt/=1000;
687 if(pt>2) pt = 2; // flat max at pt > 2
688
689 m_v_n[Harmonic::v2] = 0.02 * b * pt;
690}

◆ custom_vn()

void AddFlowByShifting::custom_vn ( double b,
double eta,
double pt )
private

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode AddFlowByShifting::execute ( )

Definition at line 231 of file AddFlowByShifting.cxx.

231 {
232 ATH_MSG_INFO(">>> AddFlowByShifting from execute");
233
234 const EventContext& ctx = Gaudi::Hive::currentContext();
235 CLHEP::HepRandomEngine *rndmEngine = getRandomEngine("FLOW", ctx);
236 // Get hijing event parameters
237 const HijingEventParams *hijing_pars;
238 if( evtStore()->retrieve(hijing_pars, "Hijing_event_params").isFailure() ) {
239 ATH_MSG_ERROR("Could not retrieve Hijing_event_params");
240 return StatusCode::FAILURE;
241 }
242 ATH_MSG_INFO("Event parameters: B = " << hijing_pars->get_b()<<
243 " BPhi = " << hijing_pars->get_bphi());
244
245
246 // FIXME: changing data in the event store
247 HijingEventParams *hijing_pars_nc = const_cast<HijingEventParams*> (hijing_pars);
248
249
250 // Read Data from Transient Store
251 const McEventCollection* mcCollptr;
252 if ( evtStore()->retrieve(mcCollptr, m_inkey).isFailure() ) {
253 ATH_MSG_ERROR("Could not retrieve truth McEventCollection");
254 return StatusCode::FAILURE;
255 }
256
257
258 // Loop over all events in original McEventCollection and
259 // Copy to a new (modifiable) collection
261 McEventCollection* mcFlowCollptr = new McEventCollection();
262 for (citr = mcCollptr->begin(); citr!=mcCollptr->end(); ++citr) {
263 mcFlowCollptr->push_back(new HepMC::GenEvent(*(*citr)));
264 }
265
266
267 //Geneate the event-plane angles (some of them may or may not be used later on)
268 //Store the angles into the hijing event parameters
269 for(int ihar=0;ihar<6;ihar++){
270 m_psi_n[ihar] =(CLHEP::RandFlat::shoot(rndmEngine)-0.5)*2*M_PI / (ihar+1); //Principal value must be within -PI/n to PI/n
271 hijing_pars_nc->set_psi(ihar+1,m_psi_n[ihar]);
272 }
273 m_psi_n[1]=hijing_pars->get_bphi() ;//the psi2 plane is aligned with the impact parameter
274 m_psi_n[1]=std::atan2(std::sin(2*m_psi_n[1]),std::cos(2*m_psi_n[1]))/2.0;//ensure that Psi2 is within [-PI/2,PI/2]
275 hijing_pars_nc->set_psi(2,m_psi_n[1]);
276 ATH_MSG_DEBUG(" Psi2 for event : "<<(*hijing_pars).get_psi(2));
277
278
279 // Add flow by phi angle shifting
281 for (itr = mcFlowCollptr->begin(); itr!=mcFlowCollptr->end(); ++itr) {
282 ATH_MSG_DEBUG("Next event in the bag ...");
283
284
285
286#ifdef HEPMC3
287 auto mainvtx=(*itr)->vertices().front();
288 if(m_flow_fluctuations) Set_EbE_Fluctuation_Multipliers(mainvtx,hijing_pars->get_b(),rndmEngine);
289 int particles_in_event = (*itr)->particles().size();
291 for ( auto parent: mainvtx->particles_out())
292#else
293 auto mainvtx=*((*itr)->vertices_begin());
294 if(m_flow_fluctuations) Set_EbE_Fluctuation_Multipliers(mainvtx,hijing_pars->get_b(),rndmEngine);
295 int particles_in_event = (*itr)->particles_size();
297 for ( auto parent: *mainvtx)
298#endif
299 {
300 // Process particles from main vertex
301 CLHEP::HepLorentzVector momentum(parent->momentum().px(),
302 parent->momentum().py(),
303 parent->momentum().pz(),
304 parent->momentum().e());
305 ATH_MSG_DEBUG("Parent particle: " << parent <<
306 " Eta = " << momentum.pseudoRapidity()<<
307 " Phi = " << momentum.phi() );
308
309 //skip particle if eta is outside implementation range
310 if(m_floweta_sw){
311 float eta=std::abs(momentum.pseudoRapidity());
313 }
314
315 //skip particle if pT is outside implementation range
316 if(m_flowpt_sw){
317 float pT=momentum.perp();
318 if (pT<m_flow_minpt || pT> m_flow_maxpt) continue;
319 }
320
321 // Randomize phi if explicitely requested
322 if(m_ranphi_sw) {
323 double phishift = SetParentToRanPhi(parent, rndmEngine);
324 MoveDescendantsToParent(parent, phishift) ;// adjust descendants to parent position
325 }
326
327 // Add flow to particles from main vertex
328 double phishift = AddFlowToParent(parent, hijing_pars);
329 MoveDescendantsToParent(std::move(parent), phishift);// adjust descendants to parent position
330 }
331
332 // correct for double counting
334 // correct for incoming particles
335 ATH_MSG_INFO( " Particles in event: " << particles_in_event <<
336 " Processed for flow: " << m_particles_processed+2);
337 if(particles_in_event != (m_particles_processed+2)){
338 ATH_MSG_WARNING( " Particles in event: " << particles_in_event <<
339 " Processed for flow: " << m_particles_processed+2);
340 }
341 }
342
343 if(evtStore()->record(mcFlowCollptr, m_outkey).isFailure()){
344 ATH_MSG_ERROR("Could not record flow McEventCollection");
345 return StatusCode::FAILURE;
346 }
347 return StatusCode::SUCCESS;
348}
#define ATH_MSG_INFO(x)
StringProperty m_outkey
IntegerProperty m_flowpt_sw
void Set_EbE_Fluctuation_Multipliers(HepMC::GenVertexPtr mainvtx, float b, CLHEP::HepRandomEngine *rndmEngine)
double AddFlowToParent(HepMC::GenParticlePtr parent, const HijingEventParams *hijing_pars)
double SetParentToRanPhi(HepMC::GenParticlePtr parent, CLHEP::HepRandomEngine *rndmEngine)
IntegerProperty m_floweta_sw
FloatProperty m_flow_maxeta
void MoveDescendantsToParent(HepMC::GenParticlePtr parent, double phishift)
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
StringProperty m_inkey
IntegerProperty m_ranphi_sw
FloatProperty m_flow_maxpt
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
void set_psi(int ihar, float psi)
float get_bphi() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode AddFlowByShifting::finalize ( )

Definition at line 351 of file AddFlowByShifting.cxx.

351 {
352 ATH_MSG_INFO(">>> AddFlowByShifting from finalize <<<");
353 if(m_graph_fluc){
354 delete m_graph_fluc ;
355 m_graph_fluc=nullptr;
356 }
357
358 // End of finalization step
359 return StatusCode::SUCCESS;
360}

◆ fixed_v2()

void AddFlowByShifting::fixed_v2 ( double b,
double eta,
double pt )
private

Definition at line 657 of file AddFlowByShifting.cxx.

658{
659 for(int ihar=0;ihar<Harmonic::NumHar;ihar++){
660 m_v_n[ihar]=0.0;
661 }
662 m_v_n[Harmonic::v2]=0.0500;
663}

◆ fixed_vn()

void AddFlowByShifting::fixed_vn ( double b,
double eta,
double pt )
private

Definition at line 645 of file AddFlowByShifting.cxx.

646{
647 m_v_n[Harmonic::v1]=0.0000;
648 m_v_n[Harmonic::v2]=0.0500;
649 m_v_n[Harmonic::v3]=0.0280;
650 m_v_n[Harmonic::v4]=0.0130;
651 m_v_n[Harmonic::v5]=0.0045;
652 m_v_n[Harmonic::v6]=0.0015;
653}

◆ getRandomEngine()

CLHEP::HepRandomEngine * AddFlowByShifting::getRandomEngine ( const std::string & streamName,
const EventContext & ctx ) const
private

Definition at line 221 of file AddFlowByShifting.cxx.

223{
224 ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
225 std::string rngName = name()+streamName;
226 rngWrapper->setSeed( rngName, ctx );
227 return rngWrapper->getEngine(ctx);
228}
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition RNGWrapper.h:169
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition RNGWrapper.h:134
ServiceHandle< IAthRNGSvc > m_rndmSvc

◆ initialize()

StatusCode AddFlowByShifting::initialize ( )

Definition at line 68 of file AddFlowByShifting.cxx.

68 {
69 ATH_MSG_INFO(">>> AddFlowByShifting from Initialize <<<");
70
71 ATH_CHECK(m_rndmSvc.retrieve());
72
73 ATH_MSG_INFO("**********Settings for Afterburner************");
74 ATH_MSG_INFO("McTruthKey : " << m_inkey );
75 ATH_MSG_INFO("McFlowKey : " << m_outkey );
76
77 ATH_MSG_INFO("FlowFunctionName : " << m_flow_function_name );
78 ATH_MSG_INFO("FlowInplementation : " << m_flow_implementation);
79 ATH_MSG_INFO("FlowFluctuations : " << m_flow_fluctuations );
80
81 ATH_MSG_INFO("RandomizePhi : " << m_ranphi_sw );
82
83 ATH_MSG_INFO("FlowEtaSwitch : " << m_floweta_sw );
84 ATH_MSG_INFO("FlowMinEtaCut : " << m_flow_mineta );
85 ATH_MSG_INFO("FlowMaxEtaCut : " << m_flow_maxeta );
86
87 ATH_MSG_INFO("FlowPtSwitch : " << m_flowpt_sw );
88 ATH_MSG_INFO("FlowMinPtCut : " << m_flow_minpt );
89 ATH_MSG_INFO("FlowMaxPtCut : " << m_flow_maxpt );
90
91 ATH_MSG_INFO("FlowV1 : " << m_custom_v1 );
92 ATH_MSG_INFO("FlowV2 : " << m_custom_v2 );
93 ATH_MSG_INFO("FlowV3 : " << m_custom_v3 );
94 ATH_MSG_INFO("FlowV4 : " << m_custom_v4 );
95 ATH_MSG_INFO("FlowV5 : " << m_custom_v5 );
96 ATH_MSG_INFO("FlowV6 : " << m_custom_v6 );
97 ATH_MSG_INFO("FlowBSwitch : " << m_flowb_sw );
98 ATH_MSG_INFO("********************************r*************");
99
100
101 // Select the flow-implementing function based of the function-choice variable
112 else{
113 ATH_MSG_ERROR("Unimplemented option for setting 'FlowFunctionName' : " << m_flow_function_name);
114 return StatusCode::FAILURE;
115 }
116
117
119 if (m_flow_implementation=="approximate"){
121 ATH_MSG_WARNING("'FlowInplementation=\"approximate\"' is obsolete, please switch to 'FlowInplementation=\"exact\"' ");
122 }
123 else if(m_flow_implementation=="exact" ){
125 }
126 else{
127 ATH_MSG_ERROR("Unimplemented option for setting 'FlowInplementation' : " << m_flow_implementation);
128 return StatusCode::FAILURE;
129 }
130
131
132
133 //TGraph storing the v2_RP/delta Vs b_imp values to be used in implementing the EbyE fluctuations
134 //the values below are b_imp-low,b_imp-high, delta/v2_RP for different centralities
135 //underflow and overflow bins are added for smooth extrapolation
137 //Fluctuations for Pb+Pb
138 if(m_flow_function_name=="jjia_minbias_new" ||
139 m_flow_function_name=="jjia_minbias_new_v2only")
140 {
141 //The delta/v2_RP values are taken from Fig15 of EbE vn paper (arXiv:1305.2942)
142 // <0 , 0-1 , 1-2 , 2-3 , 3-4 , 4-5 , 5-10 , 10-15, 15-20, 20-25, 25-30,
143 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,
144 8.117, 8.767, 9.373, 9.943,10.479,10.991,11.479,11.947,15.00 ,100.0};
145 // 30-35, 35-40, 40-45, 45-50, 50-55, 55-60, 60-65, 65-70, 70-
146 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,//bimp_high
147 8.767, 9.373, 9.943,10.479,10.991,11.479,11.947,12.399,15.00 ,100.0};
148 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,
149 0.3935,0.4106,0.4310,0.4574,0.4674,0.4873,0.4796,0.4856,0.5130,0.5130};
150 float bimp_vals[21];
151
152 for(int i=0;i<21;i++){
153 bimp_vals[i]=(b_lo[i]+b_hi[i])/2.0f;
154 val [i]=1.0f/val[i];//change to v2_RP/delta
155 val [i]=1.0/val[i];//change to v2_RP/delta
156 }
157
158 m_graph_fluc=new TGraph(21,bimp_vals,val);
159 }
160
161 //Fluctuations for O+O
162 if(m_flow_function_name=="OO_eta_indep")
163 {
164 //The v2{2} and v2{4} values are taken from the OO paper (arXiv:2509.05171)
165 //The v2{4} values beyond the 50-60% bin are put in by hand
166 //The v2{2} values beyond the 75-80% bin are put in by hand
167 //The impact parameters are obtained from HIJING
168
169 //4-particle cumulant v2 (v2{4})
170 // <0, 0-1, 1-2, 2-3, 3-4, 4-5, 5-10, 10-15, 15-20, 20-25, 25-30,
171 // 30-35, 35-40, 40-50, 50-60, 60-80, 80-100, >100,
172 float v2_4 [18]={ 0.0444322, 0.0444322, 0.0476009, 0.0495882, 0.0513053, 0.0527020, 0.0563533, 0.0614435, 0.0650522, 0.0675199, 0.0693970,
173 0.0705456, 0.0706748, 0.0686654, 0.0571383, 0.04 , 0.02 , 0.0 };//last three bins are put in by hand
174 float bimp4[18]={-1 , 0.481843, 0.886609 , 1.13462 , 1.33981 , 1.52064 , 1.95342 , 2.51881 , 2.97665 , 3.37416 , 3.72876 ,
175 4.05377 , 4.35564 , 4.77463 , 5.30719 , 6.08296 , 7.6415 , 15 };
176
177
178 // template-fit v2 (v2{2})
179 // <0, 0-1, 1-2, 2-3, 3-4, 4-5, 5-10, 10-15, 15-20, 20-25, 25-30,
180 // 30-35, 35-40, 40-45, 45-50, 50-55, 55-60, 60-65, 65-70, 70-75, 75-80, 80-100,>100
181 float v2_2 [23]={ 0.0749381, 0.0749381, 0.0782992, 0.0801742, 0.0814646, 0.0826611, 0.0853616, 0.0889407, 0.0913229, 0.0928072, 0.0933774,
182 0.0933299, 0.0926254, 0.0910148, 0.0889322, 0.086161 , 0.0828212, 0.0793132, 0.0755036, 0.0714726, 0.0668264, 0.055 , 0.05};//last two bins are put in by hand
183 float bimp2[23]={-1 , 0.481843, 0.886609 , 1.13462 , 1.33981 , 1.52064 , 1.95342 , 2.51881 , 2.97665 , 3.37416 , 3.72876 ,
184 4.05377 , 4.35564 , 4.63868 , 4.91057 , 5.17773 , 5.43665 , 5.68739 , 5.94258 , 6.20668 , 6.49519 , 7.6415 , 15};
185
186
187 //Evaluate ratio of v2{4}/delta
188 TGraph *graph_v2_4=new TGraph(18,bimp4,v2_4);
189 TGraph *graph_v2_2=new TGraph(23,bimp2,v2_2);
190 float ratio[23]={0};
191 for(int i=0;i<23;i++){
192 double vn_RP=graph_v2_4->Eval(bimp2[i]);
193 double vn_2 =graph_v2_2->Eval(bimp2[i]);
194 double delta=vn_2*vn_2 - vn_RP*vn_RP;
195 if(delta>0){
196 ratio[i]= vn_RP/sqrt(delta/2.0);
197 }
198 else{
199 ATH_MSG_ERROR("vn{2}<vn{4} for b_imp = " << bimp2[i]);
200 return StatusCode::FAILURE;
201 }
202 }
203
204 m_graph_fluc=new TGraph(23,bimp2,ratio);
205 delete graph_v2_4;
206 delete graph_v2_2;
207 }
208 //Fluctuations for Ne+Ne (TODO)
209
210 else{
211 ATH_MSG_ERROR("Flow fluctuations are not implemented for the following case: " << m_flow_function_name);
212 }
213 }
214
215
216 // Initialization terminated
217 return StatusCode::SUCCESS;
218}
#define ATH_CHECK
Evaluate an expression and check for errors.
StringProperty m_flow_function_name
FloatProperty m_flow_mineta
void jjia_minbias_new(double b, double eta, double pt)
void ao_test(double b, double eta, double pt)
StringProperty m_flow_implementation
void p_Pb_cent_eta_indep(double b, double eta, double pt)
FloatProperty m_flow_minpt
IntegerProperty m_flowb_sw
void jjia_minbias_new_v2only(double b, double eta, double pt)
void jjia_minbias_old(double b, double eta, double pt)
void fixed_v2(double b, double eta, double pt)
void OO_eta_indep(double b, double eta, double pt)
void custom_vn(double b, double eta, double pt)
void fixed_vn(double b, double eta, double pt)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ jjia_minbias_new()

void AddFlowByShifting::jjia_minbias_new ( double b,
double eta,
double pt )
private

Definition at line 603 of file AddFlowByShifting.cxx.

604{
605 pt=pt/1000.0; //convert to GeV
606
607 float a1,a2,a3,a4;
608 a1=0.4397*std::exp(-(b-4.526)*(b-4.526)/72.0) + 0.636;
609 a2=1.916/(b+2) +0.1;
610 a3=4.79*0.0001*(b-0.621)*(b-10.172)*(b-23)+1.2; // this is >0 for b>0
611 a4=0.135*std::exp(-0.5*(b-10.855)*(b-10.855)/4.607/4.607) +0.0120;
612
613 float temp1 = std::pow(pt , a1) / (1+std::exp( (pt-3.0)/a3));
614 float temp2 = std::pow(pt+0.1,-a2) / (1+std::exp(-(pt-4.5)/a3));
615 float temp3 = 0.01 / (1+std::exp(-(pt-4.5)/a3));
616
617 m_v_n[Harmonic::v2] = ( a4*(temp1+temp2) + temp3 )* std::exp(-0.5* eta*eta /6.27/6.27) ;
618
619 float fb=0.97 +1.06*std::exp(-0.5*b*b/3.2/3.2);
620 m_v_n[Harmonic::v3]=std::pow(fb*std::sqrt(m_v_n[1]),3);
621
622 float gb= 1.096 +1.36 *std::exp(-0.5*b*b/3.0/3.0);
623 gb=gb*sqrt(m_v_n[1]);
624 m_v_n[Harmonic::v4]=pow(gb,4);
625 m_v_n[Harmonic::v5]=pow(gb,5);
626 m_v_n[Harmonic::v6]=pow(gb,6);
628}
constexpr int pow(int base, int exp) noexcept

◆ jjia_minbias_new_v2only()

void AddFlowByShifting::jjia_minbias_new_v2only ( double b,
double eta,
double pt )
private

Definition at line 632 of file AddFlowByShifting.cxx.

633{
634 jjia_minbias_new(b, eta, pt);
635 //Set all harmonics except v2 to 0
636 m_v_n[Harmonic::v1] = 0;
637 m_v_n[Harmonic::v3] = 0;
638 m_v_n[Harmonic::v4] = 0;
639 m_v_n[Harmonic::v5] = 0;
640 m_v_n[Harmonic::v6] = 0;
641}

◆ jjia_minbias_old()

void AddFlowByShifting::jjia_minbias_old ( double b,
double eta,
double pt )
private

Definition at line 667 of file AddFlowByShifting.cxx.

668{
669 m_v_n[Harmonic::v1] = 0;
670 m_v_n[Harmonic::v2] = 0.03968 * b
671 * (1 - 2.1/(1 + std::exp(1.357*(pt/1000))))
672 * std::exp(-(eta*eta)/(2*6.37*6.37));
673 m_v_n[Harmonic::v3]=0.0000;
674 m_v_n[Harmonic::v4]=0.0000;
675 m_v_n[Harmonic::v5]=0.0000;
676 m_v_n[Harmonic::v6]=0.0000;
677}

◆ MoveDescendantsToParent()

void AddFlowByShifting::MoveDescendantsToParent ( HepMC::GenParticlePtr parent,
double phishift )
private

Definition at line 390 of file AddFlowByShifting.cxx.

392{
393 // Move the branch of descendant vertices and particles
394 // by phishift to parent particle position
395 auto endvtx = parent->end_vertex();
396 if ( endvtx ) {
397 ATH_MSG_DEBUG("Processing branch of parent particle "<< parent);
398
399 //Added October 2025
400 // --- Rotate the parent’s end vertex itself ---
401 if (std::abs(phishift) > 1e-7) {
402 CLHEP::HepLorentzVector pos(endvtx->position().x(),
403 endvtx->position().y(),
404 endvtx->position().z(),
405 endvtx->position().t());
406 pos.rotateZ(phishift * Gaudi::Units::rad);
407 endvtx->set_position(HepMC::FourVector(pos.x(), pos.y(), pos.z(), pos.t()));
408 }
409
410
411 //Added October 2025
412 // --- Rotate the parent’s immediate daughters (outgoing of endvtx) ---
413 #ifdef HEPMC3
414 for (auto child : endvtx->particles_out())
415 #else
416 for (auto child : *endvtx)
417 #endif
418 {
419 CLHEP::HepLorentzVector p(child->momentum().px(),
420 child->momentum().py(),
421 child->momentum().pz(),
422 child->momentum().e());
423 if (std::abs(phishift) > 1e-7) {
424 p.rotateZ(phishift * Gaudi::Units::rad);
425 child->set_momentum(HepMC::FourVector(p.px(), p.py(), p.pz(), p.e()));
426 }
428 }
429
430
431 // now rotate descendant vertices
432 #ifdef HEPMC3
433 for (HepMC::GenVertexPtr descvtx: HepMC::descendant_vertices(endvtx)) { //}
434 #else
435 for ( HepMC::GenVertex::vertex_iterator
436 descvtxit = endvtx->vertices_begin(HepMC::descendants);
437 descvtxit != endvtx->vertices_end(HepMC::descendants);
438 ++descvtxit) {
439 auto descvtx = (*descvtxit);
440 #endif
441
442 ATH_MSG_DEBUG("Processing vertex " << descvtx);
443
444 // rotate vertex
445 if(std::abs(phishift) > 1e-7) {
446 CLHEP::HepLorentzVector position(descvtx->position().x(),
447 descvtx->position().y(),
448 descvtx->position().z(),
449 descvtx->position().t());
450 position.rotateZ(phishift*Gaudi::Units::rad);
451 descvtx->set_position(HepMC::FourVector( position.x(),position.y(),position.z(),position.t()) );
452 }
453
454 // now rotate their associated particles
455 #ifdef HEPMC3
456 for (auto descpart: descvtx->particles_out())
457 #else
458 for (auto descpart: *descvtx)
459 #endif
460 {
461 CLHEP::HepLorentzVector momentum(descpart->momentum().px(),
462 descpart->momentum().py(),
463 descpart->momentum().pz(),
464 descpart->momentum().e());
465 ATH_MSG_DEBUG("Descendant particle: " << descpart <<
466 " Eta = " << descpart->momentum().pseudoRapidity() <<
467 " Phi = " << descpart->momentum().phi() );
469 // rotate particle
470 if(std::abs(phishift) > 1e-7) {
471 momentum.rotateZ(phishift*Gaudi::Units::rad);
472 descpart->set_momentum( HepMC::FourVector(momentum.px(),momentum.py(),momentum.pz(),momentum.e()) );
473 ATH_MSG_DEBUG(" Phi shift = " << phishift<<
474 " Phi shifted = " << momentum.phi());
475 }
476 }
477 }
478 }
479 return;
480}
HepMC::GenVertex * GenVertexPtr
Definition GenVertex.h:59

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ OO_eta_indep()

void AddFlowByShifting::OO_eta_indep ( double b,
double eta,
double pt )
private

Definition at line 735 of file AddFlowByShifting.cxx.

735 {
736 pt=pt/1000.0; //convert to GeV
737
738
739 //For Testing
740 /*
741 m_v_n[Harmonic::v1]=0;
742 m_v_n[Harmonic::v2]=0.1;
743 m_v_n[Harmonic::v3]=0.05;
744 m_v_n[Harmonic::v4]=0.03;
745 m_v_n[Harmonic::v5]=0;
746 m_v_n[Harmonic::v6]=0;
747 return;
748 */
749
750
751 //pT differential vn for 0-5% centrality
752 static TGraph gr_v2pt;
753 static TGraph gr_v3pt;
754 static TGraph gr_v4pt;
755 //centrality dependent scale-factors for other centralities
756 static TGraph gr_v2_cent_scale;
757 static TGraph gr_v3_cent_scale;
758 static TGraph gr_v4_cent_scale;
759
760 static bool is_initialized=false;
761 if(is_initialized==false){
762 //----------------------------------------------------------------------------------
763 //The pt Dependent v2,v3,v4 for the 0-5% centrality interval from template-fit method
764 //https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/PAPERS/HION-2025-02/fig_05.png
765 const int NumPtBins=23;
766 float v2_pt[NumPtBins]={
767 0.0 ,//extrapolation
768 0.049533 ,0.0622719,0.0776591,0.0906141,0.101341 ,0.110451 ,0.117545,
769 0.123217 ,0.126643 ,0.129142 ,0.129176 ,0.128795 ,0.126009 ,0.120966,
770 0.109416 ,0.0966881,0.0825195,0.0708585,0.0615164,0.0508748,
771 0.015 ,0.015 //extrapolation to 1.5% v2 at high-pT
772 };
773 float v3_pt[NumPtBins]={
774 0.0 ,//extrapolation
775 0.0186328,0.0262968,0.0366394,0.0467804,0.0562739,0.0639566,0.0714195,
776 0.0783429,0.0838629,0.0886202,0.0907969,0.0922756,0.0948961,0.0947266,
777 0.0898434,0.0839913,0.0801961,0.0685197,0.0648406,0.0600871,
778 0.00 ,0.00//extrapolation
779 };
780 //----------------------------------------------------
781 //For v3, we use the average of the template and 2PC values
782 float v3_pt_2PC[NumPtBins]={
783 0.0 ,//extrapolation
784 0.0182106,0.0255873,0.0355349,0.0451583,0.0537545,0.0611133,0.0675791,
785 0.0732434,0.0778371,0.0812549,0.0823093,0.0826907,0.082954 ,0.0800712,
786 0.0719686,0.062255 ,0.0498296,0.0370541,0.027638 ,0.0139785,
787 0.00 ,0.00//extrapolation
788 };
789 for(int i=0;i<NumPtBins;i++) v3_pt[i]=(v3_pt[i]+v3_pt_2PC[i])/2.0;
790 //----------------------------------------------------
791
792 float v4_pt[NumPtBins]={
793 0.0 ,//extrapolation
794 0.00446155,0.00710366,0.0117637,0.0158203,0.01931 ,0.0234234,0.0268995,
795 0.0299693 ,0.0321662 ,0.0335182,0.0358789,0.0374195,0.0359359,0.0327255,
796 0.0254762 ,0.0273239 ,0.0212901,0.0152591, -0 ,-0 ,//-ve values replaced by -0
797 0.0 , 0.00//extrapolation
798 };
799 float pt_bins[NumPtBins]={
800 0.0 ,//extrapolation
801 0.55 ,0.7 ,0.9 ,1.1 , 1.3, 1.5, 1.7,
802 1.9 ,2.1 ,2.3 ,2.5 , 2.7, 2.9, 3.25,
803 3.75 ,4.25 ,4.75 ,5.25 , 5.75, 6.5,
804 10.0 ,10000 //extrapolation
805 };
806 gr_v2pt=TGraph(NumPtBins,pt_bins,v2_pt);
807 gr_v3pt=TGraph(NumPtBins,pt_bins,v3_pt);
808 gr_v4pt=TGraph(NumPtBins,pt_bins,v4_pt);
809 gr_v2pt.SetBit(TGraph::kIsSortedX);//For faster return From Eval()
810 gr_v3pt.SetBit(TGraph::kIsSortedX);//For faster return From Eval()
811 gr_v4pt.SetBit(TGraph::kIsSortedX);//For faster return From Eval()
812 //----------------------------------------------------------------------------------
813
814
815 //----------------------------------------------------------------------------------
816 //centrality dependent v2, v3, v4 (template-fit method)
817 //https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/PAPERS/HION-2025-02/figaux_03.png
818 const int NumCentBins=23;
819 float v2_cent[NumCentBins]={
820 0.0749381,//underflow
821 0.0749381,0.0782992,0.0801742,0.0814646,0.0826611,0.0853616,0.0889407,
822 0.0913229,0.0928072,0.0933774,0.0933299,0.0926254,0.0910148,0.0889322,
823 0.086161 ,0.0828212,0.0793132,0.0755036,0.0714726,0.0668264,
824 0.055 , 0.05 //80-100 and overflow, put by hand ; using 5% v2 asymptotically
825 };
826 float v3_cent[NumCentBins]={
827 0.0409694,//underflow
828 0.0409694,0.0399241,0.0394262,0.0388545,0.0385726,0.0375281,0.0360179,
829 0.0345174,0.0330085,0.0314149,0.0298081,0.0282141,0.02664 ,0.0253094,
830 0.0239221,0.0220779,0.0213821,0.0203176,0.0175276,0.0151146,
831 0.010 , 0.0 //80-100 and overflow, put by hand; using 0% v3 asymptotically
832 };
833 float v4_cent[NumCentBins]={
834 0.0131927 ,//underflow
835 0.0131927 ,0.0129838,0.0135232 ,0.0132689 ,0.0130435 ,0.0134254 ,0.013706 ,
836 0.0136456 ,0.0136656,0.013245 ,0.0130861 ,0.0125356 ,0.0118006 ,0.0110316,
837 0.00987005,0.0106963,0.00933145,0.00784534,0.00393584,0.00308131,
838 0.003 , 0.0 //80-100 and overflow, put by hand; using 0% v4 asymptotically
839 };
840 //b_imp values for differen centralities
841 float b_imp[NumCentBins]={
842 -1 , //underflow
843 0.481843 ,0.886609 , 1.13462 , 1.33981 , 1.52064 , 1.95342 , 2.51881 ,
844 2.97665 ,3.37416 , 3.72876 , 4.05377 , 4.35564 , 4.63868 , 4.91057 ,
845 5.17773 ,5.43665 , 5.68739 , 5.94258 , 6.20668 , 6.49519 ,
846 7.6415 , 15 , //80-100 and overflow
847 };
848
849 //Integrated v2, v3, v4, for 0-5% centrality bin
850 float vn_0_5[3]={0.078963056, 0.039746672, 0.013202649};
851 //divide by integrated vn for 0-5% centrality
852 for(int i=0;i<NumCentBins;i++){
853 v2_cent[i]/=vn_0_5[0];
854 v3_cent[i]/=vn_0_5[1];
855 v4_cent[i]/=vn_0_5[2];
856 }
857 gr_v2_cent_scale=TGraph(NumCentBins, b_imp, v2_cent);
858 gr_v3_cent_scale=TGraph(NumCentBins, b_imp, v3_cent);
859 gr_v4_cent_scale=TGraph(NumCentBins, b_imp, v4_cent);
860 gr_v2_cent_scale.SetBit(TGraph::kIsSortedX);//For faster return From Eval()
861 gr_v3_cent_scale.SetBit(TGraph::kIsSortedX);//For faster return From Eval()
862 gr_v4_cent_scale.SetBit(TGraph::kIsSortedX);//For faster return From Eval()
863 //----------------------------------------------------------------------------------
864 is_initialized=true;
865 }
866
867
869 m_v_n[Harmonic::v2]=gr_v2pt.Eval(pt) * gr_v2_cent_scale.Eval(b);
870 m_v_n[Harmonic::v3]=gr_v3pt.Eval(pt) * gr_v3_cent_scale.Eval(b);
871 m_v_n[Harmonic::v4]=gr_v4pt.Eval(pt) * gr_v4_cent_scale.Eval(b);
874}

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ p_Pb_cent_eta_indep()

void AddFlowByShifting::p_Pb_cent_eta_indep ( double b,
double eta,
double pt )
private

Definition at line 704 of file AddFlowByShifting.cxx.

705{
706 pt=pt/1000.0; //convert to GeV
707
708 float an_val[4][3];
709
710 an_val[0][0] = 0.1149;
711 an_val[0][1] = 1.181;
712 an_val[0][2] = 0.3767;
713
714 an_val[1][0] = 0.0498;
715 an_val[1][1] = 1.688;
716 an_val[1][2] = 0.5046;
717
718 an_val[2][0] = 0.02095;
719 an_val[2][1] = 2.196;
720 an_val[2][2] = 0.6259;
721
722 an_val[3][0] = 0.00682*0.5;//added in 0.5 factor by hand
723 an_val[3][1] = 4.938;
724 an_val[3][2] = 1.237;
725
727 m_v_n[Harmonic::v2]=an_val[0][0]*std::pow(pt,an_val[0][1])*std::exp(-an_val[0][2]*pt);
728 m_v_n[Harmonic::v3]=an_val[1][0]*std::pow(pt,an_val[1][1])*std::exp(-an_val[1][2]*pt);
729 m_v_n[Harmonic::v4]=an_val[2][0]*std::pow(pt,an_val[2][1])*std::exp(-an_val[2][2]*pt);
730 m_v_n[Harmonic::v5]=an_val[3][0]*std::pow(pt,an_val[3][1])*std::exp(-an_val[3][2]*pt);
732}

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ Set_EbE_Fluctuation_Multipliers()

void AddFlowByShifting::Set_EbE_Fluctuation_Multipliers ( HepMC::GenVertexPtr mainvtx,
float b,
CLHEP::HepRandomEngine * rndmEngine )
private

Definition at line 876 of file AddFlowByShifting.cxx.

876 {
877 for(int ihar=0;ihar<Harmonic::NumHar;ihar++){
878 m_EbE_Multiplier_vn[ihar]=1.0;
879 }
880
881
882 for(int ihar=0;ihar<Harmonic::NumHar;ihar++){
883 float vn_rp=0,delta=0;//BG parameterizations
884
885 //in the following we assume that the vn in the event is sqrt(<vn^2>)
886 //This is because the vn(pT) were tuned to 2PC/EP measurements
887 //then : vn_evt=vn_rp^2 + 2*(delta^2)
888 //which is used together with the "alpha" to get the "vn_rp" and "delta"
889
890 //No EbE fluctuation for v1
891 if (ihar==Harmonic::v1) continue;
892 //v2
893 else if(ihar==Harmonic::v2){
894 //alpha stores ratio of V2_RP over delta
895 float alpha=m_graph_fluc->Eval(b);
896 delta=1.0f/sqrt(2.0f+alpha*alpha); //stores delta /v2{2}
897 vn_rp=alpha*delta ; //stores v2^{RP}/v2{2}
898 }
899 //v3-v6
900 else{
901 vn_rp =0;
902 delta=1.0f/sqrt(2.0f);
903 }
904 float X=CLHEP::RandGaussQ::shoot(rndmEngine,vn_rp,delta);
905 float Y=CLHEP::RandGaussQ::shoot(rndmEngine,0.0 ,delta);
906 m_EbE_Multiplier_vn[ihar]=sqrt(X*X+ Y*Y);
907 ATH_MSG_INFO("EbE_Multiplier_v"<<ihar+1<<"="<<m_EbE_Multiplier_vn[ihar]);
908 }
909}

◆ SetParentToRanPhi()

double AddFlowByShifting::SetParentToRanPhi ( HepMC::GenParticlePtr parent,
CLHEP::HepRandomEngine * rndmEngine )
private

Definition at line 363 of file AddFlowByShifting.cxx.

365{
366 // Set particle to random phi
367 // Return phi shift
369
370 double phi, phishift;
371 CLHEP::HepLorentzVector momentum(parent->momentum().px(),
372 parent->momentum().py(),
373 parent->momentum().pz(),
374 parent->momentum().e());
375 phi = momentum.phi();
376
377 double rannum = CLHEP::RandFlat::shoot(rndmEngine);
378 double ranphi = (rannum-0.5)*2*M_PI;
379 phishift = ranphi - phi;
380
381 momentum.setPhi(ranphi*Gaudi::Units::rad);
382 parent->set_momentum( HepMC::FourVector(momentum.px(),momentum.py(),momentum.pz(),momentum.e()) );
383
384 ATH_MSG_DEBUG("Parent phi randomized = " << momentum.phi());
385
386 return phishift;
387}

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ vn_func()

double AddFlowByShifting::vn_func ( double x,
void * params )
static

Definition at line 40 of file AddFlowByShifting.cxx.

41{
42 float *par_float = (float*) params;
43 double phi_0 = par_float[0];
44 float *vn = par_float+1;
45 float *psi_n = vn+Harmonic::NumHar;
46 double val=x +2*( vn[Harmonic::v1]*sin(1*(x-psi_n[Harmonic::v1]))/1.0 +
47 vn[Harmonic::v2]*sin(2*(x-psi_n[Harmonic::v2]))/2.0 +
48 vn[Harmonic::v3]*sin(3*(x-psi_n[Harmonic::v3]))/3.0 +
49 vn[Harmonic::v4]*sin(4*(x-psi_n[Harmonic::v4]))/4.0 +
50 vn[Harmonic::v5]*sin(5*(x-psi_n[Harmonic::v5]))/5.0 +
51 vn[Harmonic::v6]*sin(6*(x-psi_n[Harmonic::v6]))/6.0 );
52 return val-phi_0;
53}
#define x

Member Data Documentation

◆ m_custom_v1

FloatProperty AddFlowByShifting::m_custom_v1 {this, "custom_v1" , 0.f }
private

Definition at line 92 of file AddFlowByShifting.h.

92{this, "custom_v1" , 0.f };

◆ m_custom_v2

FloatProperty AddFlowByShifting::m_custom_v2 {this, "custom_v2" , 0.f }
private

Definition at line 93 of file AddFlowByShifting.h.

93{this, "custom_v2" , 0.f };

◆ m_custom_v3

FloatProperty AddFlowByShifting::m_custom_v3 {this, "custom_v3" , 0.f }
private

Definition at line 94 of file AddFlowByShifting.h.

94{this, "custom_v3" , 0.f };

◆ m_custom_v4

FloatProperty AddFlowByShifting::m_custom_v4 {this, "custom_v4" , 0.f }
private

Definition at line 95 of file AddFlowByShifting.h.

95{this, "custom_v4" , 0.f };

◆ m_custom_v5

FloatProperty AddFlowByShifting::m_custom_v5 {this, "custom_v5" , 0.f }
private

Definition at line 96 of file AddFlowByShifting.h.

96{this, "custom_v5" , 0.f };

◆ m_custom_v6

FloatProperty AddFlowByShifting::m_custom_v6 {this, "custom_v6" , 0.f }
private

Definition at line 97 of file AddFlowByShifting.h.

97{this, "custom_v6" , 0.f };

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_EbE_Multiplier_vn

float AddFlowByShifting::m_EbE_Multiplier_vn[Harmonic::NumHar]
private

Definition at line 112 of file AddFlowByShifting.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_flow_fluctuations

BooleanProperty AddFlowByShifting::m_flow_fluctuations {this, "FlowFluctuations" , false }
private

Definition at line 84 of file AddFlowByShifting.h.

84{this, "FlowFluctuations" , false };

◆ m_flow_function

void(AddFlowByShifting::* AddFlowByShifting::m_flow_function) (double b, double eta, double pt)
private

Definition at line 60 of file AddFlowByShifting.h.

◆ m_flow_function_name

StringProperty AddFlowByShifting::m_flow_function_name {this, "FlowFunctionName" , "jjia_minbias_new"}
private

Definition at line 81 of file AddFlowByShifting.h.

81{this, "FlowFunctionName" , "jjia_minbias_new"};

◆ m_flow_implementation

StringProperty AddFlowByShifting::m_flow_implementation {this, "FlowImplementation", "exact" }
private

Definition at line 82 of file AddFlowByShifting.h.

82{this, "FlowImplementation", "exact" };

◆ m_flow_implementation_type

int AddFlowByShifting::m_flow_implementation_type {0}
private

Definition at line 83 of file AddFlowByShifting.h.

83{0};

◆ m_flow_maxeta

FloatProperty AddFlowByShifting::m_flow_maxeta {this, "FlowMaxEtaCut" , 10.0 }
private

Definition at line 86 of file AddFlowByShifting.h.

86{this, "FlowMaxEtaCut" , 10.0 };

◆ m_flow_maxpt

FloatProperty AddFlowByShifting::m_flow_maxpt {this, "FlowMaxPtCut" , 1000000.f }
private

Definition at line 89 of file AddFlowByShifting.h.

89{this, "FlowMaxPtCut" , 1000000.f };

◆ m_flow_mineta

FloatProperty AddFlowByShifting::m_flow_mineta {this, "FlowMinEtaCut" , 0.f }
private

Definition at line 87 of file AddFlowByShifting.h.

87{this, "FlowMinEtaCut" , 0.f };

◆ m_flow_minpt

FloatProperty AddFlowByShifting::m_flow_minpt {this, "FlowMinPtCut" , 0.f }
private

Definition at line 90 of file AddFlowByShifting.h.

90{this, "FlowMinPtCut" , 0.f };

◆ m_flowb_sw

IntegerProperty AddFlowByShifting::m_flowb_sw {this, "FlowBSwitch" , 0 }
private

Definition at line 91 of file AddFlowByShifting.h.

91{this, "FlowBSwitch" , 0 };//currently not used

◆ m_floweta_sw

IntegerProperty AddFlowByShifting::m_floweta_sw {this, "FlowEtaSwitch" , 0 }
private

Definition at line 85 of file AddFlowByShifting.h.

85{this, "FlowEtaSwitch" , 0 };

◆ m_flowpt_sw

IntegerProperty AddFlowByShifting::m_flowpt_sw {this, "FlowPtSwitch" , 0 }
private

Definition at line 88 of file AddFlowByShifting.h.

88{this, "FlowPtSwitch" , 0 };

◆ m_graph_fluc

TGraph* AddFlowByShifting::m_graph_fluc {}
private

Definition at line 71 of file AddFlowByShifting.h.

71{};//TGraph storing the v2_RP/delta Vs b_imp

◆ m_inkey

StringProperty AddFlowByShifting::m_inkey {this, "McTruthKey" , "GEN_EVENT" }
private

Definition at line 78 of file AddFlowByShifting.h.

78{this, "McTruthKey" , "GEN_EVENT" }; //FIXME use Read/WriteHandles

◆ m_outkey

StringProperty AddFlowByShifting::m_outkey {this, "McFlowKey" , "FLOW_EVENT" }
private

Definition at line 79 of file AddFlowByShifting.h.

79{this, "McFlowKey" , "FLOW_EVENT" }; //FIXME use Read/WriteHandles

◆ m_particles_processed

int AddFlowByShifting::m_particles_processed {0}
private

Definition at line 99 of file AddFlowByShifting.h.

99{0};

◆ m_psi_n

float AddFlowByShifting::m_psi_n[Harmonic::NumHar]
private

Definition at line 110 of file AddFlowByShifting.h.

◆ m_ranphi_sw

IntegerProperty AddFlowByShifting::m_ranphi_sw {this, "RandomizePhi" , 0 }
private

Definition at line 80 of file AddFlowByShifting.h.

80{this, "RandomizePhi" , 0 };

◆ m_rndmSvc

ServiceHandle<IAthRNGSvc> AddFlowByShifting::m_rndmSvc {this, "RndmSvc", "AthRNGSvc"}
private

Definition at line 75 of file AddFlowByShifting.h.

75{this, "RndmSvc", "AthRNGSvc"};

◆ m_v_n

float AddFlowByShifting::m_v_n[Harmonic::NumHar]
private

Definition at line 111 of file AddFlowByShifting.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: