28 const unsigned int genEventIndex,
35 if ( 0 == mcCollection ) {
36 ::Warning (
"RootTruthParticleCnvTool",
37 "Null pointer to McEventCollection !");
38 return StatusCode::RECOVERABLE;
41 if ( mcCollection->
size() <= genEventIndex ) {
42 ::Warning (
"RootTruthParticleCnvTool",
43 "McEventCollection size: %ui; Requested element nbr : %ui !!",
46 (
unsigned int)mcCollection->
size(),
48 return StatusCode::RECOVERABLE;
51 const HepMC::GenEvent * evt = (*mcCollection)[genEventIndex];
52 container->setGenEvent( mcCollection, genEventIndex );
55 container->reserve( evt->particles_size() );
60 for (
const auto& hepMcPart: *evt) {
66 visitor->
visit( mcPart );
73 ::Error (
"RootTruthParticleCnvTool",
74 "TruthParticle is not wrapping the GenParticle : %d !!",
78 bcToMcPart[ mcLink.
compress() ] = mcPart;
89 if ( m_doEtIsolation.value() ) {
90 const std::string& etIsolName
91 = m_isolationTool->etIsolationsName(
container->genEventName() );
92 if ( etIsolName.empty() ) {
94 <<
"Could not retrieve the name of the TruthEtIsolations container"
96 return StatusCode::RECOVERABLE;
100 if ( !m_storeGate->retrieve( etIsols, etIsolName ).isSuccess() ) {
101 m_msg << MSG::WARNING
102 <<
"Could not retrieve the TruthEtIsolations container at ["
103 << etIsolName <<
"] !!"
105 return StatusCode::RECOVERABLE;
110 container->setEtIsolations( etIsols, genEventIndex );
114 return StatusCode::SUCCESS;
136const Gaudi::Details::PropertyBase&
139 std::string& )
const {
141const std::vector< Gaudi::Details::PropertyBase* >&
ATLAS-specific HepMC functions.
size_type size() const noexcept
Returns the number of elements in the collection.
a link optimized in size for a GenParticle in a McEventCollection
barcode_type compress() const
Hash the 32 bit barcode and 16 bit eventindex into a 32bit int.
virtual void visit(TruthParticle *truthParticle) const =0
The method to visit a TruthParticle to apply further modifications to the instance at hand.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
virtual int pdgId() const
Return enum indicating particle id the enum file is available in Event/EventKernel/PdtPdg....
virtual StatusCode start() override
virtual bool hasProperty(std::string_view name) const override
virtual StatusCode finalize() override
virtual StatusCode sysReinitialize() override
virtual StatusCode execute() const override
A hook for Athena algorithms.
virtual StatusCode sysRestart() override
virtual StatusCode sysStart() override
virtual const IInterface * parent() const override
virtual StatusCode stop() override
virtual StatusCode reinitialize() override
virtual const std::string & type() const override
virtual StatusCode sysInitialize() override
virtual StatusCode terminate() override
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const override
virtual Gaudi::StateMachine::State FSMState() const override
virtual const std::string & name() const override
virtual StatusCode sysFinalize() override
virtual StatusCode restart() override
virtual StatusCode convert(const McEventCollection *mcEvts, const unsigned int genEvtIndex, TruthParticleContainer *mcParts, const ITruthParticleVisitor *visitor) const override
Converts a McEventCollection into an TruthParticleContainer (ie: converts it into an AOD compliant co...
virtual StatusCode sysStop() override
double chargeFromPdgId(int pdgId) const
Helper method to get the charge of a particle given its PDG Id.
virtual StatusCode setPropertyRepr(const std::string &n, const std::string &r) override
virtual StatusCode initialize() override
virtual StatusCode configure() override
virtual StatusCode setProperty(const std::string &s) override
virtual const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
std::unordered_map< long, const TruthParticle * > Map_t
barcode to TruthParticle dictionary
(HepMC) Monte Carlo particle.
void setGenEventIndex(size_t index)
set the GenEvent index
HepMC::ConstGenParticlePtr genParticle() const
Retrieve the GenParticle this TruthParticle has been made from (if any)
void setCharge(const ChargeType charge)
Set the charge of this TruthParticle.
double charge(const T &p)