CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
ForwardRingDiskBuilderFromDet Class Reference

#include <ForwardRingDiskBuilderFromDet.h>

Public Member Functions

std::pair< SimpleDiskBounds,
float > 
computeBounds (const std::vector< const GeomDet * > &dets) const
 
BoundDiskoperator() (const std::vector< const GeomDet * > &dets) const
 

Detailed Description

As it's name indicates, it's a builder of BoundDisk from a collection of Dets. The disk has the minimal size fully containing all Dets.

Date:
2007/03/07 16:28:39
Revision:
1.3

Definition at line 21 of file ForwardRingDiskBuilderFromDet.h.

Member Function Documentation

pair< SimpleDiskBounds, float > ForwardRingDiskBuilderFromDet::computeBounds ( const std::vector< const GeomDet * > &  dets) const

Definition at line 35 of file ForwardRingDiskBuilderFromDet.cc.

References BoundingBox::corners(), Vector3DBase< T, FrameTag >::dot(), F(), i, max(), min, alignCSCRings::r, Vector3DBase< T, FrameTag >::unit(), tablePrinter::width, detailsBasic3DVector::z, and zPos.

36 {
37  // go over all corners and compute maximum deviations from mean pos.
38  float rmin((**(dets.begin())).surface().position().perp());
39  float rmax(rmin);
40  float zmin((**(dets.begin())).surface().position().z());
41  float zmax(zmin);
42  for (vector<const GeomDet*>::const_iterator idet=dets.begin();
43  idet != dets.end(); idet++) {
44 
45  /* ---- original implementation. Is it obsolete?
46  vector<DetUnit*> detUnits = (**idet).detUnits();
47  for (vector<DetUnit*>::const_iterator detu=detUnits.begin();
48  detu!=detUnits.end(); detu++) {
49  vector<GlobalPoint> corners = BoundingBox().corners(
50  dynamic_cast<const BoundPlane&>((**detu).surface()));
51  }
52  ----- */
53  vector<GlobalPoint> corners = BoundingBox().corners( (**idet).specificSurface() );
54  for (vector<GlobalPoint>::const_iterator i=corners.begin();
55  i!=corners.end(); i++) {
56  float r = i->perp();
57  float z = i->z();
58  rmin = min( rmin, r);
59  rmax = max( rmax, r);
60  zmin = min( zmin, z);
61  zmax = max( zmax, z);
62  }
63  // in addition to the corners we have to check the middle of the
64  // det +/- length/2, since the min (max) radius for typical fw
65  // dets is reached there
66 
67  float rdet = (**idet).position().perp();
68  float len = (**idet).surface().bounds().length();
69  float width = (**idet).surface().bounds().width();
70 
71  GlobalVector xAxis = (**idet).toGlobal(LocalVector(1,0,0));
72  GlobalVector yAxis = (**idet).toGlobal(LocalVector(0,1,0));
73  GlobalVector perpDir = GlobalVector( (**idet).position() - GlobalPoint(0,0,(**idet).position().z()) );
74 
75  double xAxisCos = xAxis.unit().dot(perpDir.unit());
76  double yAxisCos = yAxis.unit().dot(perpDir.unit());
77 
78  if( fabs(xAxisCos) > fabs(yAxisCos) ) {
79  rmin = min( rmin, rdet-width/2.F);
80  rmax = max( rmax, rdet+width/2.F);
81  }else{
82  rmin = min( rmin, rdet-len/2.F);
83  rmax = max( rmax, rdet+len/2.F);
84  }
85  }
86 
87 
88  float zPos = (zmax+zmin)/2.;
89  return make_pair(SimpleDiskBounds(rmin,rmax,zmin-zPos,zmax-zPos), zPos);
90 }
int i
Definition: DBlmapReader.cc:9
Local3DVector LocalVector
Definition: LocalVector.h:12
double zPos
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
#define min(a, b)
Definition: mlp_lapack.h:161
double double double z
static std::vector< GlobalPoint > corners(const BoundPlane &)
Definition: BoundingBox.cc:24
const T & max(const T &a, const T &b)
Vector3DBase unit() const
Definition: Vector3DBase.h:57
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
Global3DVector GlobalVector
Definition: GlobalVector.h:10
BoundDisk * ForwardRingDiskBuilderFromDet::operator() ( const std::vector< const GeomDet * > &  dets) const

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

Definition at line 9 of file ForwardRingDiskBuilderFromDet.cc.

References pos, and makeMuonMisalignmentScenario::rot.

10 {
11  pair<SimpleDiskBounds,float> bo =
12  computeBounds( dets );
13 
14 // LogDebug("DetLayers") << "Creating disk at Z: " << bo.second << "\n"
15 // << "Bounds are (rmin/rmax/thick) " << bo.first.innerRadius()
16 // << " / " << bo.first.outerRadius()
17 // << " / " << bo.first.thickness() ;
18 
19 // typedef Det::PositionType::BasicVectorType Vector;
20 // Vector posSum(0,0,0);
21 // for (vector<Det*>::const_iterator i=dets.begin(); i!=dets.end(); i++) {
22 // Vector pp = (**i).position().basicVector();
23 // // LogDebug("DetLayers") << " "<< (int) ( i-dets.begin()) << " at " << pp ;
24 // posSum += pp;
25 // }
26 // Det::PositionType meanPos( posSum/float(dets.size()));
27 // LogDebug("DetLayers") << " meanPos "<< meanPos ;
28 
29  Surface::PositionType pos(0.,0.,bo.second);
31  return new BoundDisk( pos, rot, bo.first);
32 }
std::pair< SimpleDiskBounds, float > computeBounds(const std::vector< const GeomDet * > &dets) const