5#ifndef GENERATORMODULES_GENBASE_H
6#define GENERATORMODULES_GENBASE_H
9#include "GaudiKernel/ServiceHandle.h"
10#include "GaudiKernel/IIncidentSvc.h"
50 GenBase(
const std::string& name, ISvcLocator* pSvcLocator);
61 virtual StatusCode
execute(
const EventContext&)
override {
return StatusCode::SUCCESS; }
73 if (events()->
empty())
74 ATH_MSG_ERROR(
"McEventCollection is empty during first event access");
75 return *(events()->begin());
82 ATH_MSG_ERROR(
"Const McEventCollection is empty during first event access");
83 return *(coll->
begin());
110 BooleanProperty
m_mkMcEvent{
this,
"MakeMcEvent",
false,
"Create a new MC event collection if it doesn't exist"};
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.
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.
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).
virtual StatusCode initialize() override
const HepMC::GenEvent * event_const(const EventContext &ctx) const
Access the current signal event (const).
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.
const McEventCollection * events_const(const EventContext &ctx) const
Access the current event's McEventCollection (const).
virtual StatusCode execute(const EventContext &) override
Execute method.
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.
HepMC3::GenEvent GenEvent
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())