CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
l1tpf_calo::GridData< T > Class Template Reference

#include <CaloClusterer.h>

Public Member Functions

void clear ()
 
float eta (int icell) const
 
void fill (const T &val)
 
const Gridgrid () const
 
 GridData ()
 
 GridData (const Grid &grid)
 
int ieta (int icell) const
 
int iphi (int icell) const
 
const Tneigh (int icell, unsigned int idx) const
 
Toperator() (float eta, float phi)
 
const Toperator() (float eta, float phi) const
 
GridData< T > & operator+= (const GridData< T > &other)
 
GridData< T > & operator= (const GridData< T > &other)
 
Toperator[] (int icell)
 
const Toperator[] (int icell) const
 
float phi (int icell) const
 
unsigned int size () const
 
void zero ()
 

Private Attributes

std::vector< Tdata_
 
const T empty_
 
const Gridgrid_
 

Detailed Description

template<typename T>
class l1tpf_calo::GridData< T >

Definition at line 96 of file CaloClusterer.h.

Constructor & Destructor Documentation

◆ GridData() [1/2]

template<typename T>
l1tpf_calo::GridData< T >::GridData ( )
inline

Definition at line 98 of file CaloClusterer.h.

98 : grid_(nullptr), data_(), empty_() {}
std::vector< T > data_

◆ GridData() [2/2]

template<typename T>
l1tpf_calo::GridData< T >::GridData ( const Grid grid)
inline

Definition at line 99 of file CaloClusterer.h.

99 : grid_(&grid), data_(grid.size()), empty_() {}
const Grid & grid() const
std::vector< T > data_
unsigned int size() const
Definition: CaloClusterer.h:25

Member Function Documentation

◆ clear()

template<typename T>
void l1tpf_calo::GridData< T >::clear ( void  )
inline

Definition at line 139 of file CaloClusterer.h.

Referenced by l1tpf_calo::SimpleCaloLinker::run().

139  {
140  for (T &t : data_)
141  t.clear();
142  }
std::vector< T > data_
long double T

◆ eta()

template<typename T>
float l1tpf_calo::GridData< T >::eta ( int  icell) const
inline

Definition at line 108 of file CaloClusterer.h.

Referenced by Particle.Particle::__str__(), Jet.Jet::jetID(), l1tpf_calo::GridData< PreCluster >::operator()(), and Jet.Jet::puJetId().

108 { return grid().eta(icell); }
float eta(int icell) const
Definition: CaloClusterer.h:28
const Grid & grid() const

◆ fill()

template<typename T>
void l1tpf_calo::GridData< T >::fill ( const T val)
inline

◆ grid()

template<typename T>
const Grid& l1tpf_calo::GridData< T >::grid ( ) const
inline

◆ ieta()

template<typename T>
int l1tpf_calo::GridData< T >::ieta ( int  icell) const
inline

Definition at line 110 of file CaloClusterer.h.

110 { return grid().ieta(icell); }
const Grid & grid() const
int ieta(int icell) const
Definition: CaloClusterer.h:32

◆ iphi()

template<typename T>
int l1tpf_calo::GridData< T >::iphi ( int  icell) const
inline

Definition at line 111 of file CaloClusterer.h.

111 { return grid().iphi(icell); }
int iphi(int icell) const
Definition: CaloClusterer.h:33
const Grid & grid() const

◆ neigh()

template<typename T>
const T& l1tpf_calo::GridData< T >::neigh ( int  icell,
unsigned int  idx 
) const
inline

Definition at line 116 of file CaloClusterer.h.

116  {
117  int ineigh = grid_->neighbour(icell, idx);
118  return (ineigh < 0 ? empty_ : data_[ineigh]);
119  }
int neighbour(int icell, unsigned int idx) const
Definition: CaloClusterer.h:27
std::vector< T > data_

◆ operator()() [1/2]

template<typename T>
T& l1tpf_calo::GridData< T >::operator() ( float  eta,
float  phi 
)
inline

Definition at line 101 of file CaloClusterer.h.

101 { return data_[grid_->find_cell(eta, phi)]; }
std::vector< T > data_
float eta(int icell) const
float phi(int icell) const
virtual int find_cell(float eta, float phi) const =0

◆ operator()() [2/2]

template<typename T>
const T& l1tpf_calo::GridData< T >::operator() ( float  eta,
float  phi 
) const
inline

Definition at line 102 of file CaloClusterer.h.

102 { return data_[grid_->find_cell(eta, phi)]; }
std::vector< T > data_
float eta(int icell) const
float phi(int icell) const
virtual int find_cell(float eta, float phi) const =0

◆ operator+=()

template<typename T>
GridData<T>& l1tpf_calo::GridData< T >::operator+= ( const GridData< T > &  other)
inline

Definition at line 126 of file CaloClusterer.h.

126  {
127  assert(grid_ == other.grid_);
128  for (unsigned int i = 0, n = data_.size(); i < n; ++i) {
129  data_[i] += other.data_[i];
130  }
131  return *this;
132  }
assert(be >=bs)
std::vector< T > data_

◆ operator=()

template<typename T>
GridData<T>& l1tpf_calo::GridData< T >::operator= ( const GridData< T > &  other)
inline

Definition at line 121 of file CaloClusterer.h.

121  {
122  assert(grid_ == other.grid_);
123  data_ = other.data_;
124  return *this;
125  }
assert(be >=bs)
std::vector< T > data_

◆ operator[]() [1/2]

template<typename T>
T& l1tpf_calo::GridData< T >::operator[] ( int  icell)
inline

Definition at line 113 of file CaloClusterer.h.

113 { return data_[icell]; }
std::vector< T > data_

◆ operator[]() [2/2]

template<typename T>
const T& l1tpf_calo::GridData< T >::operator[] ( int  icell) const
inline

Definition at line 114 of file CaloClusterer.h.

114 { return data_[icell]; }
std::vector< T > data_

◆ phi()

template<typename T>
float l1tpf_calo::GridData< T >::phi ( int  icell) const
inline

Definition at line 109 of file CaloClusterer.h.

Referenced by Particle.Particle::__str__(), l1tpf_calo::GridData< PreCluster >::operator()(), and ntupleDataFormat.Track::phiPull().

109 { return grid().phi(icell); }
const Grid & grid() const
float phi(int icell) const
Definition: CaloClusterer.h:29

◆ size()

template<typename T>
unsigned int l1tpf_calo::GridData< T >::size ( void  ) const
inline

Definition at line 106 of file CaloClusterer.h.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

106 { return data_.size(); }
std::vector< T > data_

◆ zero()

template<typename T>
void l1tpf_calo::GridData< T >::zero ( )
inline

Definition at line 136 of file CaloClusterer.h.

136 { fill(T()); }
void fill(const T &val)
long double T

Member Data Documentation

◆ data_

template<typename T>
std::vector<T> l1tpf_calo::GridData< T >::data_
private

◆ empty_

template<typename T>
const T l1tpf_calo::GridData< T >::empty_
private

Definition at line 147 of file CaloClusterer.h.

Referenced by l1tpf_calo::GridData< PreCluster >::neigh().

◆ grid_

template<typename T>
const Grid* l1tpf_calo::GridData< T >::grid_
private