CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions
PlaneBuilderForGluedDet Class Reference

#include <PlaneBuilderForGluedDet.h>

Public Types

typedef ReferenceCountingPointer< PlaneResultType
 

Public Member Functions

ResultType plane (const std::vector< const GeomDetUnit * > &dets) const
 

Private Member Functions

std::pair< RectangularPlaneBounds *, GlobalVectorcomputeRectBounds (const std::vector< const GeomDetUnit * > &dets, const Plane &plane) const
 
Surface::RotationType computeRotation (const std::vector< const GeomDetUnit * > &dets, const Surface::PositionType &meanPos) const
 

Detailed Description

Builds the minimal rectangular box that contains all input GeomDetUnits fully.

Definition at line 15 of file PlaneBuilderForGluedDet.h.

Member Typedef Documentation

◆ ResultType

Warning, remember to assign this pointer to a ReferenceCountingPointer! Should be changed to return a ReferenceCountingPointer<BoundPlane>

Definition at line 19 of file PlaneBuilderForGluedDet.h.

Member Function Documentation

◆ computeRectBounds()

std::pair< RectangularPlaneBounds *, GlobalVector > PlaneBuilderForGluedDet::computeRectBounds ( const std::vector< const GeomDetUnit * > &  dets,
const Plane plane 
) const
private

Definition at line 31 of file PlaneBuilderForGluedDet.cc.

32  {
33  // go over all corners and compute maximum deviations from mean pos.
34  std::vector<GlobalPoint> corners;
35  for (auto det : dets) {
36  const Plane& bplane = dynamic_cast<const Plane&>(det->surface());
37  std::vector<GlobalPoint> dc = BoundingBox().corners(bplane);
38  corners.insert(corners.end(), dc.begin(), dc.end());
39  }
40 
41  float xmin(0), xmax(0), ymin(0), ymax(0), zmin(0), zmax(0);
42  for (std::vector<GlobalPoint>::const_iterator i = corners.begin(), cend = corners.end(); i != cend; ++i) {
43  LocalPoint p = plane.toLocal(*i);
44  if (p.x() < xmin)
45  xmin = p.x();
46  if (p.x() > xmax)
47  xmax = p.x();
48  if (p.y() < ymin)
49  ymin = p.y();
50  if (p.y() > ymax)
51  ymax = p.y();
52  if (p.z() < zmin)
53  zmin = p.z();
54  if (p.z() > zmax)
55  zmax = p.z();
56  }
57 
58  LocalVector localOffset((xmin + xmax) / 2., (ymin + ymax) / 2., (zmin + zmax) / 2.);
59  GlobalVector offset(plane.toGlobal(localOffset));
60 
61  std::pair<RectangularPlaneBounds*, GlobalVector> result(
62  new RectangularPlaneBounds((xmax - xmin) / 2, (ymax - ymin) / 2, (zmax - zmin) / 2), offset);
63 
64  return result;
65 }

References BoundingBox::corners(), mps_fire::i, hltrates_dqm_sourceclient-live_cfg::offset, AlCaHLTBitMon_ParallelJobs::p, plane(), mps_fire::result, TrackerOfflineValidation_Dqm_cff::xmax, TrackerOfflineValidation_Dqm_cff::xmin, L1TOccupancyClient_cfi::ymax, L1TOccupancyClient_cfi::ymin, SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

Referenced by plane().

◆ computeRotation()

Surface::RotationType PlaneBuilderForGluedDet::computeRotation ( const std::vector< const GeomDetUnit * > &  dets,
const Surface::PositionType meanPos 
) const
private

Definition at line 67 of file PlaneBuilderForGluedDet.cc.

68  {
69  // choose first mono out-pointing rotation
70  // the rotations of GluedDets coincide with the mono part
71  // Simply take the x,y of the first Det if z points out,
72  // or -x, y if it doesn't
73  const BoundPlane& plane = dynamic_cast<const BoundPlane&>(dets.front()->surface());
74  //GlobalVector n = plane.normalVector();
75 
78  GlobalVector planeYAxis = plane.toGlobal(LocalVector(0, 1, 0));
79  if (planeYAxis.z() < 0)
80  yAxis = -planeYAxis;
81  else
82  yAxis = planeYAxis;
83 
84  GlobalVector planeXAxis = plane.toGlobal(LocalVector(1, 0, 0));
85  GlobalVector n = planeXAxis.cross(planeYAxis);
86 
87  if (n.x() * meanPos.x() + n.y() * meanPos.y() > 0) {
88  xAxis = planeXAxis;
89  } else {
90  xAxis = -planeXAxis;
91  }
92 
94 }

References Vector3DBase< T, FrameTag >::cross(), dqmiodumpmetadata::n, plane(), HLT_FULL_cff::xAxis, HLT_FULL_cff::yAxis, and PV3DBase< T, PVType, FrameType >::z().

◆ plane()

PlaneBuilderForGluedDet::ResultType PlaneBuilderForGluedDet::plane ( const std::vector< const GeomDetUnit * > &  dets) const

Definition at line 10 of file PlaneBuilderForGluedDet.cc.

10  {
11  // find mean position
13  Vector posSum(0, 0, 0);
14  for (auto det : dets) {
15  posSum += (*det).surface().position().basicVector();
16  }
17  Surface::PositionType meanPos(posSum / float(dets.size()));
18 
19  Surface::RotationType rotation = dets.front()->surface().rotation();
20  // Surface::RotationType rotation = computeRotation( dets, meanPos);
21  Plane tmpPlane = Plane(meanPos, rotation);
22 
23  // Take the medium properties from the first DetUnit
24  const MediumProperties& mp = dets.front()->surface().mediumProperties();
25  MediumProperties newmp(mp.radLen() * 2.0, mp.xi() * 2.0);
26 
27  std::pair<RectangularPlaneBounds*, GlobalVector> bo = computeRectBounds(dets, tmpPlane);
28  return new Plane(meanPos + bo.second, rotation, newmp, bo.first);
29 }

References computeRectBounds(), MediumProperties::radLen(), idealTransformation::rotation, and MediumProperties::xi().

Referenced by TrackerGeomBuilderFromGeometricDet::buildGeomDet(), computeRectBounds(), and computeRotation().

Vector3DBase< float, LocalTag >
TkRotation< float >
mps_fire.i
i
Definition: mps_fire.py:428
PlaneBuilderForGluedDet::computeRectBounds
std::pair< RectangularPlaneBounds *, GlobalVector > computeRectBounds(const std::vector< const GeomDetUnit * > &dets, const Plane &plane) const
Definition: PlaneBuilderForGluedDet.cc:31
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
MediumProperties::radLen
float radLen() const
Definition: MediumProperties.h:20
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiStripMonitorCluster_cfi.zmin
zmin
Definition: SiStripMonitorCluster_cfi.py:200
GloballyPositioned< float >::RotationType
TkRotation< float > RotationType
Definition: GloballyPositioned.h:22
Vector
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
PlaneBuilderForGluedDet::plane
ResultType plane(const std::vector< const GeomDetUnit * > &dets) const
Definition: PlaneBuilderForGluedDet.cc:10
BoundingBox
Definition: BoundingBox.h:12
L1TOccupancyClient_cfi.ymax
ymax
Definition: L1TOccupancyClient_cfi.py:43
SiStripMonitorCluster_cfi.zmax
zmax
Definition: SiStripMonitorCluster_cfi.py:201
Point3DBase< float, LocalTag >
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
HLT_FULL_cff.yAxis
yAxis
Definition: HLT_FULL_cff.py:46156
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
LocalVector
Local3DVector LocalVector
Definition: LocalVector.h:12
Vector3DBase::cross
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:110
MediumProperties
Definition: MediumProperties.h:12
RectangularPlaneBounds
Definition: RectangularPlaneBounds.h:12
L1TOccupancyClient_cfi.ymin
ymin
Definition: L1TOccupancyClient_cfi.py:43
MediumProperties::xi
float xi() const
Definition: MediumProperties.h:24
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
BoundPlane
Plane
Definition: Plane.h:16
HLT_FULL_cff.xAxis
xAxis
Definition: HLT_FULL_cff.py:46154
BoundingBox::corners
static std::vector< GlobalPoint > corners(const Plane &)
Definition: BoundingBox.cc:20
mps_fire.result
result
Definition: mps_fire.py:311
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
Basic3DVector< float >