CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloTowerGeometry.cc
Go to the documentation of this file.
3 
4 #include <Math/Transform3D.h>
5 #include <Math/EulerAngles.h>
6 
11 
13  cttopo(cttopo_),
14  k_NumberOfCellsForCorners(cttopo->sizeForDenseIndexing()),
15  k_NumberOfShapes(cttopo->lastHFRing()),
16  m_cellVec ( k_NumberOfCellsForCorners )
17 {
18 }
19 
20 
22 
23 
24 unsigned int
26 
27  const CaloGenericDetId gid ( id ) ;
28  assert( gid.isCaloTower() ) ;
29 
30  const CaloTowerDetId cid ( id ) ;
31  const int iea ( cid.ietaAbs() ) ;
32  const unsigned int ip ( ( cid.iphi() - 1 )/4 ) ;
33  const int izoff ( ( cid.zside() + 1 )/2 ) ;
34  const unsigned int offset ( izoff*3*18) ;
35 
36  return ( offset + ip +
37  ( cttopo->firstHFQuadPhiRing() <= iea ? 36 :
38  ( cttopo->firstHEDoublePhiRing() <= iea ? 18 : 0 ) ) ) ;
39 }
40 
41 unsigned int
43  return (unsigned int) DetId::Calo - 1 ;
44 }
45 
46 void
48  const CCGFloat* pv ,
49  unsigned int i ,
50  Pt3D& ref ) {
51  IdealObliquePrism::localCorners( lc, pv, ref ) ;
52 }
53 
54 void
56  const GlobalPoint& f2 ,
57  const GlobalPoint& f3 ,
58  const CCGFloat* parm ,
59  const DetId& detId ) {
60  const CaloGenericDetId cgid ( detId ) ;
61 
62  assert( cgid.isCaloTower() ) ;
63 
64  const CaloTowerDetId cid ( detId ) ;
65 
66  const unsigned int di ( cttopo->denseIndex(cid) ) ;
67 
68  m_cellVec[ di ] = IdealObliquePrism( f1, cornersMgr(), parm ) ;
69  addValidID( detId ) ;
70  m_dins.push_back( di );
71 }
72 
73 const CaloCellGeometry*
75  const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
76  return ( m_cellVec.size() < index ||
77  0 == cell->param() ? 0 : cell ) ;
78 }
79 
80 void
84  CaloSubdetectorGeometry::IVec& dinsVec ) const {
86  iVec.reserve( numberOfShapes()==1 ? 1 : numberOfCellsForCorners() ) ;
87  dVec.reserve( numberOfShapes()*numberOfParametersPerShape() ) ;
88  dinsVec.reserve(numberOfCellsForCorners());
89 
90  for (ParVecVec::const_iterator ivv (parVecVec().begin()) ;
91  ivv != parVecVec().end() ; ++ivv) {
92  const ParVec& pv ( *ivv ) ;
93  for (ParVec::const_iterator iv ( pv.begin() ) ; iv != pv.end() ; ++iv) {
94  dVec.push_back( *iv ) ;
95  }
96  }
97 
98  for (unsigned int i ( 0 ) ; i < numberOfCellsForCorners() ; ++i) {
99  Tr3D tr ;
100  const CaloCellGeometry* ptr ( cellGeomPtr( i ) ) ;
101 
102  if (0 != ptr) {
103  dinsVec.push_back( i );
104 
105  ptr->getTransform( tr, ( Pt3DVec* ) 0 ) ;
106 
107  if( Tr3D() == tr ) { // for preshower there is no rotation
108  const GlobalPoint& gp ( ptr->getPosition() ) ;
109  tr = HepGeom::Translate3D( gp.x(), gp.y(), gp.z() ) ;
110  }
111 
112  const CLHEP::Hep3Vector tt ( tr.getTranslation() ) ;
113  tVec.push_back( tt.x() ) ;
114  tVec.push_back( tt.y() ) ;
115  tVec.push_back( tt.z() ) ;
116  if (6 == numberOfTransformParms()) {
117  const CLHEP::HepRotation rr ( tr.getRotation() ) ;
118  const ROOT::Math::Transform3D rtr (rr.xx(), rr.xy(), rr.xz(), tt.x(),
119  rr.yx(), rr.yy(), rr.yz(), tt.y(),
120  rr.zx(), rr.zy(), rr.zz(), tt.z());
122  rtr.GetRotation( ea ) ;
123  tVec.push_back( ea.Phi() ) ;
124  tVec.push_back( ea.Theta() ) ;
125  tVec.push_back( ea.Psi() ) ;
126  }
127 
128  const CCGFloat* par ( ptr->param() ) ;
129 
130  unsigned int ishape ( 9999 ) ;
131  for( unsigned int ivv ( 0 ) ; ivv != parVecVec().size() ; ++ivv ) {
132  bool ok ( true ) ;
133  const CCGFloat* pv ( &(*parVecVec()[ivv].begin() ) ) ;
134  for( unsigned int k ( 0 ) ; k != numberOfParametersPerShape() ; ++k ) {
135  ok = ok && ( fabs( par[k] - pv[k] ) < 1.e-6 ) ;
136  }
137  if( ok ) {
138  ishape = ivv ;
139  break ;
140  }
141  }
142  assert( 9999 != ishape ) ;
143 
144  const unsigned int nn (( numberOfShapes()==1) ? (unsigned int)1 : m_dins.size() ) ;
145  if( iVec.size() < nn ) iVec.push_back( ishape ) ;
146  }
147  }
148 }
int i
Definition: DBlmapReader.cc:9
std::vector< CCGFloat > DimVec
CaloTowerGeometry(const CaloTowerTopology *cttopo_)
virtual unsigned int numberOfCellsForCorners() const
assert(m_qm.get())
bool isCaloTower() const
std::vector< unsigned int > IVec
std::vector< CCGFloat > TrVec
const_iterator begin() const
Definition: EZArrayFL.h:63
HepGeom::Transform3D Tr3D
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
std::vector< Pt3D > Pt3DVec
unsigned int alignmentTransformIndexLocal(const DetId &id)
CaloCellGeometry::CCGFloat CCGFloat
const CCGFloat * param() const
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
virtual void getTransform(Tr3D &tr, Pt3DVec *lptr) const
--------— only needed by specific utility; overloaded when needed -—
virtual unsigned int numberOfParametersPerShape() const
CaloCellGeometry::Pt3D Pt3D
CaloCellGeometry::CCGFloat CCGFloat
const CaloTowerTopology * cttopo
CaloSubdetectorGeometry::IVec m_dins
unsigned int alignmentTransformIndexGlobal(const DetId &id)
CaloCellGeometry::Pt3D Pt3D
uint32_t denseIndex(const DetId &id) const
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: DetId.h:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
void addValidID(const DetId &id)
CaloCellGeometry::CornersMgr * cornersMgr()
int firstHEDoublePhiRing() const
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Tr3D Tr3D
virtual unsigned int numberOfShapes() const
virtual ~CaloTowerGeometry()
MgrType::const_iterator const_iterator
Definition: EZArrayFL.h:27
#define begin
Definition: vmac.h:30
CaloCellGeometry::Pt3DVec Pt3DVec
const_iterator end() const
Definition: EZArrayFL.h:64
virtual unsigned int numberOfTransformParms() const
int firstHFQuadPhiRing() const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const
virtual const CaloCellGeometry * cellGeomPtr(uint32_t index) const