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

◆ AxisType

Enumerator
Bounded 
Circular 

Definition at line 62 of file HGCalHistoSeedingImpl.h.

62 { Bounded, Circular };

Constructor & Destructor Documentation

◆ Navigator() [1/2]

HGCalHistoSeedingImpl::Navigator::Navigator ( )
inline

◆ Navigator() [2/2]

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

◆ move()

std::array<int, 2> HGCalHistoSeedingImpl::Navigator::move ( int  offset1,
int  offset2 
)
inline

Definition at line 77 of file HGCalHistoSeedingImpl.h.

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

77 { return {{offset<0>(offset1), offset<1>(offset2)}}; }

◆ offset()

template<unsigned N>
int HGCalHistoSeedingImpl::Navigator::offset ( int  shift)
inline

Definition at line 80 of file HGCalHistoSeedingImpl.h.

References axis_types_, bins_, Bounded, Circular, home_, 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

◆ setHome()

void HGCalHistoSeedingImpl::Navigator::setHome ( int  x1,
int  x2 
)
inline

Definition at line 69 of file HGCalHistoSeedingImpl.h.

References bins_, Exception, home_, 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

◆ axis_types_

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

Definition at line 103 of file HGCalHistoSeedingImpl.h.

Referenced by offset().

◆ bins_

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

Definition at line 104 of file HGCalHistoSeedingImpl.h.

Referenced by offset(), and setHome().

◆ home_

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

Definition at line 105 of file HGCalHistoSeedingImpl.h.

Referenced by offset(), and setHome().