CMS 3D CMS Logo

BoundSpan.cc
Go to the documentation of this file.
5 
7 
8 void BoundSpan::compute(Surface const & plane) {
9  const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
10  const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
11 
12  Surface::GlobalPoint corners[8];
13 
14  if (trapezoidalBounds) {
15  std::array<const float, 4> const & parameters = (*trapezoidalBounds).parameters();
16 
17  auto hbotedge = parameters[0];
18  auto htopedge = parameters[1];
19  auto hapothem = parameters[3];
20  auto thickness = (*trapezoidalBounds).thickness();
21 
22  corners[0] = plane.toGlobal( LocalPoint( -htopedge, hapothem, thickness/2));
23  corners[1] = plane.toGlobal( LocalPoint( htopedge, hapothem, thickness/2));
24  corners[2] = plane.toGlobal( LocalPoint( hbotedge, -hapothem, thickness/2));
25  corners[3] = plane.toGlobal( LocalPoint( -hbotedge, -hapothem, thickness/2));
26  corners[4] = plane.toGlobal( LocalPoint( -htopedge, hapothem, -thickness/2));
27  corners[5] = plane.toGlobal( LocalPoint( htopedge, hapothem, -thickness/2));
28  corners[6] = plane.toGlobal( LocalPoint( hbotedge, -hapothem, -thickness/2));
29  corners[7] = plane.toGlobal( LocalPoint( -hbotedge, -hapothem, -thickness/2));
30 
31  }else if(rectangularBounds) {
32  auto length = rectangularBounds->length();
33  auto width = rectangularBounds->width();
34  auto thickness = (*rectangularBounds).thickness();
35 
36  corners[0] = plane.toGlobal( LocalPoint( -width/2, -length/2, thickness/2));
37  corners[1] = plane.toGlobal( LocalPoint( -width/2, +length/2, thickness/2));
38  corners[2] = plane.toGlobal( LocalPoint( +width/2, -length/2, thickness/2));
39  corners[3] = plane.toGlobal( LocalPoint( +width/2, +length/2, thickness/2));
40  corners[4] = plane.toGlobal( LocalPoint( -width/2, -length/2, -thickness/2));
41  corners[5] = plane.toGlobal( LocalPoint( -width/2, +length/2, -thickness/2));
42  corners[6] = plane.toGlobal( LocalPoint( +width/2, -length/2, -thickness/2));
43  corners[7] = plane.toGlobal( LocalPoint( +width/2, +length/2, -thickness/2));
44  }else{
45 
46  }
47 
48  float phimin = corners[0].barePhi(); float phimax = phimin;
49  float zmin = corners[0].z(); float zmax = zmin;
50  float rmin = corners[0].perp2(); float rmax = rmin;
51  for ( int i = 1; i < 8; i++ ) {
52  auto cPhi = corners[i].barePhi();
53  if ( Geom::phiLess( cPhi, phimin)) { phimin = cPhi; }
54  if ( Geom::phiLess( phimax, cPhi)) { phimax = cPhi; }
55  auto z = corners[i].z();
56  if ( z < zmin) zmin = z;
57  if ( z > zmax) zmax = z;
58  auto r = corners[i].perp2();
59  if ( r < rmin) rmin = r;
60  if ( r > rmax) rmax = r;
61 
62  }
63  m_zSpan.first = zmin;
64  m_zSpan.second = zmax;
65  m_rSpan.first = std::sqrt(rmin);
66  m_rSpan.second = std::sqrt(rmax);
67  m_phiSpan.first = phimin;
68  m_phiSpan.second = phimax;
69 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
const Bounds & bounds() const
Definition: Surface.h:120
std::pair< float, float > m_zSpan
Definition: BoundSpan.h:28
T sqrt(T t)
Definition: SSEVec.h:18
std::pair< float, float > m_rSpan
Definition: BoundSpan.h:29
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:23
void compute(Surface const &plane)
Definition: BoundSpan.cc:8
std::pair< float, float > m_phiSpan
Definition: BoundSpan.h:27