CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
CylinderBuilderFromDet Class Reference

#include <CylinderBuilderFromDet.h>

Public Types

typedef GeomDet Det
 
typedef Surface::PositionType PositionType
 
typedef Surface::RotationType RotationType
 
typedef
PositionType::BasicVectorType 
Vector
 

Public Member Functions

BoundCylinderbuild () const
 
 CylinderBuilderFromDet ()
 
BoundCylinderoperator() (std::vector< const Det * >::const_iterator first, std::vector< const Det * >::const_iterator last) const
 
void operator() (const Det &det)
 

Private Attributes

float rmax
 
float rmin
 
float zmax
 
float zmin
 

Detailed Description

Given a container of GeomDets, constructs a cylinder of minimal dimensions that contains all of the Dets completely (all corners etc.) Useful for defining a BarrelDetLayer from a group of DetUnits.

Date:
2007/03/07 16:28:39
Revision:
1.3

Definition at line 20 of file CylinderBuilderFromDet.h.

Member Typedef Documentation

Definition at line 22 of file CylinderBuilderFromDet.h.

Definition at line 23 of file CylinderBuilderFromDet.h.

Definition at line 24 of file CylinderBuilderFromDet.h.

Definition at line 25 of file CylinderBuilderFromDet.h.

Constructor & Destructor Documentation

CylinderBuilderFromDet::CylinderBuilderFromDet ( )
inline

Member Function Documentation

BoundCylinder * CylinderBuilderFromDet::build ( ) const

Definition at line 83 of file CylinderBuilderFromDet.cc.

References pos, and PV3DBase< T, PVType, FrameType >::z().

83  {
84 
85  PositionType pos( 0, 0, 0.5*(zmin+zmax));
86  RotationType rot; // only "barrel" orientation supported
87 
88  return new BoundCylinder( pos, rot,
90  zmin-pos.z(), zmax-pos.z()));
91 }
Surface::RotationType RotationType
Surface::PositionType PositionType
BoundCylinder * CylinderBuilderFromDet::operator() ( std::vector< const Det * >::const_iterator  first,
std::vector< const Det * >::const_iterator  last 
) const

Definition at line 9 of file CylinderBuilderFromDet.cc.

References BoundingBox::corners(), i, prof2calltree::last, max(), min, Basic3DVector< T >::perp(), pos, csvReporter::r, detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

11 {
12  // find mean position and radius
14  Vector posSum(0,0,0);
15  float rSum = 0;
16  for (vector<const Det*>::const_iterator i=first; i!=last; i++) {
17  posSum += (**i).surface().position().basicVector();
18  rSum += (**i).surface().position().perp();
19  }
20  float div(1/float(last-first));
21  PositionType meanPos( div*posSum);
22  float meanR( div*rSum);
23 
24  // find max deviations from mean pos in Z and from mean R
25  float rmin = meanR;
26  float rmax = meanR;
27  float zmin = meanPos.z();
28  float zmax = meanPos.z();
29  for (vector<const Det*>::const_iterator i=first; i!=last; i++) {
30  vector<GlobalPoint> corners =
31  BoundingBox::corners( dynamic_cast<const BoundPlane&>((**i).surface()));
32  for (vector<GlobalPoint>::const_iterator ic = corners.begin();
33  ic != corners.end(); ic++) {
34  float r = ic->perp();
35  float z = ic->z();
36  rmin = min( rmin, r);
37  rmax = max( rmax, r);
38  zmin = min( zmin, z);
39  zmax = max( zmax, z);
40  }
41  // in addition to the corners we have to check the middle of the
42  // det +/- thickness/2
43  // , since the min radius for some barrel dets is reached there
44  float rdet = (**i).surface().position().perp();
45  float halfThick = (**i).surface().bounds().thickness() / 2.F;
46  rmin = min( rmin, rdet-halfThick);
47  rmax = max( rmax, rdet+halfThick);
48  }
49 
50  // the transverse position is zero by construction.
51  // the Z position is the average between zmin and zmax, since the bounds
52  // are symmetric
53  // for the same reason the R is the average between rmin and rmax,
54  // but this is done by the Bounds anyway.
55 
56  PositionType pos( 0, 0, 0.5*(zmin+zmax));
57  RotationType rot; // only "barrel" orientation supported
58 
59  return new BoundCylinder( pos, rot,
60  SimpleCylinderBounds( rmin, rmax,
61  zmin-pos.z(), zmax-pos.z()));
62 }
int i
Definition: DBlmapReader.cc:9
BaseClass::BasicVectorType BasicVectorType
Definition: Point3DBase.h:19
#define min(a, b)
Definition: mlp_lapack.h:161
double double double z
PositionType::BasicVectorType Vector
static std::vector< GlobalPoint > corners(const BoundPlane &)
Definition: BoundingBox.cc:24
const T & max(const T &a, const T &b)
Surface::RotationType RotationType
bool first
Definition: L1TdeRCT.cc:79
Surface::PositionType PositionType
void CylinderBuilderFromDet::operator() ( const Det det)

Definition at line 64 of file CylinderBuilderFromDet.cc.

References BoundSurface::bounds(), max(), min, PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), csvReporter::r, GeomDet::surface(), Bounds::thickness(), and detailsBasic3DVector::z.

64  {
65  BoundingBox bb( dynamic_cast<const BoundPlane&>(det.surface()));
66  for (int nc=0; nc<8; ++nc) {
67  float r = bb[nc].perp();
68  float z = bb[nc].z();
69  rmin = std::min( rmin, r);
70  rmax = std::max( rmax, r);
71  zmin = std::min( zmin, z);
72  zmax = std::max( zmax, z);
73  }
74  // in addition to the corners we have to check the middle of the
75  // det +/- thickness/2
76  // , since the min radius for some barrel dets is reached there
77  float rdet = det.surface().position().perp();
78  float halfThick = det.surface().bounds().thickness() / 2.F;
79  rmin = std::min( rmin, rdet-halfThick);
80  rmax = std::max( rmax, rdet+halfThick);
81 }
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
T perp() const
Definition: PV3DBase.h:66
#define min(a, b)
Definition: mlp_lapack.h:161
double double double z
virtual float thickness() const =0
const T & max(const T &a, const T &b)
const Bounds & bounds() const
Definition: BoundSurface.h:89
const PositionType & position() const

Member Data Documentation

float CylinderBuilderFromDet::rmax
private

Definition at line 42 of file CylinderBuilderFromDet.h.

float CylinderBuilderFromDet::rmin
private

Definition at line 41 of file CylinderBuilderFromDet.h.

float CylinderBuilderFromDet::zmax
private

Definition at line 44 of file CylinderBuilderFromDet.h.

float CylinderBuilderFromDet::zmin
private

Definition at line 43 of file CylinderBuilderFromDet.h.