ATLAS Offline Software
Loading...
Searching...
No Matches
CaloConstCellContainer.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4/**
5 * @file CaloEvent/CaloConstCellContainer.icc
6 * @author scott snyder <snyder@bnl.gov>
7 * @date Aug, 2014
8 * @brief @c CaloCellContainer that can accept const cell pointers.
9 */
10
11
12/**
13 * @brief Constructor.
14 */
15inline
16CaloConstCellContainer::CaloConstCellContainer
17 (SG::OwnershipPolicy ownPolicy /*= SG::OWN_ELEMENTS*/)
18 : ConstDataVector< ::CaloCellContainer > (ownPolicy)
19{
20}
21
22
23/** @brief get const begin iterator on cell of just one calo */
24inline
25::CaloCellContainer::const_iterator
26CaloConstCellContainer::beginConstCalo (CaloCell_ID::SUBCALO caloNum) const
27{
28 return asDataVector()->beginConstCalo (caloNum);
29}
30
31
32/** @brief get const begin iterator on cell of just one calo */
33inline
34::CaloCellContainer::const_iterator
35CaloConstCellContainer::endConstCalo(CaloCell_ID::SUBCALO caloNum) const
36{
37 return asDataVector()->endConstCalo (caloNum);
38}
39
40
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 */
43inline
44bool CaloConstCellContainer::checkOrderedAndComplete() const
45{
46 return asDataVector()->checkOrderedAndComplete();
47}
48
49
50/** @brief indicate that the container is complete and in order */
51inline
52void CaloConstCellContainer::setIsOrderedAndComplete (bool ordered)
53{
54 baseContainer()->setIsOrderedAndComplete (ordered);
55}
56
57
58/** @brief tell wether container is complete and in order */
59inline
60bool CaloConstCellContainer::isOrderedAndComplete() const
61{
62 return asDataVector()->isOrderedAndComplete();
63}
64
65
66/** @brief verify one by one the container is ordered */
67inline
68bool CaloConstCellContainer::checkOrdered() const
69{
70 return asDataVector()->checkOrdered();
71}
72
73
74/** @brief indicates that the container is ordered */
75inline
76void CaloConstCellContainer::setIsOrdered (bool ordered)
77{
78 baseContainer()->setIsOrdered (ordered);
79}
80
81
82/** @brief tell wether container is ordered */
83inline
84bool CaloConstCellContainer::isOrdered() const
85{
86 return asDataVector()->isOrdered();
87}
88
89/** @brief tell wether container has total hash id size */
90inline
91bool CaloConstCellContainer::hasTotalSize() const
92{
93 return asDataVector()->hasTotalSize();
94}
95
96
97/** @brief tell whether it has been filled with cells (maybe none) of a given calo */
98inline
99bool CaloConstCellContainer::hasCalo(const CaloCell_ID::SUBCALO caloNum) const
100{
101 return asDataVector()->hasCalo(caloNum);
102}
103
104
105/** @brief index of first cell of given calorimeter (-1 if none).
106 Note that it is normally more efficient to use iterators */
107inline
108int CaloConstCellContainer::indexFirstCellCalo(const CaloCell_ID::SUBCALO caloNum) const
109{
110 return asDataVector()->indexFirstCellCalo (caloNum);
111}
112
113
114/** @brief index of last cell of given calorimeter (-2 if none)
115 Note that it is normally more efficient to use iterators. */
116inline
117int CaloConstCellContainer::indexLastCellCalo(const CaloCell_ID::SUBCALO caloNum) const
118{
119 return asDataVector()->indexLastCellCalo (caloNum);
120}
121
122/** @brief get number of cels of given calorimeter */
123inline
124int CaloConstCellContainer::nCellsCalo(const CaloCell_ID::SUBCALO caloNum) const
125{
126 return asDataVector()->nCellsCalo (caloNum);
127}
128
129
130/** @brief set which calo has been filled. */
131inline
132void CaloConstCellContainer::setHasCalo(CaloCell_ID::SUBCALO caloNum)
133{
134 baseContainer()->setHasCalo (caloNum);
135}
136
137
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.*/
143inline
144void CaloConstCellContainer::updateCaloIterators()
145{
146 baseContainer()->updateCaloIterators();
147}
148
149
150/** @brief fills calo iterators and the index of first cell
151 for a given subcalo */
152inline
153void CaloConstCellContainer::updateCaloBeginIterators(int ic, int ind)
154{
155 baseContainer()->updateCaloBeginIterators (ic, ind);
156}
157
158
159/** @brief fills calo iterators and the index of last cell
160 for a given subcalo */
161inline
162void CaloConstCellContainer::updateCaloEndIterators(int ic,int ind)
163{
164 baseContainer()->updateCaloEndIterators (ic, ind);
165}
166
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 */
170inline
171const CaloCell*
172CaloConstCellContainer::findCell (IdentifierHash theHash) const
173{
174 return asDataVector()->findCell (theHash);
175}
176
177
178/** @brief Return index of the cell with a given hash.
179 Returns -1 if the cell isn't found. */
180inline
181int CaloConstCellContainer::findIndex (IdentifierHash theHash) const
182{
183 return asDataVector()->findIndex (theHash);
184}
185
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 */
189inline
190void
191CaloConstCellContainer::findCellVector (const std::vector<IdentifierHash> & theVectorHash,
192 ::CaloCellContainer::CellVector & theCellVector) const
193{
194 return asDataVector()->findCellVector (theVectorHash, theCellVector);
195}
196
197
198/** @brief order container */
199inline
200void CaloConstCellContainer::order ()
201{
202 baseContainer()->order();
203}
204
205
206/** @brief reimplementation of push_back to gain speed in readin */
207inline
208void CaloConstCellContainer::push_back_fast (const CaloCell* cell)
209{
210 CaloCell* cell_nc ATLAS_THREAD_SAFE = const_cast<CaloCell*> (cell);
211 baseContainer()->push_back_fast (cell_nc);
212}
213
214/** @brief reimplementation of push_back to gain speed in readin */
215inline
216void CaloConstCellContainer::push_back_fast (std::unique_ptr<const CaloCell> cell)
217{
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));
221}
222
223/** @brief reset look up table */
224inline
225void CaloConstCellContainer::resetLookUpTable()
226{
227 baseContainer()->resetLookUpTable();
228}
229
230
231/// Return a non-const pointer to the base container.
232inline
233::CaloCellContainer* CaloConstCellContainer::baseContainer()
234{
235 // Ok, since this is used only privately.
236 ::CaloCellContainer* ccc_nc ATLAS_THREAD_SAFE =
237 const_cast< ::CaloCellContainer* > (this->asDataVector());
238 return ccc_nc;
239}
240
241
242/// If @ flag is true, then the container size equals the maximum hash.
243inline
244void CaloConstCellContainer::setHasTotalSize(bool flag)
245{
246 return baseContainer()->setHasTotalSize (flag);
247}