1 #ifndef GEOMETRY_CALOGEOMETRY_CALOGEOMETRYDBEP_H
2 #define GEOMETRY_CALOGEOMETRY_CALOGEOMETRYDBEP_H 1
6 #include "boost/shared_ptr.hpp"
27 #include <Math/Transform3D.h>
28 #include <Math/EulerAngles.h>
36 template <
class T,
class U>
46 typedef boost::shared_ptr< CaloSubdetectorGeometry >
PtrType ;
70 iRecord.template getRecord< typename T::AlignmentRecord >().
get( alignments ) ;
73 ( alignments->m_align.size() == T::numberOfAlignments() ) ) ;
74 alignPtr = alignments.
product() ;
77 iRecord.template getRecord<GlobalPositionRcd>().
get( globals ) ;
86 std::vector<uint32_t> dins;
91 iRecord.get( T::producerTag() +
std::string(
"_master"), pG ) ;
97 U::write( tvec, dvec, ivec, T::dbString() ) ;
102 iRecord.template getRecord<typename T::PGeometryRecord >().
get( pG ) ;
104 tvec = pG->getTranslation() ;
105 dvec = pG->getDimension() ;
106 ivec = pG->getIndexes() ;
110 const unsigned int nTrParm ( tvec.size()/T::k_NumberOfCellsForCorners ) ;
112 assert( dvec.size() == T::k_NumberOfShapes * T::k_NumberOfParametersPerShape ) ;
116 ptr->fillDefaultNamedParameters() ;
118 ptr->allocateCorners( T::k_NumberOfCellsForCorners ) ;
120 ptr->allocatePar( dvec.size() ,
121 T::k_NumberOfParametersPerShape ) ;
123 for(
unsigned int i ( 0 ) ;
i != T::k_NumberOfCellsForCorners ; ++
i )
125 const unsigned int nPerShape ( T::k_NumberOfParametersPerShape ) ;
127 dims.reserve( nPerShape ) ;
129 const unsigned int indx ( ivec.size()==1 ? 0 :
i ) ;
131 DimVec::const_iterator dsrc ( dvec.begin() + ivec[indx]*nPerShape ) ;
133 for(
unsigned int j ( 0 ) ;
j != nPerShape ; ++
j )
135 dims.push_back( *dsrc ) ;
141 ptr->parVecVec() ) ) ;
144 const DetId id ( T::DetIdType::detIdFromDenseIndex(
i ) ) ;
146 const unsigned int iGlob ( 0 == globalPtr ? 0 :
147 T::alignmentTransformIndexGlobal(
id ) ) ;
149 assert( 0 == globalPtr || iGlob < globalPtr->m_align.size() ) ;
153 assert( 0 == gt || iGlob == T::alignmentTransformIndexGlobal(
DetId( gt->rawId() ) ) ) ;
155 const unsigned int iLoc ( 0 == alignPtr ? 0 :
156 T::alignmentTransformIndexLocal(
id ) ) ;
158 assert( 0 == alignPtr || iLoc < alignPtr->m_align.size() ) ;
163 assert( 0 == at || ( T::alignmentTransformIndexLocal(
DetId( at->rawId() ) ) == iLoc ) ) ;
169 T::localCorners( lc, &dims.front(),
i, lRef ) ;
171 const Pt3D lBck ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] ) ) ;
172 const Pt3D lCor ( lc[0] ) ;
175 const unsigned int jj (
i*nTrParm ) ;
177 const ROOT::Math::Translation3D tl ( tvec[jj], tvec[jj+1], tvec[jj+2] ) ;
182 const ROOT::Math::Transform3D rt ( ea, tl ) ;
183 double xx,
xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz;
184 rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
185 tr =
Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
188 CLHEP::Hep3Vector(dx,dy,dz) );
191 const Tr3D atr ( 0 == at ? tr :
192 ( 0 == gt ? at->transform()*tr :
193 at->transform()*gt->transform()*tr ) ) ;
196 const Pt3D gRef ( atr*lRef ) ;
197 const GlobalPoint fCtr ( gRef.x(), gRef.y(), gRef.z() ) ;
198 const Pt3D gBck ( atr*lBck ) ;
199 const GlobalPoint fBck ( gBck.x(), gBck.y(), gBck.z() ) ;
200 const Pt3D gCor ( atr*lCor ) ;
201 const GlobalPoint fCor ( gCor.x(), gCor.y(), gCor.z() ) ;
203 ptr->newCell( fCtr, fBck, fCor, myParm,
id ) ;
206 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
const edm::ParameterSet m_pSet
std::vector< AlignTransform > m_align
boost::shared_ptr< CaloSubdetectorGeometry > PtrType
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
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)
AlgebraicVector EulerAngles
T const * product() const
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
CaloCellGeometry::CCGFloat CCGFloat