ATLAS Offline Software
Loading...
Searching...
No Matches
GlobalSim::GlobalLArCellContainer Class Reference

#include <GlobalLArCellContainer.h>

Inheritance diagram for GlobalSim::GlobalLArCellContainer:
Collaboration diagram for GlobalSim::GlobalLArCellContainer:

Classes

struct  StatusFlags
 Helper struct to hold overflow and error flags. More...

Public Types

typedef typename DataVectorBase< GlobalSim::GlobalLArCell >::Base DataVector_BASE
typedef typename DataVectorBase< GlobalSim::GlobalLArCell >::Base DVL_BASE
typedef typename DataVectorBase< GlobalSim::GlobalLArCell >::Base::PtrVector PtrVector
 This is the type of the underlying std::vector (what stdcont returns).
typedef typename DataVectorBase< GlobalSim::GlobalLArCell >::Base::PtrVector BaseContainer
typedef GlobalSim::GlobalLArCell *& reference
typedef GlobalSim::GlobalLArCell *const & const_reference
typedef typename DataVectorBase< GlobalSim::GlobalLArCell >::Base::size_type size_type
typedef typename DataVectorBase< GlobalSim::GlobalLArCell >::Base::difference_type difference_type
typedef GlobalSim::GlobalLArCellvalue_type
typedef typename DataVectorBase< GlobalSim::GlobalLArCell >::Base::allocator_type allocator_type
typedef GlobalSim::GlobalLArCell ** pointer
typedef GlobalSim::GlobalLArCell *const * const_pointer
typedef const GlobalSim::GlobalLArCellconst_value_type
typedef GlobalSim::GlobalLArCell 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 DataModel_detail::iterator< DataVectoriterator
 Standard 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

 GlobalLArCellContainer ()=default
 Default constructor.
 GlobalLArCellContainer (const std::map< std::string, Feb2MuxInfo > &febMap)
 Main constructor setting up FEB2 LUTs.
 GlobalLArCellContainer (const GlobalLArCellContainer &other)
 Copy constructor.
void push_back (const GlobalLArCell &theCell)
 Reimplementation of the push_back function to fill LArCells.
const std::unordered_set< std::string > & getFeb2Keys () const
 Function to return the full list of FEB2 names.
const std::unordered_set< std::string > & getMuxKeys () const
 Function to return the full list of MUX names.
const std::vector< GlobalLArCell * > & getCellsForFeb2 (const std::string &feb2) const
 Function to get all GlobalLArCells for a given FEB2 name.
const std::vector< std::string > & getOrderedFeb2sForMux (const std::string &mux) const
 Function to get ordered list of FEB2s for a given MUX name.
void setMaxCellsPerFeb2 (int n)
 Function to set maximum number of cells per FEB2.
void setFeb2Flags (const std::string &feb2Key, bool overflow, bool error)
 Set overflow and error flag for a FEB2.
std::size_t getMaxCellsPerFeb2 () const
 Function to get maximum number of cells per FEB2.
const std::string & getMuxForFeb2 (const std::string &feb2Key) const
 Function to get the associated MUX name for a given FEB2.
bool feb2InOverflow (const std::string &feb2Key) const
 Check if a given FEB2 is in overflow.
bool feb2InError (const std::string &feb2Key) const
 Check if a given FEB2 is in error.
bool muxInOverflow (const std::string &muxKey) const
 Check if a given MUX is in overflow.
bool muxInError (const std::string &muxKey) const
 Check if a given MUX is in error.
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 GlobalSim::GlobalLArCelloperator[] (size_type n) const
 Access an element, as an rvalue.
const GlobalSim::GlobalLArCellget (size_type n) const
 Access an element, as an rvalue.
const GlobalSim::GlobalLArCellat (size_type n) const
 Access an element, as an rvalue.
const GlobalSim::GlobalLArCellfront () const
 Access the first element in the collection as an rvalue.
const GlobalSim::GlobalLArCellback () 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.
void clear ()
 Erase all the elements in the collection.

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.

Private Attributes

std::map< std::string, StatusFlagsm_feb2Flags
 map which stores overflow and error bits for each FEB2
std::map< std::string, StatusFlagsm_muxFlags
 map which stores overflow and error bits for each MUX
std::unordered_set< std::string > m_feb2Keys
 vector of all FEB2 names
std::unordered_set< std::string > m_muxKeys
 vector of all MUX names
std::map< std::string, std::vector< GlobalLArCell * > > m_feb2ToCells
 map which keeps track of which cells are associated with which FEB2
std::map< std::string, std::vector< std::string > > m_muxToFeb2Ordered
 map which holds the ordered list of FEB2s for each MUX
std::map< std::string, std::string > m_feb2ToMux
 map which acts as lookuptable to get the associated MUX from a FEB2 name
std::size_t m_maxCellsPerFeb2 = 0
 Maximum number of cells per FEB2 in given energy encoding scheme.

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.
typedef ROOT::Meta::Selection::DataVector< GlobalSim::GlobalLArCell, DataVector_BASE >::self self
static int baseOffset1 (const char *p, const DataVector &dv, const std::type_info &ti)
 Helper for baseOffset.
static const GlobalSim::GlobalLArCelldo_cast (const typename PtrVector::value_type p)
 Helper to shorten calls to DataModel_detail::DVLCast.
static GlobalSim::GlobalLArCelldo_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.
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.

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

Definition at line 22 of file GlobalLArCellContainer.h.

Member Typedef Documentation

◆ allocator_type

typedef typename DataVectorBase<GlobalSim::GlobalLArCell>::Base::allocator_type DataVector< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::Base >::allocator_type
inherited

Definition at line 817 of file DataVector.h.

◆ base_data_vector

Definition at line 854 of file DataVector.h.

◆ base_value_type

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<GlobalSim::GlobalLArCell>::Base::PtrVector DataVector< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::Base >::BaseContainer
inherited

Definition at line 807 of file DataVector.h.

◆ const_iterator

◆ const_pointer

Definition at line 819 of file DataVector.h.

◆ const_reference

Definition at line 813 of file DataVector.h.

◆ const_reverse_iterator

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

Standard const_reverse_iterator.

Definition at line 847 of file DataVector.h.

◆ const_value_type

Definition at line 821 of file DataVector.h.

◆ DataVector_BASE

Definition at line 797 of file DataVector.h.

◆ Deleter

Definition at line 857 of file DataVector.h.

◆ difference_type

typedef typename DataVectorBase<GlobalSim::GlobalLArCell>::Base::difference_type DataVector< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::Base >::difference_type
inherited

Definition at line 815 of file DataVector.h.

◆ DVL_BASE

◆ ElementProxy

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

Standard iterator.

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

Definition at line 842 of file DataVector.h.

◆ pointer

Definition at line 818 of file DataVector.h.

◆ PtrVector

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

Definition at line 806 of file DataVector.h.

◆ reference

◆ reverse_iterator

typedef std::reverse_iterator<iterator> DataVector< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::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

◆ size_type

Definition at line 814 of file DataVector.h.

◆ unique_type

typedef std::unique_ptr<base_value_type> DataVector< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::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

Constructor & Destructor Documentation

◆ GlobalLArCellContainer() [1/3]

GlobalSim::GlobalLArCellContainer::GlobalLArCellContainer ( )
default

Default constructor.

◆ GlobalLArCellContainer() [2/3]

GlobalSim::GlobalLArCellContainer::GlobalLArCellContainer ( const std::map< std::string, Feb2MuxInfo > & febMap)

Main constructor setting up FEB2 LUTs.

Definition at line 12 of file GlobalLArCellContainer.cxx.

12 {
13
14 std::map<std::string, std::vector<std::pair<int,std::string>>> tempMap;
15
16 // Loop over map of FEB2s to establish LUTs and lists
17 for (const auto & [feb2, muxInfo] : febMap) {
18 m_feb2Flags.insert({feb2, {false, false}});
19 m_feb2Keys.insert(feb2);
20 m_muxKeys.insert(muxInfo.muxName);
21 m_muxFlags.insert({muxInfo.muxName, {false, false}});
22 m_feb2ToMux.insert({feb2, muxInfo.muxName});
23
24 tempMap[muxInfo.muxName].emplace_back(muxInfo.indexOnMux, feb2);
25 }
26
27 // Sort FEB2 vectors for each MUX
28 for (auto& [muxName, vec] : tempMap) {
29 std::sort(vec.begin(), vec.end(), [](const auto& a, const auto& b) {
30 return a.first < b.first; // sort by indexOnMux
31 });
32
33 // Copy only the FEB2 names into m_muxToFeb2Ordered
34 std::vector<std::string> orderedFeb2s;
35 orderedFeb2s.reserve(vec.size());
36 for (const auto& [idx, feb2] : vec) {
37 orderedFeb2s.push_back(feb2);
38 }
39 m_muxToFeb2Ordered[muxName] = std::move(orderedFeb2s);
40 }
41 }
std::vector< size_t > vec
static Double_t a
std::unordered_set< std::string > m_muxKeys
vector of all MUX names
std::map< std::string, std::string > m_feb2ToMux
map which acts as lookuptable to get the associated MUX from a FEB2 name
std::unordered_set< std::string > m_feb2Keys
vector of all FEB2 names
std::map< std::string, StatusFlags > m_muxFlags
map which stores overflow and error bits for each MUX
std::map< std::string, StatusFlags > m_feb2Flags
map which stores overflow and error bits for each FEB2
std::map< std::string, std::vector< std::string > > m_muxToFeb2Ordered
map which holds the ordered list of FEB2s for each MUX
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ GlobalLArCellContainer() [3/3]

GlobalSim::GlobalLArCellContainer::GlobalLArCellContainer ( const GlobalLArCellContainer & other)

Copy constructor.

Definition at line 45 of file GlobalLArCellContainer.cxx.

47 {
48 // Deep-copy DataVector elements
49 for (const auto cellPtr : other) {
50 DataVector<GlobalLArCell>::push_back(std::make_unique<GlobalLArCell>(*cellPtr));
51 }
52
53 // Copy the maps and sets
54 m_feb2Flags = other.m_feb2Flags;
55 m_feb2Keys = other.m_feb2Keys;
56 m_muxKeys = other.m_muxKeys;
57 m_muxFlags = other.m_muxFlags;
58 m_maxCellsPerFeb2 = other.m_maxCellsPerFeb2;
59 m_muxToFeb2Ordered = other.m_muxToFeb2Ordered;
60 m_feb2ToMux = other.m_feb2ToMux;
61 }
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
std::size_t m_maxCellsPerFeb2
Maximum number of cells per FEB2 in given energy encoding scheme.

Member Function Documentation

◆ assign()

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

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

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

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

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< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::Base >::capacity ( ) const
noexceptinherited

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

◆ cbegin()

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

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

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.

◆ clearMostDerived()

void DataVector< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::Base >::clearMostDerived ( )
protectedinherited

Clear m_isMostDerived for this instance and for all bases.

Called from the constructor after setting m_isMostDerived.

◆ crbegin()

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

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

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

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< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::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()

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

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< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::Base >::empty ( ) const
nodiscardnoexceptinherited

Returns true if the collection is empty.

◆ end()

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

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.

◆ feb2InError()

bool GlobalSim::GlobalLArCellContainer::feb2InError ( const std::string & feb2Key) const

Check if a given FEB2 is in error.

Definition at line 137 of file GlobalLArCellContainer.cxx.

137 {
138 auto it = m_feb2Flags.find(feb2Key);
139 return (it != m_feb2Flags.end()) ? it->second.error : false;
140 }

◆ feb2InOverflow()

bool GlobalSim::GlobalLArCellContainer::feb2InOverflow ( const std::string & feb2Key) const

Check if a given FEB2 is in overflow.

Definition at line 130 of file GlobalLArCellContainer.cxx.

130 {
131 auto it = m_feb2Flags.find(feb2Key);
132 return (it != m_feb2Flags.end()) ? it->second.overflow : false;
133 }

◆ front()

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

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

◆ getCellsForFeb2()

const std::vector< GlobalLArCell * > & GlobalSim::GlobalLArCellContainer::getCellsForFeb2 ( const std::string & feb2) const

Function to get all GlobalLArCells for a given FEB2 name.

Definition at line 75 of file GlobalLArCellContainer.cxx.

75 {
76
77 static const std::vector<GlobalLArCell*> emptyCellVector; // fallback if not found
78 auto it = m_feb2ToCells.find(feb2);
79
80 if (it != m_feb2ToCells.end()) {
81 return it->second;
82 }
83
84 return emptyCellVector;
85 }
std::map< std::string, std::vector< GlobalLArCell * > > m_feb2ToCells
map which keeps track of which cells are associated with which FEB2

◆ getFeb2Keys()

const std::unordered_set< std::string > & GlobalSim::GlobalLArCellContainer::getFeb2Keys ( ) const
inline

Function to return the full list of FEB2 names.

Definition at line 47 of file GlobalLArCellContainer.h.

47{ return m_feb2Keys; };

◆ getMaxCellsPerFeb2()

std::size_t GlobalSim::GlobalLArCellContainer::getMaxCellsPerFeb2 ( ) const
inline

Function to get maximum number of cells per FEB2.

Definition at line 65 of file GlobalLArCellContainer.h.

65{ return m_maxCellsPerFeb2; }

◆ getMuxForFeb2()

const std::string & GlobalSim::GlobalLArCellContainer::getMuxForFeb2 ( const std::string & feb2Key) const

Function to get the associated MUX name for a given FEB2.

Definition at line 102 of file GlobalLArCellContainer.cxx.

102 {
103 auto it = m_feb2ToMux.find(feb2Key);
104 if (it == m_feb2ToMux.end()) {
105 throw std::runtime_error("Unknown FEB2 key: " + feb2Key);
106 }
107 return it->second;
108 }

◆ getMuxKeys()

const std::unordered_set< std::string > & GlobalSim::GlobalLArCellContainer::getMuxKeys ( ) const
inline

Function to return the full list of MUX names.

Definition at line 50 of file GlobalLArCellContainer.h.

50{ return m_muxKeys; };

◆ getOrderedFeb2sForMux()

const std::vector< std::string > & GlobalSim::GlobalLArCellContainer::getOrderedFeb2sForMux ( const std::string & mux) const

Function to get ordered list of FEB2s for a given MUX name.

Definition at line 89 of file GlobalLArCellContainer.cxx.

89 {
90
91 static const std::vector<std::string> emptyMux;
92 auto it = m_muxToFeb2Ordered.find(mux);
93 if (it != m_muxToFeb2Ordered.end()) {
94 return it->second;
95 }
96
97 return emptyMux;
98 }

◆ insert()

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

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

void DataVector< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::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< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::Base >::max_size ( ) const
noexceptinherited

Returns the size() of the largest possible collection.

◆ muxInError()

bool GlobalSim::GlobalLArCellContainer::muxInError ( const std::string & muxKey) const

Check if a given MUX is in error.

Definition at line 151 of file GlobalLArCellContainer.cxx.

151 {
152 auto it = m_muxFlags.find(muxKey);
153 return (it != m_muxFlags.end()) ? it->second.error : false;
154 }

◆ muxInOverflow()

bool GlobalSim::GlobalLArCellContainer::muxInOverflow ( const std::string & muxKey) const

Check if a given MUX is in overflow.

Definition at line 144 of file GlobalLArCellContainer.cxx.

144 {
145 auto it = m_muxFlags.find(muxKey);
146 return (it != m_muxFlags.end()) ? it->second.overflow : false;
147 }

◆ operator[]()

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

Return the ownership policy setting for this container.

◆ pop_back()

Remove the last element from the collection.

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

◆ push_back() [1/2]

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 GlobalSim::GlobalLArCellContainer::push_back ( const GlobalLArCell & theCell)

Reimplementation of the push_back function to fill LArCells.

Definition at line 65 of file GlobalLArCellContainer.cxx.

65 {
66 auto cell = std::make_unique<GlobalLArCell>(theCell);
67 auto* cellPtr = cell.get();
69
70 m_feb2ToCells[cellPtr->getFEB2()].push_back(cellPtr);
71 }

◆ push_new()

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

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.

◆ rend()

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

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

Parameters
nNumber of elements required.

◆ resize()

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

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.

◆ setFeb2Flags()

void GlobalSim::GlobalLArCellContainer::setFeb2Flags ( const std::string & feb2Key,
bool overflow,
bool error )

Set overflow and error flag for a FEB2.

Definition at line 112 of file GlobalLArCellContainer.cxx.

112 {
113 auto& flags = m_feb2Flags[feb2Key];
114 flags.overflow = overflow;
115 flags.error = error;
116
117 // Propagate FEB2 flags to the MUX
118 if (overflow) {
119 auto& muxFlags = m_muxFlags[m_feb2ToMux[feb2Key]];
120 muxFlags.overflow = overflow;
121 }
122 if (error) {
123 auto& muxFlags = m_muxFlags[m_feb2ToMux[feb2Key]];
124 muxFlags.error = error;
125 }
126 }

◆ setMaxCellsPerFeb2()

void GlobalSim::GlobalLArCellContainer::setMaxCellsPerFeb2 ( int n)
inline

Function to set maximum number of cells per FEB2.

Definition at line 59 of file GlobalLArCellContainer.h.

◆ setMostDerived()

virtual void DataVector< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::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.

◆ shift()

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

◆ size()

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

Sort the container.

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

◆ stdcont()

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

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< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::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< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::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< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::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.

Member Data Documentation

◆ has_virtual

const bool DataVector< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::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_feb2Flags

std::map<std::string, StatusFlags> GlobalSim::GlobalLArCellContainer::m_feb2Flags
private

map which stores overflow and error bits for each FEB2

Definition at line 85 of file GlobalLArCellContainer.h.

◆ m_feb2Keys

std::unordered_set<std::string> GlobalSim::GlobalLArCellContainer::m_feb2Keys
private

vector of all FEB2 names

Definition at line 89 of file GlobalLArCellContainer.h.

◆ m_feb2ToCells

std::map<std::string, std::vector<GlobalLArCell*> > GlobalSim::GlobalLArCellContainer::m_feb2ToCells
private

map which keeps track of which cells are associated with which FEB2

Definition at line 93 of file GlobalLArCellContainer.h.

◆ m_feb2ToMux

std::map<std::string, std::string> GlobalSim::GlobalLArCellContainer::m_feb2ToMux
private

map which acts as lookuptable to get the associated MUX from a FEB2 name

Definition at line 97 of file GlobalLArCellContainer.h.

◆ m_isMostDerived

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_maxCellsPerFeb2

std::size_t GlobalSim::GlobalLArCellContainer::m_maxCellsPerFeb2 = 0
private

Maximum number of cells per FEB2 in given energy encoding scheme.

Definition at line 99 of file GlobalLArCellContainer.h.

◆ m_muxFlags

std::map<std::string, StatusFlags> GlobalSim::GlobalLArCellContainer::m_muxFlags
private

map which stores overflow and error bits for each MUX

Definition at line 87 of file GlobalLArCellContainer.h.

◆ m_muxKeys

std::unordered_set<std::string> GlobalSim::GlobalLArCellContainer::m_muxKeys
private

vector of all MUX names

Definition at line 91 of file GlobalLArCellContainer.h.

◆ m_muxToFeb2Ordered

std::map<std::string, std::vector<std::string> > GlobalSim::GlobalLArCellContainer::m_muxToFeb2Ordered
private

map which holds the ordered list of FEB2s for each MUX

Definition at line 95 of file GlobalLArCellContainer.h.

◆ must_own

bool DataVector< GlobalSim::GlobalLArCell, typename DataVectorBase<GlobalSim::GlobalLArCell>::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: