ATLAS Offline Software
Loading...
Searching...
No Matches
JetCollection Class Reference

#include <JetCollection.h>

Inheritance diagram for JetCollection:
Collaboration diagram for JetCollection:

Public Types

enum  OrderedVar {
  ByEtDown = 0 , ByEtUp = 1 , ByPtDown = 2 , ByPtUp = 3 ,
  ByEDown = 4 , ByEUp = 5 , ByEtaUp = 6 , ByEtaDown = 7 ,
  ByAbsEtaUp = 8 , ByAbsEtaDown = 9 , ByPhiDown = 10 , ByPhiUp = 11 ,
  InEtaPhiDown = 12 , InEtaPhiUp = 13 , Random = 14
}
typedef DataVector< Jet >::iterator iterator
typedef typename DataVectorBase< Jet >::Base DataVector_BASE
typedef typename DataVectorBase< Jet >::Base DVL_BASE
typedef typename DataVectorBase< Jet >::Base::PtrVector PtrVector
 This is the type of the underlying std::vector (what stdcont returns).
typedef typename DataVectorBase< Jet >::Base::PtrVector BaseContainer
typedef Jet *& reference
typedef Jet *const & const_reference
typedef typename DataVectorBase< Jet >::Base::size_type size_type
typedef typename DataVectorBase< Jet >::Base::difference_type difference_type
typedef Jetvalue_type
typedef typename DataVectorBase< Jet >::Base::allocator_type allocator_type
typedef Jet ** pointer
typedef Jet *const * const_pointer
typedef const Jetconst_value_type
typedef Jet base_value_type
 The T value used as the template parameter.
typedef std::unique_ptr< base_value_typeunique_type
 Type of a unique_ptr that can be used to insert elements into this container.
typedef DataModel_detail::ElementProxy< DataVectorElementProxy
 This type is used to proxy lvalue accesses to DataVector elements, in order to handle ownership.
typedef DataModel_detail::const_iterator< DataVectorconst_iterator
 Standard const_iterator.
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 Standard const_reverse_iterator.
typedef std::reverse_iterator< iteratorreverse_iterator
 Standard reverse_iterator.
typedef DataVector base_data_vector
using Deleter

Public Member Functions

 JetCollection (SG::OwnershipPolicy own=SG::OWN_ELEMENTS)
virtual ~JetCollection ()
bool isOrdered (JetCollection::OrderedVar ordering=JetCollection::ByEtDown) const
void setOrdered (JetCollection::OrderedVar ordered)
JetCollection::OrderedVar ordered () const
void push_back (Jet *j)
iterator insert (iterator position, Jet *j)
template<class InputIterator>
void insert (iterator position, InputIterator first, InputIterator last)
void clear ()
void clear (SG::OwnershipPolicy ownPolicy)
void setAuthor (const std::string &author)
std::string author () const
const JetMomentMapgetMomentMap () const
std::string getMomentMapName () const
JetKeyDescriptorInstancekeyDesc () const
const fastjet::ClusterSequence * fastjetClustSeq () const
 Access to the internal fastjet object. CAN RETURN NULL, see the description of m_pseudoJet.
void setFastjetClustSeq (const fastjet::ClusterSequence *cs)
Constructors, destructors, assignment.
void assign (InputIterator first, InputIterator last)
 Assign from iterators.
Size and capacity.
size_type size () const noexcept
 Returns the number of elements in the collection.
void resize (size_type sz)
 Resizes the collection to the specified number of elements.
void reserve (size_type n)
 Attempt to preallocate enough memory for a specified number of elements.
Element access.

Change the vector capacity to match the current size.

Note: this does not affect auxiliary data.

const Jetoperator[] (size_type n) const
 Access an element, as an rvalue.
const Jetget (size_type n) const
 Access an element, as an rvalue.
const Jetat (size_type n) const
 Access an element, as an rvalue.
const Jetfront () const
 Access the first element in the collection as an rvalue.
const Jetback () const
 Access the last element in the collection as an rvalue.
Iterator creation.
const_iterator begin () const noexcept
 Return a const_iterator pointing at the beginning of the collection.
const_iterator end () const noexcept
 Return a const_iterator pointing past the end of the collection.
const_reverse_iterator rbegin () const noexcept
 Return a const_reverse_iterator pointing past the end of the collection.
const_reverse_iterator rend () const noexcept
 Return a const_reverse_iterator pointing at the beginning of the collection.
const_iterator cbegin () const noexcept
 Return a const_iterator pointing at the beginning of the collection.
const_iterator cend () const noexcept
 Return a const_iterator pointing past the end of the collection.
const_reverse_iterator crbegin () const noexcept
 Return a const_reverse_iterator pointing past the end of the collection.
const_reverse_iterator crend () const noexcept
 Return a const_reverse_iterator pointing at the beginning of the collection.
Insertion operations.
value_type push_back (value_type pElem)
 Add an element to the end of the collection.
size_type push_new (size_type n, F alloc)
 Create and add a number of new elements to the end of the container.
value_type emplace_back (value_type pElem)
 Add an element to the end of the collection.
iterator insert (iterator position, value_type pElem)
 Add a new element to the collection.
iterator emplace (iterator position, value_type pElem)
 Add a new element to the collection.
void insertMove (iterator position, DataVector &other)
 Insert the contents of another DataVector, with auxiliary data copied via move semantics.
Erasure operations.
iterator erase (iterator position)
 Remove element at a given position.
void pop_back ()
 Remove the last element from the collection.

Public Attributes

DataLink< JetKeyDescriptorm_keyStore
 link to the JetKeyDescriptor is mandatory for persistency. Access done through the JetKeyDescriptorInstance

Static Public Attributes

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.
static constexpr bool must_own
 If true, then this type must own its contents.

Protected Member Functions

size_t getNextId ()
void acquireJet (Jet *j)
void recordedInSG (std::string key)
void resetJetId (std::size_t)

Protected Attributes

DataLink< JetMomentMapm_momentMapLink
size_t m_jetAuthor
 the author of this jetcollection.
size_t m_nextId
 the next free identifier for jets inside this collection
JetKeyDescriptorInstance m_keyDescInstance
 This JetKeyDescriptorInstance points by default to the global JetKeyDescriptorInstance's store. It is redirected to the key store from the input file when read out. This allows 2 events to be read at the same time.
bool m_ownMap
 false if the map is recorded in SG
const fastjet::ClusterSequence * m_fastjetClustSeq
 Pointer to the fastjet object this jet is build from.

Private Attributes

OrderedVar m_ordered

Friends

class JetCollectionCnv_p6

Internal operations.

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

Swap and sort.

void swap (DataVector &rhs)
 Swap this collection with another.
void sort ()
 Sort the container.
static void iter_swap (iterator a, iterator b)
 Swap the referents of two DataVector iterators.

Non-standard operations.

void swapElement (size_type index, value_type newElem, reference oldElem)
 Swap one element out of the container.
virtual const DataModel_detail::DVLInfoBasedvlinfo_v () const override
 Return the DV/DL info struct for this class.
const SG::AuxVectorBaseauxbase () const
 Convert to AuxVectorBase.
size_type max_size () const noexcept
 Returns the size() of the largest possible collection.
size_type capacity () const noexcept
 Returns the total number of elements that the collection can hold before needing to allocate more memory.
bool empty () const noexcept
 Returns true if the collection is empty.
void shrink_to_fit ()
const PtrVectorstdcont () const
 Return the underlying std::vector of the container.
SG::OwnershipPolicy ownPolicy () const
 Return the ownership policy setting for this container.
static const DataModel_detail::DVLInfoBasedvlinfo ()
 Return the DV/DL info struct for this class.
static int baseOffset (const std::type_info &ti)
 Return the offset of a base DataVector class.

Detailed Description

Container for Jets

JetCollection is a DataVector of Jets. It is the main data object and acts as a central point for all jet related software.
It holds a JetMomentMap and JetKeyDescriptorInstance which it serves to the jets it holds.

It redefines the push_back and insert method in order to

  • let the jets know they are owned by a JetCollection
  • perform the related operations (moment map)

It also defines an order enum (OrderedVar), and holds the order status
of the collection (ByEtDown, ByEtUp,etc..)

IMPORTANT* : one should not record this object by using StoreGate::record(), but rather use the JetCollectionHelper::record(). The reason is this function performs all the necessary operations needed to deal with the JetMomentMap.

Definition at line 29 of file JetCollection.h.

Member Typedef Documentation

◆ allocator_type

typedef typename DataVectorBase<Jet>::Base::allocator_type DataVector< Jet, typename DataVectorBase<Jet>::Base >::allocator_type
inherited

Definition at line 817 of file DataVector.h.

◆ base_data_vector

typedef DataVector DataVector< Jet, typename DataVectorBase<Jet>::Base >::base_data_vector
inherited

Definition at line 854 of file DataVector.h.

◆ base_value_type

typedef Jet DataVector< Jet, typename DataVectorBase<Jet>::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 825 of file DataVector.h.

◆ BaseContainer

typedef typename DataVectorBase<Jet>::Base::PtrVector DataVector< Jet, typename DataVectorBase<Jet>::Base >::BaseContainer
inherited

Definition at line 807 of file DataVector.h.

◆ const_iterator

◆ const_pointer

typedef Jet* const* DataVector< Jet, typename DataVectorBase<Jet>::Base >::const_pointer
inherited

Definition at line 819 of file DataVector.h.

◆ const_reference

typedef Jet* const& DataVector< Jet, typename DataVectorBase<Jet>::Base >::const_reference
inherited

Definition at line 813 of file DataVector.h.

◆ const_reverse_iterator

typedef std::reverse_iterator<const_iterator> DataVector< Jet, typename DataVectorBase<Jet>::Base >::const_reverse_iterator
inherited

Standard const_reverse_iterator.

Definition at line 847 of file DataVector.h.

◆ const_value_type

typedef const Jet* DataVector< Jet, typename DataVectorBase<Jet>::Base >::const_value_type
inherited

Definition at line 821 of file DataVector.h.

◆ DataVector_BASE

typedef typename DataVectorBase<Jet>::Base DataVector< Jet, typename DataVectorBase<Jet>::Base >::DataVector_BASE
inherited

Definition at line 797 of file DataVector.h.

◆ Deleter

using DataVector< Jet, typename DataVectorBase<Jet>::Base >::Deleter
inherited

Definition at line 857 of file DataVector.h.

◆ difference_type

typedef typename DataVectorBase<Jet>::Base::difference_type DataVector< Jet, typename DataVectorBase<Jet>::Base >::difference_type
inherited

Definition at line 815 of file DataVector.h.

◆ DVL_BASE

typedef typename DataVectorBase<Jet>::Base DataVector< Jet, typename DataVectorBase<Jet>::Base >::DVL_BASE
inherited

Definition at line 798 of file DataVector.h.

◆ ElementProxy

typedef DataModel_detail::ElementProxy<DataVector> DataVector< Jet, typename DataVectorBase<Jet>::Base >::ElementProxy
inherited

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

Definition at line 833 of file DataVector.h.

◆ iterator

Definition at line 34 of file JetCollection.h.

◆ pointer

typedef Jet** DataVector< Jet, typename DataVectorBase<Jet>::Base >::pointer
inherited

Definition at line 818 of file DataVector.h.

◆ PtrVector

typedef typename DataVectorBase<Jet>::Base::PtrVector DataVector< Jet, typename DataVectorBase<Jet>::Base >::PtrVector
inherited

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

Definition at line 806 of file DataVector.h.

◆ reference

typedef Jet*& DataVector< Jet, typename DataVectorBase<Jet>::Base >::reference
inherited

Definition at line 812 of file DataVector.h.

◆ reverse_iterator

typedef std::reverse_iterator<iterator> DataVector< Jet, typename DataVectorBase<Jet>::Base >::reverse_iterator
inherited

Standard reverse_iterator.

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

Definition at line 852 of file DataVector.h.

◆ self

typedef ROOT::Meta::Selection::DataVector<Jet,DataVector_BASE>::self DataVector< Jet, typename DataVectorBase<Jet>::Base >::self
privateinherited

Definition at line 2063 of file DataVector.h.

◆ size_type

typedef typename DataVectorBase<Jet>::Base::size_type DataVector< Jet, typename DataVectorBase<Jet>::Base >::size_type
inherited

Definition at line 814 of file DataVector.h.

◆ unique_type

typedef std::unique_ptr<base_value_type> DataVector< Jet, typename DataVectorBase<Jet>::Base >::unique_type
inherited

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

Definition at line 829 of file DataVector.h.

◆ value_type

typedef Jet* DataVector< Jet, typename DataVectorBase<Jet>::Base >::value_type
inherited

Definition at line 816 of file DataVector.h.

Member Enumeration Documentation

◆ OrderedVar

Enumerator
ByEtDown 
ByEtUp 
ByPtDown 
ByPtUp 
ByEDown 
ByEUp 
ByEtaUp 
ByEtaDown 
ByAbsEtaUp 
ByAbsEtaDown 
ByPhiDown 
ByPhiUp 
InEtaPhiDown 
InEtaPhiUp 
Random 

Definition at line 35 of file JetCollection.h.

Constructor & Destructor Documentation

◆ JetCollection()

JetCollection::JetCollection ( SG::OwnershipPolicy own = SG::OWN_ELEMENTS)

Definition at line 9 of file JetCollection.cxx.

9 :
10 DataVector<Jet>(own),
14 m_keyDescInstance(false),
15 m_ownMap(false),
16 m_fastjetClustSeq(nullptr)
17{
18 // by default the keyDescInstance points to the global s_instance's stores .
19 // The JetCollection cnv replaces that by the store read from file.
20 if( ! JetKeyDescriptorInstance::instance()->m_ConstStores ) JetKeyDescriptorInstance::instance()->createKeyStore(); // this may happen inside Trigger navigation system
23}
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
size_t m_nextId
the next free identifier for jets inside this collection
OrderedVar m_ordered
const fastjet::ClusterSequence * m_fastjetClustSeq
Pointer to the fastjet object this jet is build from.
bool m_ownMap
false if the map is recorded in SG
JetKeyDescriptorInstance m_keyDescInstance
This JetKeyDescriptorInstance points by default to the global JetKeyDescriptorInstance's store....
size_t m_jetAuthor
the author of this jetcollection.
const JetKeyDescriptor * m_ConstStores
JetKeyDescriptor * m_Stores
static JetKeyDescriptorInstance * instance()
static const size_t s_defaultJetId
static const size_t s_defaultJetAuthor

◆ ~JetCollection()

JetCollection::~JetCollection ( )
virtual

Definition at line 27 of file JetCollection.cxx.

27 {
28
29 //std::cout << " JetCollection deleting " << m_jetAuthor <<std::endl;
30 if(m_ownPolicy == SG::OWN_ELEMENTS){
31 // remove myself from my jets. Otherwise, they might invoke me
32 // in their destructors.
33 iterator it = begin();
34 iterator itE = end();
35 for(;it != itE; ++it){
36 (*it)->m_collection = nullptr;
37 }
38 }
39
40 if( (m_ownMap) && m_momentMapLink.isValid() ) {
41 delete m_momentMapLink.cptr();
42 }
43
44}
const_iterator end() const noexcept
const_iterator begin() const noexcept
DataLink< JetMomentMap > m_momentMapLink
DataVector< Jet >::iterator iterator
@ OWN_ELEMENTS
this data object owns its elements

Member Function Documentation

◆ acquireJet()

void JetCollection::acquireJet ( Jet * j)
protected

Definition at line 108 of file JetCollection.cxx.

108 {
109 // If the jet is orphan, adopt it
110 // this means : acquire its moments if they exist and give it an Id
111 // otherwise, we do nothing.
112
113 if ( j->parentCollection() && (m_ownPolicy == SG::OWN_ELEMENTS )) return ; // this case is very bad anyway, there will be problems, we can't do anything.
114
115 // In the case this collection has no author, simply acquire those from the jet.
117 std::string viewS = "";
118 if( m_ownPolicy == SG::VIEW_ELEMENTS ) viewS ="View"; // We want to distinguish the name from the jet's original collection.
119 m_jetAuthor = keyDesc()->getIndex(JetKeyConstants::InfoCat,j->jetAuthor()+viewS,true); // use the real jetAuthor() (m_jetAuthor index
120 }
121 // std::cout << " acquireJet jid="<<j->id() <<" "<<author()<<std::endl;
122
123 size_t oldId = j->id();
124 if( m_ownPolicy == SG::OWN_ELEMENTS ) j->setJetId( getNextId() );
125 if( oldId != Jet::s_defaultJetId ){
126 // jet might have moments to be tranfered
127 const JetMomentMap *jmap = j->getMomentMap();
128 // The moment map associated to this collection has the same m_ownPolicy,
129 // so the call knows how to deal the moments (i.e. copy or move)
130 if( jmap ){ getMomentMap()->transferRecord( jmap, oldId, j->id() ); }
131
132 }
133 // set myself as this jet parent now (not before !) if needed
134 if( m_ownPolicy == SG::OWN_ELEMENTS ) j->m_collection = this;
135
136}
Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current JetMomentMap
const JetMomentMap * getMomentMap() const
JetKeyDescriptorInstance * keyDesc() const
size_t getIndex(const category_t &cat, const key_t &key, bool createIfMissing=true)
virtual void transferRecord(const JetMapBase< P > *fromMap, size_t oldIndex, size_t newIndex) const
transfer a record from an other map
size_t id() const
Index category for jet shapes.
Definition Jet.cxx:1194
const shape_map_t * getMomentMap(bool addIfMissing) const
Definition Jet.cxx:1164
std::string jetAuthor() const
Author and calibration history are encoded in a simple way inside the jet object.
Definition Jet.cxx:1108
size_t m_jetAuthor
Jet author store.
const JetCollection * parentCollection() const
a pointer to the collection this jet belongs to (can be NULL)
Definition Jet.cxx:1196
void setJetId(size_t id)
Definition Jet.cxx:1200
const JetCollection * m_collection
Shape store link.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
static const key_t InfoCat
Index category for general jet info.

◆ assign()

void DataVector< Jet, typename DataVectorBase<Jet>::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.

◆ assignBaseElement()

void DataVector< Jet, typename DataVectorBase<Jet>::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()

void DataVector< Jet, typename DataVectorBase<Jet>::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()

const Jet * DataVector< Jet, typename DataVectorBase<Jet>::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.

◆ author()

std::string JetCollection::author ( ) const

Definition at line 139 of file JetCollection.cxx.

140{
142}
const key_t & getKey(const category_t &cat, size_t index) const

◆ auxbase()

const SG::AuxVectorBase & DataVector< Jet, typename DataVectorBase<Jet>::Base >::auxbase ( ) const
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()

const Jet * DataVector< Jet, typename DataVectorBase<Jet>::Base >::back ( ) const
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()

int DataVector< Jet, typename DataVectorBase<Jet>::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()

int DataVector< Jet, typename DataVectorBase<Jet>::Base >::baseOffset1 ( const char * p,
const DataVector< Jet > & 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()

const_iterator DataVector< Jet, typename DataVectorBase<Jet>::Base >::begin ( ) const
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.

◆ capacity()

size_type DataVector< Jet, typename DataVectorBase<Jet>::Base >::capacity ( ) const
noexceptinherited

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

◆ cbegin()

const_iterator DataVector< Jet, typename DataVectorBase<Jet>::Base >::cbegin ( ) const
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< Jet, typename DataVectorBase<Jet>::Base >::cend ( ) const
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/2]

void JetCollection::clear ( )

Definition at line 96 of file JetCollection.cxx.

97{
100}
void clear()
Erase all the elements in the collection.

◆ clear() [2/2]

void JetCollection::clear ( SG::OwnershipPolicy ownPolicy)

Definition at line 102 of file JetCollection.cxx.

103{
106}
SG::OwnershipPolicy ownPolicy() const

◆ clearMostDerived()

void DataVector< Jet, typename DataVectorBase<Jet>::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< Jet, typename DataVectorBase<Jet>::Base >::crbegin ( ) const
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< Jet, typename DataVectorBase<Jet>::Base >::crend ( ) const
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()

const Jet * DataVector< Jet, typename DataVectorBase<Jet>::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()

Jet * DataVector< Jet, typename DataVectorBase<Jet>::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.

◆ dv_typeid()

virtual const std::type_info & DataVector< Jet, typename DataVectorBase<Jet>::Base >::dv_typeid ( ) const
overrideprivatevirtualinherited

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()

const DataModel_detail::DVLInfoBase & DataVector< Jet, typename DataVectorBase<Jet>::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< Jet, typename DataVectorBase<Jet>::Base >::dvlinfo_v ( ) const
overridevirtualinherited

Return the DV/DL info struct for this class.

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

◆ emplace()

iterator DataVector< Jet, typename DataVectorBase<Jet>::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< Jet, typename DataVectorBase<Jet>::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< Jet, typename DataVectorBase<Jet>::Base >::empty ( ) const
nodiscardnoexceptinherited

Returns true if the collection is empty.

◆ end()

const_iterator DataVector< Jet, typename DataVectorBase<Jet>::Base >::end ( ) const
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.

◆ erase()

iterator DataVector< Jet, typename DataVectorBase<Jet>::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.

◆ fastjetClustSeq()

const fastjet::ClusterSequence * JetCollection::fastjetClustSeq ( ) const
inline

Access to the internal fastjet object. CAN RETURN NULL, see the description of m_pseudoJet.

Definition at line 143 of file JetCollection.h.

143{return m_fastjetClustSeq;}

◆ front()

const Jet * DataVector< Jet, typename DataVectorBase<Jet>::Base >::front ( ) const
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.

◆ get()

const Jet * DataVector< Jet, typename DataVectorBase<Jet>::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).

◆ getMomentMap()

const JetMomentMap * JetCollection::getMomentMap ( ) const

Definition at line 56 of file JetCollection.cxx.

56 {
57
58 //std::cout << "asking map in "<< author() << std::endl;
59 if ( !m_momentMapLink.isValid() ) {
60 // we first try to retrieve it :
61 std::string mapname = getMomentMapName();
62 m_momentMapLink.toIdentifiedObject ( mapname); // by name, because we don't use DataLink_p2 class yet
63
64 //m_momentMapLink->access(); // this hsould work whe we use DataLink_p2 P class.
65
66 //std::cout << "Datalink invalid set "<< mapname << std::endl;
67 if ( !m_momentMapLink.isValid() ) {
68 //std::cout << "Datalink invalid create map "<< mapname << std::endl;
69 // Nothing available from SG/disk. We create the map
70 JetMomentMap* map = new JetMomentMap();
71 map->m_ownPolicy = m_ownPolicy;
72 m_momentMapLink.toStorableObject( *map );
73 // This means we own it !
74 m_ownMap = true;
75 }
76 }
77
78 return m_momentMapLink.cptr();
79}
std::string getMomentMapName() const
SG::OwnershipPolicy m_ownPolicy
Definition JetMapBase.h:166

◆ getMomentMapName()

std::string JetCollection::getMomentMapName ( ) const

Definition at line 50 of file JetCollection.cxx.

50 {
51 std::string mapname = author();
52 mapname +="MomentMap";
53 return mapname;
54}
std::string author() const

◆ getNextId()

size_t JetCollection::getNextId ( )
protected

Definition at line 81 of file JetCollection.cxx.

81 {
82 return m_nextId++; // this returns m_nextId *then* increments it
83}

◆ insert() [1/3]

iterator DataVector< Jet, typename DataVectorBase<Jet>::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.

◆ insert() [2/3]

template<class InputIterator>
void JetCollection::insert ( iterator position,
InputIterator first,
InputIterator last )

Definition at line 158 of file JetCollection.h.

158 {
159 InputIterator it = first;
160 for(; it != last; ++it) acquireJet(*it);
161 DataVector<Jet>::insert(position,first,last);
162}
iterator insert(iterator position, value_type pElem)
Add a new element to the collection.
void acquireJet(Jet *j)
bool first
Definition DeMoScan.py:534

◆ insert() [3/3]

JetCollection::iterator JetCollection::insert ( JetCollection::iterator position,
Jet * j )

Definition at line 91 of file JetCollection.cxx.

91 {
92 acquireJet(j);
93 return DataVector<Jet>::insert(position,j);
94}

◆ insertMove()

void DataVector< Jet, typename DataVectorBase<Jet>::Base >::insertMove ( iterator position,
DataVector< Jet > & 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.

◆ isOrdered()

bool JetCollection::isOrdered ( JetCollection::OrderedVar ordering = JetCollection::ByEtDown) const
inline

Definition at line 62 of file JetCollection.h.

63 { return ordering == m_ordered; };

◆ iter_swap()

void DataVector< Jet, typename DataVectorBase<Jet>::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.

◆ keyDesc()

JetKeyDescriptorInstance * JetCollection::keyDesc ( ) const

Definition at line 46 of file JetCollection.cxx.

46 {
47 return &m_keyDescInstance;
48}

◆ max_size()

size_type DataVector< Jet, typename DataVectorBase<Jet>::Base >::max_size ( ) const
noexceptinherited

Returns the size() of the largest possible collection.

◆ operator[]()

const Jet * DataVector< Jet, typename DataVectorBase<Jet>::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.

◆ ordered()

JetCollection::OrderedVar JetCollection::ordered ( ) const
inline

Definition at line 68 of file JetCollection.h.

69 { return m_ordered; };

◆ ownPolicy()

SG::OwnershipPolicy DataVector< Jet, typename DataVectorBase<Jet>::Base >::ownPolicy ( ) const
inherited

Return the ownership policy setting for this container.

◆ pop_back()

void DataVector< Jet, typename DataVectorBase<Jet>::Base >::pop_back ( )
inherited

Remove the last element from the collection.

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

◆ push_back() [1/2]

value_type DataVector< Jet, typename DataVectorBase<Jet>::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.

◆ push_back() [2/2]

void JetCollection::push_back ( Jet * j)

Definition at line 85 of file JetCollection.cxx.

85 {
86 acquireJet(j);
88}
value_type push_back(value_type pElem)
Add an element to the end of the collection.

◆ push_new()

size_type DataVector< Jet, typename DataVectorBase<Jet>::Base >::push_new ( size_type n,
F alloc )
inherited

Create and add a number of new elements to the end of the container.

Parameters
nThe number of new elements to add.
allocFunctional to call to allocate a new element to push. Should be callable like T* = alloc(); For example:
dv.push_new (n, [](){ return new Foo; });
Definition FooBar.h:9
It may also be useful to allocate from a DataPool.

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

Returns the original size of the vector.

◆ rbegin()

const_reverse_iterator DataVector< Jet, typename DataVectorBase<Jet>::Base >::rbegin ( ) const
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.

◆ recordedInSG()

void JetCollection::recordedInSG ( std::string key)
protected

Definition at line 147 of file JetCollection.cxx.

147 {
148 //std::cout << "JetCollection Recorded "<< m_momentMapLink.cptr() << std::endl;
149 m_ownMap = false;
150 if( key == author() ){
152 m_momentMapLink.toIdentifiedObject ( key);
153 }else {
154 // this should never happen, so I let the raw std::cout
155 std::cout << " JetCollection ERROR attempt to record in SG with key ="<< key << " while author ="<< author() << " both should be the same."<< std::endl;
156 }
157
158
159 //
160
161}

◆ rend()

const_reverse_iterator DataVector< Jet, typename DataVectorBase<Jet>::Base >::rend ( ) const
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.

◆ reserve()

void DataVector< Jet, typename DataVectorBase<Jet>::Base >::reserve ( size_type n)
inherited

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

Parameters
nNumber of elements required.

◆ resetJetId()

void JetCollection::resetJetId ( std::size_t id_)
protected

Definition at line 163 of file JetCollection.cxx.

163 {
164
165 //make sure the jet belongs to us
166 if (m_ownPolicy == SG::OWN_ELEMENTS) {
167 if ( this->at(id_)->m_collection != this) return;
168 }
169
170 //this allows changing the jet id of a view collection...not ideal
171
172 this->at(id_)->setJetId(id_+1);
173
174}
const Jet * at(size_type n) const

◆ resize()

void DataVector< Jet, typename DataVectorBase<Jet>::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().

◆ resortAux()

void DataVector< Jet, typename DataVectorBase<Jet>::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.

◆ setAuthor()

void JetCollection::setAuthor ( const std::string & author)

Definition at line 143 of file JetCollection.cxx.

◆ setFastjetClustSeq()

void JetCollection::setFastjetClustSeq ( const fastjet::ClusterSequence * cs)
inline

Definition at line 144 of file JetCollection.h.

144{ m_fastjetClustSeq = cs;}

◆ setMostDerived()

virtual void DataVector< Jet, typename DataVectorBase<Jet>::Base >::setMostDerived ( )
overrideprotectedvirtualinherited

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.

◆ setOrdered()

void JetCollection::setOrdered ( JetCollection::OrderedVar ordered)
inline

Definition at line 65 of file JetCollection.h.

66 { m_ordered = ordered; return; };
JetCollection::OrderedVar ordered() const

◆ shift()

void DataVector< Jet, typename DataVectorBase<Jet>::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< Jet, typename DataVectorBase<Jet>::Base >::shrink_to_fit ( )
inherited

◆ size()

size_type DataVector< Jet, typename DataVectorBase<Jet>::Base >::size ( ) const
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()

void DataVector< Jet, typename DataVectorBase<Jet>::Base >::sort ( )
inherited

Sort the container.

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

◆ stdcont()

const PtrVector & DataVector< Jet, typename DataVectorBase<Jet>::Base >::stdcont ( ) const
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< Jet, typename DataVectorBase<Jet>::Base >::swap ( DataVector< Jet > & 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()

void DataVector< Jet, typename DataVectorBase<Jet>::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< Jet, typename DataVectorBase<Jet>::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< Jet, typename DataVectorBase<Jet>::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.

◆ JetCollectionCnv_p6

friend class JetCollectionCnv_p6
friend

Definition at line 105 of file JetCollection.h.

Member Data Documentation

◆ has_virtual

const bool DataVector< Jet, typename DataVectorBase<Jet>::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 802 of file DataVector.h.

◆ m_fastjetClustSeq

const fastjet::ClusterSequence* JetCollection::m_fastjetClustSeq
protected

Pointer to the fastjet object this jet is build from.

WARNING : this pointer is meant to be used in reco flow only. It is transient only, provided only to ease calculation of some jet quantities, and will be invalid for jets read from files.

Definition at line 140 of file JetCollection.h.

◆ m_isMostDerived

SG::IsMostDerivedFlag DataVector< Jet, typename DataVectorBase<Jet>::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 2059 of file DataVector.h.

◆ m_jetAuthor

size_t JetCollection::m_jetAuthor
protected

the author of this jetcollection.

We don't forbid it to be different from the m_jetAuthor of individual Jet

Definition at line 114 of file JetCollection.h.

◆ m_keyDescInstance

JetKeyDescriptorInstance JetCollection::m_keyDescInstance
mutableprotected

This JetKeyDescriptorInstance points by default to the global JetKeyDescriptorInstance's store. It is redirected to the key store from the input file when read out. This allows 2 events to be read at the same time.

Definition at line 126 of file JetCollection.h.

◆ m_keyStore

DataLink<JetKeyDescriptor> JetCollection::m_keyStore

link to the JetKeyDescriptor is mandatory for persistency. Access done through the JetKeyDescriptorInstance

Definition at line 94 of file JetCollection.h.

◆ m_momentMapLink

DataLink<JetMomentMap> JetCollection::m_momentMapLink
mutableprotected

Definition at line 108 of file JetCollection.h.

◆ m_nextId

size_t JetCollection::m_nextId
protected

the next free identifier for jets inside this collection

Definition at line 120 of file JetCollection.h.

◆ m_ordered

OrderedVar JetCollection::m_ordered
private

Definition at line 89 of file JetCollection.h.

◆ m_ownMap

bool JetCollection::m_ownMap
mutableprotected

false if the map is recorded in SG

Definition at line 130 of file JetCollection.h.

◆ must_own

bool DataVector< Jet, typename DataVectorBase<Jet>::Base >::must_own
staticconstexprinherited

If true, then this type must own its contents.

Definition at line 860 of file DataVector.h.


The documentation for this class was generated from the following files: