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

#include <Hijing.h>

Inheritance diagram for Hijing:

Public Member Functions

 Hijing (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~Hijing ()=default
virtual StatusCode genInitialize () override
 For initializing the generator, if required.
virtual StatusCode callGenerator () override
 For calling the generator on each iteration of the event loop.
virtual StatusCode genFinalize () override
 For finalising the generator, if required.
virtual StatusCode fillEvt (HepMC::GenEvent *evt) override
 For filling the HepMC event object.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
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
Event loop algorithm methods: not to be overloaded
StatusCode initialize ()
StatusCode execute (const EventContext &ctx)
 Execute method.
StatusCode finalize ()
Gen-specific event loop methods: to be overloaded
virtual StatusCode genuserInitialize ()
 For initialization of user code, if required. Called after genInitialize.
Event collection accessors (const and non-const)
HepMC::GenEvent *event ATLAS_NOT_CONST_THREAD_SAFE ()
 Access the current signal event (first in the McEventCollection).
McEventCollection *events ATLAS_NOT_CONST_THREAD_SAFE ()
 Access the current event's McEventCollection.
const HepMC::GenEventevent_const (const EventContext &ctx) const
 Access the current signal event (const).
const McEventCollectionevents_const (const EventContext &ctx) const
 Access the current event's McEventCollection (const).

Protected Member Functions

virtual CLHEP::HepLorentzVector randomizeVertex (CLHEP::HepRandomEngine *engine)
void set_user_params (void)
virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
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.

Protected Attributes

IntegerProperty m_dsid {this, "Dsid", 999999}
float m_efrm {0.}
std::string m_frame
std::string m_proj
std::string m_targ
int m_iap {0}
int m_iat {0}
int m_izp {0}
int m_izt {0}
float m_bmin {0.}
float m_bmax {0.}
float m_x {0.}
float m_y {0.}
float m_z {0.}
bool m_sel {false}
bool m_spec {true}
bool m_rand {false}
bool m_wide {false}
bool m_prand {false}
bool m_keepAllDecayVertices {true}
double m_partonStoreMinPt {5.0}
double m_vertexOffsetCut {1.0E-7}
int m_randomseed {0}
std::vector< long int > m_seeds
int m_events {0}
CommandVector m_InitializeVector
HiParnt m_hiparnt
RanSeed m_ranseed
HiMain1 m_himain1
HiMain2 m_himain2
HijJet1 m_hijjet1
HijJet2 m_hijjet2
HijJet4 m_hijjet4
HiStrng m_histrng
HijCrdn m_hijcrdn
SG::WriteHandleKey< HijingEventParamsm_event_paramsKey {this, "HijingOutputKey", "Hijing_event_params"}

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
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

Features for derived classes to use internally

IntegerProperty m_randomSeed {this, "RandomSeed", 1234567, "Random seed for the built-in random engine"}
 Seed for random number engine.
BooleanProperty m_isAfterburner {this, "IsAfterburner", false, "Set true if generator modifies existing events rather than creating new ones"}
 Flag for normal vs. afterburner generators.
std::shared_ptr< HepMC3::GenRunInfo > m_runinfo {}
 The run info for HepMC3.
CLHEP::HepRandomEngine * getRandomEngine (const std::string &streamName, const EventContext &ctx) const
CLHEP::HepRandomEngine * getRandomEngine (const std::string &streamName, unsigned long int randomSeedOffset, const EventContext &ctx) const
CLHEP::HepRandomEngine * getRandomEngineDuringInitialize (const std::string &streamName, unsigned long int randomSeedOffset, unsigned int conditionsRun=1, unsigned int lbn=1) const
ServiceHandle< IAthRNGSvcm_rndmSvc {this, "RndmSvc", "AthRNGSvc"}
 Data members.
ServiceHandle< IIncidentSvc > m_incidentSvc {this, "IncidentSvc", "IncidentSvc"}
 Handle on the incident service.

Properties

std::string m_mcEventKey {}
 StoreGate key for the MC event collection (defaults to GEN_EVENT).
BooleanProperty m_mkMcEvent {this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"}
 Flag to determine if a new MC event collection should be made if it doesn't exist.
SG::ReadHandleKey< McEventCollectionm_mcevents_const { this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" }
 Const handle to the MC event collection.

Detailed Description

Definition at line 43 of file Hijing.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ Hijing()

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

Definition at line 116 of file Hijing.cxx.

117 : GenModule(name,pSvcLocator)
118{
119 declareProperty("Initialize", m_InitializeVector);
120 declareProperty("partonStoreMinPt", m_partonStoreMinPt);
121 declareProperty("vertexOffsetCut", m_vertexOffsetCut);
122 declareProperty("randomizeVertices", m_rand); // Randomize for beam gas
123 declareProperty("selectVertex", m_sel); // Select vertex location (off for random)
124 declareProperty("wide", m_wide); // Allow randoms off the beamline (out to the pipe)
125 declareProperty("x", m_x);
126 declareProperty("y", m_y);
127 declareProperty("z", m_z);
128 declareProperty("keepSpectators", m_spec);
129 declareProperty("randomizeP", m_prand); //BPK randomizes the left<->right direction by mirroring momenta for beam gas
130 declareProperty("keepAllDecayVertices", m_keepAllDecayVertices);
131}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
GenModule(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition GenModule.cxx:14
bool m_wide
Definition Hijing.h:82
bool m_sel
Definition Hijing.h:77
bool m_prand
Definition Hijing.h:83
float m_y
Definition Hijing.h:75
double m_vertexOffsetCut
Definition Hijing.h:88
bool m_spec
Definition Hijing.h:78
float m_x
Definition Hijing.h:74
float m_z
Definition Hijing.h:76
double m_partonStoreMinPt
Definition Hijing.h:87
bool m_rand
Definition Hijing.h:81
bool m_keepAllDecayVertices
Definition Hijing.h:84
CommandVector m_InitializeVector
Definition Hijing.h:98

◆ ~Hijing()

virtual Hijing::~Hijing ( )
virtualdefault

Member Function Documentation

◆ ATLAS_NOT_CONST_THREAD_SAFE() [1/2]

McEventCollection *events GenBase::ATLAS_NOT_CONST_THREAD_SAFE ( )
inherited

Access the current event's McEventCollection.

Note
This function will make a new McEventCollection if there is not already a valid one and MakeMcEvent=True.

◆ ATLAS_NOT_CONST_THREAD_SAFE() [2/2]

HepMC::GenEvent *event GenBase::ATLAS_NOT_CONST_THREAD_SAFE ( )
inlineinherited

Access the current signal event (first in the McEventCollection).

Note
This function will make a new McEventCollection if there is not already a valid one and MakeMcEvent=True.

Definition at line 73 of file GenBase.h.

73 {
74 if (events()->empty())
75 ATH_MSG_ERROR("McEventCollection is empty during first event access");
76 return *(events()->begin());
77 }
#define ATH_MSG_ERROR(x)
static const Attributes_t empty

◆ callGenerator()

StatusCode Hijing::callGenerator ( )
overridevirtual

For calling the generator on each iteration of the event loop.

Reimplemented from GenModule.

Definition at line 177 of file Hijing.cxx.

178{
179 ATH_MSG_INFO( " HIJING generating. \n" );
180
181 // Save the random number seeds in the event
182 //Re-seed the random number stream
183 long seeds[7];
184 const EventContext& ctx = Gaudi::Hive::currentContext();
185 ATHRNG::calculateSeedsMC21(seeds, hijing_stream, ctx.eventID().event_number(), m_dsid, m_randomSeed);
186 p_Engine->setSeeds(seeds, 0); // NOT THREAD-SAFE
187 m_seeds.clear();
188 m_seeds.push_back(seeds[0]);
189 m_seeds.push_back(seeds[1]);
190
191 // Generate event
192 const char* frame = m_frame.c_str();
193 hijing_(frame, &m_bmin, &m_bmax, strlen(frame));
194
195 // Check for error using the new (custom) error return
196 //
197 int errorStatus = m_himain1.ierrstat();
198 if (errorStatus != 0) {
199 ATH_MSG_ERROR( "Error returned from HIJING, value = " << errorStatus );
200 return StatusCode::FAILURE;
201 }
202
203 // update event counter
204 ++m_events;
205
206 // store hijing event parameters
207 // -----------------------------
208 ATH_MSG_DEBUG( "New HijingEventParams" );
209 int np = m_himain1.np();
210 int nt = m_himain1.nt();
211 int n0 = m_himain1.n0();
212 int n01 = m_himain1.n01();
213 int n10 = m_himain1.n10();
214 int n11 = m_himain1.n11();
215 int natt = m_himain1.natt();
216 int jatt = m_himain1.jatt();
217 float b = m_hiparnt.hint1(19);
218 float bphi = m_hiparnt.hint1(20);
219
220 SG::WriteHandle<HijingEventParams> event_params(m_event_paramsKey);
221 event_params = std::make_unique<HijingEventParams>(np, nt, n0, n01, n10, n11, natt, jatt, b, bphi);
222
223 ATH_MSG_INFO( "\n=================================================\n"
224 << " HIJING event description: \n"
225 << " b = " << b << " fm \n"
226 << " # proj participants = " << np << "\n"
227 << " # targ participants = " << nt << "\n"
228 << " # final particles = " << natt << "\n"
229 << "=================================================\n" );
230
231 ATH_MSG_DEBUG( " HIJING generating done. \n" );
232 return StatusCode::SUCCESS;
233}
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
void hijing_(const char *, float *, float *, long int)
IntegerProperty m_randomSeed
Seed for random number engine.
Definition GenModule.h:84
HiParnt m_hiparnt
Definition Hijing.h:101
float m_bmax
Definition Hijing.h:70
HiMain1 m_himain1
Definition Hijing.h:107
IntegerProperty m_dsid
Definition Hijing.h:57
float m_bmin
Definition Hijing.h:69
int m_events
Definition Hijing.h:95
std::vector< long int > m_seeds
Definition Hijing.h:92
SG::WriteHandleKey< HijingEventParams > m_event_paramsKey
Definition Hijing.h:117
std::string m_frame
Definition Hijing.h:61
void calculateSeedsMC21(long *seeds, const std::string &algName, uint64_t ev, uint64_t run, uint64_t offset=0)
Set the random seed using a string (e.g.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::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 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

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

Definition at line 95 of file AthCommonDataStore.h.

◆ event_const()

const HepMC::GenEvent * GenBase::event_const ( const EventContext & ctx) const
inlineinherited

Access the current signal event (const).

Definition at line 80 of file GenBase.h.

80 {
81 const McEventCollection* coll = events_const(ctx);
82 if (coll->empty())
83 ATH_MSG_ERROR("Const McEventCollection is empty during first event access");
84 return *(coll->begin());
85 }
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
bool empty() const noexcept
Returns true if the collection is empty.
const McEventCollection * events_const(const EventContext &ctx) const
Access the current event's McEventCollection (const).
Definition GenBase.h:94

◆ events_const()

const McEventCollection * GenBase::events_const ( const EventContext & ctx) const
inlineinherited

Access the current event's McEventCollection (const).

Definition at line 94 of file GenBase.h.

94 {
95 SG::ReadHandle<McEventCollection> ret = SG::makeHandle(m_mcevents_const, ctx);
96 if (!ret.isValid())
97 ATH_MSG_ERROR("No McEventCollection found in StoreGate with key " << m_mcevents_const.key());
98 return ret.cptr();
99 }
SG::ReadHandleKey< McEventCollection > m_mcevents_const
Const handle to the MC event collection.
Definition GenBase.h:118
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::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 GenModule::execute ( const EventContext & ctx)
virtualinherited

Execute method.

Todo
Remove hard-coded alg name checking (already incomplete)

Reimplemented from GenBase.

Definition at line 70 of file GenModule.cxx.

70 {
71 // Examples of how to retrieve the random number engine for a given
72 // stream.
73 // NB getRandomEngine should only be called once per event for a
74 // given stream, as it causes the stream to be re-seeded each time
75 // it is called.
76
77 // Example 1 - seeded based on the current event number (+ slot, run, streamName)
78 //CLHEP::HepRandomEngine* rndmEngine = this->getRandomEngine("MyStream", ctx);
79
80 // Example 2 - seeded based on the m_randomSeed property (+ slot, run, streamName)
81 //CLHEP::HepRandomEngine* rndmEngine = this->getRandomEngine("MyStream", m_randomSeed.value(), ctx);
82
83 // Call the code that generates an event
84 CHECK(this->callGenerator());
85
86 // Create the MC event and send the GeneratorEvent stored in it to fillEvt
88 CHECK(this->fillEvt(evt));
90
91 // Add the event to the MC event collection
92 if (events()) {
93 // If this is an "afterburner" generator, replace the last event rather than add a new one
95 if (m_isAfterburner.value() || name() == "Tauola" || name() == "Photos") {
96 events()->pop_back();
97 }
98 // Add the event to the end of the collection
99 events()->push_back(evt);
100 ATH_MSG_DEBUG("MC event added to McEventCollection");
101
102 // remove the empty event in case of ParticleDecayer
103 if (name() == "ParticleDecayer") {
104 events()->pop_back();
105 }
106 }
107
108 // Call the incident service to notify that an event has been made
109 m_incidentSvc->fireIncident( Incident(name(), "McEventGenerated") );
110 return StatusCode::SUCCESS;
111}
#define CHECK(...)
Evaluate an expression and check for errors.
ServiceHandle< IIncidentSvc > m_incidentSvc
Handle on the incident service.
Definition GenModule.h:99
virtual StatusCode callGenerator()
For calling the generator on each iteration of the event loop.
Definition GenModule.h:66
virtual StatusCode fillEvt(HepMC::GenEvent *evt)=0
For filling the HepMC event object.
BooleanProperty m_isAfterburner
Flag for normal vs. afterburner generators.
Definition GenModule.h:87
void fillBarcodesAttribute(GenEvent *e)
Definition GenEvent.h:393
GenEvent * newGenEvent(const int signal_process_id, const int event_number)
Definition GenEvent.h:360
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::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 & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ fillEvt()

StatusCode Hijing::fillEvt ( HepMC::GenEvent * evt)
overridevirtual

For filling the HepMC event object.

Implements GenModule.

Definition at line 243 of file Hijing.cxx.

244{
245 // These two parameters need to be made user settable (done - AS)
246 //
247 MsgStream log(msgSvc(), name());
248 ATH_MSG_INFO( " HIJING Filing. \n" );
249
250 // Set the event number
251 evt->set_event_number( m_events );
252
253 // Set the random generator seeds
255
256 // Set the generator id
257 HepMC::set_signal_process_id(evt,50000000 + m_iap);
258
259 // Store collision parameters
260 int np = m_himain1.np();
261 int nt = m_himain1.nt();
262 int n0 = m_himain1.n0();
263 int n01 = m_himain1.n01();
264 int n10 = m_himain1.n10();
265 int n11 = m_himain1.n11();
266 //int natt = m_himain1.natt();
267 int jatt = m_himain1.jatt();
268 float b = m_hiparnt.hint1(19);
269 float bphi = m_hiparnt.hint1(20);
270
271 float sigmainel = m_hiparnt.hint1(12);
272
273 HepMC::GenHeavyIonPtr ion= std::make_shared<HepMC::GenHeavyIon>();
274 ion->Ncoll_hard=static_cast<int>(jatt);
275 ion->Npart_proj=static_cast<int>(np);
276 ion->Npart_targ=static_cast<int>(nt);
277 ion->Ncoll=static_cast<int>(n0+n10+n01+n11);
278 ion->N_Nwounded_collisions=static_cast<int>(n01);
279 ion->Nwounded_N_collisions=static_cast<int>(n10);
280 ion->Nwounded_Nwounded_collisions=static_cast<int>(n11);
281 ion->spectator_neutrons=-1;
282 ion->spectator_protons=-1;
283 ion->impact_parameter= b;
284 ion->event_plane_angle=bphi;
285 ion->event_plane_angle=-1;
286 ion->sigma_inel_NN=sigmainel;
287 evt->set_heavy_ion(std::move(ion));
288
289 // Did we keep decay history?
290 //
291 bool keptHistory = (m_hiparnt.ihpr2(21) == 1);
292
293 // The number of particles in the hijing output
294 //
295 int numHijingPart = m_himain1.natt();
296
297 // Vectors that will keep track of where particles originate from and die
298 //
299 std::vector<int> partOriginVertex_vec(numHijingPart, 0);
300 std::vector<int> partDecayVertex_vec(numHijingPart, -1);
301 std::vector<HepMC::GenParticlePtr> particleHepPartPtr_vec(numHijingPart, nullptr);
302
303 // Vector that will keep pointers to generated vertices
304 //
305 std::vector<HepMC::GenVertexPtr> vertexPtrVec;
306
307 // Create the event vertex
308 //
309 CLHEP::HepLorentzVector newVertex;
310 newVertex = CLHEP::HepLorentzVector(0.,0.,0.,0.);
311
312 if( m_rand )newVertex = randomizeVertex(p_Engine); // Create a random vertex along the pipe
313 else if(m_sel) newVertex = CLHEP::HepLorentzVector(m_x, m_y, m_z, 0.); // Create vertex at selected point - preempted by m_rand
314
315 HepMC::GenVertexPtr v1 = HepMC::newGenVertexPtr(HepMC::FourVector(newVertex.x(),newVertex.y(),newVertex.z(),newVertex.t()));
316
318 vertexPtrVec.push_back(v1);
319
320 double eproj = (double) m_efrm;
321 if ( m_frame == "CMS " ) eproj = eproj / 2.;
322
323 int proj_id = 2212;
324 if ( m_proj == "PBAR " ) {
325 proj_id = -2212;
326 } else if ( m_proj == "N " ) {
327 proj_id = 2112;
328 } else if ( m_proj == "NBAR " ) {
329 proj_id = -2112;
330 } else if ( m_proj == "PI+ " ) {
331 proj_id = 211;
332 } else if ( m_proj == "PI- " ) {
333 proj_id = -211;
334 } else if ( m_proj == "A " ) {
335 proj_id = 3000000 + m_iap;
336 }
337 HepMC::GenParticlePtr part_p = HepMC::newGenParticlePtr(HepMC::FourVector(0., 0., eproj, eproj), proj_id, 101 );
338 v1->add_particle_in( part_p );
339
340 double etarg = 0.;
341 if ( m_frame == "CMS " ) etarg = ( (double) m_efrm ) / 2.;
342
343 int targ_id = 2212;
344 if ( m_targ == "PBAR " ) {
345 targ_id = -2212;
346 } else if ( m_targ == "N " ) {
347 targ_id = 2112;
348 } else if ( m_targ == "NBAR " ) {
349 targ_id = -2112;
350 } else if ( m_targ == "PI+ " ) {
351 targ_id = 211;
352 } else if ( m_targ == "PI- " ) {
353 targ_id = -211;
354 } else if ( m_targ == "A " ) {
355 targ_id = 3000000 + m_iat;
356 }
357 HepMC::GenParticlePtr part_t = HepMC::newGenParticlePtr(HepMC::FourVector(0., 0., -etarg, etarg), targ_id, 102 );
358 v1->add_particle_in( part_t );
359
360 evt->set_beam_particles(std::move(part_p),std::move(part_t));
361
362 ATH_MSG_DEBUG( "Hijing particles for event # " << m_events << ":\n"
363 << " px, "
364 << " py, "
365 << " pz, "
366 << " Id, "
367 << " Source, "
368 << " Parent, "
369 << " Status, " );
370
371 bool inconsistency = false;
372
373 // Loop on all Hijing particles and put them all as outgoing from the event vertex
374 //
375 for (int i = 1; i <= m_himain1.natt(); ++i)
376 {
377 // Skip non-interacting projectile and target nucleons
378 //
379 if (!m_spec && ((m_himain2.katt(i, 2) == 0) || (m_himain2.katt(i, 2)) == 10)) continue;
380
381 // Find the vertex of the parent particle
382 //
383 int parentIndex = m_himain2.katt(i, 3) - 1;
384 int parentOriginIndex = 0;
385 int parentDecayIndex = -1;
386
387 // If the particle has a true parent, record its vertex info
388 //
389 if (parentIndex >= 0)
390 {
391 parentOriginIndex = partOriginVertex_vec[parentIndex];
392 parentDecayIndex = partDecayVertex_vec[parentIndex];
393 }
394
395 // A CLHEP vector containing the particle start point
396 //
397 // If the particle has been shifted, offset the particleStart accordingly
398 //
399 if( m_rand || m_sel ){ // Either way, we need to shift the particle vertex
400 m_himain2.vatt(i,1) += newVertex(0);
401 m_himain2.vatt(i,2) += newVertex(1);
402 m_himain2.vatt(i,3) += newVertex(2);
403 m_himain2.vatt(i,4) += newVertex(3);
404 }
405
406 ATH_MSG_DEBUG( std::fixed << std::setprecision(2)
407 << std::setw(5) << i << ","
408 << std::setw(7) << m_himain2.patt(i, 1) << ", "
409 << std::setw(7) << m_himain2.patt(i, 2) << ", "
410 << std::setw(7) << m_himain2.patt(i, 3) << ", "
411 << std::setw(7) << m_himain2.katt(i, 1) << ", "
412 << std::setw(7) << m_himain2.katt(i, 2) << ", "
413 << std::setw(7) << m_himain2.katt(i, 3) << ", "
414 << std::setw(7) << m_himain2.katt(i, 4) << ", "
415 << std::setw(7) << m_himain2.vatt(i, 1) << ", "
416 << std::setw(7) << m_himain2.vatt(i, 2) << ", "
417 << std::setw(7) << m_himain2.vatt(i, 3) );
418
419 CLHEP::HepLorentzVector particleStart(m_himain2.vatt(i, 1), m_himain2.vatt(i, 2),
420 m_himain2.vatt(i, 3), m_himain2.vatt(i, 4));
421
422 // By default, the particle originates from the primary vertex
423 //
424 int particleVertexIndex = 0;
425
426 // Have we kept the history?
427 //
428 if (keptHistory)
429 {
430 // Check to see if we've already generated a decay vertex for this parent
431 //
432 // std::cout << "ML-> keptHistory == True" << std::endl;
433 if (parentDecayIndex != -1)
434 {
435 // Make sure it is consistent with this track origin
436 //
437 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[parentDecayIndex]->position().x(),
438 vertexPtrVec[parentDecayIndex]->position().y(),
439 vertexPtrVec[parentDecayIndex]->position().z());
440 double distance = vertex_pos.distance(particleStart.vect());
441
442 //std::cout << "ML-> distance = " << distance <<" parentDecayIndex = "<<parentDecayIndex<< std::endl;
443 if (distance > m_vertexOffsetCut)
444 {
445 // We have an inconsistency, print a message
446 //
447 ATH_MSG_WARNING( " Inconsistency in Hijing particle vertexing, particle # " << i
448 << " starting point (x,y,z) = ("
449 << particleStart.x() << ", "
450 << particleStart.y() << ", "
451 << particleStart.z() << ") "
452 << " a distance " << distance << " away from parent decay point " );
453
454
455 // Dump the parent decay vertex
456 //
457 log << MSG::WARNING << " Parent decay vertex: (x,y,z) = " << vertexPtrVec[parentDecayIndex]->position().x()
458 << ", " << vertexPtrVec[parentDecayIndex]->position().y()
459 << ", " << vertexPtrVec[parentDecayIndex]->position().z()
460 << ", associated daughter IDs = ";
461
462 auto vertexPtrVec_particles_out_const_begin=vertexPtrVec[parentDecayIndex]->particles_out().begin();
463 auto vertexPtrVec_particles_out_const_end=vertexPtrVec[parentDecayIndex]->particles_out().end();
464 for (auto iter = vertexPtrVec_particles_out_const_begin;
465 iter != vertexPtrVec_particles_out_const_end;
466 iter++)
467 {
468 log << (*iter) << ", ";
469 }
470
471 log << endmsg;
472 inconsistency = true;
473 }
474
475 // Nonetheless set the parent decay vertex to be this particle's vertex
476 //
477 particleVertexIndex = parentDecayIndex;
478 }
479 else
480 {
481 // Now compare the distance between the vertex FROM which the parent originates and the
482 // start of this particle
483 //
484 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[parentOriginIndex]->position().x(),
485 vertexPtrVec[parentOriginIndex]->position().y(),
486 vertexPtrVec[parentOriginIndex]->position().z());
487 double distance = vertex_pos.distance(particleStart.vect());
488
489 if (distance > m_vertexOffsetCut && parentIndex == -1)
490 {
491 // *** Explicitly handle Hijing bug which generates particle with displaced vertex
492 // *** but no parent ????
493 //
494
495 ATH_MSG_WARNING( "HIJING BUG:: Particle found with displaced vertex but no parent " );
496 ATH_MSG_WARNING( " Particle parameters: " << std::fixed << std::setprecision(2)
497 << std::setw(5) << i << ","
498 << std::setw(7) << m_himain2.patt(i, 1) << ", "
499 << std::setw(7) << m_himain2.patt(i, 2) << ", "
500 << std::setw(7) << m_himain2.patt(i, 3) << ", "
501 << std::setw(7) << m_himain2.katt(i, 1) << ", "
502 << std::setw(7) << m_himain2.katt(i, 2) << ", "
503 << std::setw(7) << m_himain2.katt(i, 3) << ", "
504 << std::setw(7) << m_himain2.katt(i, 4) << ", "
505 << std::setw(7) << m_himain2.vatt(i, 1) << ", "
506 << std::setw(7) << m_himain2.vatt(i, 2) << ", "
507 << std::setw(7) << m_himain2.vatt(i, 3) );
508
509 // Assign the particle to its parent's vertex
510 //
511 particleVertexIndex = parentOriginIndex;
512 //std::cout << "ML-> case 2 distane = " << distance <<" particleVertexIndex = "<<particleVertexIndex<< std::endl;
513 }
514 if( parentIndex!=-1 && ((distance > m_vertexOffsetCut || parentOriginIndex !=0) || m_keepAllDecayVertices ) )
515 {
516 // We need to create a new vertex
517 //
518 HepMC::GenVertexPtr newVertex_p = HepMC::newGenVertexPtr(HepMC::FourVector(particleStart.x(),particleStart.y(),particleStart.z(),particleStart.t()));
519 evt->add_vertex(newVertex_p);
520 vertexPtrVec.push_back(newVertex_p);
521 particleVertexIndex = vertexPtrVec.size() - 1;
522
523 // Now we indicate that the parent has a decay vertex
524 //
525 partDecayVertex_vec[parentIndex] = particleVertexIndex;
526
527 // Now tell the vertex about the particle that created it
528 //
529
530 newVertex_p->add_particle_in(particleHepPartPtr_vec[parentIndex]);
531 }
532 else {
533 // Assign the particle to its parent's vertex
534 //
535 particleVertexIndex = parentOriginIndex;
536 }
537 }
538 }
539 else
540 {
541 // We have to brute-force search for a vertex that might match this particle
542 //
543 int foundVert = -1;
544 for (unsigned int ivert = 0; ivert < vertexPtrVec.size(); ivert++)
545 {
546
547 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[ivert]->position().x(),
548 vertexPtrVec[ivert]->position().y(),
549 vertexPtrVec[ivert]->position().z());
550 double distance = vertex_pos.distance(particleStart.vect());
551 if (distance < m_vertexOffsetCut)
552 {
553 foundVert = ivert;
554 break;
555 }
556 }
557
558 if (foundVert == -1)
559 {
560 // We need to create a new vertex
561 //
562 HepMC::GenVertexPtr newVertex_p = HepMC::newGenVertexPtr(HepMC::FourVector(particleStart.x(),particleStart.y(),particleStart.z(),particleStart.t()));
563
564 evt->add_vertex(newVertex_p);
565 vertexPtrVec.push_back(std::move(newVertex_p));
566 particleVertexIndex = vertexPtrVec.size() - 1;
567 }
568 else
569 {
570 particleVertexIndex = foundVert;
571 }
572 //std::cout << "ML-> case 3 particleVertexIndex = "<<particleVertexIndex<< std::endl;
573 }
574
575 // If the Hijing particle has decayed, set the status appropriately
576 //
577 int particleId = m_himain2.katt(i, 1);
578 int particleStatus = 1;
579 if (m_himain2.katt(i, 4) == 11) particleStatus = 2;
580
581 // Create the new particle
582 //
583 HepMC::FourVector particleP4(m_himain2.patt(i, 1),
584 m_himain2.patt(i, 2),
585 m_himain2.patt(i, 3),
586 m_himain2.patt(i, 4));
587
588 HepMC::GenParticlePtr newParticle_p = HepMC::newGenParticlePtr(particleP4, particleId,
589 particleStatus);
590
591 // Record the particle in the vector of pointers
592 // (ostensibly we only need this when we have the
593 // history but for simplicity always do it)
594 //
595 particleHepPartPtr_vec[i-1] = newParticle_p;
596
597 // Now add the particle to its vertex
598 //
599 vertexPtrVec[particleVertexIndex]->add_particle_out(std::move(newParticle_p));
600 partOriginVertex_vec[i-1] = particleVertexIndex;
601
602 }
603
604 if (inconsistency)
605 {
606 for (int i = 1; i <= m_himain1.natt(); ++i)
607 {
608 // Skip non-interacting projectile and target nucleons
609 //
610 if (!m_spec && ((m_himain2.katt(i, 2) == 0) || (m_himain2.katt(i, 2)) == 10)) continue;
611
612 ATH_MSG_WARNING( " Hijing.cxx inconsistency: " << std::fixed << std::setprecision(2)
613 // std::cout << std::fixed << std::setprecision(2)
614 << std::setw(5) << i << ","
615 << std::setw(7) << m_himain2.patt(i, 1) << ", "
616 << std::setw(7) << m_himain2.patt(i, 2) << ", "
617 << std::setw(7) << m_himain2.patt(i, 3) << ", "
618 << std::setw(7) << m_himain2.katt(i, 1) << ", "
619 << std::setw(7) << m_himain2.katt(i, 2) << ", "
620 << std::setw(7) << m_himain2.katt(i, 3) << ", "
621 << std::setw(7) << m_himain2.katt(i, 4) << ", "
622 << std::setw(7) << m_himain2.vatt(i, 1) << ", "
623 << std::setw(7) << m_himain2.vatt(i, 2) << ", "
624 << std::setw(7) << m_himain2.vatt(i, 3) );
625 }
626 }
627
628 // Generate documentation lines for high-pt partons
629 //
630 for (int isg = 1; isg <= m_hijjet2.nsg(); isg++)
631 {
632 for (int jparton = 1; jparton <= m_hijjet2.njsg(isg); jparton++)
633 {
634 double px = m_hijjet2.pxsg(isg, jparton);
635 double py = m_hijjet2.pysg(isg, jparton);
636 double pz = m_hijjet2.pzsg(isg, jparton);
637 double mass = m_hijjet2.pmsg(isg, jparton);
638
639 double ptsq = px*px + py*py;
640 double e = std::sqrt(ptsq + pz*pz + mass*mass);
641 double mt = std::sqrt(ptsq + mass*mass);
642 double pt = std::sqrt(ptsq);
643
644 double pseud = 0.5*std::log((e + pz)/(e - pz));
645
646 int partonId = m_hijjet2.k2sg(isg, jparton);
647
648 if (mt > m_partonStoreMinPt)
649 {
650 ATH_MSG_DEBUG( "hijjet2 entry: isg = " << isg
651 << ", pt = " << pt
652 << ", mt = " << mt
653 << ", eta = " << pseud );
654
655 // Add aaa non-tracked entry in the hepmc event with status code 103 (temporary)
656 //
657 v1->add_particle_out( HepMC::newGenParticlePtr( HepMC::FourVector(px, py, pz, e), partonId, 103 ) );
658 }
659 }
660 }
661
662 // Generate documentation lines for high-pt partons
663 //
664 int iap = m_hiparnt.ihnt2(1); // # of projectile nucleons
665 int iat = m_hiparnt.ihnt2(3); // # of target nucleons
666
667 for (int iproj = 1; iproj <= iap; iproj++)
668 {
669 for (int jparton = 1; jparton <= m_hijjet1.npj(iproj); jparton++)
670 {
671 double px = m_hijjet1.pjpx(iproj, jparton);
672 double py = m_hijjet1.pjpy(iproj, jparton);
673 double pz = m_hijjet1.pjpz(iproj, jparton);
674 double mass = m_hijjet1.pjpm(iproj, jparton);
675
676 double ptsq = px*px + py*py;
677 double e = std::sqrt(ptsq + pz*pz + mass*mass);
678 double mt = std::sqrt(ptsq + mass*mass);
679 double pt = std::sqrt(ptsq);
680
681 double pseud = 0.5*std::log((e + pz)/(e - pz));
682
683 int partonId = m_hijjet1.kfpj(iproj, jparton);
684
685 if (mt > m_partonStoreMinPt)
686 {
687 ATH_MSG_DEBUG( "hijjet1 entry: iproj = " << iproj
688 << ", pt = " << pt
689 << ", mt = " << mt
690 << ", eta = " << pseud );
691
692 // Add aaa non-tracked entry in the hepmc event with status code 103 (temporary)
693 //
694 v1->add_particle_out( HepMC::newGenParticlePtr( HepMC::FourVector(px, py, pz, e), partonId, 103 ) );
695 }
696 }
697 }
698
699 // Now for target nucleons
700 //
701 for (int itarg = 1; itarg <= iat; itarg++)
702 {
703 for (int jparton = 1; jparton <= m_hijjet1.ntj(itarg); jparton++)
704 {
705 double px = m_hijjet1.pjtx(itarg, jparton);
706 double py = m_hijjet1.pjty(itarg, jparton);
707 double pz = m_hijjet1.pjtz(itarg, jparton);
708 double mass = m_hijjet1.pjtm(itarg, jparton);
709
710 double ptsq = px*px + py*py;
711 double e = std::sqrt(ptsq + pz*pz + mass*mass);
712 double mt = std::sqrt(ptsq + mass*mass);
713 double pt = std::sqrt(ptsq);
714
715 double pseud = 0.5*std::log((e + pz)/(e - pz));
716
717 int partonId = m_hijjet1.kftj(itarg, jparton);
718
719 if (mt > m_partonStoreMinPt)
720 {
721 ATH_MSG_DEBUG( "hijjet1 entry: itarg = " << itarg
722 << ", pt = " << pt
723 << ", mt = " << mt
724 << ", eta = " << pseud );
725
726 // Add aaa non-tracked entry in the hepmc event with status code 103 (temporary)
727 //
728 v1->add_particle_out( HepMC::newGenParticlePtr( HepMC::FourVector(px, py, pz, e), partonId, 103 ) );
729 }
730 }
731 }
732
733 // Convert GeV -> MeV to ensure correct units
734 evt->set_units(HepMC3::Units::MEV, HepMC3::Units::MM);
735
736 //BPK-> Loop over the particles in the event, if p needs to be mirrored:
737 if( m_prand ){
738 HepMC::FourVector tmpmom(0.,0.,0.,0.);
739 double ranz = CLHEP::RandFlat::shoot(p_Engine);
740 // std::cout <<"random="<<ranz <<std::endl;
741 if (ranz < 0.5) {
742 // std::cout <<"flip="<<ranz <<std::endl;
743 for(auto pitr: *evt){
744 tmpmom= pitr->momentum();
745 tmpmom.setX(-tmpmom.x());
746 tmpmom.setY(-tmpmom.y());
747 tmpmom.setZ(-tmpmom.z());
748 tmpmom.setT(tmpmom.t());
749 pitr->set_momentum(tmpmom);
750 }
751 }
752 }
753 //BPK-<
754
755 return StatusCode::SUCCESS;
756}
#define endmsg
#define ATH_MSG_WARNING(x)
#define y
#define x
#define z
std::string m_targ
Definition Hijing.h:63
std::string m_proj
Definition Hijing.h:62
int m_iat
Definition Hijing.h:65
HijJet1 m_hijjet1
Definition Hijing.h:109
HijJet2 m_hijjet2
Definition Hijing.h:110
HiMain2 m_himain2
Definition Hijing.h:108
float m_efrm
Definition Hijing.h:60
int m_iap
Definition Hijing.h:64
virtual CLHEP::HepLorentzVector randomizeVertex(CLHEP::HepRandomEngine *engine)
Definition Hijing.cxx:759
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
HepMC3::FourVector FourVector
HepMC3::GenHeavyIonPtr GenHeavyIonPtr
Definition HeavyIon.h:11
void set_signal_process_vertex(GenEvent *e, T &v)
Definition GenEvent.h:591
void set_signal_process_id(GenEvent *e, const int i=0)
Definition GenEvent.h:580
void set_random_states(GenEvent *e, std::vector< long int > &a)
Definition GenEvent.h:588
GenParticlePtr newGenParticlePtr(const HepMC3::FourVector &mom=HepMC3::FourVector::ZERO_VECTOR(), int pid=0, int status=0)
Definition GenParticle.h:21
HepMC3::GenParticlePtr GenParticlePtr
Definition GenParticle.h:19
GenVertexPtr newGenVertexPtr(const HepMC3::FourVector &pos=HepMC3::FourVector::ZERO_VECTOR(), const int i=0)
Definition GenVertex.h:25
HepMC3::GenVertexPtr GenVertexPtr
Definition GenVertex.h:23
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ finalize()

StatusCode GenModule::finalize ( )
inlineinherited

Definition at line 55 of file GenModule.h.

55{ return genFinalize(); }
virtual StatusCode genFinalize()
For finalising the generator, if required.
Definition GenModule.h:70

◆ genFinalize()

StatusCode Hijing::genFinalize ( )
overridevirtual

For finalising the generator, if required.

Reimplemented from GenModule.

Definition at line 236 of file Hijing.cxx.

237{
238 ATH_MSG_INFO( " HIJING Ending. \n" );
239 return StatusCode::SUCCESS;
240}

◆ genInitialize()

StatusCode Hijing::genInitialize ( )
overridevirtual

For initializing the generator, if required.

Reimplemented from GenModule.

Definition at line 133 of file Hijing.cxx.

134{
135 ATH_CHECK(m_event_paramsKey.initialize());
136
137 // Initialisation of input parameters
138 std::cout << "MetaData: generator = Hijing "
139 << HIJINGVERSION << std::endl;
140 ATH_MSG_INFO( "===> Hijing initialising \n" );
141 if( m_rand ){
142 ATH_MSG_INFO( "===> Vertex randomization ON." );
143 }
144 if( m_wide ){
145 ATH_MSG_INFO( "===> Vertex rand covers whole beampipe." );
146 }
147 //BPK
148 if( m_prand ) ATH_MSG_INFO( "===> Random Momentum Mirroring enabled" );
149 if( m_keepAllDecayVertices ) ATH_MSG_INFO( "===> Keeping all decay vertices" );
150 else ATH_MSG_INFO( "===> NOT keeping all decay vertices" );
151
152 //CLHEP::HepRandomEngine* engine
153 p_Engine = getRandomEngineDuringInitialize(hijing_stream, m_randomSeed, m_dsid); // NOT THREAD-SAFE
154 hijing_stream = "HIJING";
155
156 // Set the users' initialisation parameters choices
158
159 const char* frame = m_frame.c_str();
160 const char* proj = m_proj.c_str();
161 const char* targ = m_targ.c_str();
162
163 hijset_( &m_efrm, frame, proj, targ, &m_iap, &m_izp, &m_iat, &m_izt,
164 strlen(frame), strlen(proj), strlen(targ) );
165
166 ATH_MSG_INFO( "\n=================================================\n"
167 << " HIJING initialization results: \n"
168 << " Total sigma = " << m_hiparnt.hint1(13) << " mb\n"
169 << " Inelastic sigma = " << m_hiparnt.hint1(12) << " mb\n"
170 << " Jet sigma = " << m_hiparnt.hint1(11) << " mb\n"
171 << "=================================================\n" );
172
173
174 return StatusCode::SUCCESS;
175}
#define ATH_CHECK
Evaluate an expression and check for errors.
void hijset_(float *, const char *, const char *, const char *, int *, int *, int *, int *, long int, long int, long int)
CLHEP::HepRandomEngine * getRandomEngineDuringInitialize(const std::string &streamName, unsigned long int randomSeedOffset, unsigned int conditionsRun=1, unsigned int lbn=1) const
Definition GenModule.cxx:53
void set_user_params(void)
Definition Hijing.cxx:798
int m_izt
Definition Hijing.h:67
int m_izp
Definition Hijing.h:66
const ClassName & targ(size_t i) const
Return one template argument.

◆ genuserInitialize()

virtual StatusCode GenModule::genuserInitialize ( )
inlinevirtualinherited

For initialization of user code, if required. Called after genInitialize.

Reimplemented in Pythia8B_i.

Definition at line 64 of file GenModule.h.

64{ return StatusCode::SUCCESS; }

◆ getRandomEngine() [1/2]

CLHEP::HepRandomEngine * GenModule::getRandomEngine ( const std::string & streamName,
const EventContext & ctx ) const
protectedinherited

Definition at line 34 of file GenModule.cxx.

36{
37 ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
38 std::string rngName = name()+streamName;
39 rngWrapper->setSeed( rngName, ctx );
40 return rngWrapper->getEngine(ctx);
41}
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition RNGWrapper.h:154
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition RNGWrapper.h:108
ServiceHandle< IAthRNGSvc > m_rndmSvc
Data members.
Definition GenModule.h:97

◆ getRandomEngine() [2/2]

CLHEP::HepRandomEngine * GenModule::getRandomEngine ( const std::string & streamName,
unsigned long int randomSeedOffset,
const EventContext & ctx ) const
protectedinherited

Definition at line 44 of file GenModule.cxx.

46{
47 ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
48 rngWrapper->setSeed( streamName, ctx.slot(), randomSeedOffset, ctx.eventID().run_number() );
49 return rngWrapper->getEngine(ctx);
50}

◆ getRandomEngineDuringInitialize()

CLHEP::HepRandomEngine * GenModule::getRandomEngineDuringInitialize ( const std::string & streamName,
unsigned long int randomSeedOffset,
unsigned int conditionsRun = 1,
unsigned int lbn = 1 ) const
protectedinherited

Definition at line 53 of file GenModule.cxx.

54{
55 const size_t slot=0;
56 EventContext ctx;
57 ctx.setSlot( slot );
58 ctx.setEventID (EventIDBase (conditionsRun,
59 EventIDBase::UNDEFEVT, // event
60 EventIDBase::UNDEFNUM, // timestamp
61 EventIDBase::UNDEFNUM, // timestamp ns
62 lbn));
64 Atlas::ExtendedEventContext( evtStore()->hiveProxyDict(),
65 conditionsRun) );
66 return getRandomEngine(streamName, randomSeedOffset, ctx);
67}
ServiceHandle< StoreGateSvc > & evtStore()
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
Definition GenModule.cxx:34
void setExtendedEventContext(EventContext &ctx, ExtendedEventContext &&ectx)
Move an extended context into a context object.

◆ initialize()

StatusCode GenModule::initialize ( )
virtualinherited

Reimplemented from GenBase.

Definition at line 21 of file GenModule.cxx.

21 {
22 // Base class initializations
24 // Get the random number service
25 CHECK(m_rndmSvc.retrieve());
26 // Get the incident service
27 CHECK(m_incidentSvc.retrieve());
30 return StatusCode::SUCCESS;
31}
virtual StatusCode initialize() override
Definition GenBase.cxx:17
virtual StatusCode genuserInitialize()
For initialization of user code, if required. Called after genInitialize.
Definition GenModule.h:64
virtual StatusCode genInitialize()
For initializing the generator, if required.
Definition GenModule.h:62

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::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.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::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.

◆ randomizeVertex()

CLHEP::HepLorentzVector Hijing::randomizeVertex ( CLHEP::HepRandomEngine * engine)
protectedvirtual

Definition at line 759 of file Hijing.cxx.

760{
761 // Check the range in Z for the correct pipe diameter
762 // Definitions of constants are in VertexShift.h
763
764 using namespace VertexShift;
765
766 double ranx, rany, xmax, ymax;
767 double ranz = CLHEP::RandFlat::shoot(engine, -Zmax, Zmax);
768 if( m_wide ){ // Allow the whole pipe
769 if( std::abs(ranz) < Start1 ) {
770 xmax = Xmin + Delta1;
771 ymax = xmax;
772 } else if( std::abs(ranz) < Start2 ) {
773 xmax = Xmin + Delta2;
774 ymax = xmax;
775 } else if( std::abs(ranz) < Start3 ) {
776 xmax = Xmin + Delta3;
777 ymax = xmax;
778 } else if ( std::abs(ranz) <= Envelope ){
779 xmax = Xmin;
780 ymax = xmax;
781 } else {
782 ATH_MSG_ERROR( "**** Hijing::randomizeVertex() " << ranz << " (z) is outside the detector (units of mm). Returning a centered event." );
783 return CLHEP::HepLorentzVector(0.,0.,0.,0.);
784 }
785 } else {
786 ATH_MSG_INFO( "New Coordinates: x=0., y=0., z=" << ranz );
787 return CLHEP::HepLorentzVector(0., 0., ranz, 0); // Allow distribution just along the beam (no "width", m_wide is false (default))
788 }
789 ranx = CLHEP::RandFlat::shoot(engine, -xmax, xmax);
790 rany = CLHEP::RandFlat::shoot(engine, -ymax, ymax);
791
792 ATH_MSG_INFO( "New Coordinates: x=" << ranx << ", y=" << rany << ", z=" << ranz );
793
794 return CLHEP::HepLorentzVector(ranx, rany, ranz, 0);
795}
double xmax
Definition listroot.cxx:61
double ymax
Definition listroot.cxx:64
const float Delta1
Definition VertexShift.h:29
const float Xmin
Definition VertexShift.h:25
const float Delta2
Definition VertexShift.h:30
const float Delta3
Definition VertexShift.h:31

◆ 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< Gaudi::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< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ set_user_params()

void Hijing::set_user_params ( void )
protected

Definition at line 798 of file Hijing.cxx.

799{
800 // set up the DEFAULT input parameters to hijset: these can be changed by the user ...
801 m_efrm = 14000.;
802 m_frame = "CMS ";
803 m_proj = "P ";
804 m_targ = "P ";
805 m_iap = 1;
806 m_iat = 1;
807 m_izp = 1;
808 m_izt = 1;
809 // ... and to hijing
810 m_bmin = 0.;
811 m_bmax = 0.;
812
813 // Set user Initialization parameters
814 for(CommandVector::iterator i = m_InitializeVector.begin(); i != m_InitializeVector.end(); ++i )
815 {
816 ATH_MSG_INFO( " Hijing init. Command is: " << *i );
817 StringParse mystring(*i);
818 std::string myparam = mystring.piece<std::string>(1);
819 if (myparam == "efrm")
820 {
821 m_efrm = mystring.piece<double>(2);
822 }
823 else if (myparam == "frame")
824 {
825 m_frame = mystring.piece<std::string>(2);
826 if (m_frame.size() < 8)
827 {
828 unsigned nbl = 8 - m_frame.size();
829 for (unsigned i = 0; i < nbl; ++i) m_frame += ' ';
830 }
831 }
832 else if (myparam == "proj")
833 {
834 m_proj = mystring.piece<std::string>(2);
835 if (m_proj.size() < 8)
836 {
837 unsigned nbl = 8 - m_proj.size();
838 for (unsigned i = 0; i < nbl; ++i) m_proj += ' ';
839 }
840 }
841 else if (myparam == "targ")
842 {
843 m_targ = mystring.piece<std::string>(2);
844 if (m_targ.size() < 8)
845 {
846 unsigned nbl = 8 - m_targ.size();
847 for (unsigned i = 0; i < nbl; ++i) m_targ += ' ';
848 }
849 }
850 else if (myparam == "iap")
851 {
852 m_iap = mystring.piece<int>(2);
853 }
854 else if (myparam == "izp")
855 {
856 m_izp = mystring.piece<int>(2);
857 }
858 else if (myparam == "iat")
859 {
860 m_iat = mystring.piece<int>(2);
861 }
862 else if (myparam == "izt")
863 {
864 m_izt = mystring.piece<int>(2);
865 }
866 else if (myparam == "bmin")
867 {
868 m_bmin = mystring.piece<double>(2);
869 }
870 else if (myparam == "bmax")
871 {
872 m_bmax = mystring.piece<double>(2);
873 }
874 else if (myparam == "nseed")
875 {
876 m_ranseed.nseed() = mystring.piece<int>(2);
877 }
878 else if (myparam == "hipr1")
879 {
880 int myelem = mystring.piece<int>(2);
881 m_hiparnt.hipr1(myelem) = mystring.piece<double>(3);
882 }
883 else if (myparam == "ihpr2")
884 {
885 int myelem = mystring.piece<int>(2);
886 m_hiparnt.ihpr2(myelem) = mystring.piece<int>(3);
887 }
888 else if (myparam == "hint1")
889 {
890 int myelem = mystring.piece<int>(2);
891 m_hiparnt.hint1(myelem) = mystring.piece<double>(3);
892 }
893 else if (myparam == "ihnt2")
894 {
895 int myelem = mystring.piece<int>(2);
896 m_hiparnt.ihnt2(myelem) = mystring.piece<int>(3);
897 }
898 else
899 {
900 ATH_MSG_ERROR( " ERROR in HIJING INITIALIZATION PARAMETERS " << myparam << " is an invalid parameter !" );
901 }
902 }
903}
RanSeed m_ranseed
Definition Hijing.h:104

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::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< Gaudi::Algorithm > >.

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

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::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 }

Member Data Documentation

◆ m_bmax

float Hijing::m_bmax {0.}
protected

Definition at line 70 of file Hijing.h.

70{0.};

◆ m_bmin

float Hijing::m_bmin {0.}
protected

Definition at line 69 of file Hijing.h.

69{0.};

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_dsid

IntegerProperty Hijing::m_dsid {this, "Dsid", 999999}
protected

Definition at line 57 of file Hijing.h.

57{this, "Dsid", 999999};

◆ m_efrm

float Hijing::m_efrm {0.}
protected

Definition at line 60 of file Hijing.h.

60{0.};

◆ m_event_paramsKey

SG::WriteHandleKey<HijingEventParams> Hijing::m_event_paramsKey {this, "HijingOutputKey", "Hijing_event_params"}
protected

Definition at line 117 of file Hijing.h.

117{this, "HijingOutputKey", "Hijing_event_params"};

◆ m_events

int Hijing::m_events {0}
protected

Definition at line 95 of file Hijing.h.

95{0};

◆ m_evtStore

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

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_frame

std::string Hijing::m_frame
protected

Definition at line 61 of file Hijing.h.

◆ m_hijcrdn

HijCrdn Hijing::m_hijcrdn
protected

Definition at line 113 of file Hijing.h.

◆ m_hijjet1

HijJet1 Hijing::m_hijjet1
protected

Definition at line 109 of file Hijing.h.

◆ m_hijjet2

HijJet2 Hijing::m_hijjet2
protected

Definition at line 110 of file Hijing.h.

◆ m_hijjet4

HijJet4 Hijing::m_hijjet4
protected

Definition at line 111 of file Hijing.h.

◆ m_himain1

HiMain1 Hijing::m_himain1
protected

Definition at line 107 of file Hijing.h.

◆ m_himain2

HiMain2 Hijing::m_himain2
protected

Definition at line 108 of file Hijing.h.

◆ m_hiparnt

HiParnt Hijing::m_hiparnt
protected

Definition at line 101 of file Hijing.h.

◆ m_histrng

HiStrng Hijing::m_histrng
protected

Definition at line 112 of file Hijing.h.

◆ m_iap

int Hijing::m_iap {0}
protected

Definition at line 64 of file Hijing.h.

64{0};

◆ m_iat

int Hijing::m_iat {0}
protected

Definition at line 65 of file Hijing.h.

65{0};

◆ m_incidentSvc

ServiceHandle<IIncidentSvc> GenModule::m_incidentSvc {this, "IncidentSvc", "IncidentSvc"}
privateinherited

Handle on the incident service.

Definition at line 99 of file GenModule.h.

99{this, "IncidentSvc", "IncidentSvc"};

◆ m_InitializeVector

CommandVector Hijing::m_InitializeVector
protected

Definition at line 98 of file Hijing.h.

◆ m_isAfterburner

BooleanProperty GenModule::m_isAfterburner {this, "IsAfterburner", false, "Set true if generator modifies existing events rather than creating new ones"}
protectedinherited

Flag for normal vs. afterburner generators.

Definition at line 87 of file GenModule.h.

87{this, "IsAfterburner", false, "Set true if generator modifies existing events rather than creating new ones"};

◆ m_izp

int Hijing::m_izp {0}
protected

Definition at line 66 of file Hijing.h.

66{0};

◆ m_izt

int Hijing::m_izt {0}
protected

Definition at line 67 of file Hijing.h.

67{0};

◆ m_keepAllDecayVertices

bool Hijing::m_keepAllDecayVertices {true}
protected

Definition at line 84 of file Hijing.h.

84{true};

◆ m_mcEventKey

std::string GenBase::m_mcEventKey {}
protectedinherited

StoreGate key for the MC event collection (defaults to GEN_EVENT).

Definition at line 109 of file GenBase.h.

109{};

◆ m_mcevents_const

SG::ReadHandleKey<McEventCollection> GenBase::m_mcevents_const { this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" }
privateinherited

Const handle to the MC event collection.

Definition at line 118 of file GenBase.h.

118{ this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" };

◆ m_mkMcEvent

BooleanProperty GenBase::m_mkMcEvent {this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"}
protectedinherited

Flag to determine if a new MC event collection should be made if it doesn't exist.

Definition at line 111 of file GenBase.h.

111{this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"};

◆ m_partonStoreMinPt

double Hijing::m_partonStoreMinPt {5.0}
protected

Definition at line 87 of file Hijing.h.

87{5.0};

◆ m_prand

bool Hijing::m_prand {false}
protected

Definition at line 83 of file Hijing.h.

83{false}; //BPK mirror event randomly

◆ m_proj

std::string Hijing::m_proj
protected

Definition at line 62 of file Hijing.h.

◆ m_rand

bool Hijing::m_rand {false}
protected

Definition at line 81 of file Hijing.h.

81{false};

◆ m_randomSeed

IntegerProperty GenModule::m_randomSeed {this, "RandomSeed", 1234567, "Random seed for the built-in random engine"}
protectedinherited

Seed for random number engine.

Definition at line 84 of file GenModule.h.

84{this, "RandomSeed", 1234567, "Random seed for the built-in random engine"}; // FIXME make this into an unsigned long int?

◆ m_randomseed

int Hijing::m_randomseed {0}
protected

Definition at line 91 of file Hijing.h.

91{0};

◆ m_ranseed

RanSeed Hijing::m_ranseed
protected

Definition at line 104 of file Hijing.h.

◆ m_rndmSvc

ServiceHandle<IAthRNGSvc> GenModule::m_rndmSvc {this, "RndmSvc", "AthRNGSvc"}
privateinherited

Data members.

Definition at line 97 of file GenModule.h.

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

◆ m_runinfo

std::shared_ptr<HepMC3::GenRunInfo> GenModule::m_runinfo {}
protectedinherited

The run info for HepMC3.

Definition at line 90 of file GenModule.h.

90{};

◆ m_seeds

std::vector<long int> Hijing::m_seeds
protected

Definition at line 92 of file Hijing.h.

◆ m_sel

bool Hijing::m_sel {false}
protected

Definition at line 77 of file Hijing.h.

77{false}; // Vertex shifting on or off

◆ m_spec

bool Hijing::m_spec {true}
protected

Definition at line 78 of file Hijing.h.

78{true}; // TRUE will keep specator information (default)

◆ m_targ

std::string Hijing::m_targ
protected

Definition at line 63 of file Hijing.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexOffsetCut

double Hijing::m_vertexOffsetCut {1.0E-7}
protected

Definition at line 88 of file Hijing.h.

88{1.0E-7};

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_wide

bool Hijing::m_wide {false}
protected

Definition at line 82 of file Hijing.h.

82{false}; // True allows particles with x,y distributions

◆ m_x

float Hijing::m_x {0.}
protected

Definition at line 74 of file Hijing.h.

74{0.};

◆ m_y

float Hijing::m_y {0.}
protected

Definition at line 75 of file Hijing.h.

75{0.};

◆ m_z

float Hijing::m_z {0.}
protected

Definition at line 76 of file Hijing.h.

76{0.};

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