1 #ifndef GEOMETRY_CALOGEOMETRY_CALOGEOMETRYDBEP_H 2 #define GEOMETRY_CALOGEOMETRY_CALOGEOMETRYDBEP_H 1 24 #include <Math/Transform3D.h> 25 #include <Math/EulerAngles.h> 35 template <
typename T,
bool>
40 return cc.template consumes<CaloSubdetectorGeometry>(
50 return cc.template consumesFrom<PCaloGeometry, typename T::PGeometryRecord>(
edm::ESInputTag{});
84 template <
class T,
class U>
92 using PtrType = std::unique_ptr<CaloSubdetectorGeometry>;
105 cc.template consumesFrom<Alignments, typename T::AlignmentRecord>(
edm::ESInputTag{});
122 std::vector<uint32_t> dins;
127 pG.getSummary(tvec, ivec, dvec, dins);
129 U::write(tvec, dvec, ivec, T::dbString());
133 tvec = pG.getTranslation();
134 dvec = pG.getDimension();
135 ivec = pG.getIndexes();
139 const unsigned int nTrParm(tvec.size() / T::k_NumberOfCellsForCorners);
141 assert(dvec.size() == T::k_NumberOfShapes * T::k_NumberOfParametersPerShape);
143 PtrType ptr = std::make_unique<T>();
145 ptr->fillDefaultNamedParameters();
147 ptr->allocateCorners(T::k_NumberOfCellsForCorners);
149 ptr->allocatePar(dvec.size(), T::k_NumberOfParametersPerShape);
151 for (
unsigned int i(0);
i != T::k_NumberOfCellsForCorners; ++
i) {
152 const unsigned int nPerShape(T::k_NumberOfParametersPerShape);
154 dims.reserve(nPerShape);
156 const unsigned int indx(ivec.size() == 1 ? 0 :
i);
158 DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
160 for (
unsigned int j(0);
j != nPerShape; ++
j) {
161 dims.emplace_back(*dsrc);
167 const DetId id(T::DetIdType::detIdFromDenseIndex(
i));
169 const unsigned int iGlob(
nullptr == globalPtr ? 0 : T::alignmentTransformIndexGlobal(
id));
171 assert(
nullptr == globalPtr || iGlob < globalPtr->m_align.size());
173 const AlignTransform*
gt(
nullptr == globalPtr ?
nullptr : &globalPtr->m_align[iGlob]);
175 assert(
nullptr ==
gt || iGlob == T::alignmentTransformIndexGlobal(
DetId(
gt->rawId())));
177 const unsigned int iLoc(
nullptr == alignPtr ? 0 : T::alignmentTransformIndexLocal(
id));
179 assert(
nullptr == alignPtr || iLoc < alignPtr->m_align.size());
181 const AlignTransform* at(
nullptr == alignPtr ?
nullptr : &alignPtr->m_align[iLoc]);
183 assert(
nullptr == at || (T::alignmentTransformIndexLocal(
DetId(at->rawId())) == iLoc));
189 T::localCorners(lc, &dims.front(),
i, lRef);
191 const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7]));
192 const Pt3D lCor(lc[0]);
195 const unsigned int jj(
i * nTrParm);
197 const ROOT::Math::Translation3D tl(tvec[
jj], tvec[
jj + 1], tvec[
jj + 2]);
200 const ROOT::Math::Transform3D
rt(ea, tl);
201 double xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz;
202 rt.GetComponents(
xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz);
203 tr =
Tr3D(CLHEP::HepRep3x3(
xx,
xy,
xz, yx,
yy,
yz, zx, zy,
zz), CLHEP::Hep3Vector(
dx,
dy,
dz));
206 const Tr3D atr(
nullptr == at ? tr
207 : (
nullptr ==
gt ? at->transform() * tr : at->transform() *
gt->transform() * tr));
210 const Pt3D gRef(atr * lRef);
211 const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
212 const Pt3D gBck(atr * lBck);
213 const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
214 const Pt3D gCor(atr * lCor);
215 const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
217 ptr->newCell(fCtr, fBck, fCor, myParm,
id);
220 ptr->initializeParms();
226 std::tuple<const Alignments*, const Alignments*>
getAlignGlobal(
const typename T::AlignedRecord& iRecord)
const {
238 globalPtr = &globals;
241 return std::make_tuple(alignPtr, globalPtr);
static constexpr bool value
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
CaloCellGeometry::Pt3D Pt3D
static TokenType makeToken(edm::ESConsumesCollectorT< typename T::AlignedRecord > &cc)
std::vector< CCGFloat > DimVec
std::false_type has_AlignmentRecord(...)
edm::ESGetToken< Alignments, GlobalPositionRcd > globals
uint32_t cc[maxCellsPerHit]
std::unique_ptr< CaloSubdetectorGeometry > PtrType
calogeometryDBEPimpl::AlignmentTokens< T > alignmentTokens_
std::vector< unsigned int > IVec
CaloCellGeometry::Pt3DVec Pt3DVec
std::vector< CCGFloat > TrVec
HepGeom::Transform3D Tr3D
std::vector< Pt3D > Pt3DVec
CaloGeometryDBEP(const edm::ParameterSet &ps)
std::tuple< const Alignments *, const Alignments * > getAlignGlobal(const typename T::AlignedRecord &iRecord) const
CaloSubdetectorGeometry::IVec IVec
~CaloGeometryDBEP() override
PtrType produceAligned(const typename T::AlignedRecord &iRecord)
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
AlgebraicVector EulerAngles
void makeTokens(edm::ESConsumesCollectorT< typename T::AlignedRecord > &cc)
edm::ESGetToken< Alignments, typename T::AlignmentRecord > alignments
static TokenType makeToken(edm::ESConsumesCollectorT< typename T::AlignedRecord > &cc)
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
CaloCellGeometry::CCGFloat CCGFloat
calogeometryDBEPimpl::AdditionalTokens< T > additionalTokens_