CMS 3D CMS Logo

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