|
ATLAS Offline Software
|
Container class for CaloCell.
More...
#include <CaloCellContainer.h>
|
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...
|
|
|
value_type | push_back (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...
|
|
|
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::DVLInfoBase & | dvlinfo_v () const |
| Return the DV/DL info struct for this class. More...
|
|
const SG::AuxVectorBase & | auxbase () 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 PtrVector & | stdcont () 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::DVLInfoBase & | dvlinfo () |
| 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...
|
|
Container class for CaloCell.
CaloCellContainer is a container of all LAr and Tile cells. It derives from DataVector<CaloCell>. Cells from a given calorimeter (LAr e.m., LArHEC, LArFCAl, Tile) can also be accessed individually. It has additional methods to allow fast access to any cell, given its hash identifier. CaloCellContainer is normally built by CaloRec/CaloCellMaker.cxx, and finalized by CaloRec/CaloCellContainerFinalizerTool.cxx. CaloCellContainer is NOT meant to be used for private list of cells, a simple std::vector<const CaloCell*> is best used.
- Author
- Srini Rajagopalan
-
David Rousseau
Definition at line 54 of file CaloCellContainer.h.
◆ allocator_type
◆ base_data_vector
◆ 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 824 of file DataVector.h.
◆ BaseContainer
◆ CellVector
type to be used for the internal lookup table, and to return list of cells
Definition at line 83 of file CaloCellContainer.h.
◆ const_iterator
◆ const_pointer
◆ const_reference
◆ const_reverse_iterator
Standard const_reverse_iterator
.
Definition at line 846 of file DataVector.h.
◆ const_value_type
◆ DataVector_BASE
◆ Deleter
◆ difference_type
◆ DVL_BASE
◆ 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.
◆ iterator
Standard iterator
.
Note that lvalue references here will yield an ElementProxy
, not a reference
.
Definition at line 841 of file DataVector.h.
◆ MutableCellVector
◆ pointer
◆ PtrVector
This is the type of the underlying std::vector
(what stdcont
returns).
Definition at line 805 of file DataVector.h.
◆ reference
◆ reverse_iterator
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]
◆ self [2/2]
◆ size_type
◆ unique_type
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
◆ CaloCellContainer() [1/2]
◆ CaloCellContainer() [2/2]
◆ ~CaloCellContainer()
virtual CaloCellContainer::~CaloCellContainer |
( |
| ) |
|
|
inlinevirtual |
◆ assign() [1/2]
Assign from iterators.
- Parameters
-
first | The start of the range to put in the container. |
last | The 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]
- Parameters
-
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< CaloCell , BASE >::assignBaseElement |
( |
typename BaseContainer::iterator |
pos, |
|
|
typename BaseContainer::value_type |
newElem |
|
) |
| |
|
privateinherited |
Handle element assignment from a base pointer.
- Parameters
-
pos | Position in the container to assign. |
newElem | The new element to assign. |
The old element is freed if this container owns elements. Auxiliary data are copied if appropriate.
◆ assignElement() [1/2]
Handle element assignment.
- Parameters
-
pos | Position in the container to assign. |
newElem | The new element to assign. |
The container must own its elements. Auxiliary data are copied if appropriate.
◆ assignElement() [2/2]
Handle element assignment.
- Parameters
-
pos | Position in the container to assign. |
newElem | The new element to assign. |
The old element is freed if this container owns elements. Auxiliary data are copied if appropriate.
◆ at() [1/2]
Access an element, as an lvalue.
- Parameters
-
- 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]
Access an element, as an rvalue.
- Parameters
-
- 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() [1/2]
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]
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()
Return the offset of a base DataVector
class.
- Parameters
-
ti | std::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()
Helper for baseOffset
.
- Parameters
-
p | Pointer to the start of the top-level object. |
dv | Reference to the DataVector object. |
ti | std::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]
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]
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.
◆ beginCalo()
◆ beginConstCalo()
◆ capacity()
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.
◆ checkOrdered()
bool CaloCellContainer::checkOrdered |
( |
| ) |
const |
verify one by one the container is ordered
Definition at line 173 of file CaloCellContainer.cxx.
175 unsigned int hashPrev=0;
177 for (;itr!=itrEnd;++itr){
183 if (theCell==
nullptr){
185 << MSG::WARNING <<
"CaloCellContainer NULL CELL ";
188 if (theDDE==
nullptr){
190 << MSG::WARNING <<
"CaloCellContainer WARNING NULL DDE ";
194 if (
hash < hashPrev)
return false ;
◆ checkOrderedAndComplete()
bool CaloCellContainer::checkOrderedAndComplete |
( |
| ) |
const |
verify one by one the container is complete (i.e.
size is equal to the maximum of hash identifier) and in order
Definition at line 150 of file CaloCellContainer.cxx.
155 unsigned int index=0;
156 for (;itr!=itrEnd;++itr){
157 if ( ((*itr)->caloDDE())->calo_hash()!=
index) {
◆ clear() [1/6]
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
-
ownPolicy | The new ownership policy of the container. |
trackIndices | The 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]
◆ clear() [3/6]
Erase all the elements in the collection, and reset the ownership mode.
- Parameters
-
ownPolicy | The 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]
◆ clear() [5/6]
◆ clear() [6/6]
Erase all the elements in the collection, and change how elements are to be deleted.
- Parameters
-
deleter | Object 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()
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()
Helper to shorten calls to DataModel_detail::DVLCast
.
- Parameters
-
- Returns
- The value as a
const
T*
.
The conversion will be done with static_cast
if possible, with dynamic_cast
otherwise.
◆ do_cast_nc()
Helper to shorten calls to DataModel_detail::DVLCast
.
- Parameters
-
- Returns
- The value as a
T*
.
The conversion will be done with static_cast
if possible, with dynamic_cast
otherwise.
◆ dv_typeid()
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()
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
-
position | Iterator before which the element will be added. |
pElem | The 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
-
pElem | The 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()
Returns true
if the collection is empty.
◆ end() [1/2]
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]
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.
◆ endCalo()
◆ endConstCalo()
◆ erase() [1/2]
Remove a range of elements.
- Parameters
-
first | Iterator pointing to the first element to be removed. |
last | Iterator 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]
Remove element at a given position.
- Parameters
-
position | Iterator 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.
◆ findCell() [1/2]
fast find method given identifier hash.
If the container is not ordered and complete a look up map is used, which is build the first time this method of findCellVector is used
Definition at line 354 of file CaloCellContainer.cxx.
◆ findCell() [2/2]
fast find method given identifier hash.
If the container is not ordered and complete a look up map is used, which is build the first time this method of findCellVector is used
Definition at line 345 of file CaloCellContainer.cxx.
◆ findCellVector() [1/2]
fast find method given vector of identifier hash.
Be careful that the order of cell return may not match the order of the inputs, and that some cells may be missing
Definition at line 422 of file CaloCellContainer.cxx.
426 theCellVector.reserve (theCellVector.size() + theVectorHash.size());
430 theCellVector.push_back( (*
this)[
hash] );
435 if (this->
empty()) return ;
441 size_t tbsize = lookUpTable.
size();
444 if (
hash>=tbsize) continue ;
445 int ndx = (
int)lookUpTable[
hash ] - 1;
447 const CaloCell * theCell = (*this)[ndx];
449 theCellVector.push_back( theCell);
◆ findCellVector() [2/2]
fast find method given vector of identifier hash.
Be careful that the order of cell return may not match the order of the inputs, and that some cells may be missing
Definition at line 457 of file CaloCellContainer.cxx.
◆ findCellVectorT()
template<class CONT , class VECT >
void CaloCellContainer::findCellVectorT |
( |
CONT & |
cont, |
|
|
const std::vector< IdentifierHash > & |
theVectorHash, |
|
|
VECT & |
theCellVector |
|
) |
| |
|
staticprivate |
Look up a group of cells by IdentifierHash.
This is a templated version that can be instantiated for both const and non-const versions.
- Parameters
-
cont | The container from which to fetch cells. |
theVectorHash | Vector of desired IdentifierHash's. |
theCellVector | Found cells will be appended to this vector. |
Definition at line 389 of file CaloCellContainer.cxx.
391 theCellVector.reserve (theCellVector.size() + theVectorHash.size());
392 if (cont.isOrderedAndComplete()) {
395 theCellVector.push_back( cont[
hash] );
400 if (cont.empty()) return ;
406 size_t tbsize = lookUpTable.
size();
409 if (
hash>=tbsize) continue ;
410 int ndx = (
int)lookUpTable[
hash ] - 1;
412 auto theCell = cont[ndx];
413 if (theCell!=
nullptr) {
414 theCellVector.push_back( theCell);
◆ findIndex()
Return index of the cell with a given hash.
Returns -1 if the cell isn't found.
Definition at line 363 of file CaloCellContainer.cxx.
366 const unsigned int theIndex = theHash ;
371 if (this->
empty())
return -1;
374 if (theIndex < lookUpTable.
size() )
375 return (
int)lookUpTable[theIndex] - 1;
◆ front() [1/2]
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]
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
-
- 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).
◆ getLookUpTable()
Retrieve an initialized lookup table.
Definition at line 586 of file CaloCellContainer.cxx.
598 unsigned int theSize=0;
599 size_t ncells =
size();
616 theSize = max_hash + 1;
618 lookUpTable.resize (theSize);
625 assert (theHash < theSize);
627 if (nWarningsToBePrinted > 0) {
630 int nwarn = nWarningsToBePrinted--;
631 int iold = (
int)(lookUpTable[theHash])-1;
633 if ((
size_t)iold ==
icell) {
635 <<
"Repeated cell. hash= " << theHash;
637 else if ((*
this)[iold]->
ID()==theCell->
ID()) {
639 <<
"Duplicated cell. hash="
641 <<
" E1=" << (*this)[iold]->e()
642 <<
" E2=" << theCell->
e();
646 <<
"Should be impossible ! Repeated cell. hash= " << theHash;
650 <<
"No more WARNING will be printed";
655 lookUpTable[theHash]=
icell+1;
◆ hasCalo()
tell wether it has been filled with cells (maybe none) of a given calo
Definition at line 209 of file CaloCellContainer.cxx.
210 return m_hasCalo[
static_cast<int>(caloNum)];
◆ hasTotalSize()
bool CaloCellContainer::hasTotalSize |
( |
| ) |
const |
|
inline |
◆ indexFirstCellCalo()
index of first cell of given calorimeter (-1 if none).
Note that it is normally more efficient to use iterators
Definition at line 137 of file CaloCellContainer.cxx.
◆ indexLastCellCalo()
index of last cell of given calorimeter (-2 if none) Note that it is normally more efficient to use iterators.
Definition at line 141 of file CaloCellContainer.cxx.
◆ initializeLookUpTable()
void CaloCellContainer::initializeLookUpTable |
( |
| ) |
|
initialize look up table.
Note that the look up table is initialized the first time findcell is called. If new cells are added afterwards (should not be the case) the lookuptable need be reinitialized by hand
Definition at line 467 of file CaloCellContainer.cxx.
◆ insert() [1/5]
Add a group of new elements to the collection.
- Parameters
-
position | Iterator before which the element will be added. |
first | The start of the range to put in the container. |
last | The 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]
Add a group of new elements to the collection.
- Parameters
-
position | Iterator before which the element will be added. |
first | The start of the range to put in the container. |
last | The 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]
Add a group of new elements to the collection.
- Parameters
-
position | Iterator before which the element will be added. |
l | An 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]
Add a new element to the collection.
- Parameters
-
position | Iterator before which the element will be added. |
pElem | The 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]
Add a new element to the collection.
- Parameters
-
position | Iterator before which the element will be added. |
pElem | The 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
-
position | Iterator before which the new elements will be added. |
other | The 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 CaloCellContainer::isOrdered |
( |
| ) |
const |
|
inline |
◆ isOrderedAndComplete()
bool CaloCellContainer::isOrderedAndComplete |
( |
| ) |
const |
|
inline |
◆ iter_swap()
Swap the referents of two DataVector
iterators.
- Parameters
-
a | The first iterator for the swap. |
b | The second iterator for the swap. |
◆ max_size()
Returns the size()
of the largest possible collection.
◆ msgSvc()
IMessageSvc* CaloCellContainer::msgSvc |
( |
| ) |
const |
|
private |
◆ nCellsCalo()
◆ operator[]() [1/2]
Access an element, as an lvalue.
- Parameters
-
- 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]
Access an element, as an rvalue.
- Parameters
-
- Returns
- The element at n.
No bounds checking is done. Note that we return a const
T*
rather than a reference.
◆ order()
void CaloCellContainer::order |
( |
| ) |
|
◆ orderWhenComplete()
void CaloCellContainer::orderWhenComplete |
( |
| ) |
|
|
private |
order when container is complete
Definition at line 556 of file CaloCellContainer.cxx.
569 if ((*
this)[
hash] !=
nullptr) {
571 <<
"Duplicated cell: hash= " <<
hash;
◆ orderWhenIncomplete()
void CaloCellContainer::orderWhenIncomplete |
( |
| ) |
|
|
private |
order when container is incomplete
Definition at line 485 of file CaloCellContainer.cxx.
494 sort (orderWithCaloHash());
498 for (
int i = 0; i < static_cast<int>(
size())-1; ) {
499 if ((*
this)[
i]->caloDDE()->calo_hash() ==
500 (*this)[
i+1]->caloDDE()->calo_hash())
503 <<
"Duplicated cell: hash= " << (*this)[
i]->caloDDE()->calo_hash();
528 <<
"Duplicated cell: hash= " <<
hash;
540 if (*
it !=
nullptr) {
549 assert (itout <=
end());
◆ ownPolicy()
Return the ownership policy setting for this container.
◆ pop_back() [1/2]
Remove the last element from the collection.
If the container owns its elements, then the removed element will be deleted.
◆ pop_back() [2/2]
◆ print()
void CaloCellContainer::print |
( |
| ) |
|
|
static |
dump (obsolete)
Definition at line 112 of file CaloCellContainer.cxx.
114 <<
"CaloCellContainer::print not implemented";
◆ push_back() [1/3]
void CaloCellContainer::push_back |
( |
CaloCell * |
theCell | ) |
|
◆ push_back() [2/3]
void CaloCellContainer::push_back |
( |
std::unique_ptr< CaloCell > |
theCell | ) |
|
◆ push_back() [3/3]
Add an element to the end of the collection.
- Parameters
-
pElem | The 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_fast() [1/2]
void CaloCellContainer::push_back_fast |
( |
CaloCell * |
theCell | ) |
|
◆ push_back_fast() [2/2]
void CaloCellContainer::push_back_fast |
( |
std::unique_ptr< CaloCell > |
theCell | ) |
|
reimplementation of push_back to gain speed in readin (UP version)
Definition at line 107 of file CaloCellContainer.cxx.
◆ rbegin() [1/2]
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]
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]
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]
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()
Attempt to preallocate enough memory for a specified number of elements.
- Parameters
-
n | Number of elements required. |
◆ resetLookUpTable()
void CaloCellContainer::resetLookUpTable |
( |
| ) |
|
◆ resize() [1/2]
Resizes the collection to the specified number of elements.
- Parameters
-
sz | The 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]
◆ resortAux()
Reset indices / reorder aux data after elements have been permuted.
- Parameters
-
beg | Start of the range of elements to process. |
end | End 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.
◆ setHasCalo()
set which calo has been filled.
Definition at line 213 of file CaloCellContainer.cxx.
215 const int iCalo=
static_cast<int>(caloNum);
◆ setHasTotalSize()
void CaloCellContainer::setHasTotalSize |
( |
const bool |
hasTotalSize | ) |
|
|
private |
If @ flag is true, then the container size equals the maximum hash.
Only CaloCellContainerFinalizer tool is allowed to set this. Now, set this in EmptyCellBuilderTool as it is always true.
Definition at line 169 of file CaloCellContainer.cxx.
◆ setIsOrdered()
void CaloCellContainer::setIsOrdered |
( |
const bool |
ordered | ) |
|
◆ setIsOrderedAndComplete()
void CaloCellContainer::setIsOrderedAndComplete |
( |
const bool |
ordered | ) |
|
◆ 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.
◆ shift()
Shift the auxiliary elements of the container.
- Parameters
-
pos | The starting index for the shift. |
offs | The (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()
◆ 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() [1/2]
Sort the container.
This just sorts by pointer value, so it's probably not very useful.
◆ sort() [2/2]
Sort the container with a user-specified comparison operator.
- Parameters
-
comp | Functional to compare two values. |
◆ 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
-
rhs | The 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]
Swap one element out of the container.
- Parameters
-
pos | The element in the container to swap. |
newElem | New element to put in the container. May be 0. |
oldElem | Reference 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]
Swap one element out of the container.
- Parameters
-
pos | The element in the container to swap. |
newElem | New element to put in the container. May be 0. |
oldElem | Reference 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]
Swap one element out of the container.
- Parameters
-
index | Index of the element in the container to swap. |
newElem | New element to put in the container. May be 0. |
oldElem | Reference 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]
Swap one element out of the container.
- Parameters
-
index | Index of the element in the container to swap. |
newElem | New element to put in the container. May be 0. |
oldElem | Reference 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()
Test if we can insert; raise an exception if not.
- Parameters
-
op | Description 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()
Test if we can insert; raise an exception if not.
- Parameters
-
op | Description 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.
◆ updateCaloBeginIterators()
void CaloCellContainer::updateCaloBeginIterators |
( |
int |
ic, |
|
|
int |
ind |
|
) |
| |
fills calo iterators and the index of first cell for a given subcalo
Definition at line 326 of file CaloCellContainer.cxx.
◆ updateCaloEndIterators()
void CaloCellContainer::updateCaloEndIterators |
( |
int |
ic, |
|
|
int |
ind |
|
) |
| |
fills calo iterators and the index of last cell for a given subcalo
Definition at line 338 of file CaloCellContainer.cxx.
◆ updateCaloIterators()
void CaloCellContainer::updateCaloIterators |
( |
| ) |
|
fill calo iterators and the index of first and last cell IT IS THE RESPONSABILITY OF THE PRODUCER TO CALL THIS METHOD ONCE THE FILLING IS FINISHED Please use CaloCellContainerFinalizerTool to make sure the container is properly finalised.
Definition at line 268 of file CaloCellContainer.cxx.
288 int previousCellCalo=-1;
290 for (;itr!=itrEnd;++itr){
291 const int iCalo=
static_cast<int>( (*itr)->caloDDE()->getSubCalo());
292 if (iCalo!=previousCellCalo){
297 <<
" Specific calo cells are split."
298 <<
" Specific calo iterators will be wrong ";
304 if (previousCellCalo>=0){
311 previousCellCalo=iCalo;
317 if (previousCellCalo>=0){
◆ updateCaloIteratorsOrdered()
Recursively find division points between subcalos in the container.
Should run in ~ m log n time, where n is the number of cells and m is the number of subcalos.
The cells need to be sorted for this to work.
Definition at line 245 of file CaloCellContainer.cxx.
249 int beg_calo = (*beg)->caloDDE()->getSubCalo();
250 int end_calo = (*(
end-1))->caloDDE()->getSubCalo();
251 if (beg_calo == end_calo) {
261 std::partition_point (
beg,
end, is_calo (beg_calo));
◆ CaloCellContainerFinalizerTool
◆ CaloCellContCopyTool
◆ CaloCompactCellTool
◆ CaloConstCellContainer
◆ EmptyCellBuilderTool
◆ FullCaloCellContMaker
friend class FullCaloCellContMaker |
|
friend |
◆ has_virtual
◆ m_beginCalo
◆ m_beginConstCalo
◆ m_deleter
ROOT_SELECTION_NS::MemberAttributes< kTransient > DataVector< CaloCell , BASE >::m_deleter |
|
inherited |
◆ m_endCalo
◆ m_endConstCalo
◆ m_hasCalo
std::vector<bool> CaloCellContainer::m_hasCalo |
|
private |
true if given cell from given calo has been filled (even if none)
Definition at line 286 of file CaloCellContainer.h.
◆ m_hasTotalSize
bool CaloCellContainer::m_hasTotalSize |
|
private |
true if size correspond to maximum hash.
only CaloCellContainerFinalizer tool is allowed to set this
Definition at line 276 of file CaloCellContainer.h.
◆ m_indexFirstCellCalo
std::vector<int> CaloCellContainer::m_indexFirstCellCalo |
|
private |
◆ m_indexLastCellCalo
std::vector<int> CaloCellContainer::m_indexLastCellCalo |
|
private |
◆ m_isMostDerived [1/2]
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< CaloCell , 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_isOrdered
bool CaloCellContainer::m_isOrdered |
|
private |
◆ m_isOrderedAndComplete
bool CaloCellContainer::m_isOrderedAndComplete |
|
private |
◆ m_lookUpTable
◆ m_ownPolicy
ROOT_SELECTION_NS::MemberAttributes< kTransient > DataVector< CaloCell , 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.
◆ must_own
If true, then this type must own its contents.
Definition at line 859 of file DataVector.h.
The documentation for this class was generated from the following files:
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
CxxUtils::CachedValue< CxxUtils::PackedArray > m_lookUpTable
look up table of size HashIdentifiermax.
void updateCaloIteratorsOrdered(CaloCellContainer::iterator beg, CaloCellContainer::iterator end)
Recursively find division points between subcalos in the container.
int indexLastCellCalo(const CaloCell_ID::SUBCALO caloNum) const
index of last cell of given calorimeter (-2 if none) Note that it is normally more efficient to use i...
void reset()
Reset the value to invalid.
void initializeLookUpTable()
initialize look up table.
Const iterator class for DataVector/DataList.
const T * ptr() const
Return a pointer to the cached value.
bool hasTotalSize() const
tell wether container has total hash id size
std::vector< Identifier > ID
void iter_swap(typename std::reverse_iterator< DataModel_detail::iterator< DV > > a, typename std::reverse_iterator< DataModel_detail::iterator< DV > > b)
Specialization of iter_swap for DataVector/DataList.
std::vector< int > m_indexFirstCellCalo
index of first cell of given calo (-1 if none)
bool m_isOrderedAndComplete
true if complete and in right order
bool m_hasTotalSize
true if size correspond to maximum hash.
bool isValid() const
Test to see if the value is valid.
void setIsOrdered(const bool ordered)
indicates that the container is ordered
void setHasCalo(const CaloCell_ID::SUBCALO caloNum)
set which calo has been filled.
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
bool m_isOrdered
true if ordered
size_type size() const
Returns the number of elements in the collection.
bool isOrdered() const
tell wether container is ordered
virtual double e() const override final
get energy (data member) (synonym to method energy()
CaloCell_ID::SUBCALO getSubCalo() const
cell subcalo
An array of unsigned values of some bit size, packed tightly.
int indexFirstCellCalo(const CaloCell_ID::SUBCALO caloNum) const
index of first cell of given calorimeter (-1 if none).
void orderWhenComplete()
order when container is complete
IdentifierHash calo_hash() const
cell calo hash
CaloCellContainer(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS)
Main constructor.
(Non-const) Iterator class for DataVector/DataList.
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
const CaloCell * front() const
Access the first element in the collection as an rvalue.
const CaloCell * back() const
Access the last element in the collection as an rvalue.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
void resize(size_type sz)
Resizes the collection to the specified number of elements.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
void set(const T &val) const
Set the value, assuming it is currently invalid.
std::vector< CaloCellContainer::iterator > m_beginCalo
non const iterators for the different calorimeters
const CxxUtils::PackedArray & getLookUpTable() const
Retrieve an initialized lookup table.
std::vector< CaloCellContainer::const_iterator > m_beginConstCalo
const iterators for the different calorimeters
void resetLookUpTable()
reset look up table
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
void sort()
Sort the container.
std::vector< bool > m_hasCalo
true if given cell from given calo has been filled (even if none)
bool isOrderedAndComplete() const
tell wether container is complete and in order
Data object for each calorimeter readout cell.
void orderWhenIncomplete()
order when container is incomplete
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...
int findIndex(const IdentifierHash theHash) const
Return index of the cell with a given hash.
const CaloDetDescriptor * descriptor() const
cell descriptor
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
std::vector< CaloCellContainer::const_iterator > m_endConstCalo
static void iter_swap(iterator a, iterator b)
Swap the referents of two DataVector iterators.
std::vector< CaloCellContainer::iterator > m_endCalo
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
iterator erase(iterator position)
Remove element at a given position.
static void findCellVectorT(CONT &cont, const std::vector< IdentifierHash > &theVectorHash, VECT &theCellVector)
Look up a group of cells by IdentifierHash.
size_type size() const noexcept
Returns the number of elements in the collection.
void setIsOrderedAndComplete(const bool ordered)
indicate that the container is complete and in order
bool empty() const noexcept
Returns true if the collection is empty.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
std::vector< int > m_indexLastCellCalo
index of first cell of given calo (-2 if none)