CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions
RodPlaneBuilderFromDet Class Reference

#include <RodPlaneBuilderFromDet.h>

Public Types

typedef GeomDet Det
 

Public Member Functions

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

Detailed Description

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

Definition at line 15 of file RodPlaneBuilderFromDet.h.

Member Typedef Documentation

◆ Det

Definition at line 17 of file RodPlaneBuilderFromDet.h.

Member Function Documentation

◆ computeBounds()

pair< RectangularPlaneBounds *, GlobalVector > RodPlaneBuilderFromDet::computeBounds ( const std::vector< const Det * > &  dets,
const Plane plane 
) const

Definition at line 33 of file RodPlaneBuilderFromDet.cc.

34  {
35  // go over all corners and compute maximum deviations from mean pos.
36  vector<GlobalPoint> corners;
37  for (vector<const Det*>::const_iterator idet = dets.begin(); idet != dets.end(); idet++) {
38  /* ---- original implementation. Is it obsolete?
39  vector<const DetUnit*> detUnits = (**idet).basicComponents();
40  for (vector<const DetUnit*>::const_iterator detu=detUnits.begin();
41  detu!=detUnits.end(); detu++) {
42  vector<GlobalPoint> dc =
43  BoundingBox().corners((**detu).specificSurface());
44  corners.insert( corners.end(), dc.begin(), dc.end());
45  }
46  ---- */
47 
48  // temporary implementation (May be the final one if the GluedDet surface
49  // really contains both the mono and the stereo surfaces
50  vector<GlobalPoint> dc = BoundingBox().corners((**idet).specificSurface());
51  corners.insert(corners.end(), dc.begin(), dc.end());
52  }
53 
54  float xmin(0), xmax(0), ymin(0), ymax(0), zmin(0), zmax(0);
55  for (vector<GlobalPoint>::const_iterator i = corners.begin(); i != corners.end(); i++) {
56  LocalPoint p = plane.toLocal(*i);
57  if (p.x() < xmin)
58  xmin = p.x();
59  if (p.x() > xmax)
60  xmax = p.x();
61  if (p.y() < ymin)
62  ymin = p.y();
63  if (p.y() > ymax)
64  ymax = p.y();
65  if (p.z() < zmin)
66  zmin = p.z();
67  if (p.z() > zmax)
68  zmax = p.z();
69  }
70 
71  LocalVector localOffset((xmin + xmax) / 2., (ymin + ymax) / 2., (zmin + zmax) / 2.);
72  GlobalVector offset(plane.toGlobal(localOffset));
73 
74  pair<RectangularPlaneBounds*, GlobalVector> result(
75  new RectangularPlaneBounds((xmax - xmin) / 2, (ymax - ymin) / 2, (zmax - zmin) / 2), offset);
76 
77  return result;
78 }

References BoundingBox::corners(), mps_fire::i, hltrates_dqm_sourceclient-live_cfg::offset, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, Surface::toGlobal(), GloballyPositioned< T >::toLocal(), TrackerOfflineValidation_Dqm_cff::xmax, TrackerOfflineValidation_Dqm_cff::xmin, L1TOccupancyClient_cfi::ymax, L1TOccupancyClient_cfi::ymin, SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

◆ computeRotation()

Surface::RotationType RodPlaneBuilderFromDet::computeRotation ( const std::vector< const Det * > &  dets,
const Surface::PositionType meanPos 
) const

Definition at line 80 of file RodPlaneBuilderFromDet.cc.

81  {
82  // choose first mono out-pointing rotation
83  // the rotations of GluedDets coincide with the mono part
84  // Simply take the x,y of the first Det if z points out,
85  // or -x, y if it doesn't
86  const Plane& plane = dynamic_cast<const Plane&>(dets.front()->surface());
87  //GlobalVector n = plane.normalVector();
88 
91  GlobalVector planeYAxis = plane.toGlobal(LocalVector(0, 1, 0));
92  if (planeYAxis.z() < 0)
93  yAxis = -planeYAxis;
94  else
95  yAxis = planeYAxis;
96 
97  GlobalVector planeXAxis = plane.toGlobal(LocalVector(1, 0, 0));
98  GlobalVector n = planeXAxis.cross(planeYAxis);
99 
100  if (n.x() * meanPos.x() + n.y() * meanPos.y() > 0) {
101  xAxis = planeXAxis;
102  } else {
103  xAxis = -planeXAxis;
104  }
105 
106  // LogDebug("DetLayers") << "Creating rotation with x,y axis "
107  // << xAxis << ", " << yAxis ;
108 
110 }

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

◆ operator()()

Plane * RodPlaneBuilderFromDet::operator() ( const std::vector< const Det * > &  dets) const

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

Definition at line 10 of file RodPlaneBuilderFromDet.cc.

10  {
11  // find mean position
13  Vector posSum(0, 0, 0);
14  for (vector<const Det*>::const_iterator i = dets.begin(); i != dets.end(); i++) {
15  posSum += (**i).surface().position().basicVector();
16  }
17  Surface::PositionType meanPos(posSum / float(dets.size()));
18 
19  // temporary plane - for the computation of bounds
21  Plane tmpPlane(meanPos, rotation);
22  auto bo = computeBounds(dets, tmpPlane);
23 
24  // LogDebug("DetLayers") << "Creating plane at position " << meanPos
25  // << " displaced by " << bo.second ;
26  // LogDebug("DetLayers") << "Bounds are (wid/len/thick) " << bo.first.width()
27  // << " / " << bo.first.length()
28  // << " / " << bo.first.thickness() ;
29 
30  return new Plane(meanPos + bo.second, rotation, bo.first);
31 }

References mps_fire::i, and idealTransformation::rotation.

Vector3DBase< float, LocalTag >
TkRotation< float >
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RodPlaneBuilderFromDet::computeRotation
Surface::RotationType computeRotation(const std::vector< const Det * > &dets, const Surface::PositionType &meanPos) const
Definition: RodPlaneBuilderFromDet.cc:80
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
BoundingBox
Definition: BoundingBox.h:12
L1TOccupancyClient_cfi.ymax
ymax
Definition: L1TOccupancyClient_cfi.py:43
SiStripMonitorCluster_cfi.zmax
zmax
Definition: SiStripMonitorCluster_cfi.py:201
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Point3DBase< float, LocalTag >
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
RodPlaneBuilderFromDet::computeBounds
std::pair< RectangularPlaneBounds *, GlobalVector > computeBounds(const std::vector< const Det * > &dets, const Plane &plane) const
Definition: RodPlaneBuilderFromDet.cc:33
HLT_FULL_cff.yAxis
yAxis
Definition: HLT_FULL_cff.py:46210
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
RectangularPlaneBounds
Definition: RectangularPlaneBounds.h:12
L1TOccupancyClient_cfi.ymin
ymin
Definition: L1TOccupancyClient_cfi.py:43
GloballyPositioned::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Definition: GloballyPositioned.h:98
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
Plane
Definition: Plane.h:16
HLT_FULL_cff.xAxis
xAxis
Definition: HLT_FULL_cff.py:46208
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 >