CMS 3D CMS Logo

ForwardRingDiskBuilderFromDet.cc
Go to the documentation of this file.
4 
5 using namespace std;
6 
7 // Warning, remember to assign this pointer to a ReferenceCountingPointer!
8 BoundDisk* ForwardRingDiskBuilderFromDet::operator()(const vector<const GeomDet*>& dets) const {
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 }
30 
31 pair<SimpleDiskBounds*, float> ForwardRingDiskBuilderFromDet::computeBounds(const vector<const GeomDet*>& dets) const {
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 }
Vector3DBase
Definition: Vector3DBase.h:8
TkRotation< float >
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
mps_fire.i
i
Definition: mps_fire.py:355
min
T min(T a, T b)
Definition: MathUtil.h:58
pos
Definition: PixelAliasList.h:18
ForwardRingDiskBuilderFromDet.h
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
SiStripMonitorCluster_cfi.zmin
zmin
Definition: SiStripMonitorCluster_cfi.py:200
BoundingBox.h
BoundDisk
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
SimpleDiskBounds
Definition: SimpleDiskBounds.h:11
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
BoundingBox
Definition: BoundingBox.h:12
SiStripMonitorCluster_cfi.zmax
zmax
Definition: SiStripMonitorCluster_cfi.py:201
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
ForwardRingDiskBuilderFromDet::computeBounds
std::pair< SimpleDiskBounds *, float > computeBounds(const std::vector< const GeomDet * > &dets) const
Definition: ForwardRingDiskBuilderFromDet.cc:31
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
LocalVector
Local3DVector LocalVector
Definition: LocalVector.h:12
alignCSCRings.r
r
Definition: alignCSCRings.py:93
std
Definition: JetResolutionObject.h:76
HLT_2018_cff.xAxis
xAxis
Definition: HLT_2018_cff.py:44410
ForwardRingDiskBuilderFromDet::operator()
BoundDisk * operator()(const std::vector< const GeomDet * > &dets) const
Definition: ForwardRingDiskBuilderFromDet.cc:8
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
BoundingBox::corners
static std::vector< GlobalPoint > corners(const Plane &)
Definition: BoundingBox.cc:20
SimpleDiskBounds.h
HLT_2018_cff.yAxis
yAxis
Definition: HLT_2018_cff.py:44412
BoundDisk
Disk BoundDisk
Definition: BoundDisk.h:54