ATLAS Offline Software
Classes | Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Attributes | Static Private Attributes | List of all members
CaloClusterCellLink Class Reference

Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink, CaloClusterNavigable and Navigable classes used during run 1. More...

#include <CaloClusterCellLink.h>

Collaboration diagram for CaloClusterCellLink:

Classes

class  const_iterator
 const_iterator to loop over cells belonging to a cluster More...
 
class  iterator
 

Public Types

typedef double weight_t
 

Public Member Functions

 CaloClusterCellLink ()
 default constructor (for persistency only) More...
 
 CaloClusterCellLink (const CaloCellContainer *cellCont)
 useful constructor More...
 
 CaloClusterCellLink (const DataLink< CaloCellContainer > &cellCont)
 Constructor from DataLink. More...
 
 ~CaloClusterCellLink ()
 standard destructor More...
 
const_iterator begin () const
 const begin method More...
 
const_iterator end () const
 const end method More...
 
size_t size () const
 size method More...
 
iterator begin ()
 non-const begin method More...
 
iterator end ()
 const end method More...
 
bool addCell (const unsigned cellIdx, const weight_t weight=1.0)
 Method to add a cell to the cluster. More...
 
CaloClusterCellLink::iterator removeCell (iterator cellItr)
 Method to remove a cell. More...
 
bool removeCell (const CaloCell *ptr)
 Method to remove a cell by pointer (slow!) More...
 
const CaloCellContainergetCellContainer () const
 Method to access underlying cell container. More...
 
const DataLink< CaloCellContainer > & getCellContainerLink () const
 
void reserve (const size_t s)
 Method to reserve space the underlying vector<pair> More...
 
void clear ()
 Method to remove all cells;. More...
 
void toPersistent ()
 Prepare for writing. More...
 

Static Public Attributes

static const CaloClusterCellLink::const_iterator dummyIt
 Dummy iterator to be used as begin/end if no cell-links are present. More...
 

Private Types

typedef std::vector< std::pair< unsigned, weight_t > > linkAndWeightCollType
 

Private Attributes

DataLink< CaloCellContainerm_cellCont
 
linkAndWeightCollType m_indicesAndWeights
 

Static Private Attributes

static const linkAndWeightCollType m_dummyIndicesAndWeights
 

Detailed Description

Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink, CaloClusterNavigable and Navigable classes used during run 1.

Author
Walter Lampl

Definition at line 24 of file CaloClusterCellLink.h.

Member Typedef Documentation

◆ linkAndWeightCollType

typedef std::vector<std::pair<unsigned, weight_t> > CaloClusterCellLink::linkAndWeightCollType
private

Definition at line 31 of file CaloClusterCellLink.h.

◆ weight_t

Definition at line 27 of file CaloClusterCellLink.h.

Constructor & Destructor Documentation

◆ CaloClusterCellLink() [1/3]

CaloClusterCellLink::CaloClusterCellLink ( )
default

default constructor (for persistency only)

◆ CaloClusterCellLink() [2/3]

CaloClusterCellLink::CaloClusterCellLink ( const CaloCellContainer cellCont)

useful constructor

Parameters
[in]cellContPointer to the CaloCellContainer from which this cluster is built

Definition at line 19 of file CaloClusterCellLink.cxx.

19  :
20  m_cellCont(cellCont)
21 {}

◆ CaloClusterCellLink() [3/3]

CaloClusterCellLink::CaloClusterCellLink ( const DataLink< CaloCellContainer > &  cellCont)

Constructor from DataLink.

Parameters
[in]cellContLink to the CaloCellContainer from which this cluster is built

Definition at line 24 of file CaloClusterCellLink.cxx.

24  :
25  m_cellCont(cellCont)
26 {}

◆ ~CaloClusterCellLink()

CaloClusterCellLink::~CaloClusterCellLink ( )
default

standard destructor

Member Function Documentation

◆ addCell()

bool CaloClusterCellLink::addCell ( const unsigned  cellIdx,
const weight_t  weight = 1.0 
)
inline

Method to add a cell to the cluster.

Parameters
cellIdxIndex of the cell in the CaloCellContainer
weightcell weight
Returns
true if this cell was added (always in this implementation)

Definition at line 234 of file CaloClusterCellLink.h.

234  {
235 
236  /* map version - with uniqueness check
237  std::pair<linkAndWeightCollType::iterator,bool> tryInsert=
238  m_indicesAndWeights.insert(std::make_pair(cellIdx,weight));
239  if (!tryInsert.second) {
240  //Cell existed before, need to overwrite
241  tryInsert.first->second=weight;
242  }
243  return !tryInsert.second;
244  */
245  m_indicesAndWeights.emplace_back(cellIdx,weight);
246  return true;
247 
248 }

◆ begin() [1/2]

iterator CaloClusterCellLink::begin ( )
inline

non-const begin method

Returns
begin iterator

Definition at line 180 of file CaloClusterCellLink.h.

180 {return iterator(m_cellCont, m_indicesAndWeights.begin());}

◆ begin() [2/2]

const_iterator CaloClusterCellLink::begin ( ) const
inline

const begin method

Returns
const_iterator to the first cell belonging to this cluster

Definition at line 107 of file CaloClusterCellLink.h.

107 {return const_iterator(m_cellCont, m_indicesAndWeights.begin());}

◆ clear()

void CaloClusterCellLink::clear ( )
inline

Method to remove all cells;.

Definition at line 220 of file CaloClusterCellLink.h.

220 {m_indicesAndWeights.clear();}

◆ end() [1/2]

iterator CaloClusterCellLink::end ( )
inline

const end method

Returns
end iterator

Definition at line 185 of file CaloClusterCellLink.h.

185 {return iterator(m_cellCont, m_indicesAndWeights.end());}

◆ end() [2/2]

const_iterator CaloClusterCellLink::end ( ) const
inline

const end method

Returns
const_iterator end iterator

Definition at line 112 of file CaloClusterCellLink.h.

112 {return const_iterator(m_cellCont, m_indicesAndWeights.end());}

◆ getCellContainer()

const CaloCellContainer* CaloClusterCellLink::getCellContainer ( ) const
inline

Method to access underlying cell container.

Returns
const pointer to CaloCellContainer

Definition at line 212 of file CaloClusterCellLink.h.

212 { return m_cellCont.cptr();}

◆ getCellContainerLink()

const DataLink<CaloCellContainer>& CaloClusterCellLink::getCellContainerLink ( ) const
inline

Definition at line 213 of file CaloClusterCellLink.h.

213 { return m_cellCont;}

◆ removeCell() [1/2]

bool CaloClusterCellLink::removeCell ( const CaloCell ptr)

Method to remove a cell by pointer (slow!)

Parameters
pointerto the cell in teh cell container
Returns
True if the cell was removed, False if it was not found.

Definition at line 37 of file CaloClusterCellLink.cxx.

37  {
38  bool success=false;
41  for(;it!=it_e;++it) {
42  const CaloCell* pCell=(*it);
43  if (pCell==ptrToDelete) { //Pointer comparison!
44  this->removeCell(it);
45  success=true;
46  break;
47  }//end cell found
48  }//end for loop
49  return success;
50 }

◆ removeCell() [2/2]

CaloClusterCellLink::iterator CaloClusterCellLink::removeCell ( CaloClusterCellLink::iterator  cellItr)

Method to remove a cell.

Parameters
cellItrIterator pointing to the cell to be removed
Returns
iterator to the cell following the removed one

Definition at line 29 of file CaloClusterCellLink.cxx.

29  {
30  linkAndWeightCollType::iterator toDelete=cellItr.m_it;
31  auto newVecIt=m_indicesAndWeights.erase(toDelete);
32  return {cellItr.m_ccc,newVecIt};
33 
34 }

◆ reserve()

void CaloClusterCellLink::reserve ( const size_t  s)
inline

Method to reserve space the underlying vector<pair>

Definition at line 216 of file CaloClusterCellLink.h.

216 { m_indicesAndWeights.reserve(s);}

◆ size()

size_t CaloClusterCellLink::size ( ) const
inline

size method

Returns
The number of cells

Definition at line 117 of file CaloClusterCellLink.h.

117 {return m_indicesAndWeights.size();}

◆ toPersistent()

void CaloClusterCellLink::toPersistent ( )

Prepare for writing.

Definition at line 55 of file CaloClusterCellLink.cxx.

56 {
58 }

Member Data Documentation

◆ dummyIt

const CaloClusterCellLink::const_iterator CaloClusterCellLink::dummyIt
static

Dummy iterator to be used as begin/end if no cell-links are present.

Definition at line 102 of file CaloClusterCellLink.h.

◆ m_cellCont

DataLink<CaloCellContainer> CaloClusterCellLink::m_cellCont
private

Definition at line 227 of file CaloClusterCellLink.h.

◆ m_dummyIndicesAndWeights

const CaloClusterCellLink::linkAndWeightCollType CaloClusterCellLink::m_dummyIndicesAndWeights
staticprivate

Definition at line 230 of file CaloClusterCellLink.h.

◆ m_indicesAndWeights

linkAndWeightCollType CaloClusterCellLink::m_indicesAndWeights
private

Definition at line 228 of file CaloClusterCellLink.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
skel.it
it
Definition: skel.GENtoEVGEN.py:396
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57