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 
116  // check z; (are we sure?????)
117  // auto z = myState.localPosition().z();
118  // if ( z<bounds().minZ | z>bounds().maxZ) return make_pair( false, myState);
119 
120  // check r
121  auto r2 = myState.localPosition().perp2();
122  if ( (r2 > rmin()*rmin()) & (r2< rmax()*rmax()) ) return make_pair( true, myState);
123 
124 
125  // take into account the thickness of the layer
126  float deltaR = 0.5f*bounds().thickness() *
127  myState.localDirection().perp()/std::abs(myState.localDirection().z());
128 
129  // and take into account the error on the predicted state
130  const float nSigma = 3.;
131  if (myState.hasError()) {
132  LocalError err = myState.localError().positionError();
133  // ignore correlation for the moment...
134  deltaR += nSigma * sqrt(err.xx() + err.yy());
135  }
136 
137  // check r again;
138  auto ri2 = std::max(rmin()-deltaR,0.f); ri2*=ri2;
139  auto ro2 = rmax()+deltaR; ro2*=ro2;
140  return make_pair( (r2>ri2) & (r2<ro2), myState);
141 }
#define LogDebug(id)
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
float xx() const
Definition: LocalError.h:24
virtual BoundDisk * computeSurface()
Local3DVector LocalVector
Definition: LocalVector.h:12
T perp() const
Definition: PV3DBase.h:72
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
T perp2() const
Definition: PV3DBase.h:71
LocalError positionError() const
virtual ~ForwardDetLayer()
#define unlikely(x)
float yy() const
Definition: LocalError.h:26
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
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
const LocalTrajectoryError & localError() const
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
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
Global3DVector GlobalVector
Definition: GlobalVector.h:10