CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions
ForwardRingDiskBuilderFromDet Class Reference

#include <ForwardRingDiskBuilderFromDet.h>

Public Member Functions

std::pair< SimpleDiskBounds
*, float > 
computeBounds (const std::vector< const GeomDet * > &dets) const
 
BoundDiskoperator() (const std::vector< const GeomDet * > &dets) const
 

Detailed Description

As it's name indicates, it's a builder of BoundDisk from a collection of Dets. The disk has the minimal size fully containing all Dets.

Definition at line 19 of file ForwardRingDiskBuilderFromDet.h.

Member Function Documentation

pair< SimpleDiskBounds *, float > ForwardRingDiskBuilderFromDet::computeBounds ( const std::vector< const GeomDet * > &  dets) const

Definition at line 31 of file ForwardRingDiskBuilderFromDet.cc.

References BoundingBox::corners(), Vector3DBase< T, FrameTag >::dot(), F(), mps_fire::i, SiStripPI::max, min(), alignCSCRings::r, and Vector3DBase< T, FrameTag >::unit().

31  {
32  // go over all corners and compute maximum deviations from mean pos.
33  float rmin((**(dets.begin())).surface().position().perp());
34  float rmax(rmin);
35  float zmin((**(dets.begin())).surface().position().z());
36  float zmax(zmin);
37  for (vector<const GeomDet*>::const_iterator idet = dets.begin(); idet != dets.end(); idet++) {
38  /* ---- original implementation. Is it obsolete?
39  vector<DetUnit*> detUnits = (**idet).detUnits();
40  for (vector<DetUnit*>::const_iterator detu=detUnits.begin();
41  detu!=detUnits.end(); detu++) {
42  vector<GlobalPoint> corners = BoundingBox().corners(
43  dynamic_cast<const Plane&>((**detu).surface()));
44  }
45  ----- */
46  vector<GlobalPoint> corners = BoundingBox().corners((**idet).specificSurface());
47  for (vector<GlobalPoint>::const_iterator i = corners.begin(); i != corners.end(); i++) {
48  float r = i->perp();
49  float z = i->z();
50  rmin = min(rmin, r);
51  rmax = max(rmax, r);
52  zmin = min(zmin, z);
53  zmax = max(zmax, z);
54  }
55  // in addition to the corners we have to check the middle of the
56  // det +/- length/2, since the min (max) radius for typical fw
57  // dets is reached there
58 
59  float rdet = (**idet).position().perp();
60  float len = (**idet).surface().bounds().length();
61  float width = (**idet).surface().bounds().width();
62 
63  GlobalVector xAxis = (**idet).toGlobal(LocalVector(1, 0, 0));
64  GlobalVector yAxis = (**idet).toGlobal(LocalVector(0, 1, 0));
65  GlobalVector perpDir = GlobalVector((**idet).position() - GlobalPoint(0, 0, (**idet).position().z()));
66 
67  double xAxisCos = xAxis.unit().dot(perpDir.unit());
68  double yAxisCos = yAxis.unit().dot(perpDir.unit());
69 
70  if (fabs(xAxisCos) > fabs(yAxisCos)) {
71  rmin = min(rmin, rdet - width / 2.F);
72  rmax = max(rmax, rdet + width / 2.F);
73  } else {
74  rmin = min(rmin, rdet - len / 2.F);
75  rmax = max(rmax, rdet + len / 2.F);
76  }
77  }
78 
79  float zPos = (zmax + zmin) / 2.;
80  return make_pair(new SimpleDiskBounds(rmin, rmax, zmin - zPos, zmax - zPos), zPos);
81 }
Local3DVector LocalVector
Definition: LocalVector.h:12
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
T min(T a, T b)
Definition: MathUtil.h:58
Vector3DBase unit() const
Definition: Vector3DBase.h:54
static std::vector< GlobalPoint > corners(const Plane &)
Definition: BoundingBox.cc:20
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
Global3DVector GlobalVector
Definition: GlobalVector.h:10
BoundDisk * ForwardRingDiskBuilderFromDet::operator() ( const std::vector< const GeomDet * > &  dets) const

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

Definition at line 8 of file ForwardRingDiskBuilderFromDet.cc.

References makeMuonMisalignmentScenario::rot.

8  {
9  auto bo = computeBounds(dets);
10 
11  // LogDebug("DetLayers") << "Creating disk at Z: " << bo.second << "\n"
12  // << "Bounds are (rmin/rmax/thick) " << bo.first.innerRadius()
13  // << " / " << bo.first.outerRadius()
14  // << " / " << bo.first.thickness() ;
15 
16  // typedef Det::PositionType::BasicVectorType Vector;
17  // Vector posSum(0,0,0);
18  // for (vector<Det*>::const_iterator i=dets.begin(); i!=dets.end(); i++) {
19  // Vector pp = (**i).position().basicVector();
20  // // LogDebug("DetLayers") << " "<< (int) ( i-dets.begin()) << " at " << pp ;
21  // posSum += pp;
22  // }
23  // Det::PositionType meanPos( posSum/float(dets.size()));
24  // LogDebug("DetLayers") << " meanPos "<< meanPos ;
25 
26  Surface::PositionType pos(0., 0., bo.second);
28  return new BoundDisk(pos, rot, bo.first);
29 }
std::pair< SimpleDiskBounds *, float > computeBounds(const std::vector< const GeomDet * > &dets) const
Disk BoundDisk
Definition: BoundDisk.h:54