CMS 3D CMS Logo

BarrelDetLayer.cc
Go to the documentation of this file.
7 
8 using namespace std;
9 
11 
12 //--- Extension of the interface
13 void BarrelDetLayer::setSurface(BoundCylinder* cp) { theCylinder = cp; }
14 
15 bool BarrelDetLayer::contains(const Local3DPoint& p) const { return surface().bounds().inside(p); }
16 
17 void BarrelDetLayer::initialize() { setSurface(computeSurface()); }
18 
19 //--- protected methods
21  vector<const GeomDet*> comps = basicComponents();
22 
23  // Find extension in Z
24  float theRmin = comps.front()->position().perp();
25  float theRmax = theRmin;
26  float theZmin = comps.front()->position().z();
27  float theZmax = theZmin;
28  for (vector<const GeomDet*>::const_iterator deti = comps.begin(); deti != comps.end(); deti++) {
29  vector<GlobalPoint> corners = BoundingBox().corners(dynamic_cast<const Plane&>((*deti)->surface()));
30  for (vector<GlobalPoint>::const_iterator ic = corners.begin(); ic != corners.end(); ic++) {
31  float r = ic->perp();
32  float z = ic->z();
33  theRmin = min(theRmin, r);
34  theRmax = max(theRmax, r);
35  theZmin = min(theZmin, z);
36  theZmax = max(theZmax, z);
37  }
38  // in addition to the corners we have to check the middle of the
39  // det +/- thickness/2
40  // , since the min radius for some barrel dets is reached there
41  float rdet = (**deti).position().perp();
42  float thick = (**deti).surface().bounds().thickness();
43  theRmin = min(theRmin, rdet - thick / 2.F);
44  theRmax = max(theRmax, rdet + thick / 2.F);
45  }
46 
47  // By default the barrel layers are positioned at the center of the
48  // global frame, and the axes of their local frame coincide with
49  // those of the global grame (z along the cylinder axis)
50  PositionType pos(0., 0., 0.);
52 
53  auto scp = new SimpleCylinderBounds(theRmin, theRmax, theZmin, theZmax);
54  return new Cylinder(Cylinder::computeRadius(*scp), pos, rot, scp);
55 }
56 
57 pair<bool, TrajectoryStateOnSurface> BarrelDetLayer::compatible(const TrajectoryStateOnSurface& ts,
58  const Propagator& prop,
59  const MeasurementEstimator&) const {
60  if
61  UNLIKELY(theCylinder == nullptr)
62  edm::LogError("DetLayers") << "ERROR: BarrelDetLayer::compatible() is used before the layer surface is initialized";
63  // throw an exception? which one?
64 
65  TrajectoryStateOnSurface myState = prop.propagate(ts, specificSurface());
66  if
67  UNLIKELY(!myState.isValid()) return make_pair(false, myState);
68 
69  // check z assuming symmetric bounds around position().z()
70  auto z0 = std::abs(myState.globalPosition().z() - specificSurface().position().z());
71  auto deltaZ = 0.5f * bounds().length();
72  if (z0 < deltaZ)
73  return make_pair(true, myState);
74 
75  // take into account the thickness of the layer
76  deltaZ += 0.5f * bounds().thickness() * std::abs(myState.globalDirection().z()) / myState.globalDirection().perp();
77 
78  // take also into account the error on the predicted state
79  const float nSigma = 3.;
80  if (myState.hasError())
81  deltaZ += nSigma * sqrt(myState.cartesianError().position().czz());
82  //
83  // check z again
84  return make_pair(z0 < deltaZ, myState);
85 }
virtual BoundCylinder * computeSurface()
T perp() const
Definition: PV3DBase.h:69
virtual void initialize()
const CartesianTrajectoryError cartesianError() const
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const final
GlobalPoint globalPosition() const
bool contains(const Local3DPoint &p) const
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
void setSurface(BoundCylinder *cp)
const GlobalError position() const
Position error submatrix.
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
static std::vector< GlobalPoint > corners(const Plane &)
Definition: BoundingBox.cc:20
static float computeRadius(Bounds const &bounds)
Definition: Cylinder.h:28
#define UNLIKELY(x)
Definition: Likely.h:21
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
~BarrelDetLayer() override
GlobalVector globalDirection() const