1 #ifndef GEOMETRY_CALOGEOMETRY_CALOGEOMETRYDBEP_H 2 #define GEOMETRY_CALOGEOMETRY_CALOGEOMETRYDBEP_H 1 25 #include <Math/Transform3D.h> 26 #include <Math/EulerAngles.h> 34 template <
class T,
class U>
44 using PtrType = std::unique_ptr<CaloSubdetectorGeometry >;
68 iRecord.template getRecord< typename T::AlignmentRecord >().
get( alignments ) ;
71 ( alignments->
m_align.size() == T::numberOfAlignments() ) ) ;
72 alignPtr = alignments.
product() ;
75 iRecord.template getRecord<GlobalPositionRcd>().
get( globals ) ;
84 std::vector<uint32_t> dins;
89 iRecord.get( T::producerTag() +
std::string(
"_master"), pG ) ;
95 U::write( tvec, dvec, ivec, T::dbString() ) ;
100 iRecord.template getRecord<typename T::PGeometryRecord >().
get( pG ) ;
108 const unsigned int nTrParm ( tvec.size()/T::k_NumberOfCellsForCorners ) ;
110 assert( dvec.size() == T::k_NumberOfShapes * T::k_NumberOfParametersPerShape ) ;
112 PtrType ptr = std::make_unique<T>();
114 ptr->fillDefaultNamedParameters() ;
116 ptr->allocateCorners( T::k_NumberOfCellsForCorners ) ;
118 ptr->allocatePar( dvec.size() ,
119 T::k_NumberOfParametersPerShape ) ;
121 for(
unsigned int i ( 0 ) ;
i != T::k_NumberOfCellsForCorners ; ++
i )
123 const unsigned int nPerShape ( T::k_NumberOfParametersPerShape ) ;
125 dims.reserve( nPerShape ) ;
127 const unsigned int indx ( ivec.size()==1 ? 0 :
i ) ;
129 DimVec::const_iterator dsrc ( dvec.begin() + ivec[indx]*nPerShape ) ;
131 for(
unsigned int j ( 0 ) ; j != nPerShape ; ++j )
133 dims.emplace_back( *dsrc ) ;
139 ptr->parVecVec() ) ) ;
142 const DetId id ( T::DetIdType::detIdFromDenseIndex(
i ) ) ;
144 const unsigned int iGlob (
nullptr == globalPtr ? 0 :
145 T::alignmentTransformIndexGlobal(
id ) ) ;
147 assert(
nullptr == globalPtr || iGlob < globalPtr->m_align.size() ) ;
151 assert(
nullptr == gt || iGlob == T::alignmentTransformIndexGlobal(
DetId( gt->rawId() ) ) ) ;
153 const unsigned int iLoc (
nullptr == alignPtr ? 0 :
154 T::alignmentTransformIndexLocal(
id ) ) ;
156 assert(
nullptr == alignPtr || iLoc < alignPtr->m_align.size() ) ;
161 assert(
nullptr == at || ( T::alignmentTransformIndexLocal(
DetId( at->rawId() ) ) == iLoc ) ) ;
166 Pt3DVec lc ( 8,
Pt3D(0,0,0) ) ;
167 T::localCorners( lc, &dims.front(),
i, lRef ) ;
169 const Pt3D lBck ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] ) ) ;
170 const Pt3D lCor ( lc[0] ) ;
173 const unsigned int jj (
i*nTrParm ) ;
175 const ROOT::Math::Translation3D tl ( tvec[jj], tvec[jj+1], tvec[jj+2] ) ;
180 const ROOT::Math::Transform3D rt ( ea, tl ) ;
181 double xx,
xy,
xz,
dx,yx,
yy,
yz,
dy,zx,zy,
zz,
dz;
182 rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
183 tr =
Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
186 CLHEP::Hep3Vector(dx,dy,dz) );
189 const Tr3D atr (
nullptr == at ? tr :
190 (
nullptr == gt ? at->transform()*tr :
191 at->transform()*gt->transform()*tr ) ) ;
194 const Pt3D gRef ( atr*lRef ) ;
195 const GlobalPoint fCtr ( gRef.x(), gRef.y(), gRef.z() ) ;
196 const Pt3D gBck ( atr*lBck ) ;
197 const GlobalPoint fBck ( gBck.x(), gBck.y(), gBck.z() ) ;
198 const Pt3D gCor ( atr*lCor ) ;
199 const GlobalPoint fCor ( gCor.x(), gCor.y(), gCor.z() ) ;
201 ptr->newCell( fCtr, fBck, fCor, myParm,
id ) ;
204 ptr->initializeParms() ;
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
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::vector< AlignTransform > m_align
std::vector< float > const & getDimension() const
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
CaloSubdetectorGeometry::IVec IVec
std::unique_ptr< CaloSubdetectorGeometry > PtrType
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