16 float rcheck = dets.front()->surface().
position().
perp();
17 float zcheck = dets.front()->surface().position().z();
18 for ( vector<const GeomDet*>::const_iterator
i = dets.begin();
i != dets.end();
i++){
19 float rdiff = (**i).surface().position().perp()-rcheck;
20 if ( fabs(rdiff) > 1.)
21 edm::LogError(
"TkDetLayers") <<
" ForwardDiskSectorBuilderFromDet: Trying to build Petal Wedge from "
22 <<
"Dets at different radii !! Delta_r = " << rdiff ;
23 float zdiff = zcheck - (**i).surface().position().z();
24 if ( fabs(zdiff) > 0.8)
25 edm::LogError(
"TkDetLayers") <<
" ForwardDiskSectorBuilderFromDet: Trying to build Petal Wedge from "
26 <<
"Dets at different z positions !! Delta_z = " << zdiff ;
29 pair<DiskSectorBounds,GlobalVector> bo =
30 computeBounds( dets );
37 pair<DiskSectorBounds, GlobalVector>
41 float rmin = (**(dets.begin())).surface().position().perp();
43 float zmin((**(dets.begin())).surface().position().z());
45 float phimin((**(dets.begin())).surface().position().phi());
49 for (vector<const GeomDet*>::const_iterator idet=dets.begin();
50 idet != dets.end(); idet++) {
51 vector<const GeomDet*> detUnits = (**idet).components();
52 if( detUnits.size() ){
53 for (vector<const GeomDet*>::const_iterator detu=detUnits.begin();
54 detu!=detUnits.end(); detu++) {
56 vector<GlobalPoint> corners = computeTrapezoidalCorners(*detu) ;
57 for (vector<GlobalPoint>::const_iterator
i=corners.begin();
58 i!=corners.end();
i++) {
72 float rdet = (**detu).position().perp();
73 float len = (**detu).surface().bounds().length();
74 float width = (**detu).surface().bounds().width();
83 if( fabs(xAxisCos) > fabs(yAxisCos) ) {
84 rmin =
min( rmin, rdet-width/2.
F);
85 rmax =
max( rmax, rdet+width/2.
F);
87 rmin =
min( rmin, rdet-len/2.
F);
88 rmax =
max( rmax, rdet+len/2.
F);
92 vector<GlobalPoint> corners = computeTrapezoidalCorners(*idet) ;
93 for (vector<GlobalPoint>::const_iterator
i=corners.begin();
94 i!=corners.end();
i++) {
100 zmin =
min( zmin, z);
101 zmax =
max( zmax, z);
109 float rdet = (**idet).position().perp();
110 float len = (**idet).surface().bounds().length();
111 float width = (**idet).surface().bounds().width();
117 double xAxisCos = xAxis.
unit().
dot(perpDir.
unit());
118 double yAxisCos = yAxis.
unit().
dot(perpDir.
unit());
120 if( fabs(xAxisCos) > fabs(yAxisCos) ) {
121 rmin =
min( rmin, rdet-width/2.
F);
122 rmax =
max( rmax, rdet+width/2.
F);
124 rmin =
min( rmin, rdet-len/2.
F);
125 rmax =
max( rmax, rdet+len/2.
F);
132 edm::LogError(
"TkDetLayers") <<
" ForwardDiskSectorBuilderFromDet : "
133 <<
"Something went wrong with Phi Sorting !" ;
134 float zPos = (zmax+zmin)/2.;
135 float phiWin = phimax -
phimin;
136 float phiPos = (phimax+
phimin)/2.;
137 float rmed = (rmin+rmax)/2.;
140 edm::LogError(
"TkDetLayers") <<
" Debug: something strange going on, please check " ;
148 return make_pair(
DiskSectorBounds(rmin,rmax,zmin-zPos,zmax-zPos,phiWin), pos);
180 vector<float>
parameters = (*myBounds).parameters();
182 if ( parameters[0] == 0 ) {
183 edm::LogError(
"TkDetLayers") <<
"ForwardDiskSectorBuilder: something weird going on !" ;
184 edm::LogError(
"TkDetLayers") <<
" Trapezoidal parameters of GeomDet (L2/L1/T/H): " ;
191 float hbotedge = parameters[0];
192 float htopedge = parameters[1];
193 float hapothem = parameters[3];
194 float hthick = parameters[2];
196 vector<GlobalPoint> corners;
198 corners.push_back( plane.toGlobal(
LocalPoint( -htopedge, hapothem, hthick)));
199 corners.push_back( plane.toGlobal(
LocalPoint( -htopedge, hapothem, -hthick)));
200 corners.push_back( plane.toGlobal(
LocalPoint( htopedge, hapothem, hthick)));
201 corners.push_back( plane.toGlobal(
LocalPoint( htopedge, hapothem, -hthick)));
202 corners.push_back( plane.toGlobal(
LocalPoint( hbotedge, -hapothem, hthick)));
203 corners.push_back( plane.toGlobal(
LocalPoint( hbotedge, -hapothem, -hthick)));
204 corners.push_back( plane.toGlobal(
LocalPoint( -hbotedge, -hapothem, hthick)));
205 corners.push_back( plane.toGlobal(
LocalPoint( -hbotedge, -hapothem, -hthick)));
Local3DVector LocalVector
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
const BoundPlane & specificSurface() const
Same as surface(), kept for backward compatibility.
std::pair< DiskSectorBounds, GlobalVector > computeBounds(const std::vector< const GeomDet * > &dets) const
const T & max(const T &a, const T &b)
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Cos< T >::type cos(const T &t)
Vector3DBase unit() const
BoundDiskSector * operator()(const std::vector< const GeomDet * > &dets) const
std::vector< GlobalPoint > computeTrapezoidalCorners(const GeomDet *detu) const
TkRotation< float > RotationType
Surface::RotationType computeRotation(const std::vector< const GeomDet * > &dets, Surface::PositionType pos) const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
const PositionType & position() const
Global3DVector GlobalVector