CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ForwardDetLayer.cc
Go to the documentation of this file.
6 
7 using namespace std;
8 
10  theDisk(0)
11  //theRmin(0), theRmax(0), theZmin(0), theZmax(0)
12 {}
13 
14 
16 }
17 
18 
19 //--- Extension of the interface
21  theDisk = cp;
22 }
23 
25  return surface().bounds().inside(p);
26 }
27 
28 
31 }
32 
33 
35  LogDebug("DetLayers") << "ForwaLayer::computeSurface callded" ;
36  vector<const GeomDet*> comps= basicComponents();
37 
38  vector<const GeomDet*>::const_iterator ifirst = comps.begin();
39  vector<const GeomDet*>::const_iterator ilast = comps.end();
40 
41  // Find extension in R
42  float theRmin = components().front()->position().perp();
43  float theRmax = theRmin;
44  float theZmin = components().back()->position().z();
45  float theZmax = theZmin;
46  for ( vector<const GeomDet*>::const_iterator deti = ifirst;
47  deti != ilast; deti++) {
48  vector<GlobalPoint> corners =
49  BoundingBox().corners( dynamic_cast<const BoundPlane&>((**deti).surface()));
50  for (vector<GlobalPoint>::const_iterator ic = corners.begin();
51  ic != corners.end(); ic++) {
52  float r = ic->perp();
53  LogDebug("DetLayers") << "corner.perp(): " << r ;
54  float z = ic->z();
55  theRmin = min( theRmin, r);
56  theRmax = max( theRmax, r);
57  theZmin = min( theZmin, z);
58  theZmax = max( theZmax, z);
59  }
60 
61  // in addition to the corners we have to check the middle of the
62  // det +/- length/2
63  // , since the min (max) radius for typical fw dets is reached there
64 
65  float rdet = (**deti).position().perp();
66  float len = (**deti).surface().bounds().length();
67  float width = (**deti).surface().bounds().width();
68 
69  GlobalVector xAxis = (**deti).toGlobal(LocalVector(1,0,0));
70  GlobalVector yAxis = (**deti).toGlobal(LocalVector(0,1,0));
71  GlobalVector perpDir = GlobalVector( (**deti).position() - GlobalPoint(0,0,(**deti).position().z()) );
72 
73  double xAxisCos = xAxis.unit().dot(perpDir.unit());
74  double yAxisCos = yAxis.unit().dot(perpDir.unit());
75 
76  LogDebug("DetLayers") << "in ForwardDetLayer::computeSurface(),xAxisCos,yAxisCos: " << xAxisCos << " , " << yAxisCos ;
77  LogDebug("DetLayers") << "det pos.perp,length,width: "
78  << rdet << " , "
79  << len << " , "
80  << width ;
81 
82  if( fabs(xAxisCos) > fabs(yAxisCos) ) {
83  theRmin = min( theRmin, rdet-width/2.F);
84  theRmax = max( theRmax, rdet+width/2.F);
85  }else{
86  theRmin = min( theRmin, rdet-len/2.F);
87  theRmax = max( theRmax, rdet+len/2.F);
88  }
89  }
90 
91 
92  LogDebug("DetLayers") << "creating SimpleDiskBounds with r range" << theRmin << " "
93  << theRmax << " and z range " << theZmin << " " << theZmax ;
94 
95  // By default the forward layers are positioned around the z axis of the
96  // global frame, and the axes of their local frame coincide with
97  // those of the global grame (z along the disk axis)
98  float zPos = (theZmax+theZmin)/2.;
99  PositionType pos(0.,0.,zPos);
100  RotationType rot;
101 
102  return new BoundDisk( pos, rot,
103  SimpleDiskBounds( theRmin, theRmax,
104  theZmin-zPos, theZmax-zPos));
105 }
106 
107 
108 pair<bool, TrajectoryStateOnSurface>
110  const Propagator& prop,
111  const MeasurementEstimator& est) const
112 {
113  if(theDisk == 0) edm::LogError("DetLayers")
114  << "ERROR: BarrelDetLayer::compatible() is used before the layer surface is initialized" ;
115  // throw an exception? which one?
116 
117  TrajectoryStateOnSurface myState = prop.propagate( ts, specificSurface());
118  if ( !myState.isValid()) return make_pair( false, myState);
119 
120  // take into account the thickness of the layer
121  float deltaR = surface().bounds().thickness()/2. *
122  fabs( tan( myState.localDirection().theta()));
123 
124  // take into account the error on the predicted state
125  const float nSigma = 3.;
126  if (myState.hasError()) {
127  LocalError err = myState.localError().positionError();
128  // ignore correlation for the moment...
129  deltaR += nSigma * sqrt(err.xx() + err.yy());
130  }
131 
132  float zPos = (zmax()+zmin())/2.;
133  SimpleDiskBounds tmp( rmin()-deltaR, rmax()+deltaR,
134  zmin()-zPos, zmax()-zPos);
135 
136  return make_pair( tmp.inside(myState.localPosition()), myState);
137 }
#define LogDebug(id)
float xx() const
Definition: LocalError.h:19
virtual BoundDisk * computeSurface()
Local3DVector LocalVector
Definition: LocalVector.h:12
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
double zPos
LocalVector localDirection() const
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
void setSurface(BoundDisk *cp)
float rmin() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
virtual const std::vector< const GeometricSearchDet * > & components() const =0
Returns basic components, if any.
#define min(a, b)
Definition: mlp_lapack.h:161
float zmin() const
LocalError positionError() const
static std::vector< GlobalPoint > corners(const BoundPlane &)
Definition: BoundingBox.cc:24
Geom::Theta< T > theta() const
Definition: PV3DBase.h:69
virtual ~ForwardDetLayer()
virtual float thickness() const =0
virtual bool inside(const Local3DPoint &p) const
Determine if the point is inside the bounds.
Definition: DDAxes.h:10
float yy() const
Definition: LocalError.h:21
const T & max(const T &a, const T &b)
virtual void initialize()
T sqrt(T t)
Definition: SSEVec.h:28
virtual const BoundDisk & specificSurface() const
bool contains(const Local3DPoint &p) const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
ReferenceCountingPointer< BoundDisk > theDisk
const LocalTrajectoryError & localError() const
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:9
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
Vector3DBase unit() const
Definition: Vector3DBase.h:57
float zmax() const
const Bounds & bounds() const
Definition: BoundSurface.h:89
virtual const std::vector< const GeomDet * > & basicComponents() const =0
virtual std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
float rmax() const
Global3DVector GlobalVector
Definition: GlobalVector.h:10