ATLAS Offline Software
Loading...
Searching...
No Matches
TruthParticleContainer.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6// TruthParticleContainer.cxx
7// Implementation file for class TruthParticleContainer
8// Author: S.Binet<binet@cern.ch>
10
11
12// STL includes
13#include <iostream>
14
15// McParticleEvent includes
17
21
28
29/*
30TruthParticleContainer::TruthParticleContainer( const TruthParticleContainer& rhs ) :
31 DataVector<I4Momentum> ( rhs ),
32 DataVector<INavigable4Momentum>( rhs ),
33 DataVector<TruthParticle>( rhs ),
34 m_genEvent ( rhs.m_genEvent ),
35 m_etIsolations( rhs.m_etIsolations ),
36 m_particles ( rhs.m_particles )
37{}
38
39TruthParticleContainer& TruthParticleContainer::operator=( const TruthParticleContainer& rhs )
40{
41 if ( this != &rhs ) {
42 DataVector<TruthParticle>::operator=(rhs);
43 m_genEvent = rhs.m_genEvent;
44 m_etIsolations = rhs.m_etIsolations;
45 m_particles = rhs.m_particles;
46 }
47
48 return *this;
49}
50*/
51
58
62
63const TruthParticle*
64TruthParticleContainer::truthParticle( const int barcode,std::size_t genEventIdx ) const
65{
67 Map_t::const_iterator itr = m_particles.find(mcLink.compress());
68 if ( itr != m_particles.end() ) {
69 return itr->second;
70 }
71 return nullptr;
72}
73
74std::size_t
75TruthParticleContainer::truthParticleIdx( const int barcode, std::size_t genEventIdx ) const
76{
78 Map_t::const_iterator itr = m_particles.find(mcLink.compress());
79 if ( itr != m_particles.end() ) {
80 for ( std::size_t idx = 0; idx != this->size(); ++idx ) {
81 if ( this->operator[](idx) == itr->second ) {
82 return idx;
83 }
84 }
85 }
86 return NoIdx;
87}
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
size_type size() const noexcept
ElementLink< TruthEtIsolationsContainer > m_etIsolations
Persistent pointer to the TruthEtIsolations container, holding Et isolations for TruthParticle or Hep...
ElementLink< McEventCollection > m_genEvent
Persistent pointer to the HepMC::GenEvent we are proxying.
Map_t m_particles
Dictionary to ease the extraction of a TruthParticle (contained by this collection) from the HepMC::G...
std::size_t genEventIdx() const
Retrieve the index (within a McEventCollection) of the HepMC::GenEvent this TruthParticleContainer is...
const TruthParticle * truthParticle(const int barcode, std::size_t genEventIdx=0) const
return a const pointer to an TruthParticle given the barcode of the HepMC::GenParticle it is wrapping
std::size_t truthParticleIdx(const int barcode, std::size_t genEventIdx=0) const
return the index to an TruthParticle given the barcode of the HepMC::GenParticle it is wrapping retur...
TruthParticleContainer()
Default constructor:
Forward declaration.
OwnershipPolicy