CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
*, GlobalVector
computeBounds (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 46 of file ForwardDiskSectorBuilderFromWedges.cc.

References funct::cos(), bookConverter::max, min(), Geom::pi(), funct::sin(), SiStripMonitorClusterAlca_cfi::zmax, and SiStripMonitorClusterAlca_cfi::zmin.

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

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

98  {
99 
100  GlobalVector yAxis = ( GlobalVector( pos.x(), pos.y(), 0.)).unit();
101 
102  GlobalVector zAxis( 0., 0., 1.);
103  GlobalVector xAxis = yAxis.cross( zAxis);
104 
105  return Surface::RotationType( xAxis, yAxis);
106 }
T y() const
Definition: PV3DBase.h:63
string unit
Definition: csvLumiCalc.py:46
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
TkRotation< float > RotationType
tuple zAxis
Definition: MetAnalyzer.py:56
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 11 of file ForwardDiskSectorBuilderFromWedges.cc.

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

12 {
13  // check first that all wedges are about at the same phi and z !
14  float phiStart = wedges.front()->position().phi();
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 ( std::abs( 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)) {
24  wphimin = phiStart;
25  wphimax = wphi;
26  } else {
27  wphimin = wphi;
28  wphimax = phiStart;
29  }
30  float phidiff = wphimax - wphimin;
31  if ( phidiff < 0.) phidiff += 2.*Geom::pi();
32  if ( phidiff > 0.3 )
33  edm::LogError("TkDetLayers") << " ForwardDiskSectorBuilderFromWedges: Trying to build "
34  << "Petal from Wedges at different phi ! Delta phi = "
35  << phidiff ;
36  }
37 
38  auto bo = computeBounds( wedges );
39 
40  Surface::PositionType pos( bo.second.x(), bo.second.y(), bo.second.z() );
42  return new BoundDiskSector( pos, rot, bo.first);
43 }
std::pair< DiskSectorBounds *, GlobalVector > computeBounds(const std::vector< const TECWedge * > &wedges) const
int i
Definition: DBlmapReader.cc:9
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
constexpr double pi()
Definition: Pi.h:31