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< 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)
 
 ~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/7]

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/7]

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/7]

Definition at line 18 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.

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

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() [5/7]

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() [6/7]

Definition at line 128 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.

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

Definition at line 238 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.

239  {
240  TrVec tvec; // transformation
241  DimVec dvec; // parameters
242  IVec ivec; // layers
243  IVec dins; // valid geom ids
244 
245  const auto& geom = iRecord.get(geometryToken_);
246 
247  geom.getSummary(tvec, ivec, dvec, dins);
248 
250  //*********************************************************************************************
251 
252  const auto& topology = iRecord.get(additionalTokens_.topology);
253 
254  assert(dvec.size() <= topology.totalGeomModules() * HGCalGeometry::k_NumberOfParametersPerShape);
256  PtrType ptr(hcg);
257 
258  ptr->allocateCorners(topology.ncells());
260 
261  const unsigned int nTrParm(ptr->numberOfTransformParms());
262  const unsigned int nPerShape(HGCalGeometry::k_NumberOfParametersPerShape);
263 
264  for (auto it : dins) {
265  DetId id = topology.encode(topology.geomDenseId2decId(it));
266  // get layer
267  int layer = ivec[it];
268 
269  // get transformation
270  const unsigned int jj(it * nTrParm);
271  Tr3D tr;
272  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
273  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
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));
279 
280  // get parameters
281  DimVec dims;
282  dims.reserve(nPerShape);
283 
284  DimVec::const_iterator dsrc(dvec.begin() + layer * nPerShape);
285  for (unsigned int j(0); j != nPerShape; ++j) {
286  dims.push_back(*dsrc);
287  ++dsrc;
288  }
289 
290  std::vector<GlobalPoint> corners(FlatHexagon::ncorner_);
291 
292  FlatHexagon::createCorners(dims, tr, corners);
293 
294  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
295  GlobalPoint front(
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()));
302 
303  GlobalPoint back(
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()));
310 
311  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
312  std::swap(front, back);
313  std::swap_ranges(
314  corners.begin(), corners.begin() + FlatHexagon::ncornerBy2_, corners.begin() + FlatHexagon::ncornerBy2_);
315  }
316 
317  ptr->newCell(front, back, corners[0], myParm, id);
318  }
319 
320  ptr->initializeParms(); // initializations; must happen after cells filled
321 
322  return ptr;
323 }
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

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