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 (float eta, float phi) const
 
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 (float eta, float phi) 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 142 of file CaloClusterer.h.

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

142  {
143  for (T &t : data_)
144  t.clear();
145  }
std::vector< T > data_
long double T

◆ eta() [1/2]

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

Definition at line 104 of file CaloClusterer.h.

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

104 { return grid().eta(grid_->find_cell(eta, phi)); }
float eta(int icell) const
Definition: CaloClusterer.h:28
const Grid & grid() const
float phi(float eta, float phi) const
float eta(float eta, float phi) const
virtual int find_cell(float eta, float phi) const =0

◆ eta() [2/2]

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

Definition at line 111 of file CaloClusterer.h.

Referenced by Particle.Particle::__str__(), Jet.Jet::jetID(), and Jet.Jet::puJetId().

111 { 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 113 of file CaloClusterer.h.

113 { 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 114 of file CaloClusterer.h.

114 { 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 119 of file CaloClusterer.h.

119  {
120  int ineigh = grid_->neighbour(icell, idx);
121  return (ineigh < 0 ? empty_ : data_[ineigh]);
122  }
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)]; }
float phi(float eta, float phi) const
std::vector< T > data_
float eta(float eta, float phi) 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)]; }
float phi(float eta, float phi) const
std::vector< T > data_
float eta(float eta, float phi) 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 129 of file CaloClusterer.h.

129  {
130  assert(grid_ == other.grid_);
131  for (unsigned int i = 0, n = data_.size(); i < n; ++i) {
132  data_[i] += other.data_[i];
133  }
134  return *this;
135  }
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 124 of file CaloClusterer.h.

124  {
125  assert(grid_ == other.grid_);
126  data_ = other.data_;
127  return *this;
128  }
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 116 of file CaloClusterer.h.

116 { 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 117 of file CaloClusterer.h.

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

◆ phi() [1/2]

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

◆ phi() [2/2]

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

Definition at line 112 of file CaloClusterer.h.

Referenced by Particle.Particle::__str__(), and ntupleDataFormat.Track::phiPull().

112 { 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 109 of file CaloClusterer.h.

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

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

◆ zero()

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

Definition at line 139 of file CaloClusterer.h.

139 { 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 150 of file CaloClusterer.h.

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

◆ grid_

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