5#ifndef GENERATORMODULES_GENBASE_H
6#define GENERATORMODULES_GENBASE_H
9#include "GaudiKernel/ServiceHandle.h"
10#include "GaudiKernel/IPartPropSvc.h"
11#include "GaudiKernel/IIncidentSvc.h"
21#include "HepPDT/ParticleData.hh"
22#include "HepPDT/ParticleDataTable.hh"
54 GenBase(
const std::string& name, ISvcLocator* pSvcLocator);
65 virtual StatusCode
execute()
override {
return StatusCode::SUCCESS; }
77 if (events()->
empty())
78 ATH_MSG_ERROR(
"McEventCollection is empty during first event access");
79 return *(events()->begin());
85 ATH_MSG_ERROR(
"Const McEventCollection is empty during first event access");
127 return pdt().particle(HepPDT::ParticleID(std::abs(pid)));
139 BooleanProperty
m_mkMcEvent{
this,
"MakeMcEvent",
false,
"Create a new MC event collection if it doesn't exist"};
147 void GeVToMeV(HepMC::GenEvent* evt);
149 void MeVToGeV(HepMC::GenEvent* evt);
151 void cmTomm(HepMC::GenEvent* evt);
153 void mmTocm(HepMC::GenEvent* evt);
Helpers for checking error return status codes and reporting errors.
Property holding a SG store/key/clid from which a ReadHandle is made.
static const Attributes_t empty
Define macros for attributes used to control the static checker.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
const HepPDT::ParticleData * particleData(int pid) const
Access an element in the particle data table.
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.
std::string m_mcEventKey
StoreGate key for the MC event collection (defaults to GEN_EVENT)
void GeVToMeV(HepMC::GenEvent *evt)
Scale event energies/momenta by x 1000.
const ServiceHandle< IPartPropSvc > partPropSvc() const
Access the particle property service.
virtual StatusCode initialize() override
const HepPDT::ParticleDataTable & particleTable() const
Get a particle data table.
virtual ~GenBase()
Virtual destructor.
GenBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
BooleanProperty m_mkMcEvent
Flag to determine if a new MC event collection should be made if it doesn't exist.
virtual StatusCode execute() override
const McEventCollection * events_const(const EventContext &ctx) const
ServiceHandle< IPartPropSvc > m_ppSvc
Handle on the particle property service.
void MeVToGeV(HepMC::GenEvent *evt)
Scale event energies/momenta by x 1/1000.
void cmTomm(HepMC::GenEvent *evt)
Scale event lengths by x 10.
void mmTocm(HepMC::GenEvent *evt)
Scale event lengths by x 1/10.
const McEventCollection * events_const() const
Access the current event's McEventCollection (const)
const HepPDT::ParticleDataTable & pdt() const
Shorter alias to get a particle data table.
const HepMC::GenEvent * event_const() const
Access the current signal event (const)
SG::ReadHandleKey< McEventCollection > m_mcevents_const
Const handle to the MC event collection.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
Property holding a SG store/key/clid from which a ReadHandle is made.
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())