CMS 3D CMS Logo

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