CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GlobalDetRodRangeZPhi.cc
Go to the documentation of this file.
5 
6 #include <array>
7 
9  float dx = plane.bounds().width() / 2.;
10  float dy = plane.bounds().length() / 2.;
11  float dz = plane.bounds().thickness() / 2.;
12 
13  // rods may be inverted (actually are in every other layer), so have to find out the
14  // orientation of the local frame
15  float deltaZ =
16  (plane.toGlobal(LocalPoint(0, 0, -dz)).perp() < plane.toGlobal(LocalPoint(0, 0, dz)).perp()) ? -dz : dz;
17 
18  const std::array<Surface::GlobalPoint, 4> corners{{plane.toGlobal(LocalPoint(-dx, -dy, deltaZ)),
19  plane.toGlobal(LocalPoint(-dx, dy, deltaZ)),
20  plane.toGlobal(LocalPoint(dx, -dy, deltaZ)),
21  plane.toGlobal(LocalPoint(dx, dy, deltaZ))}};
22 
23  float phimin = corners[0].phi();
24  float phimax = phimin;
25 
26  float zmin = corners[0].z();
27  float zmax = zmin;
28 
29  for (const auto& corner : corners) {
30  float phi = corner.phi();
31  if (Geom::phiLess(phi, phimin))
32  phimin = phi;
33  if (Geom::phiLess(phimax, phi))
34  phimax = phi;
35 
36  float z = corner.z();
37  zmin = std::min(zmin, z);
38  zmax = std::max(zmax, z);
39  }
40 
41  theZRange.first = zmin;
42  theZRange.second = zmax;
43  thePhiRange.first = phimin;
44  thePhiRange.second = phimax;
45 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
virtual float length() const =0
T perp() const
Definition: PV3DBase.h:69
const Bounds & bounds() const
Definition: Surface.h:87
Definition: Plane.h:16
virtual float thickness() const =0
T min(T a, T b)
Definition: MathUtil.h:58
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
GlobalDetRodRangeZPhi(const Plane &RodPlane)
virtual float width() const =0