1 #ifndef GEOMETRY_CALOGEOMETRY_CALOGEOMETRYDBEP_H 2 #define GEOMETRY_CALOGEOMETRY_CALOGEOMETRYDBEP_H 1 26 #include <Math/Transform3D.h> 27 #include <Math/EulerAngles.h> 35 template <
class T,
class U>
45 typedef std::shared_ptr<CaloSubdetectorGeometry >
PtrType ;
69 iRecord.template getRecord< typename T::AlignmentRecord >().
get( alignments ) ;
72 ( alignments->
m_align.size() == T::numberOfAlignments() ) ) ;
73 alignPtr = alignments.
product() ;
76 iRecord.template getRecord<GlobalPositionRcd>().
get( globals ) ;
85 std::vector<uint32_t> dins;
90 iRecord.get( T::producerTag() +
std::string(
"_master"), pG ) ;
96 U::write( tvec, dvec, ivec, T::dbString() ) ;
101 iRecord.template getRecord<typename T::PGeometryRecord >().
get( pG ) ;
109 const unsigned int nTrParm ( tvec.size()/T::k_NumberOfCellsForCorners ) ;
111 assert( dvec.size() == T::k_NumberOfShapes * T::k_NumberOfParametersPerShape ) ;
113 PtrType ptr (
new T ) ;
115 ptr->fillDefaultNamedParameters() ;
117 ptr->allocateCorners( T::k_NumberOfCellsForCorners ) ;
119 ptr->allocatePar( dvec.size() ,
120 T::k_NumberOfParametersPerShape ) ;
122 for(
unsigned int i ( 0 ) ;
i != T::k_NumberOfCellsForCorners ; ++
i )
124 const unsigned int nPerShape ( T::k_NumberOfParametersPerShape ) ;
126 dims.reserve( nPerShape ) ;
128 const unsigned int indx ( ivec.size()==1 ? 0 :
i ) ;
130 DimVec::const_iterator dsrc ( dvec.begin() + ivec[indx]*nPerShape ) ;
132 for(
unsigned int j ( 0 ) ; j != nPerShape ; ++j )
134 dims.push_back( *dsrc ) ;
140 ptr->parVecVec() ) ) ;
143 const DetId id ( T::DetIdType::detIdFromDenseIndex(
i ) ) ;
145 const unsigned int iGlob ( 0 == globalPtr ? 0 :
146 T::alignmentTransformIndexGlobal(
id ) ) ;
148 assert( 0 == globalPtr || iGlob < globalPtr->m_align.size() ) ;
152 assert( 0 == gt || iGlob == T::alignmentTransformIndexGlobal(
DetId( gt->rawId() ) ) ) ;
154 const unsigned int iLoc ( 0 == alignPtr ? 0 :
155 T::alignmentTransformIndexLocal(
id ) ) ;
157 assert( 0 == alignPtr || iLoc < alignPtr->m_align.size() ) ;
162 assert( 0 == at || ( T::alignmentTransformIndexLocal(
DetId( at->rawId() ) ) == iLoc ) ) ;
167 Pt3DVec lc ( 8,
Pt3D(0,0,0) ) ;
168 T::localCorners( lc, &dims.front(),
i, lRef ) ;
170 const Pt3D lBck ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] ) ) ;
171 const Pt3D lCor ( lc[0] ) ;
174 const unsigned int jj (
i*nTrParm ) ;
176 const ROOT::Math::Translation3D tl ( tvec[jj], tvec[jj+1], tvec[jj+2] ) ;
181 const ROOT::Math::Transform3D rt ( ea, tl ) ;
182 double xx,
xy,
xz,dx,yx,
yy,
yz,dy,zx,zy,
zz,
dz;
183 rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
184 tr =
Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
187 CLHEP::Hep3Vector(dx,dy,dz) );
190 const Tr3D atr ( 0 == at ? tr :
191 ( 0 == gt ? at->transform()*tr :
192 at->transform()*gt->transform()*tr ) ) ;
195 const Pt3D gRef ( atr*lRef ) ;
196 const GlobalPoint fCtr ( gRef.x(), gRef.y(), gRef.z() ) ;
197 const Pt3D gBck ( atr*lBck ) ;
198 const GlobalPoint fBck ( gBck.x(), gBck.y(), gBck.z() ) ;
199 const Pt3D gCor ( atr*lCor ) ;
200 const GlobalPoint fCor ( gCor.x(), gCor.y(), gCor.z() ) ;
202 ptr->newCell( fCtr, fBck, fCor, myParm,
id ) ;
205 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< float > const & getTranslation() const
const edm::ParameterSet m_pSet
std::shared_ptr< CaloSubdetectorGeometry > PtrType
std::vector< AlignTransform > m_align
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
std::vector< float > const & getDimension() const
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
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
T const * product() const
CaloCellGeometry::CCGFloat CCGFloat
std::vector< uint32_t > const & getIndexes() const