ATLAS Offline Software
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | Friends | List of all members
TruthParticleContainer Class Reference

#include <TruthParticleContainer.h>

Inheritance diagram for TruthParticleContainer:
Collaboration diagram for TruthParticleContainer:

Public Types

typedef std::unordered_map< long, const TruthParticle * > Map_t
 barcode to TruthParticle dictionary More...
 
typedef TruthParticle::evtIndex_t evtIndex_t
 
typedef BASE DataVector_BASE
 
typedef BASE DVL_BASE
 
typedef BASE::PtrVector PtrVector
 This is the type of the underlying std::vector (what stdcont returns). More...
 
typedef BASE::PtrVector BaseContainer
 
typedef TruthParticle *& reference
 
typedef TruthParticle *constconst_reference
 
typedef BASE::size_type size_type
 
typedef BASE::difference_type difference_type
 
typedef TruthParticlevalue_type
 
typedef BASE::allocator_type allocator_type
 
typedef TruthParticle ** pointer
 
typedef TruthParticle *constconst_pointer
 
typedef const TruthParticleconst_value_type
 
typedef TruthParticle base_value_type
 The T value used as the template parameter. More...
 
typedef std::unique_ptr< base_value_typeunique_type
 Type of a unique_ptr that can be used to insert elements into this container. More...
 
typedef DataModel_detail::ElementProxy< DataVectorElementProxy
 This type is used to proxy lvalue accesses to DataVector elements, in order to handle ownership. More...
 
typedef DataModel_detail::const_iterator< DataVectorconst_iterator
 Standard const_iterator. More...
 
typedef DataModel_detail::iterator< DataVectoriterator
 Standard iterator. More...
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 Standard const_reverse_iterator. More...
 
typedef std::reverse_iterator< iteratorreverse_iterator
 Standard reverse_iterator. More...
 
typedef DataVector base_data_vector
 
using Deleter = typename BASE::Deleter
 
typedef DataVector< TruthParticle, BASE > self
 A helper typedef. More...
 

Public Member Functions

 TruthParticleContainer ()
 Default constructor: More...
 
 TruthParticleContainer (const SG::OwnershipPolicy own)
 Copy constructor: compiler generated one is good enough. More...
 
 ~TruthParticleContainer ()
 Destructor: More...
 
std::ostream & dump (std::ostream &out=std::cout) const
 Dump the content of the TruthParticleContainer. More...
 
const HepMC::GenEvent * genEvent () const
 Retrieve the HepMC::GenEvent this TruthParticleContainer is proxying. More...
 
const ElementLink< McEventCollection > & genEventLink () const
 Retrieve the HepMC::GenEvent this TruthParticleContainer is proxying, as a link. More...
 
const std::string & genEventName () const
 Retrieve the name (StoreGate location) of the HepMC::GenEvent this TruthParticleContainer is proxying. More...
 
std::size_t genEventIdx () const
 Retrieve the index (within a McEventCollection) of the HepMC::GenEvent this TruthParticleContainer is proxying. More...
 
const TruthParticletruthParticle (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 More...
 
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 return TruthParticleContainer::NoIdx if no such TruthParticle exists More...
 
bool hasEtIsol () const
 tell if this TruthParticleContainer has been registered with a TruthEtIsolations container More...
 
bool hasEtIsol (const int barcode) const
 tell if a TruthParticle (or a HepMC::GenParticle) has Et isolations data associated to it. More...
 
const TruthEtIsolations::EtIsol_tetIsolations (const int barcode) const
 return the container of Truth Et isolations for a given TruthParticle (or a HepMC::GenParticle) More...
 
const ElementLink< TruthEtIsolationsContainer > & etIsolationsLink () const
 return the link to truth Et isolations. More...
 
double etIsol (const int barcode, const TruthParticleParameters::ConeSize coneIdx) const
 Return the Et isolation for a given particle and a given cone size. More...
 
void setGenEvent (const ElementLink< McEventCollection > &genEvent)
 Setup the persistent pointer toward the HepMC::GenEvent this TruthParticleContainer is proxying. More...
 
void setGenEvent (const McEventCollection *mcColl, const std::size_t genEventIdx, IProxyDict *sg=nullptr)
 Setup the persistent pointer toward the HepMC::GenEvent this TruthParticleContainer is proxying. More...
 
void setEtIsolations (const ElementLink< TruthEtIsolationsContainer > &etIsolations)
 Setup the persistent pointer toward the TruthEtIsolations. More...
 
void setEtIsolations (const TruthEtIsolationsContainer *etIsolations, const std::size_t etIsolationsIdx, IProxyDict *sg=nullptr)
 Setup the persistent pointer toward the TruthEtIsolations. More...
 
void setParticles (const Map_t &parts)
 Setup the dictionary of barcodes-to-TruthParticle. More...
 
Size and capacity.
size_type size () const noexcept
 Returns the number of elements in the collection. More...
 
void resize (size_type sz)
 Resizes the collection to the specified number of elements. More...
 
void reserve (size_type n)
 Attempt to preallocate enough memory for a specified number of elements. More...
 
Element access.

Change the vector capacity to match the current size.

Note: this does not affect auxiliary data.

const TruthParticleoperator[] (size_type n) const
 Access an element, as an rvalue. More...
 
ElementProxy operator[] (size_type n)
 Access an element, as an lvalue. More...
 
const TruthParticleget (size_type n) const
 Access an element, as an rvalue. More...
 
const TruthParticleat (size_type n) const
 Access an element, as an rvalue. More...
 
ElementProxy at (size_type n)
 Access an element, as an lvalue. More...
 
const TruthParticlefront () const
 Access the first element in the collection as an rvalue. More...
 
ElementProxy front ()
 Access the first element in the collection as an lvalue. More...
 
const TruthParticleback () const
 Access the last element in the collection as an rvalue. More...
 
ElementProxy back ()
 Access the last element in the collection as an lvalue. More...
 
Iterator creation.
const_iterator begin () const noexcept
 Return a const_iterator pointing at the beginning of the collection. More...
 
iterator begin () noexcept
 Return an iterator pointing at the beginning of the collection. More...
 
const_iterator end () const noexcept
 Return a const_iterator pointing past the end of the collection. More...
 
iterator end () noexcept
 Return an iterator pointing past the end of the collection. More...
 
const_reverse_iterator rbegin () const noexcept
 Return a const_reverse_iterator pointing past the end of the collection. More...
 
reverse_iterator rbegin () noexcept
 Return a reverse_iterator pointing past the end of the collection. More...
 
const_reverse_iterator rend () const noexcept
 Return a const_reverse_iterator pointing at the beginning of the collection. More...
 
reverse_iterator rend () noexcept
 Return a reverse_iterator pointing at the beginning of the collection. More...
 
const_iterator cbegin () const noexcept
 Return a const_iterator pointing at the beginning of the collection. More...
 
const_iterator cend () const noexcept
 Return a const_iterator pointing past the end of the collection. More...
 
const_reverse_iterator crbegin () const noexcept
 Return a const_reverse_iterator pointing past the end of the collection. More...
 
const_reverse_iterator crend () const noexcept
 Return a const_reverse_iterator pointing at the beginning of the collection. More...
 
Insertion operations.
value_type push_back (value_type pElem)
 Add an element to the end of the collection. More...
 
value_type push_back (std::unique_ptr< base_value_type > pElem)
 Add an element to the end of the collection. More...
 
value_type emplace_back (value_type pElem)
 Add an element to the end of the collection. More...
 
iterator insert (iterator position, value_type pElem)
 Add a new element to the collection. More...
 
iterator insert (iterator position, std::unique_ptr< base_value_type > pElem)
 Add a new element to the collection. More...
 
void insert (iterator position, InputIterator first, InputIterator last)
 Add a group of new elements to the collection. More...
 
void insert (iterator position, InputIterator first, InputIterator last)
 Add a group of new elements to the collection. More...
 
void insert (iterator position, std::initializer_list< value_type > l)
 Add a group of new elements to the collection. More...
 
iterator emplace (iterator position, value_type pElem)
 Add a new element to the collection. More...
 
void insertMove (iterator position, DataVector &other)
 Insert the contents of another DataVector, with auxiliary data copied via move semantics. More...
 
Erasure operations.
iterator erase (iterator position)
 Remove element at a given position. More...
 
iterator erase (iterator first, iterator last)
 Remove a range of elements. More...
 
void pop_back ()
 Remove the last element from the collection. More...
 
void clear ()
 Erase all the elements in the collection. More...
 
Constructors, destructors, assignment.
void assign (InputIterator first, InputIterator last)
 Assign from iterators. More...
 
void assign (std::initializer_list< value_type > l)
 
Size and capacity.
size_type size () const noexcept
 Returns the number of elements in the collection. More...
 
void resize (size_type sz)
 Resizes the collection to the specified number of elements. More...
 
void reserve (size_type n)
 Attempt to preallocate enough memory for a specified number of elements. More...
 
Element access.

Change the vector capacity to match the current size.

Note: this does not affect auxiliary data.

const TruthParticleoperator[] (size_type n) const
 Access an element, as an rvalue. More...
 
ElementProxy operator[] (size_type n)
 Access an element, as an lvalue. More...
 
const TruthParticleget (size_type n) const
 Access an element, as an rvalue. More...
 
const TruthParticleat (size_type n) const
 Access an element, as an rvalue. More...
 
ElementProxy at (size_type n)
 Access an element, as an lvalue. More...
 
const TruthParticlefront () const
 Access the first element in the collection as an rvalue. More...
 
ElementProxy front ()
 Access the first element in the collection as an lvalue. More...
 
const TruthParticleback () const
 Access the last element in the collection as an rvalue. More...
 
ElementProxy back ()
 Access the last element in the collection as an lvalue. More...
 
Iterator creation.
const_iterator begin () const noexcept
 Return a const_iterator pointing at the beginning of the collection. More...
 
iterator begin () noexcept
 Return an iterator pointing at the beginning of the collection. More...
 
const_iterator end () const noexcept
 Return a const_iterator pointing past the end of the collection. More...
 
iterator end () noexcept
 Return an iterator pointing past the end of the collection. More...
 
const_reverse_iterator rbegin () const noexcept
 Return a const_reverse_iterator pointing past the end of the collection. More...
 
reverse_iterator rbegin () noexcept
 Return a reverse_iterator pointing past the end of the collection. More...
 
const_reverse_iterator rend () const noexcept
 Return a const_reverse_iterator pointing at the beginning of the collection. More...
 
reverse_iterator rend () noexcept
 Return a reverse_iterator pointing at the beginning of the collection. More...
 
const_iterator cbegin () const noexcept
 Return a const_iterator pointing at the beginning of the collection. More...
 
const_iterator cend () const noexcept
 Return a const_iterator pointing past the end of the collection. More...
 
const_reverse_iterator crbegin () const noexcept
 Return a const_reverse_iterator pointing past the end of the collection. More...
 
const_reverse_iterator crend () const noexcept
 Return a const_reverse_iterator pointing at the beginning of the collection. More...
 
Insertion operations.
value_type push_back (value_type pElem)
 Add an element to the end of the collection. More...
 
value_type push_back (std::unique_ptr< base_value_type > pElem)
 Add an element to the end of the collection. More...
 
value_type emplace_back (value_type pElem)
 Add an element to the end of the collection. More...
 
iterator insert (iterator position, value_type pElem)
 Add a new element to the collection. More...
 
iterator insert (iterator position, std::unique_ptr< base_value_type > pElem)
 Add a new element to the collection. More...
 
void insert (iterator position, InputIterator first, InputIterator last)
 Add a group of new elements to the collection. More...
 
void insert (iterator position, InputIterator first, InputIterator last)
 Add a group of new elements to the collection. More...
 
void insert (iterator position, std::initializer_list< value_type > l)
 Add a group of new elements to the collection. More...
 
iterator emplace (iterator position, value_type pElem)
 Add a new element to the collection. More...
 
void insertMove (iterator position, DataVector &other)
 Insert the contents of another DataVector, with auxiliary data copied via move semantics. More...
 
Erasure operations.
iterator erase (iterator position)
 Remove element at a given position. More...
 
iterator erase (iterator first, iterator last)
 Remove a range of elements. More...
 
void pop_back ()
 Remove the last element from the collection. More...
 
void clear ()
 Erase all the elements in the collection. More...
 

Public Attributes

ROOT_SELECTION_NS::MemberAttributes< kTransient > m_isMostDerived
 Automatically generate dictionary for contained vector. More...
 
ROOT_SELECTION_NS::MemberAttributes< kTransient > m_deleter
 
ROOT_SELECTION_NS::MemberAttributes< kTransient > m_ownPolicy
 We do not want to save this. More...
 

Static Public Attributes

static const std::size_t NoIdx = static_cast<std::size_t>(-1)
 
static const bool has_virtual
 This is true for any DataVector class if we need to use virtual derivation to get to the base DataVector class. More...
 
static constexpr bool must_own
 If true, then this type must own its contents. More...
 

Protected Attributes

ElementLink< McEventCollectionm_genEvent
 Persistent pointer to the HepMC::GenEvent we are proxying. More...
 
ElementLink< TruthEtIsolationsContainerm_etIsolations
 Persistent pointer to the TruthEtIsolations container, holding Et isolations for TruthParticle or HepMC::GenParticle. More...
 
Map_t m_particles
 Dictionary to ease the extraction of a TruthParticle (contained by this collection) from the HepMC::GenParticle barcode. More...
 

Friends

class TruthParticleCnvTool
 

Swap and sort.

void swap (DataVector &rhs)
 Swap this collection with another. More...
 
void sort ()
 Sort the container. More...
 
void sort (COMPARE comp)
 Sort the container with a user-specified comparison operator. More...
 
static void iter_swap (iterator a, iterator b)
 Swap the referents of two DataVector iterators. More...
 

Non-standard operations.

void resize (size_type sz)
 
void pop_back ()
 
void clear (SG::OwnershipPolicy ownPolicy)
 Erase all the elements in the collection, and reset the ownership mode. More...
 
void clear (SG::OwnershipPolicy ownPolicy, SG::IndexTrackingPolicy trackIndices)
 
void clear (std::unique_ptr< Deleter > deleter)
 Erase all the elements in the collection, and change how elements are to be deleted. More...
 
void clear ()
 
void clear (SG::OwnershipPolicy ownPolicy, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
 
void swapElement (size_type index, value_type newElem, reference oldElem)
 Swap one element out of the container. More...
 
void swapElement (iterator pos, value_type newElem, reference oldElem)
 Swap one element out of the container. More...
 
void swapElement (size_type index, std::unique_ptr< base_value_type > newElem, std::unique_ptr< base_value_type > &oldElem)
 Swap one element out of the container. More...
 
void swapElement (iterator pos, std::unique_ptr< base_value_type > newElem, std::unique_ptr< base_value_type > &oldElem)
 Swap one element out of the container. More...
 
virtual const DataModel_detail::DVLInfoBasedvlinfo_v () const
 Return the DV/DL info struct for this class. More...
 
const SG::AuxVectorBaseauxbase () const
 Convert to AuxVectorBase. More...
 
size_type max_size () const noexcept
 Returns the size() of the largest possible collection. More...
 
size_type capacity () const noexcept
 Returns the total number of elements that the collection can hold before needing to allocate more memory. More...
 
bool empty () const noexcept
 Returns true if the collection is empty. More...
 
void shrink_to_fit ()
 
const PtrVectorstdcont () const
 Return the underlying std::vector of the container. More...
 
SG::OwnershipPolicy ownPolicy () const
 Return the ownership policy setting for this container. More...
 
static const DataModel_detail::DVLInfoBasedvlinfo ()
 Return the DV/DL info struct for this class. More...
 
static int baseOffset (const std::type_info &ti)
 Return the offset of a base DataVector class. More...
 

Internal operations.

void resortAux (iterator beg, iterator end)
 Reset indices / reorder aux data after elements have been permuted. More...
 
void testInsert (const char *op)
 Test if we can insert; raise an exception if not. More...
 
void testInsertOol (const char *op)
 Test if we can insert; raise an exception if not. More...
 
typedef ROOT_SELECTION_NS::DataVector< TruthParticle, DataVector_BASE >::self self
 
SG::IsMostDerivedFlag m_isMostDerived
 This flag is true if this DV instance is the most-derived one. More...
 
static int baseOffset1 (const char *p, const DataVector &dv, const std::type_info &ti)
 Helper for baseOffset. More...
 
static const TruthParticledo_cast (const typename PtrVector::value_type p)
 Helper to shorten calls to DataModel_detail::DVLCast. More...
 
static TruthParticledo_cast_nc (typename PtrVector::value_type p)
 Helper to shorten calls to DataModel_detail::DVLCast. More...
 
void assignElement (typename BaseContainer::iterator pos, value_type newElem)
 Handle element assignment. More...
 
void assignElement (typename BaseContainer::iterator pos, std::unique_ptr< base_value_type > newElem)
 Handle element assignment. More...
 
void assignBaseElement (typename BaseContainer::iterator pos, typename BaseContainer::value_type newElem)
 Handle element assignment from a base pointer. More...
 
void shift (size_t pos, ptrdiff_t offs)
 Shift the auxiliary elements of the container. More...
 
virtual const std::type_info & dv_typeid () const
 Find the most-derived DataVector class in the hierarchy. More...
 
void clearMostDerived ()
 Clear m_isMostDerived for this instance and for all bases. More...
 
virtual void setMostDerived ()
 Set m_isMostDerived for this instance and clear it for all bases. More...
 

Detailed Description

Definition at line 41 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

Member Typedef Documentation

◆ allocator_type

typedef BASE::allocator_type DataVector< TruthParticle , BASE >::allocator_type
inherited

Definition at line 816 of file DataVector.h.

◆ base_data_vector

typedef DataVector DataVector< TruthParticle , BASE >::base_data_vector
inherited

Definition at line 853 of file DataVector.h.

◆ base_value_type

typedef TruthParticle DataVector< TruthParticle , BASE >::base_value_type
inherited

The T value used as the template parameter.

Note that this is different from value_type (that's T*).

Definition at line 824 of file DataVector.h.

◆ BaseContainer

typedef BASE::PtrVector DataVector< TruthParticle , BASE >::BaseContainer
inherited

Definition at line 806 of file DataVector.h.

◆ const_iterator

Standard const_iterator.

Definition at line 837 of file DataVector.h.

◆ const_pointer

typedef TruthParticle * const* DataVector< TruthParticle , BASE >::const_pointer
inherited

Definition at line 818 of file DataVector.h.

◆ const_reference

typedef TruthParticle * const& DataVector< TruthParticle , BASE >::const_reference
inherited

Definition at line 812 of file DataVector.h.

◆ const_reverse_iterator

typedef std::reverse_iterator<const_iterator> DataVector< TruthParticle , BASE >::const_reverse_iterator
inherited

Standard const_reverse_iterator.

Definition at line 846 of file DataVector.h.

◆ const_value_type

Definition at line 820 of file DataVector.h.

◆ DataVector_BASE

typedef BASE DataVector< TruthParticle , BASE >::DataVector_BASE
inherited

Definition at line 796 of file DataVector.h.

◆ Deleter

using DataVector< TruthParticle , BASE >::Deleter = typename BASE::Deleter
inherited

Definition at line 856 of file DataVector.h.

◆ difference_type

typedef BASE::difference_type DataVector< TruthParticle , BASE >::difference_type
inherited

Definition at line 814 of file DataVector.h.

◆ DVL_BASE

typedef BASE DataVector< TruthParticle , BASE >::DVL_BASE
inherited

Definition at line 797 of file DataVector.h.

◆ ElementProxy

This type is used to proxy lvalue accesses to DataVector elements, in order to handle ownership.

Definition at line 832 of file DataVector.h.

◆ evtIndex_t

typedef TruthParticle::evtIndex_t TruthParticleContainer::evtIndex_t

◆ iterator

Standard iterator.

Note that lvalue references here will yield an ElementProxy, not a reference.

Definition at line 841 of file DataVector.h.

◆ Map_t

typedef std::unordered_map<long,const TruthParticle*> TruthParticleContainer::Map_t

◆ pointer

typedef TruthParticle ** DataVector< TruthParticle , BASE >::pointer
inherited

Definition at line 817 of file DataVector.h.

◆ PtrVector

typedef BASE::PtrVector DataVector< TruthParticle , BASE >::PtrVector
inherited

This is the type of the underlying std::vector (what stdcont returns).

Definition at line 805 of file DataVector.h.

◆ reference

typedef TruthParticle *& DataVector< TruthParticle , BASE >::reference
inherited

Definition at line 811 of file DataVector.h.

◆ reverse_iterator

typedef std::reverse_iterator<iterator> DataVector< TruthParticle , BASE >::reverse_iterator
inherited

Standard reverse_iterator.

Note that lvalue references here will yield an ElementProxy, not a reference.

Definition at line 851 of file DataVector.h.

◆ self [1/2]

typedef ROOT_SELECTION_NS::DataVector<TruthParticle , DataVector_BASE>::self DataVector< TruthParticle , BASE >::self
privateinherited

Definition at line 2042 of file DataVector.h.

◆ self [2/2]

typedef DataVector< TruthParticle , BASE > DataVector< TruthParticle , BASE >::self
inherited

A helper typedef.

Definition at line 3428 of file DataVector.h.

◆ size_type

typedef BASE::size_type DataVector< TruthParticle , BASE >::size_type
inherited

Definition at line 813 of file DataVector.h.

◆ unique_type

typedef std::unique_ptr<base_value_type> DataVector< TruthParticle , BASE >::unique_type
inherited

Type of a unique_ptr that can be used to insert elements into this container.

Definition at line 828 of file DataVector.h.

◆ value_type

typedef TruthParticle * DataVector< TruthParticle , BASE >::value_type
inherited

Definition at line 815 of file DataVector.h.

Constructor & Destructor Documentation

◆ TruthParticleContainer() [1/2]

TruthParticleContainer::TruthParticleContainer ( )

Default constructor:

Constructors.

Definition at line 22 of file TruthParticleContainer.cxx.

22  :
24  m_genEvent ( ),
25  m_etIsolations( ),
26  m_particles ( )
27 {}

◆ TruthParticleContainer() [2/2]

TruthParticleContainer::TruthParticleContainer ( const SG::OwnershipPolicy  own)

Copy constructor: compiler generated one is good enough.

Assignment operator: compiler generated one is good enough Constructor with parameters: to setup the ownership policy

Definition at line 52 of file TruthParticleContainer.cxx.

52  :
54  m_genEvent ( ),
55  m_etIsolations( ),
56  m_particles ( )
57 {}

◆ ~TruthParticleContainer()

TruthParticleContainer::~TruthParticleContainer ( )
inline

Destructor:

Inline methods:

Definition at line 217 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

218 {}

Member Function Documentation

◆ assign() [1/2]

void DataVector< TruthParticle , BASE >::assign ( InputIterator  first,
InputIterator  last 
)
inherited

Assign from iterators.

Parameters
firstThe start of the range to put in the container.
lastThe end of the range to put in the container.

Any existing owned elements will be released. The DataVector's ownership policy determines whether it will take ownership of the new elements.

◆ assign() [2/2]

void DataVector< TruthParticle , BASE >::assign ( std::initializer_list< value_type l)
inherited
Parameters
lAn initializer list.

Any existing owned elements will be released. The DataVector's ownership policy determines whether it will take ownership of the new elements.

◆ assignBaseElement()

void DataVector< TruthParticle , BASE >::assignBaseElement ( typename BaseContainer::iterator  pos,
typename BaseContainer::value_type  newElem 
)
privateinherited

Handle element assignment from a base pointer.

Parameters
posPosition in the container to assign.
newElemThe new element to assign.

The old element is freed if this container owns elements. Auxiliary data are copied if appropriate.

◆ assignElement() [1/2]

void DataVector< TruthParticle , BASE >::assignElement ( typename BaseContainer::iterator  pos,
std::unique_ptr< base_value_type newElem 
)
privateinherited

Handle element assignment.

Parameters
posPosition in the container to assign.
newElemThe new element to assign.

The container must own its elements. Auxiliary data are copied if appropriate.

◆ assignElement() [2/2]

void DataVector< TruthParticle , BASE >::assignElement ( typename BaseContainer::iterator  pos,
value_type  newElem 
)
privateinherited

Handle element assignment.

Parameters
posPosition in the container to assign.
newElemThe new element to assign.

The old element is freed if this container owns elements. Auxiliary data are copied if appropriate.

◆ at() [1/2]

ElementProxy DataVector< TruthParticle , BASE >::at ( size_type  n)
inherited

Access an element, as an lvalue.

Parameters
nArray index to access.
Returns
Proxy to the element at n.

Will raise std::out_of_range if the index is out-of-bounds. Note that we return a proxy object rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ at() [2/2]

const TruthParticle * DataVector< TruthParticle , BASE >::at ( size_type  n) const
inherited

Access an element, as an rvalue.

Parameters
nArray index to access.
Returns
The element at n.

Will raise std::out_of_range if the index is out-of-bounds. Note that we return a const T* rather than a reference.

◆ auxbase()

const SG::AuxVectorBase& DataVector< TruthParticle , BASE >::auxbase
inherited

Convert to AuxVectorBase.

Needed to get AuxVectorBase from a ConstDataVector. Present in DataVector as well for consistency. We only really need it in the base class; however, root6 fails constructing a TMethodCall for this if there is virtual derivation. A workaround is to redeclare this in the derived classes too.

◆ back() [1/2]

ElementProxy DataVector< TruthParticle , BASE >::back
inherited

Access the last element in the collection as an lvalue.

Returns
Proxy to the last element in the collection.

No checking is done to ensure that the container is not empty. Note that we return a proxy object rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ back() [2/2]

const TruthParticle * DataVector< TruthParticle , BASE >::back
inherited

Access the last element in the collection as an rvalue.

Returns
The last element in the collection.

No checking is done to ensure that the container is not empty. Note that we return a const T* rather than a reference.

◆ baseOffset()

static int DataVector< TruthParticle , BASE >::baseOffset ( const std::type_info &  ti)
staticinherited

Return the offset of a base DataVector class.

Parameters
tistd::type_info of the desired class.

If ti represents a DataVector base class of this one, then return the offset of that base class. Otherwise, return -1.

This function is here due to limitations of root 6, which can't calculate these offsets correctly from the dictionary if virtual derivation is used.

◆ baseOffset1()

static int DataVector< TruthParticle , BASE >::baseOffset1 ( const char *  p,
const DataVector< TruthParticle > &  dv,
const std::type_info &  ti 
)
staticinherited

Helper for baseOffset.

Parameters
pPointer to the start of the top-level object.
dvReference to the DataVector object.
tistd::type_info of the desired class.

If ti represents a DataVector base class of this one, then return the offset of that base class. Otherwise, return -1.

◆ begin() [1/2]

const_iterator DataVector< TruthParticle , BASE >::begin
noexceptinherited

Return a const_iterator pointing at the beginning of the collection.

Returns
A const_iterator.

Note that dereferencing the iterator will yield a const T* rather than a reference.

◆ begin() [2/2]

iterator DataVector< TruthParticle , BASE >::begin
noexceptinherited

Return an iterator pointing at the beginning of the collection.

Returns
An iterator.

Note that dereferencing the iterator will yield a proxy rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ capacity()

size_type DataVector< TruthParticle , BASE >::capacity
noexceptinherited

Returns the total number of elements that the collection can hold before needing to allocate more memory.

◆ cbegin()

const_iterator DataVector< TruthParticle , BASE >::cbegin
noexceptinherited

Return a const_iterator pointing at the beginning of the collection.

Returns
A const_iterator.

Note that dereferencing the iterator will yield a const T* rather than a reference.

◆ cend()

const_iterator DataVector< TruthParticle , BASE >::cend
noexceptinherited

Return a const_iterator pointing past the end of the collection.

Returns
A const_iterator.

Note that dereferencing the iterator will yield a const T* rather than a reference.

◆ clear() [1/6]

void DataVector< TruthParticle , BASE >::clear
inherited

Erase all the elements in the collection.

Erase all the elements in the collection, and reset the ownership mode.

If the container owns its elements, then the removed elements will be deleted. Any duplicates will be removed in this process, but don't rely on this.

Parameters
ownPolicyThe new ownership policy of the container.
trackIndicesThe index tracking policy.

If the container owns its elements, then the removed elements will be deleted. Any duplicates will be removed in this process, but don't rely on this.

◆ clear() [2/6]

void DataVector< TruthParticle , BASE >::clear
inherited

◆ clear() [3/6]

void DataVector< TruthParticle , BASE >::clear ( SG::OwnershipPolicy  ownPolicy)
inherited

Erase all the elements in the collection, and reset the ownership mode.

Parameters
ownPolicyThe new ownership policy of the container.

If the container owns its elements, then the removed elements will be deleted. Any duplicates will be removed in this process, but don't rely on this.

◆ clear() [4/6]

void DataVector< TruthParticle , BASE >::clear ( SG::OwnershipPolicy  ownPolicy,
SG::IndexTrackingPolicy  trackIndices 
)
inherited

◆ clear() [5/6]

void DataVector< TruthParticle , BASE >::clear ( SG::OwnershipPolicy  ownPolicy,
SG::IndexTrackingPolicy  trackIndices = SG::DEFAULT_TRACK_INDICES 
)
inherited

◆ clear() [6/6]

void DataVector< TruthParticle , BASE >::clear ( std::unique_ptr< Deleter deleter)
inherited

Erase all the elements in the collection, and change how elements are to be deleted.

Parameters
deleterObject to be used to delete object. Passing nullptr will change back to the default.

If the container owns its elements, then the removed elements will be deleted. Any duplicates will be removed in this process, but don't rely on this. After the current elements are deleted, the Deleter object is changed.

◆ clearMostDerived()

void DataVector< TruthParticle , BASE >::clearMostDerived
protectedinherited

Clear m_isMostDerived for this instance and for all bases.

Called from the constructor after setting m_isMostDerived.

◆ crbegin()

const_reverse_iterator DataVector< TruthParticle , BASE >::crbegin
noexceptinherited

Return a const_reverse_iterator pointing past the end of the collection.

Returns
A const_reverse_iterator.

Note that dereferencing the iterator will yield a const T* rather than a reference.

◆ crend()

const_reverse_iterator DataVector< TruthParticle , BASE >::crend
noexceptinherited

Return a const_reverse_iterator pointing at the beginning of the collection.

Returns
A const_reverse_iterator.

Note that dereferencing the iterator will yield a const T* rather than a reference.

◆ do_cast()

static const TruthParticle * DataVector< TruthParticle , BASE >::do_cast ( const typename PtrVector::value_type  p)
staticinherited

Helper to shorten calls to DataModel_detail::DVLCast.

Parameters
pThe value to convert.
Returns
The value as a const T*.

The conversion will be done with static_cast if possible, with dynamic_cast otherwise.

◆ do_cast_nc()

static TruthParticle * DataVector< TruthParticle , BASE >::do_cast_nc ( typename PtrVector::value_type  p)
staticinherited

Helper to shorten calls to DataModel_detail::DVLCast.

Parameters
pThe value to convert.
Returns
The value as a T*.

The conversion will be done with static_cast if possible, with dynamic_cast otherwise.

◆ dump()

std::ostream & TruthParticleContainer::dump ( std::ostream &  out = std::cout) const
inline

Dump the content of the TruthParticleContainer.

Definition at line 221 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

222 {
223  if ( m_genEvent.isValid() ) {
225  }
226  return out;
227 }

◆ dv_typeid()

virtual const std::type_info& DataVector< TruthParticle , BASE >::dv_typeid
privatevirtualinherited

Find the most-derived DataVector class in the hierarchy.

Returns
The type_info for the class for which this method gets run.

This is used to generate a nice error message when the most-derived check for insertions fails. Every DataVector defines this virtual method, so when it's called, the one corresponding to the most-derived DataVector gets run.

◆ dvlinfo()

static const DataModel_detail::DVLInfoBase& DataVector< TruthParticle , BASE >::dvlinfo
staticinherited

Return the DV/DL info struct for this class.

This can be used to make sure that it's instantiated.

◆ dvlinfo_v()

virtual const DataModel_detail::DVLInfoBase& DataVector< TruthParticle , BASE >::dvlinfo_v
virtualinherited

Return the DV/DL info struct for this class.

This can be used to make sure that it's instantiated.

◆ emplace()

iterator DataVector< TruthParticle , BASE >::emplace ( iterator  position,
value_type  pElem 
)
inherited

Add a new element to the collection.

Parameters
positionIterator before which the element will be added.
pElemThe element to add to the collection.
Returns
An iterator that points to the inserted data.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

For DataVector, this is just the same as insert. It's included just for interface compatibility with std::vector.

◆ emplace_back()

value_type DataVector< TruthParticle , BASE >::emplace_back ( value_type  pElem)
inherited

Add an element to the end of the collection.

Parameters
pElemThe element to add to the collection.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

For DataVector, this is like the same as push_back, and it returns the pushed element. It's included just for interface compatibility with std::vector.

◆ empty()

bool DataVector< TruthParticle , BASE >::empty
noexceptinherited

Returns true if the collection is empty.

◆ end() [1/2]

const_iterator DataVector< TruthParticle , BASE >::end
noexceptinherited

Return a const_iterator pointing past the end of the collection.

Returns
A const_iterator.

Note that dereferencing the iterator will yield a const T* rather than a reference.

◆ end() [2/2]

iterator DataVector< TruthParticle , BASE >::end
noexceptinherited

Return an iterator pointing past the end of the collection.

Returns
An iterator.

Note that dereferencing the iterator will yield a proxy rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ erase() [1/2]

iterator DataVector< TruthParticle , BASE >::erase ( iterator  first,
iterator  last 
)
inherited

Remove a range of elements.

Parameters
firstIterator pointing to the first element to be removed.
lastIterator pointing one past the last element to be removed.
Returns
An iterator pointing to the element pointed to by last prior to erasing (or end()).

If the container owns its elements, then the removed elements will be deleted. Any duplicates will be removed in this process, but don't rely on this.

◆ erase() [2/2]

iterator DataVector< TruthParticle , BASE >::erase ( iterator  position)
inherited

Remove element at a given position.

Parameters
positionIterator pointing to the element to be removed.
Returns
An iterator pointing to the next element (or end()).

If the container owns its elements, then the pointed-to element will be deleted.

◆ etIsol()

double TruthParticleContainer::etIsol ( const int  barcode,
const TruthParticleParameters::ConeSize  coneIdx 
) const
inline

Return the Et isolation for a given particle and a given cone size.

Definition at line 281 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

283 {
284  return hasEtIsol( barcode )
285  ? (*m_etIsolations)->etIsol(barcode, idx)
286  : -999.;
287 }

◆ etIsolations()

const TruthEtIsolations::EtIsol_t * TruthParticleContainer::etIsolations ( const int  barcode) const
inline

return the container of Truth Et isolations for a given TruthParticle (or a HepMC::GenParticle)

Definition at line 267 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

268 {
269  return hasEtIsol( barcode )
270  ? (*m_etIsolations)->etIsolations(barcode)
271  : 0;
272 }

◆ etIsolationsLink()

const ElementLink< TruthEtIsolationsContainer > & TruthParticleContainer::etIsolationsLink ( ) const
inline

return the link to truth Et isolations.

Definition at line 275 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

276 {
277  return m_etIsolations;
278 }

◆ front() [1/2]

ElementProxy DataVector< TruthParticle , BASE >::front
inherited

Access the first element in the collection as an lvalue.

Returns
Proxy to the first element in the collection.

No checking is done to ensure that the container is not empty. Note that we return a proxy object rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ front() [2/2]

const TruthParticle * DataVector< TruthParticle , BASE >::front
inherited

Access the first element in the collection as an rvalue.

Returns
The first element in the collection.

No checking is done to ensure that the container is not empty. Note that we return a const T* rather than a reference.

◆ genEvent()

const HepMC::GenEvent * TruthParticleContainer::genEvent ( ) const
inline

Retrieve the HepMC::GenEvent this TruthParticleContainer is proxying.

Definition at line 230 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

231 {
232  return m_genEvent.isValid() ? (*m_genEvent) : 0;
233 }

◆ genEventIdx()

std::size_t TruthParticleContainer::genEventIdx ( ) const
inline

Retrieve the index (within a McEventCollection) of the HepMC::GenEvent this TruthParticleContainer is proxying.

Definition at line 243 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

244 {
245  return m_genEvent.index();
246 }

◆ genEventLink()

const ElementLink< McEventCollection > & TruthParticleContainer::genEventLink ( ) const
inline

Retrieve the HepMC::GenEvent this TruthParticleContainer is proxying, as a link.

Definition at line 237 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

238 {
239  return m_genEvent;
240 }

◆ genEventName()

const std::string & TruthParticleContainer::genEventName ( ) const
inline

Retrieve the name (StoreGate location) of the HepMC::GenEvent this TruthParticleContainer is proxying.

Definition at line 249 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

250 {
251  return m_genEvent.dataID();
252 }

◆ get()

const TruthParticle * DataVector< TruthParticle , BASE >::get ( size_type  n) const
inherited

Access an element, as an rvalue.

Parameters
nArray index to access.
Returns
The element at n.

This is a synonym for operator[] const, to be used when calling from root (where we can't readily call just the const version of a method).

◆ hasEtIsol() [1/2]

bool TruthParticleContainer::hasEtIsol ( ) const
inline

tell if this TruthParticleContainer has been registered with a TruthEtIsolations container

Definition at line 255 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

256 {
257  return m_etIsolations.isValid();
258 }

◆ hasEtIsol() [2/2]

bool TruthParticleContainer::hasEtIsol ( const int  barcode) const
inline

tell if a TruthParticle (or a HepMC::GenParticle) has Et isolations data associated to it.

Definition at line 261 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

262 {
263  return hasEtIsol() && (*m_etIsolations)->hasEtIsol( barcode );
264 }

◆ insert() [1/5]

void DataVector< TruthParticle , BASE >::insert ( iterator  position,
InputIterator  first,
InputIterator  last 
)
inherited

Add a group of new elements to the collection.

Parameters
positionIterator before which the element will be added.
firstThe start of the range to put in the container.
lastThe end of the range to put in the container.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

This overload is for the case where the iterator value type is convertible to T*.

◆ insert() [2/5]

void DataVector< TruthParticle , BASE >::insert ( iterator  position,
InputIterator  first,
InputIterator  last 
)
inherited

Add a group of new elements to the collection.

Parameters
positionIterator before which the element will be added.
firstThe start of the range to put in the container.
lastThe end of the range to put in the container.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

This overload is for the case where the iterator value type is convertible to unique_ptr<T>.

◆ insert() [3/5]

void DataVector< TruthParticle , BASE >::insert ( iterator  position,
std::initializer_list< value_type l 
)
inherited

Add a group of new elements to the collection.

Parameters
positionIterator before which the element will be added.
lAn initializer list.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ insert() [4/5]

iterator DataVector< TruthParticle , BASE >::insert ( iterator  position,
std::unique_ptr< base_value_type pElem 
)
inherited

Add a new element to the collection.

Parameters
positionIterator before which the element will be added.
pElemThe element to add to the collection.
Returns
An iterator that points to the inserted data.

The container must be an owning container.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ insert() [5/5]

iterator DataVector< TruthParticle , BASE >::insert ( iterator  position,
value_type  pElem 
)
inherited

Add a new element to the collection.

Parameters
positionIterator before which the element will be added.
pElemThe element to add to the collection.
Returns
An iterator that points to the inserted data.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ insertMove()

void DataVector< TruthParticle , BASE >::insertMove ( iterator  position,
DataVector< TruthParticle > &  other 
)
inherited

Insert the contents of another DataVector, with auxiliary data copied via move semantics.

Parameters
positionIterator before which the new elements will be added.
otherThe vector to add.

The ownership mode of this vector must be the same as other; otherwise, an exception will be thrown.

If both vectors are view vectors, then this is the same as insert (position, other.begin(), other.end()) .

Otherwise, the elements from other will be inserted into this vector. This vector will take ownership of the elements, and the ownership mode of other will be changed to VIEW_ELEMENTS. Auxiliary data for these elements will be transferred, using move semantics if possible. (Thus, the auxiliary store for other may be modified and must not be locked.) Finally, the auxiliary store pointer for other will be cleared (but the store itself will not be deleted since it's not owned by the vector).

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ iter_swap()

static void DataVector< TruthParticle , BASE >::iter_swap ( iterator  a,
iterator  b 
)
staticinherited

Swap the referents of two DataVector iterators.

Parameters
aThe first iterator for the swap.
bThe second iterator for the swap.

◆ max_size()

size_type DataVector< TruthParticle , BASE >::max_size
noexceptinherited

Returns the size() of the largest possible collection.

◆ operator[]() [1/2]

ElementProxy DataVector< TruthParticle , BASE >::operator[] ( size_type  n)
inherited

Access an element, as an lvalue.

Parameters
nArray index to access.
Returns
Proxy to the element at n.

No bounds checking is done. Note that we return a proxy object rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ operator[]() [2/2]

const TruthParticle * DataVector< TruthParticle , BASE >::operator[] ( size_type  n) const
inherited

Access an element, as an rvalue.

Parameters
nArray index to access.
Returns
The element at n.

No bounds checking is done. Note that we return a const T* rather than a reference.

◆ ownPolicy()

SG::OwnershipPolicy DataVector< TruthParticle , BASE >::ownPolicy
inherited

Return the ownership policy setting for this container.

◆ pop_back() [1/2]

void DataVector< TruthParticle , BASE >::pop_back
inherited

Remove the last element from the collection.

If the container owns its elements, then the removed element will be deleted.

◆ pop_back() [2/2]

void DataVector< TruthParticle , BASE >::pop_back
inherited

◆ push_back() [1/2]

value_type DataVector< TruthParticle , BASE >::push_back ( std::unique_ptr< base_value_type pElem)
inherited

Add an element to the end of the collection.

Parameters
pElemThe element to add to the collection.

The container must be an owning container.

Note: this method may only be called using the most derived DataVector in the hierarchy.

Returns the pushed pointer.

◆ push_back() [2/2]

value_type DataVector< TruthParticle , BASE >::push_back ( value_type  pElem)
inherited

Add an element to the end of the collection.

Parameters
pElemThe element to add to the collection.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

Returns the pushed pointer.

◆ rbegin() [1/2]

const_reverse_iterator DataVector< TruthParticle , BASE >::rbegin
noexceptinherited

Return a const_reverse_iterator pointing past the end of the collection.

Returns
A const_reverse_iterator.

Note that dereferencing the iterator will yield a const T* rather than a reference.

◆ rbegin() [2/2]

reverse_iterator DataVector< TruthParticle , BASE >::rbegin
noexceptinherited

Return a reverse_iterator pointing past the end of the collection.

Returns
A reverse_iterator.

Note that dereferencing the iterator will yield a proxy rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ rend() [1/2]

const_reverse_iterator DataVector< TruthParticle , BASE >::rend
noexceptinherited

Return a const_reverse_iterator pointing at the beginning of the collection.

Returns
A const_reverse_iterator.

Note that dereferencing the iterator will yield a const T* rather than a reference.

◆ rend() [2/2]

reverse_iterator DataVector< TruthParticle , BASE >::rend
noexceptinherited

Return a reverse_iterator pointing at the beginning of the collection.

Returns
A reverse_iterator.

Note that dereferencing the iterator will yield a proxy rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ reserve()

void DataVector< TruthParticle , BASE >::reserve ( size_type  n)
inherited

Attempt to preallocate enough memory for a specified number of elements.

Parameters
nNumber of elements required.

◆ resize() [1/2]

void DataVector< TruthParticle , BASE >::resize ( size_type  sz)
inherited

Resizes the collection to the specified number of elements.

Parameters
szThe new size of the collection.

Note that this function differs from the standard in that it does not allow specifying the value of any inserted elements. They will always be 0.

If the container is shrunk, elements will be deleted as with erase().

◆ resize() [2/2]

void DataVector< TruthParticle , BASE >::resize ( size_type  sz)
inherited

◆ resortAux()

void DataVector< TruthParticle , BASE >::resortAux ( iterator  beg,
iterator  end 
)
inherited

Reset indices / reorder aux data after elements have been permuted.

Parameters
begStart of the range of elements to process.
endEnd of the range of elements to process.

Call this after some operation that has permuted the elements in the container (such as sort). The index information in the elements will be used to permute all auxiliary data in the same way. Finally, all the indices will be reset in the correct order.

◆ setEtIsolations() [1/2]

void TruthParticleContainer::setEtIsolations ( const ElementLink< TruthEtIsolationsContainer > &  etIsolations)
inline

Setup the persistent pointer toward the TruthEtIsolations.

Definition at line 307 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

308 {
310 }

◆ setEtIsolations() [2/2]

void TruthParticleContainer::setEtIsolations ( const TruthEtIsolationsContainer etIsolations,
const std::size_t  etIsolationsIdx,
IProxyDict sg = nullptr 
)
inline

Setup the persistent pointer toward the TruthEtIsolations.

Definition at line 313 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

316 {
317  if ( 0 != etIsolations && etIsolations->size() > etIsolationsIdx ) {
318  m_etIsolations.toIndexedElement( *etIsolations, etIsolationsIdx, sg );
319  }
320 }

◆ setGenEvent() [1/2]

void TruthParticleContainer::setGenEvent ( const ElementLink< McEventCollection > &  genEvent)
inline

Setup the persistent pointer toward the HepMC::GenEvent this TruthParticleContainer is proxying.

Definition at line 290 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

291 {
293  m_particles.clear();
294 }

◆ setGenEvent() [2/2]

void TruthParticleContainer::setGenEvent ( const McEventCollection mcColl,
const std::size_t  genEventIdx,
IProxyDict sg = nullptr 
)
inline

Setup the persistent pointer toward the HepMC::GenEvent this TruthParticleContainer is proxying.

Definition at line 297 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

300 {
301  if ( 0 != mcColl && mcColl->size() > genEvtIdx ) {
302  m_genEvent.toIndexedElement( *mcColl, genEvtIdx, sg );
303  }
304 }

◆ setMostDerived()

virtual void DataVector< TruthParticle , BASE >::setMostDerived
protectedvirtualinherited

Set m_isMostDerived for this instance and clear it for all bases.

Called from testInsert if the test fails. The flag may not have been set if this container was made via copy construction, so set it appropriately now so we can test again.

◆ setParticles()

void TruthParticleContainer::setParticles ( const Map_t parts)
inline

Setup the dictionary of barcodes-to-TruthParticle.

Definition at line 323 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

324 {
326 }

◆ shift()

void DataVector< TruthParticle , BASE >::shift ( size_t  pos,
ptrdiff_t  offs 
)
privateinherited

Shift the auxiliary elements of the container.

Parameters
posThe starting index for the shift.
offsThe (signed) amount of the shift.

The elements in the container should have already been shifted; this operation will then adjust the element indices and also shift the elements in the vectors for all aux data items. offs may be either positive or negative.

If offs is positive, then the container is growing. The container size should be increased by offs, the element at pos moved to pos + offs, and similarly for following elements. The elements between pos and pos + offs should be default-initialized.

If offs is negative, then the container is shrinking. The element at pos should be moved to pos + offs, and similarly for following elements. The container should then be shrunk by -offs elements (running destructors as appropriate).

◆ shrink_to_fit()

void DataVector< TruthParticle , BASE >::shrink_to_fit
inherited

◆ size()

size_type DataVector< TruthParticle , BASE >::size
noexceptinherited

Returns the number of elements in the collection.

Could in principle be inherited from the base class, but redeclared in the derived class to avoid root6 bugs.

◆ sort() [1/2]

void DataVector< TruthParticle , BASE >::sort
inherited

Sort the container.

This just sorts by pointer value, so it's probably not very useful.

◆ sort() [2/2]

void DataVector< TruthParticle , BASE >::sort ( COMPARE  comp)
inherited

Sort the container with a user-specified comparison operator.

Parameters
compFunctional to compare two values.

◆ stdcont()

const PtrVector & DataVector< TruthParticle , BASE >::stdcont
inherited

Return the underlying std::vector of the container.

Returns
Reference to the std::vector actually holding the collection.

Note that DataVector<T>::stdcont does not necessarily return a std::vector<T*> if DataVector inheritance is being used.

◆ swap()

void DataVector< TruthParticle , BASE >::swap ( DataVector< TruthParticle > &  rhs)
inherited

Swap this collection with another.

Parameters
rhsThe collection with which to swap.

Ownership is swapped along with the collection content.

Note: this method may only be called using the most-derived DataVector in the hierarchy. The rhs must also be referenced using the most-derived DataVector.

◆ swapElement() [1/4]

void DataVector< TruthParticle , BASE >::swapElement ( iterator  pos,
std::unique_ptr< base_value_type newElem,
std::unique_ptr< base_value_type > &  oldElem 
)
inherited

Swap one element out of the container.

Parameters
posThe element in the container to swap.
newElemNew element to put in the container. May be 0.
oldElemReference to receive the element removed from the container.

Reference oldElem is initialized with element pos of the collection (no bounds checking). Then element index is set to newElem.

The collection must own its elements to use its interface. The collection will take ownership of newElem and will return ownership of oldElem.

Note: this method may only be called using the most derived DataList in the hierarchy.

◆ swapElement() [2/4]

void DataVector< TruthParticle , BASE >::swapElement ( iterator  pos,
value_type  newElem,
reference  oldElem 
)
inherited

Swap one element out of the container.

Parameters
posThe element in the container to swap.
newElemNew element to put in the container. May be 0.
oldElemReference to receive the element removed from the container.

Reference oldElem is initialized with element pos of the collection (no bounds checking). Then element index is set to newElem. If the collection owns its elements, then it will take ownership of newElem and release (without deleting) the element returned through oldElem.

Note: this method may only be called using the most derived DataList in the hierarchy.

◆ swapElement() [3/4]

void DataVector< TruthParticle , BASE >::swapElement ( size_type  index,
std::unique_ptr< base_value_type newElem,
std::unique_ptr< base_value_type > &  oldElem 
)
inherited

Swap one element out of the container.

Parameters
indexIndex of the element in the container to swap.
newElemNew element to put in the container. May be 0.
oldElemReference to receive the element removed from the container.

Reference oldElem is initialized with element index of the collection (no bounds checking). Then element index is set to newElem.

The collection must own its elements to use its interface. The collection will take ownership of newElem and will return ownership of oldElem.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ swapElement() [4/4]

void DataVector< TruthParticle , BASE >::swapElement ( size_type  index,
value_type  newElem,
reference  oldElem 
)
inherited

Swap one element out of the container.

Parameters
indexIndex of the element in the container to swap.
newElemNew element to put in the container. May be 0.
oldElemReference to receive the element removed from the container.

Reference oldElem is initialized with element index of the collection (no bounds checking). Then element index is set to newElem. If the collection owns its elements, then it will take ownership of newElem and release (without deleting) the element returned through oldElem.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ testInsert()

void DataVector< TruthParticle , BASE >::testInsert ( const char *  op)
inherited

Test if we can insert; raise an exception if not.

Parameters
opDescription of the attempted operation.

In order to maintain type-safety, we can only allow insertions using the most-derived instance of DataVector. This checks this by testing the m_isMostDerived, which is set by the constructors to true only for the most-derived instance. If the test fails, we call to potentially out-of-line code to continue.

◆ testInsertOol()

void DataVector< TruthParticle , BASE >::testInsertOol ( const char *  op)
inherited

Test if we can insert; raise an exception if not.

Parameters
opDescription of the attempted operation.

This continues the test of testInsert. There is one case where m_isMostDerived may not be set correctly. If this container was made via copy construction, then all the m_isMostDerived flags will be false. So we call setMostDerived to set the flags correctly and test again. If the test fails again, then we raise an exception.

◆ truthParticle()

const TruthParticle * TruthParticleContainer::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

Const methods:

Definition at line 64 of file TruthParticleContainer.cxx.

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 }

◆ truthParticleIdx()

std::size_t TruthParticleContainer::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 return TruthParticleContainer::NoIdx if no such TruthParticle exists

Definition at line 75 of file TruthParticleContainer.cxx.

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 }

Friends And Related Function Documentation

◆ TruthParticleCnvTool

friend class TruthParticleCnvTool
friend

Member Data Documentation

◆ has_virtual

const bool DataVector< TruthParticle , BASE >::has_virtual
staticinherited

This is true for any DataVector class if we need to use virtual derivation to get to the base DataVector class.

Definition at line 801 of file DataVector.h.

◆ m_deleter

ROOT_SELECTION_NS::MemberAttributes< kTransient > DataVector< TruthParticle , BASE >::m_deleter
inherited

Definition at line 3436 of file DataVector.h.

◆ m_etIsolations

ElementLink<TruthEtIsolationsContainer> TruthParticleContainer::m_etIsolations
protected

Persistent pointer to the TruthEtIsolations container, holding Et isolations for TruthParticle or HepMC::GenParticle.

Note that a TruthParticleContainer is not required to always have such a valid link.

Definition at line 200 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

◆ m_genEvent

ElementLink<McEventCollection> TruthParticleContainer::m_genEvent
protected

Persistent pointer to the HepMC::GenEvent we are proxying.

Definition at line 193 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

◆ m_isMostDerived [1/2]

SG::IsMostDerivedFlag DataVector< TruthParticle , BASE >::m_isMostDerived
privateinherited

This flag is true if this DV instance is the most-derived one.

We set this to true in the top-level constructor; the constructor then calls clearMostDerived on the base classes.

Definition at line 2038 of file DataVector.h.

◆ m_isMostDerived [2/2]

ROOT_SELECTION_NS::MemberAttributes< kTransient > DataVector< TruthParticle , BASE >::m_isMostDerived
inherited

Automatically generate dictionary for contained vector.

Declare the automatically created variable transient

Definition at line 3435 of file DataVector.h.

◆ m_ownPolicy

ROOT_SELECTION_NS::MemberAttributes< kTransient > DataVector< TruthParticle , BASE >::m_ownPolicy
inherited

We do not want to save this.

The P->T converter should decide the ownership mode.

Definition at line 3440 of file DataVector.h.

◆ m_particles

Map_t TruthParticleContainer::m_particles
protected

Dictionary to ease the extraction of a TruthParticle (contained by this collection) from the HepMC::GenParticle barcode.

Definition at line 205 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h.

◆ must_own

constexpr bool DataVector< TruthParticle , BASE >::must_own
staticconstexprinherited

If true, then this type must own its contents.

Definition at line 859 of file DataVector.h.

◆ NoIdx

const std::size_t TruthParticleContainer::NoIdx = static_cast<std::size_t>(-1)
static

The documentation for this class was generated from the following files:
TruthParticleContainer::m_particles
Map_t m_particles
Dictionary to ease the extraction of a TruthParticle (contained by this collection) from the HepMC::G...
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:205
TruthParticleContainer::m_genEvent
ElementLink< McEventCollection > m_genEvent
Persistent pointer to the HepMC::GenEvent we are proxying.
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:193
TruthParticleContainer::m_etIsolations
ElementLink< TruthEtIsolationsContainer > m_etIsolations
Persistent pointer to the TruthEtIsolations container, holding Et isolations for TruthParticle or Hep...
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:200
TruthParticleContainer::genEventIdx
std::size_t genEventIdx() const
Retrieve the index (within a McEventCollection) of the HepMC::GenEvent this TruthParticleContainer is...
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:243
HepMC::Print::line
void line(std::ostream &os, const GenEvent &e)
Definition: GenEvent.h:554
TruthParticleContainer::genEvent
const HepMC::GenEvent * genEvent() const
Retrieve the HepMC::GenEvent this TruthParticleContainer is proxying.
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:230
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
TruthParticleContainer::NoIdx
static const std::size_t NoIdx
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:51
DataVector< TruthParticle >
test_pythinning.out
out
Definition: test_pythinning.py:94
TruthParticleContainer::etIsolations
const TruthEtIsolations::EtIsol_t * etIsolations(const int barcode) const
return the container of Truth Et isolations for a given TruthParticle (or a HepMC::GenParticle)
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:267
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TruthParticleContainer::hasEtIsol
bool hasEtIsol() const
tell if this TruthParticleContainer has been registered with a TruthEtIsolations container
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:255