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:
2012/12/25 14:59:34
Revision:
1.4

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 34 of file ForwardRingDiskBuilderFromDet.cc.

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

35 {
36  // go over all corners and compute maximum deviations from mean pos.
37  float rmin((**(dets.begin())).surface().position().perp());
38  float rmax(rmin);
39  float zmin((**(dets.begin())).surface().position().z());
40  float zmax(zmin);
41  for (vector<const GeomDet*>::const_iterator idet=dets.begin();
42  idet != dets.end(); idet++) {
43 
44  /* ---- original implementation. Is it obsolete?
45  vector<DetUnit*> detUnits = (**idet).detUnits();
46  for (vector<DetUnit*>::const_iterator detu=detUnits.begin();
47  detu!=detUnits.end(); detu++) {
48  vector<GlobalPoint> corners = BoundingBox().corners(
49  dynamic_cast<const Plane&>((**detu).surface()));
50  }
51  ----- */
52  vector<GlobalPoint> corners = BoundingBox().corners( (**idet).specificSurface() );
53  for (vector<GlobalPoint>::const_iterator i=corners.begin();
54  i!=corners.end(); i++) {
55  float r = i->perp();
56  float z = i->z();
57  rmin = min( rmin, r);
58  rmax = max( rmax, r);
59  zmin = min( zmin, z);
60  zmax = max( zmax, z);
61  }
62  // in addition to the corners we have to check the middle of the
63  // det +/- length/2, since the min (max) radius for typical fw
64  // dets is reached there
65 
66  float rdet = (**idet).position().perp();
67  float len = (**idet).surface().bounds().length();
68  float width = (**idet).surface().bounds().width();
69 
70  GlobalVector xAxis = (**idet).toGlobal(LocalVector(1,0,0));
71  GlobalVector yAxis = (**idet).toGlobal(LocalVector(0,1,0));
72  GlobalVector perpDir = GlobalVector( (**idet).position() - GlobalPoint(0,0,(**idet).position().z()) );
73 
74  double xAxisCos = xAxis.unit().dot(perpDir.unit());
75  double yAxisCos = yAxis.unit().dot(perpDir.unit());
76 
77  if( fabs(xAxisCos) > fabs(yAxisCos) ) {
78  rmin = min( rmin, rdet-width/2.F);
79  rmax = max( rmax, rdet+width/2.F);
80  }else{
81  rmin = min( rmin, rdet-len/2.F);
82  rmax = max( rmax, rdet+len/2.F);
83  }
84  }
85 
86 
87  float zPos = (zmax+zmin)/2.;
88  return make_pair(new SimpleDiskBounds(rmin,rmax,zmin-zPos,zmax-zPos), zPos);
89 }
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
float float float z
const T & max(const T &a, const T &b)
Vector3DBase unit() const
Definition: Vector3DBase.h:57
static std::vector< GlobalPoint > corners(const Plane &)
Definition: BoundingBox.cc:24
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  auto bo = computeBounds( dets );
12 
13 // LogDebug("DetLayers") << "Creating disk at Z: " << bo.second << "\n"
14 // << "Bounds are (rmin/rmax/thick) " << bo.first.innerRadius()
15 // << " / " << bo.first.outerRadius()
16 // << " / " << bo.first.thickness() ;
17 
18 // typedef Det::PositionType::BasicVectorType Vector;
19 // Vector posSum(0,0,0);
20 // for (vector<Det*>::const_iterator i=dets.begin(); i!=dets.end(); i++) {
21 // Vector pp = (**i).position().basicVector();
22 // // LogDebug("DetLayers") << " "<< (int) ( i-dets.begin()) << " at " << pp ;
23 // posSum += pp;
24 // }
25 // Det::PositionType meanPos( posSum/float(dets.size()));
26 // LogDebug("DetLayers") << " meanPos "<< meanPos ;
27 
28  Surface::PositionType pos(0.,0.,bo.second);
30  return new BoundDisk( pos, rot, bo.first);
31 }
std::pair< SimpleDiskBounds *, float > computeBounds(const std::vector< const GeomDet * > &dets) const
Disk BoundDisk
Definition: BoundDisk.h:64