CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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_
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_() {}
unsigned int size() const
Definition: CaloClusterer.h:25
const Grid & grid() const
std::vector< T > data_

Member Function Documentation

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
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(), and Jet.Jet::puJetId().

108 { return grid().eta(icell); }
float eta(int icell) const
Definition: CaloClusterer.h:28
const Grid & grid() const
template<typename T>
void l1tpf_calo::GridData< T >::fill ( const T val)
inline

Definition at line 135 of file CaloClusterer.h.

Referenced by l1tpf_calo::SimpleCaloLinkerBase::clearBase(), and l1tpf_calo::GridData< PreCluster >::zero().

135 { std::fill(data_.begin(), data_.end(), val); }
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
std::vector< T > data_
template<typename T>
const Grid& l1tpf_calo::GridData< T >::grid ( ) const
inline
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); }
int ieta(int icell) const
Definition: CaloClusterer.h:32
const Grid & grid() const
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); }
const Grid & grid() const
int iphi(int icell) const
Definition: CaloClusterer.h:33
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_
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_
virtual int find_cell(float eta, float phi) const =0
float eta(int icell) const
float phi(int icell) const
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_
virtual int find_cell(float eta, float phi) const =0
float eta(int icell) const
float phi(int icell) const
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_
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_
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_
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_
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__(), and ntupleDataFormat.Track::phiPull().

109 { return grid().phi(icell); }
float phi(int icell) const
Definition: CaloClusterer.h:29
const Grid & grid() const
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_
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

template<typename T>
std::vector<T> l1tpf_calo::GridData< T >::data_
private
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().

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