2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 * @file CaloEvent/CaloConstCellContainer.icc
6 * @author scott snyder <snyder@bnl.gov>
8 * @brief @c CaloCellContainer that can accept const cell pointers.
16CaloConstCellContainer::CaloConstCellContainer
17 (SG::OwnershipPolicy ownPolicy /*= SG::OWN_ELEMENTS*/)
18 : ConstDataVector< ::CaloCellContainer > (ownPolicy)
23/** @brief get const begin iterator on cell of just one calo */
25::CaloCellContainer::const_iterator
26CaloConstCellContainer::beginConstCalo (CaloCell_ID::SUBCALO caloNum) const
28 return asDataVector()->beginConstCalo (caloNum);
32/** @brief get const begin iterator on cell of just one calo */
34::CaloCellContainer::const_iterator
35CaloConstCellContainer::endConstCalo(CaloCell_ID::SUBCALO caloNum) const
37 return asDataVector()->endConstCalo (caloNum);
41/** @brief verify one by one the container is complete (i.e. size is equal to the
42 * maximum of hash identifier) and in order */
44bool CaloConstCellContainer::checkOrderedAndComplete() const
46 return asDataVector()->checkOrderedAndComplete();
50/** @brief indicate that the container is complete and in order */
52void CaloConstCellContainer::setIsOrderedAndComplete (bool ordered)
54 baseContainer()->setIsOrderedAndComplete (ordered);
58/** @brief tell wether container is complete and in order */
60bool CaloConstCellContainer::isOrderedAndComplete() const
62 return asDataVector()->isOrderedAndComplete();
66/** @brief verify one by one the container is ordered */
68bool CaloConstCellContainer::checkOrdered() const
70 return asDataVector()->checkOrdered();
74/** @brief indicates that the container is ordered */
76void CaloConstCellContainer::setIsOrdered (bool ordered)
78 baseContainer()->setIsOrdered (ordered);
82/** @brief tell wether container is ordered */
84bool CaloConstCellContainer::isOrdered() const
86 return asDataVector()->isOrdered();
89/** @brief tell wether container has total hash id size */
91bool CaloConstCellContainer::hasTotalSize() const
93 return asDataVector()->hasTotalSize();
97/** @brief tell whether it has been filled with cells (maybe none) of a given calo */
99bool CaloConstCellContainer::hasCalo(const CaloCell_ID::SUBCALO caloNum) const
101 return asDataVector()->hasCalo(caloNum);
105/** @brief index of first cell of given calorimeter (-1 if none).
106 Note that it is normally more efficient to use iterators */
108int CaloConstCellContainer::indexFirstCellCalo(const CaloCell_ID::SUBCALO caloNum) const
110 return asDataVector()->indexFirstCellCalo (caloNum);
114/** @brief index of last cell of given calorimeter (-2 if none)
115 Note that it is normally more efficient to use iterators. */
117int CaloConstCellContainer::indexLastCellCalo(const CaloCell_ID::SUBCALO caloNum) const
119 return asDataVector()->indexLastCellCalo (caloNum);
122/** @brief get number of cels of given calorimeter */
124int CaloConstCellContainer::nCellsCalo(const CaloCell_ID::SUBCALO caloNum) const
126 return asDataVector()->nCellsCalo (caloNum);
130/** @brief set which calo has been filled. */
132void CaloConstCellContainer::setHasCalo(CaloCell_ID::SUBCALO caloNum)
134 baseContainer()->setHasCalo (caloNum);
138/** @brief fill calo iterators and the index of first and last cell
139 IT IS THE RESPONSABILITY OF THE PRODUCER TO CALL THIS
140 METHOD ONCE THE FILLING IS FINISHED
141 Please use CaloCellContainerFinalizerTool to make sure the
142 container is properly finalised.*/
144void CaloConstCellContainer::updateCaloIterators()
146 baseContainer()->updateCaloIterators();
150/** @brief fills calo iterators and the index of first cell
151 for a given subcalo */
153void CaloConstCellContainer::updateCaloBeginIterators(int ic, int ind)
155 baseContainer()->updateCaloBeginIterators (ic, ind);
159/** @brief fills calo iterators and the index of last cell
160 for a given subcalo */
162void CaloConstCellContainer::updateCaloEndIterators(int ic,int ind)
164 baseContainer()->updateCaloEndIterators (ic, ind);
167/** @brief fast find method given identifier hash. If the container is
168 not ordered and complete a look up map is used, which is build the first
169 time this method of findCellVector is used */
172CaloConstCellContainer::findCell (IdentifierHash theHash) const
174 return asDataVector()->findCell (theHash);
178/** @brief Return index of the cell with a given hash.
179 Returns -1 if the cell isn't found. */
181int CaloConstCellContainer::findIndex (IdentifierHash theHash) const
183 return asDataVector()->findIndex (theHash);
186/** @brief fast find method given vector of identifier hash.
187 Be careful that the order of cell return may not match the order
188 of the inputs, and that some cells may be missing */
191CaloConstCellContainer::findCellVector (const std::vector<IdentifierHash> & theVectorHash,
192 ::CaloCellContainer::CellVector & theCellVector) const
194 return asDataVector()->findCellVector (theVectorHash, theCellVector);
198/** @brief order container */
200void CaloConstCellContainer::order ()
202 baseContainer()->order();
206/** @brief reimplementation of push_back to gain speed in readin */
208void CaloConstCellContainer::push_back_fast (const CaloCell* cell)
210 CaloCell* cell_nc ATLAS_THREAD_SAFE = const_cast<CaloCell*> (cell);
211 baseContainer()->push_back_fast (cell_nc);
214/** @brief reimplementation of push_back to gain speed in readin */
216void CaloConstCellContainer::push_back_fast (std::unique_ptr<const CaloCell> cell)
218 CaloCell* cell_nc ATLAS_THREAD_SAFE = const_cast<CaloCell*> (cell.release());
219 std::unique_ptr<CaloCell> cell_nc_up(cell_nc);
220 baseContainer()->push_back_fast (std::move(cell_nc_up));
223/** @brief reset look up table */
225void CaloConstCellContainer::resetLookUpTable()
227 baseContainer()->resetLookUpTable();
231/// Return a non-const pointer to the base container.
233::CaloCellContainer* CaloConstCellContainer::baseContainer()
235 // Ok, since this is used only privately.
236 ::CaloCellContainer* ccc_nc ATLAS_THREAD_SAFE =
237 const_cast< ::CaloCellContainer* > (this->asDataVector());
242/// If @ flag is true, then the container size equals the maximum hash.
244void CaloConstCellContainer::setHasTotalSize(bool flag)
246 return baseContainer()->setHasTotalSize (flag);