CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
CaloGeometryDBEP< T, U > Class Template Reference

#include <CaloGeometryDBEP.h>

Inheritance diagram for CaloGeometryDBEP< T, U >:
edm::ESProducer edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Public Types

typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef CaloSubdetectorGeometry::DimVec DimVec
 
typedef CaloSubdetectorGeometry::IVec IVec
 
typedef CaloCellGeometry::Pt3D Pt3D
 
typedef CaloCellGeometry::Pt3DVec Pt3DVec
 
using PtrType = std::unique_ptr< CaloSubdetectorGeometry >
 
typedef CaloCellGeometry::Tr3D Tr3D
 
typedef CaloSubdetectorGeometry::TrVec TrVec
 

Public Member Functions

 CaloGeometryDBEP (const edm::ParameterSet &ps)
 
template<>
CaloGeometryDBEP< HGCalGeometry, CaloGeometryDBReader >::PtrType produceAligned (const typename HGCalGeometry::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP< HcalGeometry, CaloGeometryDBReader >::PtrType produceAligned (const typename HcalGeometry::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP< ZdcGeometry, CaloGeometryDBReader >::PtrType produceAligned (const typename ZdcGeometry::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP< HcalGeometry, CaloGeometryDBWriter >::PtrType produceAligned (const typename HcalGeometry::AlignedRecord &iRecord)
 
PtrType produceAligned (const typename T::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP< CaloTowerGeometry, CaloGeometryDBReader >::PtrType produceAligned (const typename CaloTowerGeometry::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP< CaloTowerGeometry, CaloGeometryDBWriter >::PtrType produceAligned (const typename CaloTowerGeometry::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP< HGCalGeometry, CaloGeometryDBWriter >::PtrType produceAligned (const typename HGCalGeometry::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP< ZdcGeometry, CaloGeometryDBWriter >::PtrType produceAligned (const typename ZdcGeometry::AlignedRecord &iRecord)
 
 ~CaloGeometryDBEP () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 

Private Member Functions

std::tuple< const Alignments *, const Alignments * > getAlignGlobal (const typename T::AlignedRecord &iRecord) const
 

Private Attributes

calogeometryDBEPimpl::AdditionalTokens< TadditionalTokens_
 
calogeometryDBEPimpl::AlignmentTokens< TalignmentTokens_
 
bool applyAlignment_
 
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

template<class T, class U>
class CaloGeometryDBEP< T, U >

Definition at line 85 of file CaloGeometryDBEP.h.

Member Typedef Documentation

◆ CCGFloat

template<class T, class U>
typedef CaloCellGeometry::CCGFloat CaloGeometryDBEP< T, U >::CCGFloat

Definition at line 87 of file CaloGeometryDBEP.h.

◆ DimVec

template<class T, class U>
typedef CaloSubdetectorGeometry::DimVec CaloGeometryDBEP< T, U >::DimVec

Definition at line 94 of file CaloGeometryDBEP.h.

◆ IVec

template<class T, class U>
typedef CaloSubdetectorGeometry::IVec CaloGeometryDBEP< T, U >::IVec

Definition at line 95 of file CaloGeometryDBEP.h.

◆ Pt3D

template<class T, class U>
typedef CaloCellGeometry::Pt3D CaloGeometryDBEP< T, U >::Pt3D

Definition at line 88 of file CaloGeometryDBEP.h.

◆ Pt3DVec

template<class T, class U>
typedef CaloCellGeometry::Pt3DVec CaloGeometryDBEP< T, U >::Pt3DVec

Definition at line 89 of file CaloGeometryDBEP.h.

◆ PtrType

template<class T, class U>
using CaloGeometryDBEP< T, U >::PtrType = std::unique_ptr<CaloSubdetectorGeometry>

Definition at line 92 of file CaloGeometryDBEP.h.

◆ Tr3D

template<class T, class U>
typedef CaloCellGeometry::Tr3D CaloGeometryDBEP< T, U >::Tr3D

Definition at line 90 of file CaloGeometryDBEP.h.

◆ TrVec

template<class T, class U>
typedef CaloSubdetectorGeometry::TrVec CaloGeometryDBEP< T, U >::TrVec

Definition at line 93 of file CaloGeometryDBEP.h.

Constructor & Destructor Documentation

◆ CaloGeometryDBEP()

template<class T, class U>
CaloGeometryDBEP< T, U >::CaloGeometryDBEP ( const edm::ParameterSet ps)
inline

Definition at line 97 of file CaloGeometryDBEP.h.

References CaloGeometryDBEP< T, U >::additionalTokens_, calogeometryDBEPimpl::AlignmentTokens< T, bool >::alignments, CaloGeometryDBEP< T, U >::alignmentTokens_, CaloGeometryDBEP< T, U >::applyAlignment_, gpuPixelDoublets::cc, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), CaloGeometryDBEP< T, U >::geometryToken_, calogeometryDBEPimpl::AlignmentTokens< T, bool >::globals, and edm::ESProducer::setWhatProduced().

97  : applyAlignment_(ps.getParameter<bool>("applyAlignment")) {
98  auto cc = setWhatProduced(this,
100  edm::es::Label(T::producerTag())); //+std::string("TEST") ) ) ;
101 
103  if (applyAlignment_) {
105  cc.template consumesFrom<Alignments, typename T::AlignmentRecord>(edm::ESInputTag{});
106  alignmentTokens_.globals = cc.template consumesFrom<Alignments, GlobalPositionRcd>(edm::ESInputTag{});
107  }
108  }
110 
111  additionalTokens_.makeTokens(cc);
112  }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< Alignments, GlobalPositionRcd > globals
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
calogeometryDBEPimpl::AlignmentTokens< T > alignmentTokens_
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
edm::ESGetToken< Alignments, typename T::AlignmentRecord > alignments
calogeometryDBEPimpl::AdditionalTokens< T > additionalTokens_

◆ ~CaloGeometryDBEP()

template<class T, class U>
CaloGeometryDBEP< T, U >::~CaloGeometryDBEP ( )
inlineoverride

Definition at line 114 of file CaloGeometryDBEP.h.

114 {}

Member Function Documentation

◆ getAlignGlobal()

template<class T, class U>
std::tuple<const Alignments*, const Alignments*> CaloGeometryDBEP< T, U >::getAlignGlobal ( const typename T::AlignedRecord &  iRecord) const
inlineprivate

Definition at line 226 of file CaloGeometryDBEP.h.

References calogeometryDBEPimpl::AlignmentTokens< T, bool >::alignments, CaloGeometryDBEP< T, U >::alignmentTokens_, CaloGeometryDBEP< T, U >::applyAlignment_, cms::cuda::assert(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), and calogeometryDBEPimpl::AlignmentTokens< T, bool >::globals.

Referenced by CaloGeometryDBEP< T, U >::produceAligned().

226  {
227  const Alignments* alignPtr(nullptr);
228  const Alignments* globalPtr(nullptr);
230  if (applyAlignment_) // get ptr if necessary
231  {
232  const auto& alignments = iRecord.get(alignmentTokens_.alignments);
233  // require expected size
234  assert(alignments.m_align.size() == T::numberOfAlignments());
235  alignPtr = &alignments;
236 
237  const auto& globals = iRecord.get(alignmentTokens_.globals);
238  globalPtr = &globals;
239  }
240  }
241  return std::make_tuple(alignPtr, globalPtr);
242  }
edm::ESGetToken< Alignments, GlobalPositionRcd > globals
calogeometryDBEPimpl::AlignmentTokens< T > alignmentTokens_
assert(be >=bs)
edm::ESGetToken< Alignments, typename T::AlignmentRecord > alignments

◆ produceAligned() [1/9]

Definition at line 9 of file moduleDB.cc.

References cms::cuda::assert(), FlatHexagon::createCorners(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), CaloCellGeometry::getParmPtr(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqmiolumiharvest::j, findQualityFiles::jj, HGCalGeometry::k_NumberOfParametersPerShape, HGCalGeometry::k_NumberOfShapes, nano_mu_digi_cff::layer, PV3DBase< T, PVType, FrameType >::mag2(), calogeometryDBEPimpl::nameHGCal, FlatHexagon::ncorner_, FlatHexagon::ncornerBy2_, FlatHexagon::oneBySix_, hcal_runs::rt, edm::swap(), HLT_2024v14_cff::topology, x, geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, detailsBasic3DVector::y, geometryCSVtoXML::yy, geometryCSVtoXML::yz, detailsBasic3DVector::z, and geometryCSVtoXML::zz.

10  {
11  TrVec tvec;
12  DimVec dvec;
13  IVec ivec;
14  IVec dins;
15 
16  edm::LogVerbatim("HGCalGeom") << "Reading HGCalGeometry " << calogeometryDBEPimpl::nameHGCal;
17  const auto& pG = iRecord.get(geometryToken_);
18 
19  tvec = pG.getTranslation();
20  dvec = pG.getDimension();
21  ivec = pG.getIndexes();
22  dins = pG.getDenseIndices();
23  //*********************************************************************************************
24  const auto& topology = iRecord.get(additionalTokens_.topology);
25 
26  assert(dvec.size() <= topology.totalGeomModules() * HGCalGeometry::k_NumberOfParametersPerShape);
28  PtrType ptr(hcg);
29 
30  ptr->allocateCorners(topology.ncells());
32 
33  const unsigned int nTrParm(ptr->numberOfTransformParms());
34  const unsigned int nPerShape(HGCalGeometry::k_NumberOfParametersPerShape);
35 
36  for (auto it : dins) {
37  DetId id = topology.encode(topology.geomDenseId2decId(it));
38  // get layer
39  int layer = ivec[it];
40 
41  // get transformation
42  const unsigned int jj(it * nTrParm);
43  Tr3D tr;
44  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
45  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
47  const ROOT::Math::Transform3D rt(ea, tl);
48  double xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz;
49  rt.GetComponents(xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz);
50  tr = Tr3D(CLHEP::HepRep3x3(xx, xy, xz, yx, yy, yz, zx, zy, zz), CLHEP::Hep3Vector(dx, dy, dz));
51 
52  // get parameters
53  DimVec dims;
54  dims.reserve(nPerShape);
55 
56  DimVec::const_iterator dsrc(dvec.begin() + layer * nPerShape);
57  for (unsigned int j(0); j != nPerShape; ++j) {
58  dims.emplace_back(*dsrc);
59  ++dsrc;
60  }
61 
62  std::vector<GlobalPoint> corners(FlatHexagon::ncorner_);
63 
64  FlatHexagon::createCorners(dims, tr, corners);
65 
66  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
67  GlobalPoint front(
69  (corners[0].x() + corners[1].x() + corners[2].x() + corners[3].x() + corners[4].x() + corners[5].x()),
71  (corners[0].y() + corners[1].y() + corners[2].y() + corners[3].y() + corners[4].y() + corners[5].y()),
73  (corners[0].z() + corners[1].z() + corners[2].z() + corners[3].z() + corners[4].z() + corners[5].z()));
74 
75  GlobalPoint back(
77  (corners[6].x() + corners[7].x() + corners[8].x() + corners[9].x() + corners[10].x() + corners[11].x()),
79  (corners[6].y() + corners[7].y() + corners[8].y() + corners[9].y() + corners[10].y() + corners[11].y()),
81  (corners[6].z() + corners[7].z() + corners[8].z() + corners[9].z() + corners[10].z() + corners[11].z()));
82 
83  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
84  std::swap(front, back);
85  std::swap_ranges(
86  corners.begin(), corners.begin() + FlatHexagon::ncornerBy2_, corners.begin() + FlatHexagon::ncornerBy2_);
87  }
88 
89  ptr->newCell(front, back, corners[0], myParm, id);
90  }
91 
92  ptr->initializeParms(); // initializations; must happen after cells filled
93 
94  return ptr;
95 }
static constexpr unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:46
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition: FlatHexagon.cc:134
Log< level::Info, true > LogVerbatim
std::unique_ptr< CaloSubdetectorGeometry > PtrType
assert(be >=bs)
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
static constexpr unsigned int ncorner_
Definition: FlatHexagon.h:81
CaloSubdetectorGeometry::IVec IVec
static constexpr unsigned int k_NumberOfParametersPerShape
Definition: HGCalGeometry.h:45
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
Definition: DetId.h:17
static constexpr unsigned int ncornerBy2_
Definition: FlatHexagon.h:82
AlgebraicVector EulerAngles
Definition: Definitions.h:34
static constexpr auto nameHGCal
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
calogeometryDBEPimpl::AdditionalTokens< T > additionalTokens_
static constexpr double oneBySix_
Definition: FlatHexagon.h:80

◆ produceAligned() [2/9]

Definition at line 12 of file moduleDB.cc.

References HcalGeometry::alignmentTransformIndexGlobal(), HcalGeometry::alignmentTransformIndexLocal(), cms::cuda::assert(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), CaloCellGeometry::getParmPtr(), submitPVValidationJobs::gt, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, findQualityFiles::jj, HcalGeometry::k_NumberOfParametersPerShape, hcal_runs::rt, geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

13  {
14  const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
15 
16  TrVec tvec;
17  DimVec dvec;
18  IVec ivec;
19  IVec dins;
20 
21  const auto& pG = iRecord.get(geometryToken_);
22 
23  tvec = pG.getTranslation();
24  dvec = pG.getDimension();
25  ivec = pG.getIndexes();
26  dins = pG.getDenseIndices();
27  //*********************************************************************************************
28 
29  const auto& hcalTopology = iRecord.get(additionalTokens_.topology);
30 
31  // We know that the numer of shapes chanes with changing depth
32  // so, this check is temporary disabled. We need to implement
33  // a way either to store or calculate the number of shapes or be able
34  // to deal with only max numer of shapes.
35  // assert( dvec.size() == hcalTopology.getNumberOfShapes() * HcalGeometry::k_NumberOfParametersPerShape ) ;
36  assert(dvec.size() <= hcalTopology.getNumberOfShapes() * HcalGeometry::k_NumberOfParametersPerShape);
37  HcalGeometry* hcg = new HcalGeometry(hcalTopology);
38 
39  PtrType ptr(hcg);
40 
41  const unsigned int nTrParm(hcg->numberOfTransformParms());
42 
43  ptr->fillDefaultNamedParameters();
44  ptr->allocateCorners(hcalTopology.ncells() + hcalTopology.getHFSize());
45  ptr->allocatePar(dvec.size(), HcalGeometry::k_NumberOfParametersPerShape);
46 
47  for (unsigned int i(0); i < dins.size(); ++i) {
48  const unsigned int nPerShape(HcalGeometry::k_NumberOfParametersPerShape);
49  DimVec dims;
50  dims.reserve(nPerShape);
51 
52  const unsigned int indx(ivec.size() == 1 ? 0 : i);
53 
54  DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
55 
56  for (unsigned int j(0); j != nPerShape; ++j) {
57  dims.emplace_back(*dsrc);
58  ++dsrc;
59  }
60 
61  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
62 
63  const DetId id(hcalTopology.denseId2detId(dins[i]));
64 
65  const unsigned int iGlob(nullptr == globalPtr ? 0 : HcalGeometry::alignmentTransformIndexGlobal(id));
66 
67  assert(nullptr == globalPtr || iGlob < globalPtr->m_align.size());
68 
69  const AlignTransform* gt(nullptr == globalPtr ? nullptr : &globalPtr->m_align[iGlob]);
70 
71  assert(nullptr == gt || iGlob == HcalGeometry::alignmentTransformIndexGlobal(DetId(gt->rawId())));
72 
73  const unsigned int iLoc(nullptr == alignPtr ? 0 : HcalGeometry::alignmentTransformIndexLocal(id));
74 
75  assert(nullptr == alignPtr || iLoc < alignPtr->m_align.size());
76 
77  const AlignTransform* at(nullptr == alignPtr ? nullptr : &alignPtr->m_align[iLoc]);
78 
79  assert(nullptr == at || (HcalGeometry::alignmentTransformIndexLocal(DetId(at->rawId())) == iLoc));
80 
81  Pt3D lRef;
82  Pt3DVec lc(8, Pt3D(0, 0, 0));
83  hcg->localCorners(lc, &dims.front(), dins[i], lRef);
84 
85  const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7])); // ctr rear face in local
86  const Pt3D lCor(lc[0]);
87 
88  //----------------------------------- create transform from 6 numbers ---
89  const unsigned int jj(i * nTrParm); // Note: Dence indices are not sorted and
90  // parameters stored according to order of a cell creation
91  Tr3D tr;
92  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
93  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
95  const ROOT::Math::Transform3D rt(ea, tl);
96  double xx, xy, xz, dx;
97  double yx, yy, yz, dy;
98  double zx, zy, zz, dz;
99  rt.GetComponents(xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz);
100  tr = Tr3D(CLHEP::HepRep3x3(xx, xy, xz, yx, yy, yz, zx, zy, zz), CLHEP::Hep3Vector(dx, dy, dz));
101 
102  // now prepend alignment(s) for final transform
103  const Tr3D atr(nullptr == at ? tr
104  : (nullptr == gt ? at->transform() * tr : at->transform() * gt->transform() * tr));
105  //--------------------------------- done making transform ---------------
106 
107  const Pt3D gRef(atr * lRef);
108  const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
109  const Pt3D gBck(atr * lBck);
110  const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
111  const Pt3D gCor(atr * lCor);
112  const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
113 
114  assert(hcalTopology.detId2denseId(id) == dins[i]);
115 
116  ptr->newCell(fCtr, fBck, fCor, myParm, id);
117  }
118 
119  ptr->initializeParms(); // initializations; must happen after cells filled
120 
121  return ptr;
122 }
CaloCellGeometry::Pt3D Pt3D
static unsigned int alignmentTransformIndexLocal(const DetId &id)
std::unique_ptr< CaloSubdetectorGeometry > PtrType
assert(be >=bs)
std::tuple< const Alignments *, const Alignments * > getAlignGlobal(const typename T::AlignedRecord &iRecord) const
CaloSubdetectorGeometry::IVec IVec
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
CaloCellGeometry::Pt3D Pt3D
Definition: DetId.h:17
AlgebraicVector EulerAngles
Definition: Definitions.h:34
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
calogeometryDBEPimpl::AdditionalTokens< T > additionalTokens_

◆ produceAligned() [3/9]

Definition at line 15 of file moduleDB.cc.

References ZdcGeometry::alignmentTransformIndexGlobal(), ZdcGeometry::alignmentTransformIndexLocal(), cms::cuda::assert(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), CaloCellGeometry::getParmPtr(), submitPVValidationJobs::gt, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, findQualityFiles::jj, ZdcGeometry::k_NumberOfParametersPerShape, ZdcGeometry::k_NumberOfShapes, hcal_runs::rt, geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

15  {
16  const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
17 
18  TrVec tvec;
19  DimVec dvec;
20  IVec ivec;
21  IVec dins;
22 
23  const auto& pG = iRecord.get(geometryToken_);
24 
25  tvec = pG.getTranslation();
26  dvec = pG.getDimension();
27  ivec = pG.getIndexes();
28  dins = pG.getDenseIndices();
29  //*********************************************************************************************
30 
31  const auto& zdcTopology = iRecord.get(additionalTokens_.topology);
32 
34  ZdcGeometry* zdcGeometry = new ZdcGeometry(&zdcTopology);
35  PtrType ptr(zdcGeometry);
36 
37  const unsigned int nTrParm(tvec.size() / zdcTopology.kSizeForDenseIndexing());
38 
40 
41  ptr->fillDefaultNamedParameters();
42 
43  ptr->allocateCorners(zdcTopology.kSizeForDenseIndexing());
44  ptr->allocatePar(zdcGeometry->numberOfShapes(), ZdcGeometry::k_NumberOfParametersPerShape);
45 
46  for (unsigned int i(0); i < dins.size(); ++i) {
47  const unsigned int nPerShape(ZdcGeometry::k_NumberOfParametersPerShape);
48  DimVec dims;
49  dims.reserve(nPerShape);
50 
51  const unsigned int indx(ivec.size() == 1 ? 0 : i);
52 
53  DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
54 
55  for (unsigned int j(0); j != nPerShape; ++j) {
56  dims.emplace_back(*dsrc);
57  ++dsrc;
58  }
59 
60  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
61 
62  const DetId id(zdcTopology.denseId2detId(dins[i]));
63 
64  const unsigned int iGlob(nullptr == globalPtr ? 0 : ZdcGeometry::alignmentTransformIndexGlobal(id));
65 
66  assert(nullptr == globalPtr || iGlob < globalPtr->m_align.size());
67 
68  const AlignTransform* gt(nullptr == globalPtr ? nullptr : &globalPtr->m_align[iGlob]);
69 
70  assert(nullptr == gt || iGlob == ZdcGeometry::alignmentTransformIndexGlobal(DetId(gt->rawId())));
71 
72  const unsigned int iLoc(nullptr == alignPtr ? 0 : ZdcGeometry::alignmentTransformIndexLocal(id));
73 
74  assert(nullptr == alignPtr || iLoc < alignPtr->m_align.size());
75 
76  const AlignTransform* at(nullptr == alignPtr ? nullptr : &alignPtr->m_align[iLoc]);
77 
78  assert(nullptr == at || (ZdcGeometry::alignmentTransformIndexLocal(DetId(at->rawId())) == iLoc));
79 
80  const CaloGenericDetId gId(id);
81 
82  Pt3D lRef;
83  Pt3DVec lc(8, Pt3D(0, 0, 0));
84  zdcGeometry->localCorners(lc, &dims.front(), dins[i], lRef);
85 
86  const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7])); // ctr rear face in local
87  const Pt3D lCor(lc[0]);
88 
89  //----------------------------------- create transform from 6 numbers ---
90  const unsigned int jj(i * nTrParm);
91  Tr3D tr;
92  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
93  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
95  const ROOT::Math::Transform3D rt(ea, tl);
96  double xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz;
97  rt.GetComponents(xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz);
98  tr = Tr3D(CLHEP::HepRep3x3(xx, xy, xz, yx, yy, yz, zx, zy, zz), CLHEP::Hep3Vector(dx, dy, dz));
99 
100  // now prepend alignment(s) for final transform
101  const Tr3D atr(nullptr == at ? tr
102  : (nullptr == gt ? at->transform() * tr : at->transform() * gt->transform() * tr));
103  //--------------------------------- done making transform ---------------
104 
105  const Pt3D gRef(atr * lRef);
106  const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
107  const Pt3D gBck(atr * lBck);
108  const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
109  const Pt3D gCor(atr * lCor);
110  const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
111 
112  assert(zdcTopology.detId2denseId(id) == dins[i]);
113 
114  ptr->newCell(fCtr, fBck, fCor, myParm, id);
115  }
116  ptr->initializeParms(); // initializations; must happen after cells filled
117 
118  return ptr;
119 }
static unsigned int alignmentTransformIndexLocal(const DetId &id)
Definition: ZdcGeometry.cc:63
CaloCellGeometry::Pt3D Pt3D
std::unique_ptr< CaloSubdetectorGeometry > PtrType
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
Definition: ZdcGeometry.cc:70
static constexpr int k_NumberOfParametersPerShape
Definition: ZdcGeometry.h:31
assert(be >=bs)
std::tuple< const Alignments *, const Alignments * > getAlignGlobal(const typename T::AlignedRecord &iRecord) const
CaloSubdetectorGeometry::IVec IVec
static constexpr int k_NumberOfShapes
Definition: ZdcGeometry.h:29
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
CaloCellGeometry::Pt3D Pt3D
Definition: DetId.h:17
AlgebraicVector EulerAngles
Definition: Definitions.h:34
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
calogeometryDBEPimpl::AdditionalTokens< T > additionalTokens_

◆ produceAligned() [4/9]

Definition at line 20 of file calowriters.cc.

References HcalGeometry::alignmentTransformIndexGlobal(), HcalGeometry::alignmentTransformIndexLocal(), cms::cuda::assert(), HcalGeometry::dbString(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), CaloCellGeometry::getParmPtr(), submitPVValidationJobs::gt, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, findQualityFiles::jj, HcalGeometry::k_NumberOfParametersPerShape, hcal_runs::rt, CaloGeometryDBWriter::writeIndexed(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

21  {
22  const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
23 
24  TrVec tvec;
25  DimVec dvec;
26  IVec ivec;
27  IVec dins;
28 
29  const auto& pG = iRecord.get(geometryToken_);
30 
31  pG.getSummary(tvec, ivec, dvec, dins);
32 
34  //*********************************************************************************************
35 
36  const auto& hcalTopology = iRecord.get(additionalTokens_.topology);
37 
38  // We know that the numer of shapes chanes with changing depth
39  // so, this check is temporary disabled. We need to implement
40  // a way either to store or calculate the number of shapes or be able
41  // to deal with only max numer of shapes.
42  assert(dvec.size() <= hcalTopology.getNumberOfShapes() * HcalGeometry::k_NumberOfParametersPerShape);
43  HcalGeometry* hcalGeometry = new HcalGeometry(hcalTopology);
44  PtrType ptr(hcalGeometry);
45 
46  const unsigned int nTrParm(hcalGeometry->numberOfTransformParms());
47 
48  ptr->fillDefaultNamedParameters();
49  ptr->allocateCorners(hcalTopology.ncells() + hcalTopology.getHFSize());
50  ptr->allocatePar(hcalGeometry->numberOfShapes(), HcalGeometry::k_NumberOfParametersPerShape);
51 
52  for (unsigned int i(0); i < dins.size(); ++i) {
53  const unsigned int nPerShape(HcalGeometry::k_NumberOfParametersPerShape);
54  DimVec dims;
55  dims.reserve(nPerShape);
56 
57  const unsigned int indx(ivec.size() == 1 ? 0 : i);
58 
59  DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
60 
61  for (unsigned int j(0); j != nPerShape; ++j) {
62  dims.push_back(*dsrc);
63  ++dsrc;
64  }
65 
66  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
67 
68  const DetId id(hcalTopology.denseId2detId(dins[i]));
69 
70  const unsigned int iGlob(nullptr == globalPtr ? 0 : HcalGeometry::alignmentTransformIndexGlobal(id));
71 
72  assert(nullptr == globalPtr || iGlob < globalPtr->m_align.size());
73 
74  const AlignTransform* gt(nullptr == globalPtr ? nullptr : &globalPtr->m_align[iGlob]);
75 
76  assert(nullptr == gt || iGlob == HcalGeometry::alignmentTransformIndexGlobal(DetId(gt->rawId())));
77 
78  const unsigned int iLoc(nullptr == alignPtr ? 0 : HcalGeometry::alignmentTransformIndexLocal(id));
79 
80  assert(nullptr == alignPtr || iLoc < alignPtr->m_align.size());
81 
82  const AlignTransform* at(nullptr == alignPtr ? nullptr : &alignPtr->m_align[iLoc]);
83 
84  assert(nullptr == at || (HcalGeometry::alignmentTransformIndexLocal(DetId(at->rawId())) == iLoc));
85 
86  Pt3D lRef;
87  Pt3DVec lc(8, Pt3D(0, 0, 0));
88  hcalGeometry->localCorners(lc, &dims.front(), dins[i], lRef);
89 
90  const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7])); // ctr rear face in local
91  const Pt3D lCor(lc[0]);
92 
93  //----------------------------------- create transform from 6 numbers ---
94  const unsigned int jj(i * nTrParm);
95 
96  Tr3D tr;
97  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
98  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
100  const ROOT::Math::Transform3D rt(ea, tl);
101  double xx, xy, xz, dx;
102  double yx, yy, yz, dy;
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));
106 
107  // now prepend alignment(s) for final transform
108  const Tr3D atr(nullptr == at ? tr
109  : (nullptr == gt ? at->transform() * tr : at->transform() * gt->transform() * tr));
110  //--------------------------------- done making transform ---------------
111 
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());
118 
119  assert(hcalTopology.detId2denseId(id) == dins[i]);
120  ptr->newCell(fCtr, fBck, fCor, myParm, id);
121  }
122 
123  ptr->initializeParms(); // initializations; must happen after cells filled
124 
125  return ptr;
126 }
CaloCellGeometry::Pt3D Pt3D
static unsigned int alignmentTransformIndexLocal(const DetId &id)
static void writeIndexed(const TrVec &tvec, const DimVec &dvec, const IVec &ivec, const IVec &dins, const std::string &tag)
std::unique_ptr< CaloSubdetectorGeometry > PtrType
assert(be >=bs)
std::tuple< const Alignments *, const Alignments * > getAlignGlobal(const typename T::AlignedRecord &iRecord) const
CaloSubdetectorGeometry::IVec IVec
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
CaloCellGeometry::Pt3D Pt3D
Definition: DetId.h:17
AlgebraicVector EulerAngles
Definition: Definitions.h:34
static std::string dbString()
Definition: HcalGeometry.h:40
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
calogeometryDBEPimpl::AdditionalTokens< T > additionalTokens_

◆ produceAligned() [5/9]

template<class T, class U>
PtrType CaloGeometryDBEP< T, U >::produceAligned ( const typename T::AlignedRecord &  iRecord)
inline

Definition at line 116 of file CaloGeometryDBEP.h.

References cms::cuda::assert(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, CaloGeometryDBEP< T, U >::geometryToken_, CaloGeometryDBEP< T, U >::getAlignGlobal(), CaloCellGeometry::getParmPtr(), submitPVValidationJobs::gt, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, findQualityFiles::jj, hcal_runs::rt, writeEcalDQMStatus::write, geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

116  {
117  const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
118 
119  TrVec tvec;
120  DimVec dvec;
121  IVec ivec;
122  std::vector<uint32_t> dins;
123 
124  if constexpr (U::writeFlag()) {
125  const auto& pG = iRecord.get(geometryToken_);
126 
127  pG.getSummary(tvec, ivec, dvec, dins);
128 
129  U::write(tvec, dvec, ivec, T::dbString());
130  } else {
131  const auto& pG = iRecord.get(geometryToken_);
132 
133  tvec = pG.getTranslation();
134  dvec = pG.getDimension();
135  ivec = pG.getIndexes();
136  }
137  //*********************************************************************************************
138 
139  const unsigned int nTrParm(tvec.size() / T::k_NumberOfCellsForCorners);
140 
141  assert(dvec.size() == T::k_NumberOfShapes * T::k_NumberOfParametersPerShape);
142 
143  PtrType ptr = std::make_unique<T>();
144 
145  ptr->fillDefaultNamedParameters();
146 
147  ptr->allocateCorners(T::k_NumberOfCellsForCorners);
148 
149  ptr->allocatePar(dvec.size(), T::k_NumberOfParametersPerShape);
150 
151  for (unsigned int i(0); i != T::k_NumberOfCellsForCorners; ++i) {
152  const unsigned int nPerShape(T::k_NumberOfParametersPerShape);
153  DimVec dims;
154  dims.reserve(nPerShape);
155 
156  const unsigned int indx(ivec.size() == 1 ? 0 : i);
157 
158  DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
159 
160  for (unsigned int j(0); j != nPerShape; ++j) {
161  dims.emplace_back(*dsrc);
162  ++dsrc;
163  }
164 
165  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
166 
167  const DetId id(T::DetIdType::detIdFromDenseIndex(i));
168 
169  const unsigned int iGlob(nullptr == globalPtr ? 0 : T::alignmentTransformIndexGlobal(id));
170 
171  assert(nullptr == globalPtr || iGlob < globalPtr->m_align.size());
172 
173  const AlignTransform* gt(nullptr == globalPtr ? nullptr : &globalPtr->m_align[iGlob]);
174 
175  assert(nullptr == gt || iGlob == T::alignmentTransformIndexGlobal(DetId(gt->rawId())));
176 
177  const unsigned int iLoc(nullptr == alignPtr ? 0 : T::alignmentTransformIndexLocal(id));
178 
179  assert(nullptr == alignPtr || iLoc < alignPtr->m_align.size());
180 
181  const AlignTransform* at(nullptr == alignPtr ? nullptr : &alignPtr->m_align[iLoc]);
182 
183  assert(nullptr == at || (T::alignmentTransformIndexLocal(DetId(at->rawId())) == iLoc));
184 
185  const CaloGenericDetId gId(id);
186 
187  Pt3D lRef;
188  Pt3DVec lc(8, Pt3D(0, 0, 0));
189  T::localCorners(lc, &dims.front(), i, lRef);
190 
191  const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7])); // ctr rear face in local
192  const Pt3D lCor(lc[0]);
193 
194  //----------------------------------- create transform from 6 numbers ---
195  const unsigned int jj(i * nTrParm);
196  Tr3D tr;
197  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
198  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
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));
204 
205  // now prepend alignment(s) for final transform
206  const Tr3D atr(nullptr == at ? tr
207  : (nullptr == gt ? at->transform() * tr : at->transform() * gt->transform() * tr));
208  //--------------------------------- done making transform ---------------
209 
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());
216 
217  ptr->newCell(fCtr, fBck, fCor, myParm, id);
218  }
219 
220  ptr->initializeParms(); // initializations; must happen after cells filled
221 
222  return ptr;
223  }
CaloCellGeometry::Pt3D Pt3D
std::unique_ptr< CaloSubdetectorGeometry > PtrType
assert(be >=bs)
std::tuple< const Alignments *, const Alignments * > getAlignGlobal(const typename T::AlignedRecord &iRecord) const
CaloSubdetectorGeometry::IVec IVec
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
CaloCellGeometry::Pt3D Pt3D
Definition: DetId.h:17
AlgebraicVector EulerAngles
Definition: Definitions.h:34
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec

◆ produceAligned() [6/9]

Definition at line 126 of file moduleDB.cc.

References CaloTowerGeometry::alignmentTransformIndexGlobal(), CaloTowerGeometry::alignmentTransformIndexLocal(), cms::cuda::assert(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), CaloCellGeometry::getParmPtr(), submitPVValidationJobs::gt, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, findQualityFiles::jj, CaloTowerGeometry::k_NumberOfParametersPerShape, CaloTowerGeometry::localCorners(), CaloTowerGeometry::numberOfCellsForCorners(), CaloTowerGeometry::numberOfParametersPerShape(), CaloTowerGeometry::numberOfShapes(), hcal_runs::rt, geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

127  {
128  const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
129 
130  TrVec tvec;
131  DimVec dvec;
132  IVec ivec;
133  IVec dins;
134 
135  const auto& pG = iRecord.get(geometryToken_);
136 
137  tvec = pG.getTranslation();
138  dvec = pG.getDimension();
139  ivec = pG.getIndexes();
140  dins = pG.getDenseIndices();
141  //*********************************************************************************************
142 
143  const auto& caloTopology = iRecord.get(additionalTokens_.topology);
144 
145  CaloTowerGeometry* ctg = new CaloTowerGeometry(&caloTopology);
146 
147  const unsigned int nTrParm(tvec.size() / ctg->numberOfCellsForCorners());
148 
150 
151  PtrType ptr(ctg);
152 
153  ptr->fillDefaultNamedParameters();
154 
155  ptr->allocateCorners(ctg->numberOfCellsForCorners());
156 
157  ptr->allocatePar(dvec.size(), CaloTowerGeometry::k_NumberOfParametersPerShape);
158 
159  for (unsigned int i(0); i < dins.size(); ++i) {
160  const unsigned int nPerShape(ctg->numberOfParametersPerShape());
161  DimVec dims;
162  dims.reserve(nPerShape);
163 
164  const unsigned int indx(ivec.size() == 1 ? 0 : i);
165 
166  DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
167 
168  for (unsigned int j(0); j != nPerShape; ++j) {
169  dims.emplace_back(*dsrc);
170  ++dsrc;
171  }
172 
173  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
174 
175  const DetId id(caloTopology.detIdFromDenseIndex(dins[i]));
176 
177  const unsigned int iGlob(nullptr == globalPtr ? 0 : ctg->alignmentTransformIndexGlobal(id));
178 
179  assert(nullptr == globalPtr || iGlob < globalPtr->m_align.size());
180 
181  const AlignTransform* gt(nullptr == globalPtr ? nullptr : &globalPtr->m_align[iGlob]);
182 
183  assert(nullptr == gt || iGlob == ctg->alignmentTransformIndexGlobal(DetId(gt->rawId())));
184 
185  const unsigned int iLoc(nullptr == alignPtr ? 0 : ctg->alignmentTransformIndexLocal(id));
186 
187  assert(nullptr == alignPtr || iLoc < alignPtr->m_align.size());
188 
189  const AlignTransform* at(nullptr == alignPtr ? nullptr : &alignPtr->m_align[iLoc]);
190 
191  assert(nullptr == at || (ctg->alignmentTransformIndexLocal(DetId(at->rawId())) == iLoc));
192 
193  const CaloGenericDetId gId(id);
194 
195  Pt3D lRef;
196  Pt3DVec lc(8, Pt3D(0, 0, 0));
197  ctg->localCorners(lc, &dims.front(), dins[i], lRef);
198 
199  const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7])); // ctr rear face in local
200  const Pt3D lCor(lc[0]);
201 
202  //----------------------------------- create transform from 6 numbers ---
203  const unsigned int jj(i * nTrParm);
204  Tr3D tr;
205  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
206  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
208  const ROOT::Math::Transform3D rt(ea, tl);
209  double xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz;
210  rt.GetComponents(xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz);
211  tr = Tr3D(CLHEP::HepRep3x3(xx, xy, xz, yx, yy, yz, zx, zy, zz), CLHEP::Hep3Vector(dx, dy, dz));
212 
213  // now prepend alignment(s) for final transform
214  const Tr3D atr(nullptr == at ? tr
215  : (nullptr == gt ? at->transform() * tr : at->transform() * gt->transform() * tr));
216  //--------------------------------- done making transform ---------------
217 
218  const Pt3D gRef(atr * lRef);
219  const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
220  const Pt3D gBck(atr * lBck);
221  const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
222  const Pt3D gCor(atr * lCor);
223  const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
224 
225  assert(caloTopology.denseIndex(id) == dins[i]);
226 
227  ptr->newCell(fCtr, fBck, fCor, myParm, id);
228  }
229 
230  ptr->initializeParms(); // initializations; must happen after cells filled
231 
232  return ptr;
233 }
CaloCellGeometry::Pt3D Pt3D
virtual unsigned int numberOfCellsForCorners() const
unsigned int numberOfShapes() const override
std::unique_ptr< CaloSubdetectorGeometry > PtrType
unsigned int numberOfParametersPerShape() const override
unsigned int alignmentTransformIndexLocal(const DetId &id)
assert(be >=bs)
std::tuple< const Alignments *, const Alignments * > getAlignGlobal(const typename T::AlignedRecord &iRecord) const
CaloSubdetectorGeometry::IVec IVec
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
unsigned int alignmentTransformIndexGlobal(const DetId &id)
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: DetId.h:17
AlgebraicVector EulerAngles
Definition: Definitions.h:34
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
calogeometryDBEPimpl::AdditionalTokens< T > additionalTokens_

◆ produceAligned() [7/9]

Definition at line 130 of file calowriters.cc.

References CaloTowerGeometry::alignmentTransformIndexGlobal(), CaloTowerGeometry::alignmentTransformIndexLocal(), cms::cuda::assert(), CaloTowerGeometry::dbString(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), CaloCellGeometry::getParmPtr(), submitPVValidationJobs::gt, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, findQualityFiles::jj, CaloTowerGeometry::k_NumberOfParametersPerShape, CaloTowerGeometry::localCorners(), CaloTowerGeometry::numberOfCellsForCorners(), CaloTowerGeometry::numberOfParametersPerShape(), CaloTowerGeometry::numberOfShapes(), hcal_runs::rt, CaloGeometryDBWriter::writeIndexed(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

131  {
132  const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
133 
134  TrVec tvec;
135  DimVec dvec;
136  IVec ivec;
137  IVec dins;
138 
139  const auto& pG = iRecord.get(geometryToken_);
140 
141  pG.getSummary(tvec, ivec, dvec, dins);
142 
144  //*********************************************************************************************
145 
146  const auto& caloTopology = iRecord.get(additionalTokens_.topology);
147 
148  CaloTowerGeometry* ctg = new CaloTowerGeometry(&caloTopology);
149 
150  const unsigned int nTrParm(tvec.size() / ctg->numberOfCellsForCorners());
151 
153 
154  PtrType ptr(ctg);
155 
156  ptr->fillDefaultNamedParameters();
157 
158  ptr->allocateCorners(ctg->numberOfCellsForCorners());
159 
160  ptr->allocatePar(dvec.size(), CaloTowerGeometry::k_NumberOfParametersPerShape);
161 
162  for (unsigned int i(0); i < dins.size(); ++i) {
163  const unsigned int nPerShape(ctg->numberOfParametersPerShape());
164  DimVec dims;
165  dims.reserve(nPerShape);
166 
167  const unsigned int indx(ivec.size() == 1 ? 0 : i);
168 
169  DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
170 
171  for (unsigned int j(0); j != nPerShape; ++j) {
172  dims.push_back(*dsrc);
173  ++dsrc;
174  }
175 
176  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
177 
178  const DetId id(caloTopology.detIdFromDenseIndex(dins[i]));
179 
180  const unsigned int iGlob(nullptr == globalPtr ? 0 : ctg->alignmentTransformIndexGlobal(id));
181 
182  assert(nullptr == globalPtr || iGlob < globalPtr->m_align.size());
183 
184  const AlignTransform* gt(nullptr == globalPtr ? nullptr : &globalPtr->m_align[iGlob]);
185 
186  assert(nullptr == gt || iGlob == ctg->alignmentTransformIndexGlobal(DetId(gt->rawId())));
187 
188  const unsigned int iLoc(nullptr == alignPtr ? 0 : ctg->alignmentTransformIndexLocal(id));
189 
190  assert(nullptr == alignPtr || iLoc < alignPtr->m_align.size());
191 
192  const AlignTransform* at(nullptr == alignPtr ? nullptr : &alignPtr->m_align[iLoc]);
193 
194  assert(nullptr == at || (ctg->alignmentTransformIndexLocal(DetId(at->rawId())) == iLoc));
195 
196  const CaloGenericDetId gId(id);
197 
198  Pt3D lRef;
199  Pt3DVec lc(8, Pt3D(0, 0, 0));
200  ctg->localCorners(lc, &dims.front(), dins[i], lRef);
201 
202  const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7])); // ctr rear face in local
203  const Pt3D lCor(lc[0]);
204 
205  //----------------------------------- create transform from 6 numbers ---
206  const unsigned int jj(i * nTrParm);
207  Tr3D tr;
208  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
209  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
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));
215 
216  // now prepend alignment(s) for final transform
217  const Tr3D atr(nullptr == at ? tr
218  : (nullptr == gt ? at->transform() * tr : at->transform() * gt->transform() * tr));
219  //--------------------------------- done making transform ---------------
220 
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());
227 
228  assert(caloTopology.denseIndex(id) == dins[i]);
229 
230  ptr->newCell(fCtr, fBck, fCor, myParm, id);
231  }
232 
233  ptr->initializeParms(); // initializations; must happen after cells filled
234 
235  return ptr;
236 }
CaloCellGeometry::Pt3D Pt3D
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
std::unique_ptr< CaloSubdetectorGeometry > PtrType
unsigned int numberOfParametersPerShape() const override
unsigned int alignmentTransformIndexLocal(const DetId &id)
assert(be >=bs)
std::tuple< const Alignments *, const Alignments * > getAlignGlobal(const typename T::AlignedRecord &iRecord) const
CaloSubdetectorGeometry::IVec IVec
static std::string dbString()
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
unsigned int alignmentTransformIndexGlobal(const DetId &id)
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: DetId.h:17
AlgebraicVector EulerAngles
Definition: Definitions.h:34
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
calogeometryDBEPimpl::AdditionalTokens< T > additionalTokens_

◆ produceAligned() [8/9]

Definition at line 240 of file calowriters.cc.

References cms::cuda::assert(), FlatHexagon::createCorners(), HGCalGeometry::dbString(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, relativeConstraints::geom, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), CaloCellGeometry::getParmPtr(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqmiolumiharvest::j, findQualityFiles::jj, HGCalGeometry::k_NumberOfParametersPerShape, HGCalGeometry::k_NumberOfShapes, nano_mu_digi_cff::layer, PV3DBase< T, PVType, FrameType >::mag2(), FlatHexagon::ncorner_, FlatHexagon::ncornerBy2_, FlatHexagon::oneBySix_, hcal_runs::rt, edm::swap(), HLT_2024v14_cff::topology, CaloGeometryDBWriter::writeIndexed(), x, geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, detailsBasic3DVector::y, geometryCSVtoXML::yy, geometryCSVtoXML::yz, detailsBasic3DVector::z, and geometryCSVtoXML::zz.

241  {
242  TrVec tvec; // transformation
243  DimVec dvec; // parameters
244  IVec ivec; // layers
245  IVec dins; // valid geom ids
246 
247  const auto& geom = iRecord.get(geometryToken_);
248 
249  geom.getSummary(tvec, ivec, dvec, dins);
250 
252  //*********************************************************************************************
253 
254  const auto& topology = iRecord.get(additionalTokens_.topology);
255 
256  assert(dvec.size() <= topology.totalGeomModules() * HGCalGeometry::k_NumberOfParametersPerShape);
258  PtrType ptr(hcg);
259 
260  ptr->allocateCorners(topology.ncells());
262 
263  const unsigned int nTrParm(ptr->numberOfTransformParms());
264  const unsigned int nPerShape(HGCalGeometry::k_NumberOfParametersPerShape);
265 
266  for (auto it : dins) {
267  DetId id = topology.encode(topology.geomDenseId2decId(it));
268  // get layer
269  int layer = ivec[it];
270 
271  // get transformation
272  const unsigned int jj(it * nTrParm);
273  Tr3D tr;
274  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
275  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
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));
281 
282  // get parameters
283  DimVec dims;
284  dims.reserve(nPerShape);
285 
286  DimVec::const_iterator dsrc(dvec.begin() + layer * nPerShape);
287  for (unsigned int j(0); j != nPerShape; ++j) {
288  dims.push_back(*dsrc);
289  ++dsrc;
290  }
291 
292  std::vector<GlobalPoint> corners(FlatHexagon::ncorner_);
293 
294  FlatHexagon::createCorners(dims, tr, corners);
295 
296  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
297  GlobalPoint front(
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()));
304 
305  GlobalPoint back(
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()));
312 
313  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
314  std::swap(front, back);
315  std::swap_ranges(
316  corners.begin(), corners.begin() + FlatHexagon::ncornerBy2_, corners.begin() + FlatHexagon::ncornerBy2_);
317  }
318 
319  ptr->newCell(front, back, corners[0], myParm, id);
320  }
321 
322  ptr->initializeParms(); // initializations; must happen after cells filled
323 
324  return ptr;
325 }
static constexpr unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:46
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition: FlatHexagon.cc:134
static void writeIndexed(const TrVec &tvec, const DimVec &dvec, const IVec &ivec, const IVec &dins, const std::string &tag)
std::unique_ptr< CaloSubdetectorGeometry > PtrType
assert(be >=bs)
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
static constexpr unsigned int ncorner_
Definition: FlatHexagon.h:81
CaloSubdetectorGeometry::IVec IVec
static constexpr unsigned int k_NumberOfParametersPerShape
Definition: HGCalGeometry.h:45
static std::string dbString()
Definition: HGCalGeometry.h:49
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
Definition: DetId.h:17
static constexpr unsigned int ncornerBy2_
Definition: FlatHexagon.h:82
AlgebraicVector EulerAngles
Definition: Definitions.h:34
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
calogeometryDBEPimpl::AdditionalTokens< T > additionalTokens_
static constexpr double oneBySix_
Definition: FlatHexagon.h:80

◆ produceAligned() [9/9]

Definition at line 329 of file calowriters.cc.

References ZdcGeometry::alignmentTransformIndexGlobal(), ZdcGeometry::alignmentTransformIndexLocal(), cms::cuda::assert(), ZdcGeometry::dbString(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), CaloCellGeometry::getParmPtr(), submitPVValidationJobs::gt, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, findQualityFiles::jj, ZdcGeometry::k_NumberOfParametersPerShape, ZdcGeometry::k_NumberOfShapes, hcal_runs::rt, CaloGeometryDBWriter::writeIndexed(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

329  {
330  const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
331 
332  TrVec tvec;
333  DimVec dvec;
334  IVec ivec;
335  IVec dins;
336 
337  const auto& pG = iRecord.get(geometryToken_);
338 
339  pG.getSummary(tvec, ivec, dvec, dins);
340 
342  //*********************************************************************************************
343 
344  const auto& zdcTopology = iRecord.get(additionalTokens_.topology);
345 
346  // We know that the numer of shapes chanes with changing depth
347  // so, this check is temporary disabled. We need to implement
348  // a way either to store or calculate the number of shapes or be able
349  // to deal with only max numer of shapes.
351  ZdcGeometry* zdcGeometry = new ZdcGeometry(&zdcTopology);
352  PtrType ptr(zdcGeometry);
353 
354  const unsigned int nTrParm(tvec.size() / zdcTopology.kSizeForDenseIndexing());
355 
356  ptr->fillDefaultNamedParameters();
357  ptr->allocateCorners(zdcTopology.kSizeForDenseIndexing());
358  ptr->allocatePar(zdcGeometry->numberOfShapes(), ZdcGeometry::k_NumberOfParametersPerShape);
359 
360  for (unsigned int i(0); i < dins.size(); ++i) {
361  const unsigned int nPerShape(ZdcGeometry::k_NumberOfParametersPerShape);
362  DimVec dims;
363  dims.reserve(nPerShape);
364 
365  const unsigned int indx(ivec.size() == 1 ? 0 : i);
366 
367  DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
368 
369  for (unsigned int j(0); j != nPerShape; ++j) {
370  dims.push_back(*dsrc);
371  ++dsrc;
372  }
373 
374  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
375 
376  const DetId id(zdcTopology.denseId2detId(dins[i]));
377 
378  const unsigned int iGlob(nullptr == globalPtr ? 0 : ZdcGeometry::alignmentTransformIndexGlobal(id));
379 
380  assert(nullptr == globalPtr || iGlob < globalPtr->m_align.size());
381 
382  const AlignTransform* gt(nullptr == globalPtr ? nullptr : &globalPtr->m_align[iGlob]);
383 
384  assert(nullptr == gt || iGlob == ZdcGeometry::alignmentTransformIndexGlobal(DetId(gt->rawId())));
385 
386  const unsigned int iLoc(nullptr == alignPtr ? 0 : ZdcGeometry::alignmentTransformIndexLocal(id));
387 
388  assert(nullptr == alignPtr || iLoc < alignPtr->m_align.size());
389 
390  const AlignTransform* at(nullptr == alignPtr ? nullptr : &alignPtr->m_align[iLoc]);
391 
392  assert(nullptr == at || (ZdcGeometry::alignmentTransformIndexLocal(DetId(at->rawId())) == iLoc));
393 
394  Pt3D lRef;
395  Pt3DVec lc(8, Pt3D(0, 0, 0));
396  zdcGeometry->localCorners(lc, &dims.front(), dins[i], lRef);
397 
398  const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7])); // ctr rear face in local
399  const Pt3D lCor(lc[0]);
400 
401  //----------------------------------- create transform from 6 numbers ---
402  const unsigned int jj(i * nTrParm);
403  Tr3D tr;
404  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
405  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
407  const ROOT::Math::Transform3D rt(ea, tl);
408  double xx, xy, xz, dx;
409  double yx, yy, yz, dy;
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));
413 
414  // now prepend alignment(s) for final transform
415  const Tr3D atr(nullptr == at ? tr
416  : (nullptr == gt ? at->transform() * tr : at->transform() * gt->transform() * tr));
417  //--------------------------------- done making transform ---------------
418 
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());
425 
426  assert(zdcTopology.detId2denseId(id) == dins[i]);
427  ptr->newCell(fCtr, fBck, fCor, myParm, id);
428  }
429 
430  ptr->initializeParms(); // initializations; must happen after cells filled
431 
432  return ptr;
433 }
static unsigned int alignmentTransformIndexLocal(const DetId &id)
Definition: ZdcGeometry.cc:63
CaloCellGeometry::Pt3D Pt3D
static void writeIndexed(const TrVec &tvec, const DimVec &dvec, const IVec &ivec, const IVec &dins, const std::string &tag)
std::unique_ptr< CaloSubdetectorGeometry > PtrType
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
Definition: ZdcGeometry.cc:70
static constexpr int k_NumberOfParametersPerShape
Definition: ZdcGeometry.h:31
assert(be >=bs)
std::tuple< const Alignments *, const Alignments * > getAlignGlobal(const typename T::AlignedRecord &iRecord) const
CaloSubdetectorGeometry::IVec IVec
static constexpr int k_NumberOfShapes
Definition: ZdcGeometry.h:29
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
calogeometryDBEPimpl::GeometryTraits< T, U::writeFlag()>::TokenType geometryToken_
CaloCellGeometry::Pt3D Pt3D
Definition: DetId.h:17
AlgebraicVector EulerAngles
Definition: Definitions.h:34
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
static std::string dbString()
Definition: ZdcGeometry.h:33
calogeometryDBEPimpl::AdditionalTokens< T > additionalTokens_

Member Data Documentation

◆ additionalTokens_

template<class T, class U>
calogeometryDBEPimpl::AdditionalTokens<T> CaloGeometryDBEP< T, U >::additionalTokens_
private

Definition at line 246 of file CaloGeometryDBEP.h.

Referenced by CaloGeometryDBEP< T, U >::CaloGeometryDBEP().

◆ alignmentTokens_

template<class T, class U>
calogeometryDBEPimpl::AlignmentTokens<T> CaloGeometryDBEP< T, U >::alignmentTokens_
private

◆ applyAlignment_

template<class T, class U>
bool CaloGeometryDBEP< T, U >::applyAlignment_
private

◆ geometryToken_

template<class T, class U>
calogeometryDBEPimpl::GeometryTraits<T, U::writeFlag()>::TokenType CaloGeometryDBEP< T, U >::geometryToken_
private