CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 BoundPlane&>((*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.);
65  RotationType rot;
66 
67  return new BoundCylinder( pos, rot,
68  SimpleCylinderBounds( theRmin, theRmax,
69  theZmin, theZmax));
70 }
71 
72 
73 pair<bool, TrajectoryStateOnSurface>
75  const Propagator& prop,
76  const MeasurementEstimator& est) const
77 {
78  if(theCylinder == 0) 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 ( !myState.isValid()) return make_pair( false, myState);
84 
85  // take into account the thickness of the layer
86  float deltaZ = surface().bounds().thickness()/2. /
87  fabs( tan( myState.globalDirection().theta()));
88 
89  // take into account the error on the predicted state
90  const float nSigma = 3.;
91  if (myState.hasError()) {
92  deltaZ += nSigma * sqrt( myState.cartesianError().position().czz());
93  }
94  //
95  // check z assuming symmetric bounds around position().z()
96  //
97  deltaZ += surface().bounds().length()/2;
98  return make_pair(fabs(myState.globalPosition().z()-surface().position().z())<deltaZ,
99  myState);
100 }
virtual BoundCylinder * computeSurface()
virtual void initialize()
GlobalPoint globalPosition() const
#define min(a, b)
Definition: mlp_lapack.h:161
double double double z
static std::vector< GlobalPoint > corners(const BoundPlane &)
Definition: BoundingBox.cc:24
bool contains(const Local3DPoint &p) const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:69
const T & max(const T &a, const T &b)
const CartesianTrajectoryError & cartesianError() const
T sqrt(T t)
Definition: SSEVec.h:28
T z() const
Definition: PV3DBase.h:58
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:9
GlobalError position() const
Position error submatrix.
void setSurface(BoundCylinder *cp)
virtual ~BarrelDetLayer()
virtual std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const
GlobalVector globalDirection() const