20 const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
27 const auto& pG = iRecord.
get(geometryToken_);
29 pG.getSummary(tvec, ivec, dvec, dins);
34 const auto& hcalTopology = iRecord.
get(additionalTokens_.topology);
44 const unsigned int nTrParm(hcalGeometry->numberOfTransformParms());
46 ptr->fillDefaultNamedParameters();
47 ptr->allocateCorners(hcalTopology.ncells() + hcalTopology.getHFSize());
50 for (
unsigned int i(0);
i < dins.size(); ++
i) {
53 dims.reserve(nPerShape);
55 const unsigned int indx(ivec.size() == 1 ? 0 :
i);
57 DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
59 for (
unsigned int j(0);
j != nPerShape; ++
j) {
60 dims.push_back(*dsrc);
66 const DetId id(hcalTopology.denseId2detId(dins[
i]));
70 assert(
nullptr == globalPtr || iGlob < globalPtr->m_align.size());
72 const AlignTransform*
gt(
nullptr == globalPtr ?
nullptr : &globalPtr->m_align[iGlob]);
78 assert(
nullptr == alignPtr || iLoc < alignPtr->m_align.size());
80 const AlignTransform* at(
nullptr == alignPtr ?
nullptr : &alignPtr->m_align[iLoc]);
86 hcalGeometry->localCorners(lc, &dims.front(), dins[
i], lRef);
88 const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7]));
89 const Pt3D lCor(lc[0]);
92 const unsigned int jj(
i * nTrParm);
95 const ROOT::Math::Translation3D tl(tvec[
jj], tvec[
jj + 1], tvec[
jj + 2]);
98 const ROOT::Math::Transform3D
rt(ea, tl);
101 double zx, zy,
zz,
dz;
102 rt.GetComponents(
xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz);
103 tr =
Tr3D(CLHEP::HepRep3x3(
xx,
xy,
xz, yx,
yy,
yz, zx, zy,
zz), CLHEP::Hep3Vector(
dx,
dy,
dz));
106 const Tr3D atr(
nullptr == at ? tr
107 : (
nullptr ==
gt ? at->transform() * tr : at->transform() *
gt->transform() * tr));
110 const Pt3D gRef(atr * lRef);
111 const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
112 const Pt3D gBck(atr * lBck);
113 const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
114 const Pt3D gCor(atr * lCor);
115 const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
117 assert(hcalTopology.detId2denseId(
id) == dins[
i]);
118 ptr->newCell(fCtr, fBck, fCor, myParm,
id);
121 ptr->initializeParms();
130 const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
137 const auto& pG = iRecord.
get(geometryToken_);
139 pG.getSummary(tvec, ivec, dvec, dins);
144 const auto& caloTopology = iRecord.
get(additionalTokens_.topology);
154 ptr->fillDefaultNamedParameters();
160 for (
unsigned int i(0);
i < dins.size(); ++
i) {
163 dims.reserve(nPerShape);
165 const unsigned int indx(ivec.size() == 1 ? 0 :
i);
167 DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
169 for (
unsigned int j(0);
j != nPerShape; ++
j) {
170 dims.push_back(*dsrc);
176 const DetId id(caloTopology.detIdFromDenseIndex(dins[
i]));
180 assert(
nullptr == globalPtr || iGlob < globalPtr->m_align.size());
182 const AlignTransform*
gt(
nullptr == globalPtr ?
nullptr : &globalPtr->m_align[iGlob]);
188 assert(
nullptr == alignPtr || iLoc < alignPtr->m_align.size());
190 const AlignTransform* at(
nullptr == alignPtr ?
nullptr : &alignPtr->m_align[iLoc]);
200 const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7]));
201 const Pt3D lCor(lc[0]);
204 const unsigned int jj(
i * nTrParm);
206 const ROOT::Math::Translation3D tl(tvec[
jj], tvec[
jj + 1], tvec[
jj + 2]);
209 const ROOT::Math::Transform3D
rt(ea, tl);
210 double xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz;
211 rt.GetComponents(
xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz);
212 tr =
Tr3D(CLHEP::HepRep3x3(
xx,
xy,
xz, yx,
yy,
yz, zx, zy,
zz), CLHEP::Hep3Vector(
dx,
dy,
dz));
215 const Tr3D atr(
nullptr == at ? tr
216 : (
nullptr ==
gt ? at->transform() * tr : at->transform() *
gt->transform() * tr));
219 const Pt3D gRef(atr * lRef);
220 const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
221 const Pt3D gBck(atr * lBck);
222 const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
223 const Pt3D gCor(atr * lCor);
224 const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
226 assert(caloTopology.denseIndex(
id) == dins[
i]);
228 ptr->newCell(fCtr, fBck, fCor, myParm,
id);
231 ptr->initializeParms();
245 const auto&
geom = iRecord.
get(geometryToken_);
247 geom.getSummary(tvec, ivec, dvec, dins);
252 const auto& topology = iRecord.
get(additionalTokens_.topology);
258 ptr->allocateCorners(topology.ncells());
261 const unsigned int nTrParm(ptr->numberOfTransformParms());
264 for (
auto it : dins) {
265 DetId id = topology.encode(topology.geomDenseId2decId(it));
267 int layer = ivec[it];
270 const unsigned int jj(it * nTrParm);
272 const ROOT::Math::Translation3D tl(tvec[
jj], tvec[
jj + 1], tvec[
jj + 2]);
275 const ROOT::Math::Transform3D
rt(ea, tl);
276 double xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz;
277 rt.GetComponents(
xx,
xy,
xz,
dx, yx,
yy,
yz,
dy, zx, zy,
zz,
dz);
278 tr =
Tr3D(CLHEP::HepRep3x3(
xx,
xy,
xz, yx,
yy,
yz, zx, zy,
zz), CLHEP::Hep3Vector(
dx,
dy,
dz));
282 dims.reserve(nPerShape);
284 DimVec::const_iterator dsrc(dvec.begin() +
layer * nPerShape);
285 for (
unsigned int j(0);
j != nPerShape; ++
j) {
286 dims.push_back(*dsrc);
297 (corners[0].
x() + corners[1].
x() + corners[2].
x() + corners[3].
x() + corners[4].
x() + corners[5].
x()),
299 (corners[0].
y() + corners[1].
y() + corners[2].
y() + corners[3].
y() + corners[4].
y() + corners[5].
y()),
301 (corners[0].
z() + corners[1].
z() + corners[2].
z() + corners[3].
z() + corners[4].
z() + corners[5].
z()));
305 (corners[6].
x() + corners[7].
x() + corners[8].
x() + corners[9].
x() + corners[10].
x() + corners[11].
x()),
307 (corners[6].
y() + corners[7].
y() + corners[8].
y() + corners[9].
y() + corners[10].
y() + corners[11].
y()),
309 (corners[6].
z() + corners[7].
z() + corners[8].
z() + corners[9].
z() + corners[10].
z() + corners[11].
z()));
317 ptr->newCell(front, back, corners[0], myParm,
id);
320 ptr->initializeParms();
static constexpr unsigned int k_NumberOfShapes
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
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
unsigned int numberOfParametersPerShape() const override
CaloCellGeometry::Pt3DVec Pt3DVec
unsigned int alignmentTransformIndexLocal(const DetId &id)
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
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
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 constexpr double oneBySix_