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

Definition at line 64 of file HGCalHistoSeedingImpl.h.

64 : axis_types_({{AxisType::Bounded, AxisType::Bounded}}), bins_({{0, 0}}), home_({{0, 0}}) {}

References Bounded.

◆ 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}}) {}

Member Function Documentation

◆ move()

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

Definition at line 77 of file HGCalHistoSeedingImpl.h.

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

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

◆ offset()

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

Definition at line 80 of file HGCalHistoSeedingImpl.h.

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  }

References axis_types_, bins_, Bounded, Circular, home_, SiStripPI::max, and edm::shift.

◆ setHome()

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

Definition at line 69 of file HGCalHistoSeedingImpl.h.

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  }

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

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

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().

testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
HGCalHistoSeedingImpl::Navigator::home_
std::array< int, 2 > home_
Definition: HGCalHistoSeedingImpl.h:105
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
HGCalHistoSeedingImpl::Navigator::bins_
std::array< int, 2 > bins_
Definition: HGCalHistoSeedingImpl.h:104
HGCalHistoSeedingImpl::Navigator::AxisType::Bounded
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
Exception
Definition: hltDiff.cc:246
HGCalHistoSeedingImpl::Navigator::axis_types_
std::array< AxisType, 2 > axis_types_
Definition: HGCalHistoSeedingImpl.h:103
HGCalHistoSeedingImpl::Navigator::AxisType::Circular