ATLAS Offline Software
Loading...
Searching...
No Matches
CaloClusterNavigable.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef CALOEVENT_CALOCLUSTERNAVIGABLE_H
6#define CALOEVENT_CALOCLUSTERNAVIGABLE_H
7
14
15#include "AthLinks/ElementLink.h"
16
18
20
21#include "CaloEvent/CaloCell.h"
23
26
27#include <algorithm>
28
31
32
33class CaloClusterNavigable : virtual public INavigable
34{
35 public:
36
39
42 CaloCellLink* pLink);
43
46
48 virtual ~CaloClusterNavigable();
49
52
54 void putElement(const CaloCellContainer* pContainer,
55 const CaloCell* pCell,
56 const double& weight=double(1.));
58 void putElement(const CaloCellContainer* pContainer,
59 size_t& iCell,
60 const double& weight=double(1.));
62 void insertElement(const CaloCellContainer* pContainer,
63 const CaloCell* pCell,
64 const double& weight=double(1.));
66 void insertElement(const CaloCellContainer* pContainer,
67 size_t& iCell,
68 const double& weight=double(1.));
70 void insertElement(const CaloCellContainer* pContainer,
71 size_t iCell,
72 const double weight,
73 size_t size_hint);
76 const double weight,
77 size_t size_hint = 0);
78
80 void reweight(const CaloCell* pCell,const double& weight=double(1.));
81
83 void reweight(const CaloCellContainer* pContainer, size_t& iCell,
84 const double& weight=double(1.));
85
87 void reweight(object_iter& cellIter, const double& weight=double(1.));
88
89
91 bool remove(const CaloCell* pCell);
92
94 bool remove(const CaloCellContainer* pContainer,size_t& iCell);
95
97 bool removeAll();
98
100 bool contains(const CaloCell* pCell) const;
101
103 bool contains(const CaloCellContainer* pContainer, size_t& iCell) const;
104
105 // find constituent
106 // object_iter find(const CaloCell* pCell) const;
107 // object_iter find(const CaloCellContainer* pContainer, size_t& iCell) const;
108
110 // Access to Constituents //
112
114 virtual object_iter begin() const;
116 virtual object_iter end() const;
118 virtual unsigned int nCells() const;
119
121 double getParameter(const CaloCell* pCell) const;
123 double getParameter(const CaloCellContainer* pContainer,size_t& iCell) const;
125 double getParameter(object_iter& cellIter) const;
126
128 const CaloCellContainer* getContainer(const CaloCell* pCell) const;
130 const CaloCellContainer* getContainer(object_iter cellIter) const;
131
133 bool getIndex(const CaloCell* pCell,size_t& iCell) const;
135 bool getIndex(object_iter cellIter,size_t& iCell) const;
136
138 virtual void fillToken(INavigationToken& iToken) const;
140 virtual void fillToken(INavigationToken& iToken,
141 const std::any& rPar) const;
142
143 virtual bool isCellLinkValid() const ;
144
145 typedef
147
149 const cell_link_type& cellLink() const { return m_cellLink; }
150
152 {
154 }
155
156
157protected:
158
167
169 const CaloCellLink* getCellLink() const;
170
172
173 bool setLinkStore(CaloCellLink* pLink,bool ownStores=true);
174
176 const CaloCellLink* getCellLinkPtr() const;
177
179
180
181private:
183 // CaloCellLink* m_cellLinkPointer;
184
187
188};
189
190inline
192 bool ownStores)
193{
194 m_cellLink.setElement(pLink);
195 m_ownLinkStore = ownStores;
196 // m_cellLinkPointer = pLink;
197 return *m_cellLink != 0;
198}
199
200inline
202 const CaloCell* pCell,
203 const double& weight)
204{
205 (this->getCellLink())->putElement(pContainer,pCell,weight);
206}
207
208inline
210 size_t& iCell,
211 const double& weight)
212{
213 (this->getCellLink())->putElement(pContainer,iCell,weight);
214}
215
216inline
218 const CaloCell* pCell,
219 const double& weight)
220{
221 (this->getCellLink())->insertElement(pContainer,pCell,weight);
222}
223
224inline
226 size_t& iCell,
227 const double& weight)
228{
229 (this->getCellLink())->insertElement(pContainer,iCell,weight);
230}
231
232inline
234 size_t iCell,
235 const double weight,
236 size_t size_hint)
237{
238 (this->getCellLink())->insertElement(pContainer,iCell,weight,size_hint);
239}
240
241inline
242void
244 const double weight,
245 size_t size_hint)
246{
247 (this->getCellLink())->insertElement(el,weight,size_hint);
248}
249
250inline
251void CaloClusterNavigable::reweight(const CaloCell* pCell,const double& weight)
252{
253 (this->getCellLink())->reweight(pCell,weight);
254}
255
256inline
258 size_t& iCell,
259 const double& weight)
260{
261 (this->getCellLink())->reweight(pContainer,iCell,weight);
262}
263
264inline
265void CaloClusterNavigable::reweight(object_iter& cellIter,const double& weight)
266{
267 (this->getCellLink())->reweight(cellIter,weight);
268}
269
270inline
272{
273 return (this->getCellLink())->remove(pCell);
274}
275
276inline
278 size_t& iCell)
279{
280 return (this->getCellLink())->remove(pContainer,iCell);
281}
282
283inline
285{
286 return (this->getCellLink())->removeAll();
287}
288
289inline
291{
292 return (this->getCellLink())->contains(pCell);
293}
294
295inline
297 size_t& iCell) const
298{
299 return (this->getCellLink())->contains(pContainer,iCell);
300}
301
302inline
307
308inline
313
314inline
316{
317
318 const CaloCellLink* link = this->getCellLinkPtr();
319 if (link)
320 return link->size();
321 else
322 return 0;
323
324}
325
326inline
328{
329 return (this->getCellLink())->getParameter(pCell);
330}
331
332inline
334 size_t& iCell) const
335{
336 return (this->getCellLink())->getParameter(pContainer,iCell);
337}
338
339inline
341{
342 return (this->getCellLink())->getParameter(cellIter);
343}
344
345inline
346const CaloCellContainer*
348{
349 return (this->getCellLink())->getContainer(pCell);
350}
351
352inline
353const CaloCellContainer*
355{
356 return (this->getCellLink())->getContainer(cellIter);
357}
358
359inline
360bool CaloClusterNavigable::getIndex(const CaloCell* pCell,size_t& iCell) const
361{
362 return (this->getCellLink())->getIndex(pCell,iCell);
363}
364
365inline
366bool CaloClusterNavigable::getIndex(object_iter cellIter,size_t& iCell) const
367{
368 return (this->getCellLink())->getIndex(cellIter,iCell);
369}
370
371//inline
372//CaloClusterNavigable::object_iter
373//CaloClusterNavigable::find(const CaloCell* pCell) const
374//{
375// const CaloCellLink* pLink = this->getCellLink();
376// return pLink->find(pCell);
377//}
378
379
380//inline
381//CaloClusterNavigable::object_iter
382//CaloClusterNavigable::find(const CaloCellContainer* pContainer,
383// size_t& iCell) const
384//{
385// const CaloCellLink* pLink = this->getCellLink();
386// return pLink->find(pContainer,iCell);
387//}
388
389inline
391{
392 if ( this->getCellLink() )
393 (this->getCellLink())->fillToken(iToken);
394}
395
396inline void
398 const std::any& rPar) const
399{
400 if ( this->getCellLink() )
401 (this->getCellLink())->fillToken(iToken,rPar);
402}
403
404inline bool
406{
407 if (!pLinkStore)
408 return false;
409
410 CaloCellLink* pLink = *m_cellLink != 0
411 ? const_cast<CaloCellLink*>(*m_cellLink) : (CaloCellLink*)0;
412
413 m_ownLinkStore = !pLinkStore->ownElements();
415 pLink,
416 m_cellLink);
417}
418
419//inline const CaloCellLink*
420//CaloClusterNavigable::getCellLink() const
421//{
422// return m_cellLinkPointer != 0 ? m_cellLinkPointer : *m_cellLink;
423//}
424
425inline CaloCellLink*
427{
428 CaloCellLink* ret;
429 if (m_cellLink.isValid())
430 ret = const_cast<CaloCellLink*>(*m_cellLink);
431 else
432 ret = 0;
433 return ret;
434
435}
436
437inline const CaloCellLink*
439 const CaloCellLink* ret;
440 if (m_cellLink.isValid())
441 ret = *m_cellLink;
442 else
443 ret = 0;
444 return ret;
445}
446
447
448inline
450{
451 return this->getCellLinkPtr() !=0;
452}
453
454
455#endif
456
Define macros for attributes used to control the static checker.
Container class for CaloCell.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
virtual object_iter end() const
end iterator for public object access
void insertElement(const CaloCellContainer *pContainer, const CaloCell *pCell, const double &weight=double(1.))
insert element without checking if already in store: use element pointer
void reweight(const CaloCell *pCell, const double &weight=double(1.))
re-weight (overwrite old weight)
const cell_link_type & cellLink() const
Access to underlying link.
friend class CaloClusterContainerCnvTestMakeCluster
CaloCellLink::cell_iterator object_iter
external cell iterator type
friend class CaloClusterContainerCnv_p6
void resetCellLink(const cell_link_type &cellLink)
bool getIndex(const CaloCell *pCell, size_t &iCell) const
get index of child in original container, given a pointer
bool setCellLink(CaloCellLinkContainer *pLink)
CaloCellLink * getCellLinkPtr()
const CaloCellContainer * getContainer(const CaloCell *pCell) const
public container access: retrieve Container for given object pointer
virtual object_iter begin() const
begin iterator for public object access
bool removeAll()
remove all objects from the Navigable
cell_link_type m_cellLink
Local pointer to cell store.
bool setLinkStore(CaloCellLink *pLink, bool ownStores=true)
CaloClusterNavigable()
default constructor
bool contains(const CaloCell *pCell) const
check if constituent is already there
virtual ~CaloClusterNavigable()
destructor
friend class CaloClusterContainerCnv_p4
friend class CaloClusterContainerCnv_p7
friend class CaloClusterContainerCnv_p2
double getParameter(const CaloCell *pCell) const
public container access: relational parameter retrieval
virtual unsigned int nCells() const
size of object access
friend class CaloClusterContainerCnv_p5
CaloClusterLinkTemplate< CaloCellLinkContainer >::link_type cell_link_type
void putElement(const CaloCellContainer *pContainer, const CaloCell *pCell, const double &weight=double(1.))
add element to the Navigable: use pointer
virtual bool isCellLinkValid() const
virtual void fillToken(INavigationToken &iToken) const
fill token for navigation
bool remove(const CaloCell *pCell)
remove object from the Navigable
friend class CaloClusterContainerCnv_p3
NavigableIterator begin()
NavigableIterator end()
virtual unsigned int size() const
static bool setLink(CONT *pCont, DOBJ *pDat, ELEM &rElm)