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.

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().

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 }
Definition: Plane.h:16
ResultType plane(const std::vector< const GeomDetUnit *> &dets) const
static std::vector< GlobalPoint > corners(const Plane &)
Definition: BoundingBox.cc:20

◆ 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.

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

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 }
Local3DVector LocalVector
Definition: LocalVector.h:12
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:110
T z() const
Definition: PV3DBase.h:61
ResultType plane(const std::vector< const GeomDetUnit *> &dets) const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
TkRotation< float > RotationType

◆ plane()

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

Definition at line 10 of file PlaneBuilderForGluedDet.cc.

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

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

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 }
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
Definition: Plane.h:16
float radLen() const
float xi() const
std::pair< RectangularPlaneBounds *, GlobalVector > computeRectBounds(const std::vector< const GeomDetUnit *> &dets, const Plane &plane) const