CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
HGCalHistoSeedingImpl::Navigator Class Reference

Public Types

enum  AxisType { AxisType::Bounded, AxisType::Circular }
 

Public Member Functions

std::array< int, 2 > move (int offset1, int offset2)
 
 Navigator ()
 
 Navigator (int bins1, AxisType type_axis1, int bins2, AxisType type_axis2)
 
template<unsigned N>
int offset (int shift)
 
void setHome (int x1, int x2)
 

Private Attributes

std::array< AxisType, 2 > axis_types_
 
std::array< int, 2 > bins_
 
std::array< int, 2 > home_
 

Detailed Description

Definition at line 60 of file HGCalHistoSeedingImpl.h.

Member Enumeration Documentation

Enumerator
Bounded 
Circular 

Definition at line 62 of file HGCalHistoSeedingImpl.h.

62 { Bounded, Circular };

Constructor & Destructor Documentation

HGCalHistoSeedingImpl::Navigator::Navigator ( )
inline
HGCalHistoSeedingImpl::Navigator::Navigator ( int  bins1,
AxisType  type_axis1,
int  bins2,
AxisType  type_axis2 
)
inline

Definition at line 66 of file HGCalHistoSeedingImpl.h.

67  : axis_types_({{type_axis1, type_axis2}}), bins_({{bins1, bins2}}), home_({{0, 0}}) {}
std::array< AxisType, 2 > axis_types_

Member Function Documentation

std::array<int, 2> HGCalHistoSeedingImpl::Navigator::move ( int  offset1,
int  offset2 
)
inline
template<unsigned N>
int HGCalHistoSeedingImpl::Navigator::offset ( int  shift)
inline

Definition at line 80 of file HGCalHistoSeedingImpl.h.

References SiStripPI::max, and edm::shift.

80  {
81  int shifted = std::get<N>(home_);
82  int max = std::get<N>(bins_);
83  switch (std::get<N>(axis_types_)) {
84  case AxisType::Bounded:
85  shifted += shift;
86  if (shifted < 0 || shifted >= max)
87  shifted = -1;
88  break;
89  case AxisType::Circular:
90  shifted += shift;
91  while (shifted < 0)
92  shifted += max;
93  while (shifted >= max)
94  shifted -= max;
95  break;
96  default:
97  break;
98  }
99  return shifted;
100  }
std::array< AxisType, 2 > axis_types_
static unsigned int const shift
void HGCalHistoSeedingImpl::Navigator::setHome ( int  x1,
int  x2 
)
inline

Definition at line 69 of file HGCalHistoSeedingImpl.h.

References Exception, testProducerWithPsetDescEmpty_cfi::x1, and testProducerWithPsetDescEmpty_cfi::x2.

Referenced by HGCalHistoSeedingImpl::computeInterpolatedMaxSeeds(), HGCalHistoSeedingImpl::computeMaxSeeds(), and HGCalHistoSeedingImpl::fillSmoothHistoClusters().

69  {
70  if (x1 < 0 || x2 < 0 || x1 >= std::get<0>(bins_) || x2 >= std::get<1>(bins_)) {
71  throw cms::Exception("OutOfBound") << "Setting invalid navigator home position (" << x1 << "," << x2 << "\n)";
72  }
73  home_[0] = x1;
74  home_[1] = x2;
75  }

Member Data Documentation

std::array<AxisType, 2> HGCalHistoSeedingImpl::Navigator::axis_types_
private

Definition at line 103 of file HGCalHistoSeedingImpl.h.

std::array<int, 2> HGCalHistoSeedingImpl::Navigator::bins_
private

Definition at line 104 of file HGCalHistoSeedingImpl.h.

std::array<int, 2> HGCalHistoSeedingImpl::Navigator::home_
private

Definition at line 105 of file HGCalHistoSeedingImpl.h.