CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
boundSpan Namespace Reference

Functions

void computeSpan (BoundSurface &plane)
 

Function Documentation

void boundSpan::computeSpan ( BoundSurface plane)

Definition at line 10 of file BoundSpan.cc.

References PV3DBase< T, PVType, FrameType >::barePhi(), BoundSurface::bounds(), i, BoundSurface::m_phiSpan, BoundSurface::m_zSpan, ExpressReco_HICollisions_FallBack::parameters, Geom::phiLess(), Surface::toGlobal(), tablePrinter::width, and z.

Referenced by BoundSurface::computeSpan().

10  {
11  typedef std::pair<float, float> return_type;
12  const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
13  const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
14 
15  Surface::GlobalPoint corners[8];
16 
17  if (trapezoidalBounds) {
18  std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
19 
20  float hbotedge = parameters[0];
21  float htopedge = parameters[1];
22  float hapothem = parameters[3];
23  float thickness = (*trapezoidalBounds).thickness();
24 
25  corners[0] = plane.toGlobal( LocalPoint( -htopedge, hapothem, thickness/2));
26  corners[1] = plane.toGlobal( LocalPoint( htopedge, hapothem, thickness/2));
27  corners[2] = plane.toGlobal( LocalPoint( hbotedge, -hapothem, thickness/2));
28  corners[3] = plane.toGlobal( LocalPoint( -hbotedge, -hapothem, thickness/2));
29  corners[4] = plane.toGlobal( LocalPoint( -htopedge, hapothem, -thickness/2));
30  corners[5] = plane.toGlobal( LocalPoint( htopedge, hapothem, -thickness/2));
31  corners[6] = plane.toGlobal( LocalPoint( hbotedge, -hapothem, -thickness/2));
32  corners[7] = plane.toGlobal( LocalPoint( -hbotedge, -hapothem, -thickness/2));
33 
34  }else if(rectangularBounds) {
35  float length = rectangularBounds->length();
36  float width = rectangularBounds->width();
37  float thickness = (*rectangularBounds).thickness();
38 
39  corners[0] = plane.toGlobal( LocalPoint( -width/2, -length/2, thickness/2));
40  corners[1] = plane.toGlobal( LocalPoint( -width/2, +length/2, thickness/2));
41  corners[2] = plane.toGlobal( LocalPoint( +width/2, -length/2, thickness/2));
42  corners[3] = plane.toGlobal( LocalPoint( +width/2, +length/2, thickness/2));
43  corners[4] = plane.toGlobal( LocalPoint( -width/2, -length/2, -thickness/2));
44  corners[5] = plane.toGlobal( LocalPoint( -width/2, +length/2, -thickness/2));
45  corners[6] = plane.toGlobal( LocalPoint( +width/2, -length/2, -thickness/2));
46  corners[7] = plane.toGlobal( LocalPoint( +width/2, +length/2, -thickness/2));
47  }else{
48 
49  }
50 
51  float phimin = corners[0].barePhi(); float phimax = phimin;
52  float zmin = corners[0].z(); float zmax = zmin;
53  for ( int i = 1; i < 8; i++ ) {
54  float cPhi = corners[i].barePhi();
55  if ( Geom::phiLess( cPhi, phimin)) { phimin = cPhi; }
56  if ( Geom::phiLess( phimax, cPhi)) { phimax = cPhi; }
57  float z = corners[i].z();
58  if ( z < zmin) zmin = z;
59  if ( z > zmax) zmax = z;
60  }
61  plane.m_zSpan.first = zmin;
62  plane.m_zSpan.second = zmax;
63  plane.m_phiSpan.first = phimin;
64  plane.m_phiSpan.second = phimax;
65 
66 
67  }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
int i
Definition: DBlmapReader.cc:9
T barePhi() const
Definition: PV3DBase.h:62
Definition: DDAxes.h:10
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:57
const Bounds & bounds() const
Definition: BoundSurface.h:89
std::pair< float, float > m_zSpan
Definition: BoundSurface.h:102
std::pair< float, float > m_phiSpan
Definition: BoundSurface.h:101
Local3DPoint LocalPoint
Definition: LocalPoint.h:11