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