15 float zStart = wedges.front()->position().z();
16 float wphimin, wphimax;
17 for (vector<const TECWedge*>::const_iterator
i = wedges.begin();
i != wedges.end();
i++){
18 float zdiff = (**i).surface().position().z() - zStart;
19 if ( fabs( zdiff) > 5.)
20 edm::LogError(
"TkDetLayers") <<
" ForwardDiskSectorBuilderFromWedges: Trying to build "
21 <<
"Petal from Wedges at different z ! Delta Z = " << zdiff ;
22 float wphi = (**i).surface().position().phi();
23 if (
PhiLess()( phiStart, wphi)) {
30 float phidiff = wphimax - wphimin;
31 if ( phidiff < 0.) phidiff += 2.*
Geom::pi();
33 edm::LogError(
"TkDetLayers") <<
" ForwardDiskSectorBuilderFromWedges: Trying to build "
34 <<
"Petal from Wedges at different phi ! Delta phi = "
38 pair<DiskSectorBounds,GlobalVector> bo =
39 computeBounds( wedges );
46 pair<DiskSectorBounds, GlobalVector>
51 float rmin((**(wedges.begin())).specificSurface().innerRadius());
53 float zmin((**(wedges.begin())).surface().position().z());
55 float phimin((**(wedges.begin())).surface().position().phi());
58 for (vector<const TECWedge*>::const_iterator iw=wedges.begin();
59 iw != wedges.end(); iw++) {
62 float ri = (**iw).specificSurface().innerRadius();
63 float ro = (**iw).specificSurface().outerRadius();
64 float zmi = (**iw).surface().position().z() - (**iw).specificSurface().bounds().thickness()/2.;
65 float zma = (**iw).surface().position().z() + (**iw).specificSurface().bounds().thickness()/2.;
66 float phi1 = (**iw).surface().position().phi() - (**iw).specificSurface().phiExtension()/2.;
67 float phi2 = (**iw).surface().position().phi() + (**iw).specificSurface().phiExtension()/2.;
68 rmin =
min( rmin, ri);
69 rmax =
max( rmax, ro);
70 zmin =
min( zmin, zmi);
71 zmax =
max( zmax, zma);
72 if (
PhiLess()( phi1, phimin)) phimin = phi1;
73 if (
PhiLess()( phimax, phi2)) phimax = phi2;
77 edm::LogError(
"TkDetLayers") <<
" ForwardDiskSectorBuilderFromWedges : "
78 <<
"Something went wrong with Phi Sorting !";
79 float zPos = (zmax+zmin)/2.;
80 float phiWin = phimax - phimin;
81 float phiPos = (phimax+phimin)/2.;
82 float rmed = (rmin+rmax)/2.;
85 edm::LogError(
"TkDetLayers") <<
" Debug: something strange going on, please check " ;
94 return make_pair(
DiskSectorBounds(rmin,rmax,zmin-zPos,zmax-zPos,phiWin), pos);
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
BoundDiskSector * operator()(const std::vector< const TECWedge * > &wedges) const
Surface::RotationType computeRotation(const std::vector< const TECWedge * > &wedges, Surface::PositionType pos) const
const T & max(const T &a, const T &b)
std::pair< DiskSectorBounds, GlobalVector > computeBounds(const std::vector< const TECWedge * > &wedges) const
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Cos< T >::type cos(const T &t)
TkRotation< float > RotationType
const PositionType & position() const
Global3DVector GlobalVector