22 const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
29 const auto& pG = iRecord.
get(geometryToken_);
31 pG.getSummary(tvec, ivec, dvec, dins);
36 const auto& hcalTopology = iRecord.
get(additionalTokens_.topology);
46 const unsigned int nTrParm(hcalGeometry->numberOfTransformParms());
48 ptr->fillDefaultNamedParameters();
49 ptr->allocateCorners(hcalTopology.ncells() + hcalTopology.getHFSize());
52 for (
unsigned int i(0);
i < dins.size(); ++
i) {
55 dims.reserve(nPerShape);
57 const unsigned int indx(ivec.size() == 1 ? 0 :
i);
59 DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
61 for (
unsigned int j(0);
j != nPerShape; ++
j) {
62 dims.push_back(*dsrc);
68 const DetId id(hcalTopology.denseId2detId(dins[
i]));
72 assert(
nullptr == globalPtr || iGlob < globalPtr->m_align.size());
74 const AlignTransform*
gt(
nullptr == globalPtr ?
nullptr : &globalPtr->m_align[iGlob]);
80 assert(
nullptr == alignPtr || iLoc < alignPtr->m_align.size());
82 const AlignTransform* at(
nullptr == alignPtr ?
nullptr : &alignPtr->m_align[iLoc]);
88 hcalGeometry->localCorners(lc, &dims.front(), dins[
i], lRef);
90 const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7]));
91 const Pt3D lCor(lc[0]);
94 const unsigned int jj(
i * nTrParm);
97 const ROOT::Math::Translation3D tl(tvec[
jj], tvec[
jj + 1], tvec[
jj + 2]);
100 const ROOT::Math::Transform3D
rt(ea, tl);
103 double zx, zy,
zz,
dz;
104 rt.GetComponents(
xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz);
105 tr =
Tr3D(CLHEP::HepRep3x3(
xx,
xy,
xz, yx,
yy,
yz, zx, zy,
zz), CLHEP::Hep3Vector(
dx,
dy,
dz));
108 const Tr3D atr(
nullptr == at ? tr
109 : (
nullptr ==
gt ? at->transform() * tr : at->transform() *
gt->transform() * tr));
112 const Pt3D gRef(atr * lRef);
113 const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
114 const Pt3D gBck(atr * lBck);
115 const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
116 const Pt3D gCor(atr * lCor);
117 const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
119 assert(hcalTopology.detId2denseId(
id) == dins[
i]);
120 ptr->newCell(fCtr, fBck, fCor, myParm,
id);
123 ptr->initializeParms();
132 const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
139 const auto& pG = iRecord.
get(geometryToken_);
141 pG.getSummary(tvec, ivec, dvec, dins);
146 const auto& caloTopology = iRecord.
get(additionalTokens_.topology);
156 ptr->fillDefaultNamedParameters();
162 for (
unsigned int i(0);
i < dins.size(); ++
i) {
165 dims.reserve(nPerShape);
167 const unsigned int indx(ivec.size() == 1 ? 0 :
i);
169 DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
171 for (
unsigned int j(0);
j != nPerShape; ++
j) {
172 dims.push_back(*dsrc);
178 const DetId id(caloTopology.detIdFromDenseIndex(dins[
i]));
182 assert(
nullptr == globalPtr || iGlob < globalPtr->m_align.size());
184 const AlignTransform*
gt(
nullptr == globalPtr ?
nullptr : &globalPtr->m_align[iGlob]);
190 assert(
nullptr == alignPtr || iLoc < alignPtr->m_align.size());
192 const AlignTransform* at(
nullptr == alignPtr ?
nullptr : &alignPtr->m_align[iLoc]);
202 const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7]));
203 const Pt3D lCor(lc[0]);
206 const unsigned int jj(
i * nTrParm);
208 const ROOT::Math::Translation3D tl(tvec[
jj], tvec[
jj + 1], tvec[
jj + 2]);
211 const ROOT::Math::Transform3D
rt(ea, tl);
212 double xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz;
213 rt.GetComponents(
xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz);
214 tr =
Tr3D(CLHEP::HepRep3x3(
xx,
xy,
xz, yx,
yy,
yz, zx, zy,
zz), CLHEP::Hep3Vector(
dx,
dy,
dz));
217 const Tr3D atr(
nullptr == at ? tr
218 : (
nullptr ==
gt ? at->transform() * tr : at->transform() *
gt->transform() * tr));
221 const Pt3D gRef(atr * lRef);
222 const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
223 const Pt3D gBck(atr * lBck);
224 const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
225 const Pt3D gCor(atr * lCor);
226 const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
228 assert(caloTopology.denseIndex(
id) == dins[
i]);
230 ptr->newCell(fCtr, fBck, fCor, myParm,
id);
233 ptr->initializeParms();
247 const auto&
geom = iRecord.
get(geometryToken_);
249 geom.getSummary(tvec, ivec, dvec, dins);
254 const auto&
topology = iRecord.
get(additionalTokens_.topology);
260 ptr->allocateCorners(
topology.ncells());
263 const unsigned int nTrParm(ptr->numberOfTransformParms());
266 for (
auto it : dins) {
272 const unsigned int jj(
it * nTrParm);
274 const ROOT::Math::Translation3D tl(tvec[
jj], tvec[
jj + 1], tvec[
jj + 2]);
277 const ROOT::Math::Transform3D
rt(ea, tl);
278 double xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz;
279 rt.GetComponents(
xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz);
280 tr =
Tr3D(CLHEP::HepRep3x3(
xx,
xy,
xz, yx,
yy,
yz, zx, zy,
zz), CLHEP::Hep3Vector(
dx,
dy,
dz));
284 dims.reserve(nPerShape);
286 DimVec::const_iterator dsrc(dvec.begin() +
layer * nPerShape);
287 for (
unsigned int j(0);
j != nPerShape; ++
j) {
288 dims.push_back(*dsrc);
299 (corners[0].
x() + corners[1].
x() + corners[2].
x() + corners[3].
x() + corners[4].
x() + corners[5].
x()),
301 (corners[0].
y() + corners[1].
y() + corners[2].
y() + corners[3].
y() + corners[4].
y() + corners[5].
y()),
303 (corners[0].
z() + corners[1].
z() + corners[2].
z() + corners[3].
z() + corners[4].
z() + corners[5].
z()));
307 (corners[6].
x() + corners[7].
x() + corners[8].
x() + corners[9].
x() + corners[10].
x() + corners[11].
x()),
309 (corners[6].
y() + corners[7].
y() + corners[8].
y() + corners[9].
y() + corners[10].
y() + corners[11].
y()),
311 (corners[6].
z() + corners[7].
z() + corners[8].
z() + corners[9].
z() + corners[10].
z() + corners[11].
z()));
319 ptr->newCell(front, back, corners[0], myParm,
id);
322 ptr->initializeParms();
330 const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
337 const auto& pG = iRecord.
get(geometryToken_);
339 pG.getSummary(tvec, ivec, dvec, dins);
344 const auto& zdcTopology = iRecord.
get(additionalTokens_.topology);
354 const unsigned int nTrParm(tvec.size() / zdcTopology.kSizeForDenseIndexing());
356 ptr->fillDefaultNamedParameters();
357 ptr->allocateCorners(zdcTopology.kSizeForDenseIndexing());
360 for (
unsigned int i(0);
i < dins.size(); ++
i) {
363 dims.reserve(nPerShape);
365 const unsigned int indx(ivec.size() == 1 ? 0 :
i);
367 DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
369 for (
unsigned int j(0);
j != nPerShape; ++
j) {
370 dims.push_back(*dsrc);
376 const DetId id(zdcTopology.denseId2detId(dins[
i]));
380 assert(
nullptr == globalPtr || iGlob < globalPtr->m_align.size());
382 const AlignTransform*
gt(
nullptr == globalPtr ?
nullptr : &globalPtr->m_align[iGlob]);
388 assert(
nullptr == alignPtr || iLoc < alignPtr->m_align.size());
390 const AlignTransform* at(
nullptr == alignPtr ?
nullptr : &alignPtr->m_align[iLoc]);
396 zdcGeometry->localCorners(lc, &dims.front(), dins[
i], lRef);
398 const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7]));
399 const Pt3D lCor(lc[0]);
402 const unsigned int jj(
i * nTrParm);
404 const ROOT::Math::Translation3D tl(tvec[
jj], tvec[
jj + 1], tvec[
jj + 2]);
407 const ROOT::Math::Transform3D
rt(ea, tl);
410 double zx, zy,
zz,
dz;
411 rt.GetComponents(
xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz);
412 tr =
Tr3D(CLHEP::HepRep3x3(
xx,
xy,
xz, yx,
yy,
yz, zx, zy,
zz), CLHEP::Hep3Vector(
dx,
dy,
dz));
415 const Tr3D atr(
nullptr == at ? tr
416 : (
nullptr ==
gt ? at->transform() * tr : at->transform() *
gt->transform() * tr));
419 const Pt3D gRef(atr * lRef);
420 const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
421 const Pt3D gBck(atr * lBck);
422 const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
423 const Pt3D gCor(atr * lCor);
424 const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
426 assert(zdcTopology.detId2denseId(
id) == dins[
i]);
427 ptr->newCell(fCtr, fBck, fCor, myParm,
id);
430 ptr->initializeParms();
static constexpr unsigned int k_NumberOfShapes
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
static unsigned int alignmentTransformIndexLocal(const DetId &id)
CaloCellGeometry::Pt3D Pt3D
CaloGeometryDBEP< HcalGeometry, CaloGeometryDBWriter > HcalGeometryToDBEP
static unsigned int alignmentTransformIndexLocal(const DetId &id)
virtual unsigned int numberOfCellsForCorners() const
static void writeIndexed(const TrVec &tvec, const DimVec &dvec, const IVec &ivec, const IVec &dins, const std::string &tag)
unsigned int numberOfShapes() const override
CaloGeometryDBEP< CastorGeometry, CaloGeometryDBWriter > CastorGeometryToDBEP
std::unique_ptr< CaloSubdetectorGeometry > PtrType
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
static constexpr int k_NumberOfParametersPerShape
unsigned int numberOfParametersPerShape() const override
CaloCellGeometry::Pt3DVec Pt3DVec
unsigned int alignmentTransformIndexLocal(const DetId &id)
void swap(Association< C > &lhs, Association< C > &rhs)
static constexpr unsigned int ncorner_
CaloGeometryDBEP< EcalEndcapGeometry, CaloGeometryDBWriter > EcalEndcapGeometryToDBEP
CaloSubdetectorGeometry::IVec IVec
static constexpr unsigned int k_NumberOfParametersPerShape
CaloGeometryDBEP< CaloTowerGeometry, CaloGeometryDBWriter > CaloTowerGeometryToDBEP
CaloGeometryDBEP< ZdcGeometry, CaloGeometryDBWriter > ZdcGeometryToDBEP
static constexpr int k_NumberOfShapes
static std::string dbString()
static std::string dbString()
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
PtrType produceAligned(const typename T::AlignedRecord &iRecord)
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
CaloGeometryDBEP< EcalPreshowerGeometry, CaloGeometryDBWriter > EcalPreshowerGeometryToDBEP
unsigned int alignmentTransformIndexGlobal(const DetId &id)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
static constexpr unsigned int ncornerBy2_
AlgebraicVector EulerAngles
CaloGeometryDBEP< HGCalGeometry, CaloGeometryDBWriter > HGCalGeometryToDBEP
static std::string dbString()
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
CaloGeometryDBEP< EcalBarrelGeometry, CaloGeometryDBWriter > EcalBarrelGeometryToDBEP
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
CaloCellGeometry::CCGFloat CCGFloat
static std::string dbString()
static constexpr double oneBySix_