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
BladeShapeBuilderFromDet Class Reference

#include <BladeShapeBuilderFromDet.h>

Public Member Functions

BoundDiskSector * operator() (const std::vector< const GeomDet * > &dets) const
 

Private Member Functions

std::pair< DiskSectorBounds
*, GlobalVector
computeBounds (const std::vector< const GeomDet * > &dets, const Plane &plane) const
 
Surface::RotationType computeRotation (const std::vector< const GeomDet * > &dets, const Surface::PositionType &pos) const
 

Detailed Description

The trapezoid has the minimal size fully containing all Dets.

Definition at line 18 of file BladeShapeBuilderFromDet.h.

Member Function Documentation

pair< DiskSectorBounds *, GlobalVector > BladeShapeBuilderFromDet::computeBounds ( const std::vector< const GeomDet * > &  dets,
const Plane plane 
) const
private

Definition at line 36 of file BladeShapeBuilderFromDet.cc.

References BoundingBox::corners(), funct::cos(), F(), i, LogDebug, max(), min, PV3DBase< T, PVType, FrameType >::perp(), phi, PV3DBase< T, PVType, FrameType >::phi(), phimax, phimin, Geom::pi(), alignCSCRings::r, funct::sin(), Surface::toGlobal(), GloballyPositioned< T >::toLocal(), detailsBasic3DVector::z, PV3DBase< T, PVType, FrameType >::z(), SiStripMonitorClusterAlca_cfi::zmax, SiStripMonitorClusterAlca_cfi::zmin, and zPos.

38 {
39  Surface::PositionType tmpPos = dets.front()->surface().position();
40 
41 
42  float rmin(plane.toLocal(tmpPos).perp());
43  float rmax(plane.toLocal(tmpPos).perp());
44  float zmin(plane.toLocal(tmpPos).z());
45  float zmax(plane.toLocal(tmpPos).z());
46  float phimin(plane.toLocal(tmpPos).phi());
47  float phimax(plane.toLocal(tmpPos).phi());
48 
49  for(vector<const GeomDet*>::const_iterator it=dets.begin(); it!=dets.end(); it++){
50  vector<GlobalPoint> corners = BoundingBox().corners( (*it)->specificSurface() );
51 
52  for(vector<GlobalPoint>::const_iterator i=corners.begin();
53  i!=corners.end(); i++) {
54 
55  float r = plane.toLocal(*i).perp();
56  float z = plane.toLocal(*i).z();
57  float phi = plane.toLocal(*i).phi();
58  rmin = min( rmin, r);
59  rmax = max( rmax, r);
60  zmin = min( zmin, z);
61  zmax = max( zmax, z);
62  if ( PhiLess()( phi, phimin)) phimin = phi;
63  if ( PhiLess()( phimax, phi)) phimax = phi;
64  }
65  // in addition to the corners we have to check the middle of the
66  // det +/- length/2, since the min (max) radius for typical fw
67  // dets is reached there
68 
69  float rdet = (*it)->position().perp();
70  float height = (*it)->surface().bounds().width();
71  rmin = min( rmin, rdet-height/2.F);
72  rmax = max( rmax, rdet+height/2.F);
73 
74 
75  }
76 
77  if (!PhiLess()(phimin, phimax))
78  edm::LogError("TkDetLayers") << " BladeShapeBuilderFromDet : "
79  << "Something went wrong with Phi Sorting !" ;
80  float zPos = (zmax+zmin)/2.;
81  float phiWin = phimax - phimin;
82  float phiPos = (phimax+phimin)/2.;
83  float rmed = (rmin+rmax)/2.;
84  if ( phiWin < 0. ) {
85  if ( (phimin < Geom::pi() / 2.) || (phimax > -Geom::pi()/2.) ){
86  edm::LogError("TkDetLayers") << " something strange going on, please check " ;
87  }
88  //edm::LogInfo(TkDetLayers) << " Wedge at pi: phi " << phimin << " " << phimax << " " << phiWin
89  // << " " << 2.*Geom::pi()+phiWin << " " ;
90  phiWin += 2.*Geom::pi();
91  phiPos += Geom::pi();
92  }
93 
94  LocalVector localPos( rmed*cos(phiPos), rmed*sin(phiPos), zPos);
95 
96  LogDebug("TkDetLayers") << "localPos in computeBounds: " << localPos << "\n"
97  << "rmin: " << rmin << "\n"
98  << "rmax: " << rmax << "\n"
99  << "zmin: " << zmin << "\n"
100  << "zmax: " << zmax << "\n"
101  << "phiWin: " << phiWin ;
102 
103  return make_pair(new DiskSectorBounds(rmin,rmax,zmin,zmax,phiWin),
104  plane.toGlobal(localPos) );
105 
106 }
#define LogDebug(id)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
int i
Definition: DBlmapReader.cc:9
T perp() const
Definition: PV3DBase.h:72
double zPos
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
#define min(a, b)
Definition: mlp_lapack.h:161
float float float z
const T & max(const T &a, const T &b)
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static std::vector< GlobalPoint > corners(const Plane &)
Definition: BoundingBox.cc:24
double pi()
Definition: Pi.h:31
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
Definition: DDAxes.h:10
Surface::RotationType BladeShapeBuilderFromDet::computeRotation ( const std::vector< const GeomDet * > &  dets,
const Surface::PositionType pos 
) const
private

Definition at line 110 of file BladeShapeBuilderFromDet.cc.

References Vector3DBase< T, FrameTag >::cross(), GloballyPositioned< T >::position(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

112 {
113  const Plane& plane = dets.front()->surface();
114 
115  GlobalVector xAxis;
116  GlobalVector yAxis;
117  GlobalVector zAxis;
118 
119  GlobalVector planeXAxis = plane.toGlobal( LocalVector( 1, 0, 0));
120  GlobalPoint planePosition = plane.position();
121 
122  if(planePosition.x()*planeXAxis.x()+planePosition.y()*planeXAxis.y() > 0.){
123  yAxis = planeXAxis;
124  }else{
125  yAxis = -planeXAxis;
126  }
127 
128  GlobalVector planeZAxis = plane.toGlobal( LocalVector( 0, 0, 1));
129  if(planeZAxis.z()*planePosition.z() > 0.){
130  zAxis = planeZAxis;
131  }else{
132  zAxis = -planeZAxis;
133  }
134 
135  xAxis = yAxis.cross( zAxis);
136 
137  return Surface::RotationType( xAxis, yAxis);
138 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
Local3DVector LocalVector
Definition: LocalVector.h:12
T y() const
Definition: PV3DBase.h:63
Definition: Plane.h:17
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
T z() const
Definition: PV3DBase.h:64
TkRotation< float > RotationType
T x() const
Definition: PV3DBase.h:62
const PositionType & position() const
BoundDiskSector * BladeShapeBuilderFromDet::operator() ( const std::vector< const GeomDet * > &  dets) const

Definition at line 13 of file BladeShapeBuilderFromDet.cc.

References i, pos, and idealTransformation::rotation.

14 {
15  // find mean position
17  Vector posSum(0,0,0);
18  for (vector<const GeomDet*>::const_iterator i=dets.begin(); i!=dets.end(); i++) {
19  posSum += (**i).surface().position().basicVector();
20  }
21  Surface::PositionType meanPos( 0.,0.,posSum.z()/float(dets.size()) );
22 
23  // temporary plane - for the computation of bounds
25  Plane tmpPlane( meanPos, rotation);
26 
27 
28  auto bo =
29  computeBounds( dets,tmpPlane );
30  GlobalPoint pos = meanPos+bo.second;
31  //edm::LogInfo(TkDetLayers) << "global pos in operator: " << pos ;
32  return new BoundDiskSector( pos, rotation, bo.first);
33 }
int i
Definition: DBlmapReader.cc:9
std::pair< DiskSectorBounds *, GlobalVector > computeBounds(const std::vector< const GeomDet * > &dets, const Plane &plane) const
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
Definition: Plane.h:17
Surface::RotationType computeRotation(const std::vector< const GeomDet * > &dets, const Surface::PositionType &pos) const
TkRotation< float > RotationType