ATLAS Offline Software
Loading...
Searching...
No Matches
CaloEnergyCluster.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7
9
11
12#include "CaloEvent/CaloCell.h"
15
16#include <iostream>
17
23
25
26void
28 const CaloCell* /*const_cell_ptr*/ theCell,
29 double weight)
30{
31 // cell already in collection
32 if ( this->contains(theCell) )
33 {
34 // update weight
35 double newWeight = weight + this->getCellWeight(theCell);
36 // reweight the cell
37 this->reweightCell(theCell,newWeight);
38 }
39 else
40 {
41 // from Navigable base
42 this->insertElement(theContainer,theCell,weight);
43 // update kinematics
44 this->updateKine(theCell,weight);
45 }
46}
47
48void
50 index_type theIndex,
51 double weight)
52{
53 if ((int)theIndex < 0) abort();
54
55 // cell already in collection
56 if ( this->contains(theContainer,theIndex) )
57 {
58 // try
59 // {
60 // // std::cout << "Replace CaloCell @"
61 // // << (theContainer->operator[])(theIndex)
62 // // << " index " << theIndex
63 // // << " with energy "
64 // // << ((theContainer->operator[])(theIndex))->e()
65 // // << std::endl;
66 // // update weight
67 double newWeight =
68 weight + this->getCellWeight(theContainer,theIndex);
69 // change weight
70 this->reweightCell(theContainer,theIndex,newWeight);
71 // } catch(...) {
72 // std::cout << " Object ["
73 // << (typeid(*this)).name()
74 // << "] failed to insert cell @"
75 // << (theContainer->operator[])(theIndex)
76 // << " in container @"
77 // << theContainer
78 // << " with index <"
79 // << theIndex
80 // << ">" << std::endl;
81 // this->dumpStore();
82 // }
83 }
84 else
85 {
86 // from Navigable base
87 // try
88 // {
89 this->insertElement(theContainer,theIndex,weight);
90 // std::cout << "Insert CaloCell @"
91 // << (theContainer->operator[])(theIndex)
92 // << " index " << theIndex
93 // << " with energy "
94 // << ((theContainer->operator[])(theIndex))->e()
95 // << std::endl;
96 // update kinematics
97 this->updateKine((theContainer->operator[])(theIndex),weight);
98 // } catch(...) {
99 // std::cout << " Object ["
100 // << (typeid(*this)).name()
101 // << "] failed to insert cell @"
102 // << (theContainer->operator[])(theIndex)
103 // << " in container @"
104 // << theContainer
105 // << " with index <"
106 // << theIndex
107 // << ">" << std::endl;
108 // this->dumpStore();
109 }
110 // this->dumpStore();
111}
112
113void
115 index_type theIndex,
116 double weight,
117 size_t size_hint)
118{
119 if ((int)theIndex < 0) abort();
120 this->insertElement(theContainer,theIndex,weight,size_hint);
121 this->updateKine((theContainer->operator[])(theIndex),weight);
122}
123
124void
126 index_type theIndex,
127 double weight,
128 size_t size_hint)
129{
130 if ((int)theIndex < 0) abort();
131 this->insertElement(theContainer,theIndex,weight,size_hint);
132}
133
134
135void
137 index_type theIndex,
138 IProxyDict* sg,
139 double weight,
140 size_t size_hint)
141{
142 if ((int)theIndex < 0) abort();
143 this->insertElement(theContainer,theIndex,sg,weight,size_hint);
144}
145
146
147void
149 index_type theIndex,
150 double weight,
151 size_t size_hint)
152{
153 if ((int)theIndex < 0) abort();
154 ElementLink<CaloCellContainer> el (theContainer, theIndex);
155 this->insertElement(el,weight,size_hint);
156}
157
158
159void
160CaloEnergyCluster::removeCell(/*CaloCellContainer::const_reference*/
161 const CaloCell* theCell)
162{
163 if ( this->contains(theCell) )
164 {
165 // update kinematics
166 this->updateKine(theCell,
167 -(this->getCellWeight(theCell)));
168 // from Navigable base
169 this->remove(theCell);
170 }
171}
172
173void
175 index_type& theIndex)
176{
177 if ( this->contains(theContainer,theIndex) )
178 {
179 // update kinematics
180 this->updateKine((*theContainer)[theIndex],
181 -(this->getCellWeight(theContainer,theIndex)));
182
183 // from Navigable
184 this->remove(theContainer,theIndex);
185 }
186}
187
188void
193
194void
195CaloEnergyCluster::reweightCell(const CaloCell* pCell, double weight)
196{
197 double adjWeight = weight - this->getCellWeight(pCell);
198 this->reweight(pCell,weight);
199 this->updateKine(pCell,adjWeight);
200}
201
202void
204 index_type& refIndex,
205 double weight)
206{
207 this->reweightCell((pContainer->operator[])(refIndex),weight);
208 // double adjWeight = weight - this->getCellWeight(pContainer,refIndex);
209 // this->reweight(pContainer,refIndex,weight);
210 // this->updateKine((pContainer->operator[])(refIndex),adjWeight);
211}
212
213void
215{
216 // keep this implementation separated (faster!)
217 double adjWeight = weight - this->getCellWeight(cellIter);
218 this->reweight(cellIter,weight);
219 this->updateKine(*cellIter,adjWeight);
220}
221
222double
223CaloEnergyCluster::getCellWeight(/*CaloCellContainer::const_reference*/
224 const CaloCell* theCell) const
225{
226 // from Navigable
227 return this->contains(theCell)
228 ? this->getParameter(theCell)
229 : 0.;
230}
231
232double
234 index_type& theIndex) const
235{
236 // from Navigable
237 return this->contains(theContainer,theIndex)
238 ? this->getParameter(theContainer,theIndex)
239 : 0.;
240}
241
242double
244{
245 return this->getParameter(iterCell);
246}
247
249CaloEnergyCluster::getCellContainer(/*CaloCellContainer::const_reference*/
250 const CaloCell*
251 theCell) const
252{
253 return this->getContainer(theCell);
254}
255
256bool
258 index_type& theIndex) const
259{
260 // from Navigable
261 return this->getIndex(theCell,theIndex);
262}
263
264unsigned int
266{
267 return this->size();
268}
269
274
279
281 recStatus)
282{
283 m_status = recStatus;
284}
285
287{
288 return m_status;
289}
Container class for CaloCell.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
void setRecoStatus(CaloRecoStatus::StatusIndicator recStatus)
Set the reconstruction status.
void addUniqueCellNoKine(const CaloCellContainer *theContainer, index_type theIndex, double weight, size_t size_hint=0)
Add a cell (very fast)
CaloEnergyCluster()
Default constructor.
Navigable< CaloCellContainer, double >::object_iter cell_iterator
Iterator type for cell store.
const CaloCellContainer * getCellContainer(const CaloCell *theCell) const
Retrieve the pointer to the original cell container for a given cell.
unsigned int getNumberOfCells() const
Return the number of cells in the store.
void removeCells()
Remove all cells without kinematic update.
Navigable< CaloCellContainer, double >::external_index_type index_type
Index type for CaloCellContainer.
void addCell(const CaloCellContainer *theContainer, const CaloCell *theCell, double weight)
Add a cell with global kinematic update (slow)
const CaloRecoStatus & getRecoStatus() const
Retrieve the reconstruction status.
double getCellWeight(const CaloCell *theCell) const
Retrieve the kinematic weight of a given cell.
void reweightCell(const CaloCell *theCell, double weight)
Reweight a cell with kinematic update.
virtual void updateKine(const CaloCell *theCell, double weight)=0
Interface to kinematic update implementation.
void removeCell(const CaloCell *theCell)
Remove a cell with kinematic update.
cell_iterator cell_begin() const
Retrieve a STL-type begin() iterator for the cell store.
cell_iterator cell_end() const
Retrieve a STL-type end() iterator for the cell store.
virtual ~CaloEnergyCluster()
Destructor.
bool getCellIndex(const CaloCell *theCell, index_type &theIndex) const
Retrieve the index of a given cell in the cell container.
virtual void addUniqueCell(const CaloCellContainer *theContainer, index_type theIndex, double weight, size_t size_hint=0)
Add a cell with global kinematic update (fast)
CaloRecoStatus m_status
Calorimeter reconstruction status.
reconstruction status indicator
StatusIndicator
reconstruction status word
virtual unsigned int size() const
virtual object_iter begin() const
bool remove(const constituent_type *aConstituent)
double getParameter(const constituent_type *aConstituent) const
bool contains(const constituent_type *aConstituent) const
void reweight(const constituent_type *constituentObject, const double &objectParameter=double())
void insertElement(const CaloCellContainer *objectContainer, const constituent_type *constituentObject, const double &objectParameter=double(), size_t sizeHint=0)
virtual object_iter end() const
bool getIndex(const constituent_type *aConstituent, external_index_type &theIndex) const
const CaloCellContainer * getContainer(const constituent_type *aConstituent) const
P4EEtaPhiM(const double e, const double eta, const double phi, const double m)
constructor with all data members
Definition P4EEtaPhiM.cxx:7