CMS 3D CMS Logo

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 ()
 
void operator() (const Det &det)
 
BoundCylinderoperator() (std::vector< const Det * >::const_iterator first, std::vector< const Det * >::const_iterator last) const
 

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.

Definition at line 18 of file CylinderBuilderFromDet.h.

Member Typedef Documentation

◆ Det

Definition at line 20 of file CylinderBuilderFromDet.h.

◆ PositionType

Definition at line 21 of file CylinderBuilderFromDet.h.

◆ RotationType

Definition at line 22 of file CylinderBuilderFromDet.h.

◆ Vector

Definition at line 23 of file CylinderBuilderFromDet.h.

Constructor & Destructor Documentation

◆ CylinderBuilderFromDet()

CylinderBuilderFromDet::CylinderBuilderFromDet ( )
inline

Member Function Documentation

◆ build()

BoundCylinder * CylinderBuilderFromDet::build ( ) const

Definition at line 78 of file CylinderBuilderFromDet.cc.

78  {
79  PositionType pos(0, 0, 0.5 * (zmin + zmax));
80  RotationType rot; // only "barrel" orientation supported
81 
82  auto scp = new SimpleCylinderBounds(rmin, rmax, zmin - pos.z(), zmax - pos.z());
83  return new Cylinder(Cylinder::computeRadius(*scp), pos, rot, scp);
84 }

References Cylinder::computeRadius(), makeMuonMisalignmentScenario::rot, SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

◆ operator()() [1/2]

void CylinderBuilderFromDet::operator() ( const Det det)

Definition at line 59 of file CylinderBuilderFromDet.cc.

59  {
60  BoundingBox bb(dynamic_cast<const Plane&>(det.surface()));
61  for (int nc = 0; nc < 8; ++nc) {
62  float r = bb[nc].perp();
63  float z = bb[nc].z();
64  rmin = std::min(rmin, r);
65  rmax = std::max(rmax, r);
66  zmin = std::min(zmin, z);
67  zmax = std::max(zmax, z);
68  }
69  // in addition to the corners we have to check the middle of the
70  // det +/- thickness/2
71  // , since the min radius for some barrel dets is reached there
72  float rdet = det.surface().position().perp();
73  float halfThick = det.surface().bounds().thickness() / 2.F;
74  rmin = std::min(rmin, rdet - halfThick);
75  rmax = std::max(rmax, rdet + halfThick);
76 }

References Surface::bounds(), SiStripPI::max, min(), PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), alignCSCRings::r, GeomDet::surface(), Bounds::thickness(), SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

◆ operator()() [2/2]

BoundCylinder * CylinderBuilderFromDet::operator() ( std::vector< const Det * >::const_iterator  first,
std::vector< const Det * >::const_iterator  last 
) const

Definition at line 8 of file CylinderBuilderFromDet.cc.

9  {
10  // find mean position and radius
12  Vector posSum(0, 0, 0);
13  float rSum = 0;
14  for (vector<const Det*>::const_iterator i = first; i != last; i++) {
15  posSum += (**i).surface().position().basicVector();
16  rSum += (**i).surface().position().perp();
17  }
18  float div(1 / float(last - first));
19  PositionType meanPos(div * posSum);
20  float meanR(div * rSum);
21 
22  // find max deviations from mean pos in Z and from mean R
23  float rmin = meanR;
24  float rmax = meanR;
25  float zmin = meanPos.z();
26  float zmax = meanPos.z();
27  for (vector<const Det*>::const_iterator i = first; i != last; i++) {
28  vector<GlobalPoint> corners = BoundingBox::corners(dynamic_cast<const Plane&>((**i).surface()));
29  for (vector<GlobalPoint>::const_iterator ic = corners.begin(); ic != corners.end(); ic++) {
30  float r = ic->perp();
31  float z = ic->z();
32  rmin = min(rmin, r);
33  rmax = max(rmax, r);
34  zmin = min(zmin, z);
35  zmax = max(zmax, z);
36  }
37  // in addition to the corners we have to check the middle of the
38  // det +/- thickness/2
39  // , since the min radius for some barrel dets is reached there
40  float rdet = (**i).surface().position().perp();
41  float halfThick = (**i).surface().bounds().thickness() / 2.F;
42  rmin = min(rmin, rdet - halfThick);
43  rmax = max(rmax, rdet + halfThick);
44  }
45 
46  // the transverse position is zero by construction.
47  // the Z position is the average between zmin and zmax, since the bounds
48  // are symmetric
49  // for the same reason the R is the average between rmin and rmax,
50  // but this is done by the Bounds anyway.
51 
52  PositionType pos(0, 0, 0.5 * (zmin + zmax));
53  RotationType rot; // only "barrel" orientation supported
54 
55  auto scp = new SimpleCylinderBounds(rmin, rmax, zmin - pos.z(), zmax - pos.z());
56  return new Cylinder(Cylinder::computeRadius(*scp), pos, rot, scp);
57 }

References Cylinder::computeRadius(), BoundingBox::corners(), first, mps_fire::i, dqmdumpme::last, SiStripPI::max, min(), Basic3DVector< T >::perp(), alignCSCRings::r, makeMuonMisalignmentScenario::rot, PV3DBase< T, PVType, FrameType >::z(), SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

Member Data Documentation

◆ rmax

float CylinderBuilderFromDet::rmax
private

Definition at line 40 of file CylinderBuilderFromDet.h.

◆ rmin

float CylinderBuilderFromDet::rmin
private

Definition at line 39 of file CylinderBuilderFromDet.h.

◆ zmax

float CylinderBuilderFromDet::zmax
private

Definition at line 42 of file CylinderBuilderFromDet.h.

◆ zmin

float CylinderBuilderFromDet::zmin
private

Definition at line 41 of file CylinderBuilderFromDet.h.

CylinderBuilderFromDet::rmax
float rmax
Definition: CylinderBuilderFromDet.h:40
CylinderBuilderFromDet::rmin
float rmin
Definition: CylinderBuilderFromDet.h:39
mps_fire.i
i
Definition: mps_fire.py:428
CylinderBuilderFromDet::RotationType
Surface::RotationType RotationType
Definition: CylinderBuilderFromDet.h:22
min
T min(T a, T b)
Definition: MathUtil.h:58
pos
Definition: PixelAliasList.h:18
CylinderBuilderFromDet::PositionType
Surface::PositionType PositionType
Definition: CylinderBuilderFromDet.h:21
Vector
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
SimpleCylinderBounds
Definition: SimpleCylinderBounds.h:19
dqmdumpme.last
last
Definition: dqmdumpme.py:56
BoundingBox
Definition: BoundingBox.h:12
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
DDAxes::z
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
Bounds::thickness
virtual float thickness() const =0
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
CylinderBuilderFromDet::zmin
float zmin
Definition: CylinderBuilderFromDet.h:41
alignCSCRings.r
r
Definition: alignCSCRings.py:93
CylinderBuilderFromDet::zmax
float zmax
Definition: CylinderBuilderFromDet.h:42
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
GeometricSearchDet::surface
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
BoundingBox::corners
static std::vector< GlobalPoint > corners(const Plane &)
Definition: BoundingBox.cc:20
Cylinder::computeRadius
static float computeRadius(Bounds const &bounds)
Definition: Cylinder.h:28
Cylinder
Definition: Cylinder.h:19
CylinderBuilderFromDet::Vector
PositionType::BasicVectorType Vector
Definition: CylinderBuilderFromDet.h:23
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
Point3DBase< float, GlobalTag >::BasicVectorType
BaseClass::BasicVectorType BasicVectorType
Definition: Point3DBase.h:17