CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
ForwardDiskSectorBuilderFromWedges Class Reference

#include <ForwardDiskSectorBuilderFromWedges.h>

Public Member Functions

BoundDiskSectoroperator() (const std::vector< const TECWedge * > &wedges) const
 

Private Member Functions

std::pair< DiskSectorBounds *, GlobalVectorcomputeBounds (const std::vector< const TECWedge * > &wedges) const
 
Surface::RotationType computeRotation (const std::vector< const TECWedge * > &wedges, Surface::PositionType pos) const
 

Detailed Description

As it's name indicates, it's a builder of a BoundDiskSector from a collection of Wedges (of one petal). The disk sector has the minimal size fully containing all wedges.

Definition at line 15 of file ForwardDiskSectorBuilderFromWedges.h.

Member Function Documentation

pair< DiskSectorBounds *, GlobalVector > ForwardDiskSectorBuilderFromWedges::computeBounds ( const std::vector< const TECWedge * > &  wedges) const
private

Definition at line 45 of file ForwardDiskSectorBuilderFromWedges.cc.

References funct::cos(), SiStripPI::max, min(), Geom::phiLess(), phimax, phimin, Geom::pi(), and funct::sin().

46 {
47 
48  // compute maximum and minimum radius and phi
49  float rmin((**(wedges.begin())).specificSurface().innerRadius());
50  float rmax(rmin);
51  float zmin((**(wedges.begin())).surface().position().z());
52  float zmax(zmin);
53  float phimin((**(wedges.begin())).surface().position().phi());
54  float phimax(phimin);
55 
56  for (vector<const TECWedge*>::const_iterator iw=wedges.begin();
57  iw != wedges.end(); iw++) {
58  // edm::LogInfo(TkDetLayers) << "---------------------------------------------" ;
59  // edm::LogInfo(TkDetLayers) << " Builder: Position of wedge :" << (**iw).position() ;
60  float ri = (**iw).specificSurface().innerRadius();
61  float ro = (**iw).specificSurface().outerRadius();
62  float zmi = (**iw).surface().position().z() - (**iw).specificSurface().bounds().thickness()/2.;
63  float zma = (**iw).surface().position().z() + (**iw).specificSurface().bounds().thickness()/2.;
64  float phi1 = (**iw).surface().position().phi() - (**iw).specificSurface().phiHalfExtension();
65  float phi2 = (**iw).surface().position().phi() + (**iw).specificSurface().phiHalfExtension();
66  rmin = min( rmin, ri);
67  rmax = max( rmax, ro);
68  zmin = min( zmin, zmi);
69  zmax = max( zmax, zma);
70  if ( Geom::phiLess( phi1, phimin)) phimin = phi1;
71  if ( Geom::phiLess( phimax, phi2)) phimax = phi2;
72  }
73 
74  if (!Geom::phiLess(phimin, phimax))
75  edm::LogError("TkDetLayers") << " ForwardDiskSectorBuilderFromWedges : "
76  << "Something went wrong with Phi Sorting !";
77  float zPos = (zmax+zmin)/2.;
78  float phiWin = phimax - phimin;
79  float phiPos = (phimax+phimin)/2.;
80  float rmed = (rmin+rmax)/2.;
81  if ( phiWin < 0. ) {
82  if ( (phimin < Geom::pi() / 2.) || (phimax > -Geom::pi()/2.) ){
83  edm::LogError("TkDetLayers") << " Debug: something strange going on, please check " ;
84  }
85  // edm::LogInfo(TkDetLayers) << " Petal at pi: phi " << phimin << " " << phimax << " " << phiWin
86  // << " " << 2.*Geom::pi()+phiWin << " " ;
87  phiWin += 2.*Geom::pi();
88  phiPos += Geom::pi();
89  }
90 
91  GlobalVector pos( rmed*cos(phiPos), rmed*sin(phiPos), zPos);
92  return make_pair(new DiskSectorBounds(rmin,rmax,zmin-zPos,zmax-zPos,phiWin), pos);
93 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
T min(T a, T b)
Definition: MathUtil.h:58
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:23
constexpr double pi()
Definition: Pi.h:31
Surface::RotationType ForwardDiskSectorBuilderFromWedges::computeRotation ( const std::vector< const TECWedge * > &  wedges,
Surface::PositionType  pos 
) const
private

Definition at line 96 of file ForwardDiskSectorBuilderFromWedges.cc.

References Vector3DBase< T, FrameTag >::cross(), csvLumiCalc::unit, PV3DBase< T, PVType, FrameType >::x(), MuonErrorMatrixValues_cff::xAxis, PV3DBase< T, PVType, FrameType >::y(), MuonErrorMatrixValues_cff::yAxis, and MetAnalyzer::zAxis.

97  {
98 
99  GlobalVector yAxis = ( GlobalVector( pos.x(), pos.y(), 0.)).unit();
100 
101  GlobalVector zAxis( 0., 0., 1.);
102  GlobalVector xAxis = yAxis.cross( zAxis);
103 
104  return Surface::RotationType( xAxis, yAxis);
105 }
T y() const
Definition: PV3DBase.h:63
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
TkRotation< float > RotationType
T x() const
Definition: PV3DBase.h:62
Global3DVector GlobalVector
Definition: GlobalVector.h:10
BoundDiskSector * ForwardDiskSectorBuilderFromWedges::operator() ( const std::vector< const TECWedge * > &  wedges) const

Warning, remember to assign this pointer to a ReferenceCountingPointer! Should be changed to return a ReferenceCountingPointer<BoundDisk>

Definition at line 10 of file ForwardDiskSectorBuilderFromWedges.cc.

References funct::abs(), mps_fire::i, PV3DBase< T, PVType, FrameType >::phi(), hitfit::phidiff(), Geom::phiLess(), Geom::pi(), GloballyPositioned< T >::position(), and makeMuonMisalignmentScenario::rot.

11 {
12  // check first that all wedges are about at the same phi and z !
13  float phiStart = wedges.front()->position().phi();
14  float zStart = wedges.front()->position().z();
15  float wphimin, wphimax;
16  for (vector<const TECWedge*>::const_iterator i = wedges.begin(); i != wedges.end(); i++){
17  float zdiff = (**i).surface().position().z() - zStart;
18  if ( std::abs( zdiff) > 5.)
19  edm::LogError("TkDetLayers") << " ForwardDiskSectorBuilderFromWedges: Trying to build "
20  << "Petal from Wedges at different z ! Delta Z = " << zdiff ;
21  float wphi = (**i).surface().position().phi();
22  if ( Geom::phiLess( phiStart, wphi)) {
23  wphimin = phiStart;
24  wphimax = wphi;
25  } else {
26  wphimin = wphi;
27  wphimax = phiStart;
28  }
29  float phidiff = wphimax - wphimin;
30  if ( phidiff < 0.) phidiff += 2.*Geom::pi();
31  if ( phidiff > 0.3 )
32  edm::LogError("TkDetLayers") << " ForwardDiskSectorBuilderFromWedges: Trying to build "
33  << "Petal from Wedges at different phi ! Delta phi = "
34  << phidiff ;
35  }
36 
37  auto bo = computeBounds( wedges );
38 
39  Surface::PositionType pos( bo.second.x(), bo.second.y(), bo.second.z() );
41  return new BoundDiskSector( pos, rot, bo.first);
42 }
std::pair< DiskSectorBounds *, GlobalVector > computeBounds(const std::vector< const TECWedge * > &wedges) const
double phidiff(double phi)
Normalized difference in azimuthal angles to a range between .
Definition: fourvec.cc:230
Surface::RotationType computeRotation(const std::vector< const TECWedge * > &wedges, Surface::PositionType pos) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:23
constexpr double pi()
Definition: Pi.h:31