1 #ifndef GEOMETRY_CALOGEOMETRY_CALOGEOMETRYDBEP_H
2 #define GEOMETRY_CALOGEOMETRY_CALOGEOMETRYDBEP_H 1
6 #include "boost/shared_ptr.hpp"
26 #include <Math/Transform3D.h>
27 #include <Math/EulerAngles.h>
35 template <
class T,
class U>
45 typedef boost::shared_ptr< CaloSubdetectorGeometry >
PtrType ;
66 iRecord.template getRecord< typename T::AlignmentRecord >().
get( alignments ) ;
69 ( alignments->m_align.size() == T::numberOfAlignments() ) ) ;
70 alignPtr = alignments.
product() ;
73 iRecord.template getRecord<GlobalPositionRcd>().
get( globals ) ;
86 iRecord.get( T::producerTag() + std::string(
"_master"), pG ) ;
92 U::write( tvec, dvec, ivec, T::dbString() ) ;
98 iRecord.template getRecord<typename T::PGeometryRecord >().
get( pG ) ;
100 tvec = pG->getTranslation() ;
101 dvec = pG->getDimension() ;
102 ivec = pG->getIndexes() ;
106 const unsigned int nTrParm ( tvec.size()/T::k_NumberOfCellsForCorners ) ;
108 assert( dvec.size() == T::k_NumberOfShapes * T::k_NumberOfParametersPerShape ) ;
112 ptr->fillDefaultNamedParameters() ;
114 ptr->allocateCorners( T::k_NumberOfCellsForCorners ) ;
116 ptr->allocatePar( dvec.size() ,
117 T::k_NumberOfParametersPerShape ) ;
119 for(
unsigned int i ( 0 ) ;
i != T::k_NumberOfCellsForCorners ; ++
i )
121 const unsigned int nPerShape ( T::k_NumberOfParametersPerShape ) ;
123 dims.reserve( nPerShape ) ;
125 const unsigned int indx ( ivec.size()==1 ? 0 :
i ) ;
127 DimVec::const_iterator dsrc ( dvec.begin() + ivec[indx]*nPerShape ) ;
129 for(
unsigned int j ( 0 ) ;
j != nPerShape ; ++
j )
131 dims.push_back( *dsrc ) ;
137 ptr->parVecVec() ) ) ;
140 const DetId id ( T::DetIdType::detIdFromDenseIndex(
i ) ) ;
142 const unsigned int iGlob ( 0 == globalPtr ? 0 :
143 T::alignmentTransformIndexGlobal(
id ) ) ;
145 assert( 0 == globalPtr || iGlob < globalPtr->m_align.size() ) ;
149 assert( 0 == gt || iGlob == T::alignmentTransformIndexGlobal(
DetId( gt->rawId() ) ) ) ;
151 const unsigned int iLoc ( 0 == alignPtr ? 0 :
152 T::alignmentTransformIndexLocal(
id ) ) ;
154 assert( 0 == alignPtr || iLoc < alignPtr->m_align.size() ) ;
159 assert( 0 == at || ( T::alignmentTransformIndexLocal(
DetId( at->rawId() ) ) == iLoc ) ) ;
165 T::localCorners( lc, &dims.front(),
i, lRef ) ;
167 const Pt3D lBck ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] ) ) ;
168 const Pt3D lCor ( lc[0] ) ;
171 const unsigned int jj (
i*nTrParm ) ;
173 const ROOT::Math::Translation3D tl ( tvec[jj], tvec[jj+1], tvec[jj+2] ) ;
178 const ROOT::Math::Transform3D rt ( ea, tl ) ;
179 double xx,
xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz;
180 rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
181 tr =
Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
184 CLHEP::Hep3Vector(dx,dy,dz) );
187 const Tr3D atr ( 0 == at ? tr :
188 ( 0 == gt ? at->transform()*tr :
189 at->transform()*gt->transform()*tr ) ) ;
192 const Pt3D gRef ( atr*lRef ) ;
193 const GlobalPoint fCtr ( gRef.x(), gRef.y(), gRef.z() ) ;
194 const Pt3D gBck ( atr*lBck ) ;
195 const GlobalPoint fBck ( gBck.x(), gBck.y(), gBck.z() ) ;
196 const Pt3D gCor ( atr*lCor ) ;
197 const GlobalPoint fCor ( gCor.x(), gCor.y(), gCor.z() ) ;
199 ptr->newCell( fCtr, fBck, fCor, myParm,
id ) ;
202 ptr->initializeParms() ;
CaloCellGeometry::Pt3D Pt3D
std::vector< CCGFloat > DimVec
std::vector< unsigned int > IVec
CaloCellGeometry::Pt3DVec Pt3DVec
std::vector< CCGFloat > TrVec
HepGeom::Transform3D Tr3D
std::vector< Pt3D > Pt3DVec
std::vector< AlignTransform > m_align
boost::shared_ptr< CaloSubdetectorGeometry > PtrType
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
CaloSubdetectorGeometry::IVec IVec
PtrType produceAligned(const typename T::AlignedRecord &iRecord)
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector) const
AlgebraicVector EulerAngles
T const * product() const
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
CaloCellGeometry::CCGFloat CCGFloat