5#ifndef TRUTHHELPER_GENACCESSIO_H
6#define TRUTHHELPER_GENACCESSIO_H
12#include "GaudiKernel/Bootstrap.h"
13#include "GaudiKernel/ISvcLocator.h"
28 if (
m_sgSvc.retrieve().isFailure()) {
29 throw StatusCode::FAILURE;
38 if ( (
m_sgSvc->retrieve(firstMEC, lastMEC)).isFailure() ) {
39 log << MSG::ERROR <<
"Could not retrieve iterators for McEventCollections" <<
endmsg;
43 for ( ; firstMEC!= lastMEC; ++firstMEC) icount++;
44 log << MSG::DEBUG <<
"Number of McEventCollections= "<< icount <<
endmsg;
48 log << MSG::DEBUG <<
"Key = " << key <<
endmsg;
50 return this->
getDH(mcCollptr, key);
56 for (itr = mcColl.
begin(); itr!=mcColl.
end(); ++itr) {
58 const HepMC::GenEvent* genEvt = (*itr);
59 if (genEvt == 0)
return StatusCode::FAILURE;
61 for (
auto it: *genEvt) {
65 for (
auto it: *genEvt) {
66 mcParticles.push_back(std::move(it));
71 return StatusCode::SUCCESS;
77 return m_sgSvc->retrieve(dh, key);
80 return m_sgSvc->record(storee, key);
std::vector< HepMC::ConstGenParticlePtr > MCParticleCollection
std::vector< HepMC::ConstGenParticlePtr >::const_iterator MCParticleCollectionCIter
ATLAS-specific HepMC functions.
DataModel_detail::const_iterator< DataVector > const_iterator
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.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
a const_iterator facade to DataHandle.
StatusCode getMC(MCParticleCollection &mcParticles, const bool ifgen=false, const std::string &key="GEN_EVENT") const
ServiceHandle< StoreGateSvc > m_sgSvc
StatusCode getDH(const McEventCollection *&dh, const std::string &key) const
StatusCode store(McEventCollection *storee, const std::string &key) const
StatusCode getDH(const McEventCollection *&dh) const
IMessageSvc * getMessageSvc(bool quiet=false)
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...