CMS 3D CMS Logo

RectangularEtaPhiRegion.h
Go to the documentation of this file.
1 #ifndef DataFormats_Math_RectangularEtaPhiRegion_h
2 #define DataFormats_Math_RectangularEtaPhiRegion_h
3 
5 
7 public:
8  RectangularEtaPhiRegion(float etaLow, float etaHigh, float phiLow, float phiHigh)
9  : ceta(0.5f * (etaHigh + etaLow)), deta(0.5f * std::abs(etaHigh - etaLow)) {
11  constexpr float c1 = 2. * M_PI;
12  if (phiHigh < phiLow)
13  phiHigh += c1;
14  dphi = 0.5f * (phiHigh - phiLow);
15  cphi = phiLow + dphi;
16  }
17 
18  bool inRegion(float eta, float phi) const {
19  return std::abs(eta - ceta) < deta && std::abs(proxim(phi, cphi) - cphi) < dphi;
20  }
21 
22  auto etaLow() const { return ceta - deta; }
23  auto etaHigh() const { return ceta + deta; }
24  auto phiLow() const { return cphi - dphi; }
25  auto phiHigh() const { return cphi + dphi; }
26 
27 private:
28  float ceta;
29  float deta;
30  float cphi;
31  float dphi;
32 };
33 
34 #endif
RectangularEtaPhiRegion::etaHigh
auto etaHigh() const
Definition: RectangularEtaPhiRegion.h:23
RectangularEtaPhiRegion::phiHigh
auto phiHigh() const
Definition: RectangularEtaPhiRegion.h:25
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
proxim
constexpr T proxim(T b, T a)
Definition: normalizedPhi.h:14
RectangularEtaPhiRegion
Definition: RectangularEtaPhiRegion.h:6
PVValHelper::eta
Definition: PVValidationHelpers.h:69
RectangularEtaPhiRegion::ceta
float ceta
Definition: RectangularEtaPhiRegion.h:28
normalizedPhi.h
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
RectangularEtaPhiRegion::cphi
float cphi
Definition: RectangularEtaPhiRegion.h:30
RectangularEtaPhiRegion::RectangularEtaPhiRegion
RectangularEtaPhiRegion(float etaLow, float etaHigh, float phiLow, float phiHigh)
Definition: RectangularEtaPhiRegion.h:8
DDAxes::phi
RectangularEtaPhiRegion::inRegion
bool inRegion(float eta, float phi) const
Definition: RectangularEtaPhiRegion.h:18
std
Definition: JetResolutionObject.h:76
RectangularEtaPhiRegion::deta
float deta
Definition: RectangularEtaPhiRegion.h:29
RectangularEtaPhiRegion::phiLow
auto phiLow() const
Definition: RectangularEtaPhiRegion.h:24
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RectangularEtaPhiRegion::dphi
float dphi
Definition: RectangularEtaPhiRegion.h:31
RectangularEtaPhiRegion::etaLow
auto etaLow() const
Definition: RectangularEtaPhiRegion.h:22