CMS 3D CMS Logo

TIBLayer.cc
Go to the documentation of this file.
1 #include "TIBLayer.h"
2 
4 
6 
7 #include "LayerCrossingSide.h"
8 #include "DetGroupMerger.h"
10 
15 
17 
18 TIBLayer::TIBLayer(std::vector<const TIBRing*>& innerRings, std::vector<const TIBRing*>& outerRings)
19  : TBLayer(innerRings, outerRings, GeomDetEnumerators::TIB) {
20  theComps.assign(theInnerComps.begin(), theInnerComps.end());
21  theComps.insert(theComps.end(), theOuterComps.begin(), theOuterComps.end());
22 
23  std::sort(theComps.begin(), theComps.end(), isDetLessZ);
24  std::sort(theInnerComps.begin(), theInnerComps.end(), isDetLessZ);
25  std::sort(theOuterComps.begin(), theOuterComps.end(), isDetLessZ);
26 
27  for (auto& it : theComps) {
28  theBasicComps.insert(theBasicComps.end(), it->basicComponents().begin(), it->basicComponents().end());
29  }
30 
31  // initialize the surface
34  initialize();
35 
36  LogDebug("TkDetLayers") << "==== DEBUG TIBLayer =====";
37  LogDebug("TkDetLayers") << "innerCyl radius, thickness, lenght: " << theInnerCylinder->radius() << " , "
38  << theInnerCylinder->bounds().thickness() << " , " << theInnerCylinder->bounds().length();
39 
40  LogDebug("TkDetLayers") << "outerCyl radius, thickness, lenght: " << theOuterCylinder->radius() << " , "
41  << theOuterCylinder->bounds().thickness() << " , " << theOuterCylinder->bounds().length();
42 
43  LogDebug("TkDetLayers") << "Cyl radius, thickness, lenght: " << specificSurface().radius() << " , "
44  << specificSurface().bounds().thickness() << " , " << specificSurface().bounds().length();
45 
46  for (auto& i : theInnerComps) {
47  LogDebug("TkDetLayers") << "inner TIBRing pos z,radius,eta,phi: " << i->position().z() << " , "
48  << i->position().perp() << " , " << i->position().eta() << " , " << i->position().phi();
49  }
50 
51  for (auto& i : theOuterComps) {
52  LogDebug("TkDetLayers") << "outer TIBRing pos z,radius,eta,phi: " << i->position().z() << " , "
53  << i->position().perp() << " , " << i->position().eta() << " , " << i->position().phi();
54  }
55 
56  // initialise the bin finders
57  // vector<const GeometricSearchDet*> tmpIn;
58  //for (vector<const TIBRing*>::const_iterator i=theInnerRings.begin();
59  // i != theInnerRings.end(); i++) tmpIn.push_back(*i);
61 
63 }
64 
66 
67 BoundCylinder* TIBLayer::cylinder(const std::vector<const GeometricSearchDet*>& rings) {
68  float leftPos = rings.front()->surface().position().z();
69  float rightPos = rings.back()->surface().position().z();
70 
71  const BoundCylinder& frontRing = static_cast<const BoundCylinder&>(rings.front()->surface());
72  const BoundCylinder& backRing = static_cast<const BoundCylinder&>(rings.back()->surface());
73  float r = frontRing.radius();
74  const Bounds& leftBounds = frontRing.bounds();
75  const Bounds& rightBounds = backRing.bounds();
76 
77  //float r = rings.front()->specificSurface().radius();
78  //const Bounds& leftBounds = rings.front()->specificSurface().bounds();
79  //const Bounds& rightBounds = rings.back()->specificSurface().bounds();
80 
81  float thick = leftBounds.thickness() / 2;
82  float zmin = leftPos - leftBounds.length() / 2;
83  float zmax = rightPos + rightBounds.length() / 2;
84  float rmin = r - thick;
85  float rmax = r + thick;
86  float zpos = 0.5 * (leftPos + rightPos);
87 
88  auto scp = new SimpleCylinderBounds(rmin, rmax, zmin - zpos, zmax - zpos);
89  return new Cylinder(r, Surface::PositionType(0, 0, zpos), rings.front()->surface().rotation(), scp);
90 }
91 
92 std::tuple<bool, int, int> TIBLayer::computeIndexes(GlobalPoint gInnerPoint, GlobalPoint gOuterPoint) const {
93  int innerIndex = theInnerBinFinder.binIndex(gInnerPoint.z());
94  const GeometricSearchDet* innerRing = theInnerComps[innerIndex];
95  float innerDist = std::abs(innerRing->surface().position().z() - gInnerPoint.z());
96 
97  int outerIndex = theOuterBinFinder.binIndex(gOuterPoint.z());
98  const GeometricSearchDet* outerRing = theOuterComps[outerIndex];
99  float outerDist = std::abs(outerRing->surface().position().z() - gOuterPoint.z());
100 
101  return std::make_tuple(innerDist < outerDist, innerIndex, outerIndex);
102 }
103 
105  const Propagator& prop,
106  const MeasurementEstimator& est,
107  const SubLayerCrossing& crossing,
108  float window,
109  std::vector<DetGroup>& result,
110  bool checkClosest) const {
111  const GlobalPoint& gCrossingPos = crossing.position();
112 
113  const std::vector<const GeometricSearchDet*>& sLayer(subLayer(crossing.subLayerIndex()));
114 
115  int closestIndex = crossing.closestDetIndex();
116  int negStartIndex = closestIndex - 1;
117  int posStartIndex = closestIndex + 1;
118 
119  if (checkClosest) { // must decide if the closest is on the neg or pos side
120  if (gCrossingPos.z() < sLayer[closestIndex]->surface().position().z()) {
121  posStartIndex = closestIndex;
122  } else {
123  negStartIndex = closestIndex;
124  }
125  }
126 
127  typedef CompatibleDetToGroupAdder Adder;
128  for (int idet = negStartIndex; idet >= 0; idet--) {
129  const GeometricSearchDet* neighborRing = sLayer[idet];
130  if (!overlap(gCrossingPos, *neighborRing, window))
131  break;
132  if (!Adder::add(*neighborRing, tsos, prop, est, result))
133  break;
134  }
135  for (int idet = posStartIndex; idet < static_cast<int>(sLayer.size()); idet++) {
136  const GeometricSearchDet* neighborRing = sLayer[idet];
137  if (!overlap(gCrossingPos, *neighborRing, window))
138  break;
139  if (!Adder::add(*neighborRing, tsos, prop, est, result))
140  break;
141  }
142 }
143 
144 bool TIBLayer::overlap(const GlobalPoint& crossPoint, const GeometricSearchDet& det, float window) {
145  float halfLength = 0.5f * det.surface().bounds().length();
146 
147  // edm::LogInfo(TkDetLayers) << " TIBLayer: checking ring with z " << det.position().z();
148 
149  return std::abs(crossPoint.z() - det.position().z()) < (halfLength + window);
150 }
151 
153  const TrajectoryStateOnSurface& tsos,
154  const MeasurementEstimator& est) const {
155  // we assume the outer and inner rings have about same thickness...
156 
157  // edm::LogInfo(TkDetLayers) << "TIBLayer::computeWindowSize: Y axis of tangent plane is"
158  // << plane.toGlobal( LocalVector(0,1,0)) ;
159 
161  float yError = localError.y();
162 
163  // float tanTheta = std::tan( tsos.globalMomentum().theta());
164  auto gm = tsos.globalMomentum();
165  auto cotanTheta = gm.z() / gm.perp();
166  float thickCorrection = 0.5f * det->surface().bounds().thickness() * std::abs(cotanTheta);
167 
168  // FIXME: correct this in case of wide phi window !
169 
170  return yError + thickCorrection;
171 }
SubLayerCrossing::position
const GlobalPoint & position() const
Definition: SubLayerCrossings.h:14
SectorBuilder_Tib_cff.TIB
TIB
Definition: SectorBuilder_Tib_cff.py:16
MeasurementEstimator
Definition: MeasurementEstimator.h:19
HelixBarrelCylinderCrossing.h
mps_fire.i
i
Definition: mps_fire.py:355
DetLessZ.h
MessageLogger.h
GeomDet
Definition: GeomDet.h:27
GeneralBinFinderInZforGeometricSearchDet< float >
LayerCrossingSide.h
SimpleCylinderBounds.h
BarrelDetLayer::initialize
virtual void initialize()
Definition: BarrelDetLayer.cc:18
svgfig.window
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:643
Bounds
Definition: Bounds.h:18
TIBLayer::theInnerBinFinder
GeneralBinFinderInZforGeometricSearchDet< float > theInnerBinFinder
Definition: TIBLayer.h:39
GeometricSearchDet::position
virtual const Surface::PositionType & position() const
Returns position of the surface.
Definition: GeometricSearchDet.h:31
SiStripMonitorCluster_cfi.zmin
zmin
Definition: SiStripMonitorCluster_cfi.py:200
TBLayer::theInnerCylinder
ReferenceCountingPointer< BoundCylinder > theInnerCylinder
Definition: TBLayer.h:74
Bounds::length
virtual float length() const =0
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
SimpleCylinderBounds
Definition: SimpleCylinderBounds.h:19
Propagator
Definition: Propagator.h:44
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
DetLayerException.h
SiStripMonitorCluster_cfi.zmax
zmax
Definition: SiStripMonitorCluster_cfi.py:201
DetWithState
GeometricSearchDet::DetWithState DetWithState
Definition: TIBLayer.cc:16
TIBLayer::TIBLayer
TIBLayer(std::vector< const TIBRing * > &innerRings, std::vector< const TIBRing * > &outerRings) __attribute__((cold))
Definition: TIBLayer.cc:18
MeasurementEstimator.h
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
Vector2DBase
Definition: Vector2DBase.h:8
DetGroupMerger.h
Point3DBase< float, GlobalTag >
isDetLessZ
bool isDetLessZ(const GeometricSearchDet *a, const GeometricSearchDet *b)
Definition: DetLessZ.h:10
TBLayer::theComps
std::vector< const GeometricSearchDet * > theComps
Definition: TBLayer.h:69
Bounds::thickness
virtual float thickness() const =0
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
TIBLayer::~TIBLayer
~TIBLayer() override __attribute__((cold))
Definition: TIBLayer.cc:65
TBLayer::theBasicComps
std::vector< const GeomDet * > theBasicComps
Definition: TBLayer.h:72
PV2DBase::y
T y() const
Definition: PV2DBase.h:44
PVValHelper::add
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
Definition: PVValidationHelpers.cc:12
TBLayer::theOuterComps
std::vector< const GeometricSearchDet * > theOuterComps
Definition: TBLayer.h:71
SubLayerCrossing::closestDetIndex
int closestDetIndex() const
Definition: SubLayerCrossings.h:13
GeneralBinFinderInZforGeometricSearchDet::binIndex
int binIndex(T z) const override
returns an index in the valid range for the bin closest to Z
Definition: GeneralBinFinderInZforGeometricSearchDet.h:37
TBLayer::subLayer
const std::vector< const GeometricSearchDet * > & subLayer(int ind) const
Definition: TBLayer.h:51
GeometricSearchDet::DetWithState
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
Definition: GeometricSearchDet.h:19
TBLayer::theOuterCylinder
ReferenceCountingPointer< BoundCylinder > theOuterCylinder
Definition: TBLayer.h:75
CompatibleDetToGroupAdder.h
alignCSCRings.r
r
Definition: alignCSCRings.py:93
TIBLayer::computeIndexes
std::tuple< bool, int, int > computeIndexes(GlobalPoint gInnerPoint, GlobalPoint gOuterPoint) const override __attribute__((hot))
Definition: TIBLayer.cc:92
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
GeomDetEnumerators
Definition: GeomDetEnumerators.h:8
TIBLayer::cylinder
BoundCylinder * cylinder(const std::vector< const GeometricSearchDet * > &rings) __attribute__((cold))
Definition: TIBLayer.cc:67
TIBLayer::overlap
static bool overlap(const GlobalPoint &gpos, const GeometricSearchDet &ring, float window) __attribute__((hot))
Definition: TIBLayer.cc:144
TBLayer::theInnerComps
std::vector< const GeometricSearchDet * > theInnerComps
Definition: TBLayer.h:70
CompatibleDetToGroupAdder
Definition: CompatibleDetToGroupAdder.h:13
GeometricSearchDet::surface
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
BoundCylinder
TIBLayer::computeWindowSize
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const override __attribute__((hot))
Definition: TIBLayer.cc:152
SubLayerCrossing
Definition: SubLayerCrossings.h:7
SubLayerCrossing::subLayerIndex
int subLayerIndex() const
Definition: SubLayerCrossings.h:12
TIBLayer::searchNeighbors
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const override __attribute__((hot))
Definition: TIBLayer.cc:104
TIBLayer.h
Cylinder
Definition: Cylinder.h:19
mps_fire.result
result
Definition: mps_fire.py:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GeometricSearchDet
Definition: GeometricSearchDet.h:17
TIBLayer::theOuterBinFinder
GeneralBinFinderInZforGeometricSearchDet< float > theOuterBinFinder
Definition: TIBLayer.h:40
BarrelDetLayer::specificSurface
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
Definition: BarrelDetLayer.h:39
TBLayer
Definition: TBLayer.h:10
MeasurementEstimator::maximalLocalDisplacement
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0