test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalDetRodRangeZPhi.cc
Go to the documentation of this file.
5 
6 #include <vector>
7 
8 using namespace std;
9 
11 
12  float dx = plane.bounds().width()/2.;
13  float dy = plane.bounds().length()/2.;
14  float dz = plane.bounds().thickness()/2.;
15 
16  // rods may be inverted (actually are in every other layer), so have to find out the
17  // orientation of the local frame
18  float deltaZ = (plane.toGlobal( LocalPoint( 0, 0, -dz)).perp() <
19  plane.toGlobal( LocalPoint( 0, 0, dz)).perp() ) ? -dz : dz ;
20 
21 
22  vector<Surface::GlobalPoint> corners(4);
23  corners[0] = plane.toGlobal( LocalPoint( -dx, -dy, deltaZ));
24  corners[1] = plane.toGlobal( LocalPoint( -dx, dy, deltaZ));
25  corners[2] = plane.toGlobal( LocalPoint( dx, -dy, deltaZ));
26  corners[3] = plane.toGlobal( LocalPoint( dx, dy, deltaZ));
27 
28  float phimin = corners[0].phi(); float phimax = phimin;
29  float zmin = corners[0].z(); float zmax = zmin;
30  for ( int i=1; i<4; i++) {
31  float phi = corners[i].phi();
32  if ( PhiLess()( phi, phimin)) phimin = phi;
33  if ( PhiLess()( phimax, phi)) phimax = phi;
34 
35  float z = corners[i].z();
36  if ( z < zmin) zmin = z;
37  if ( z > zmax) zmax = z;
38  }
39 
40  theZRange.first = zmin;
41  theZRange.second = zmax;
42  thePhiRange.first = phimin;
43  thePhiRange.second = phimax;
44 
45 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
int i
Definition: DBlmapReader.cc:9
virtual float length() const =0
T perp() const
Definition: PV3DBase.h:72
const Bounds & bounds() const
Definition: Surface.h:120
Definition: Plane.h:17
virtual float thickness() const =0
GlobalDetRodRangeZPhi(const Plane &RodPlane)
Geom::Phi< T > phi() const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
virtual float width() const =0