66#include " Geometry/ForwardGeometry/interface/ZdcHardcodeGeometryData.h"
77#include < algorithm>
88
9- typedef CaloCellGeometry::CCGFloat CCGFloat;
9+ #include < Math/Transform3D.h>
10+ #include < Math/EulerAngles.h>
11+
12+ #include < algorithm>
13+
1014typedef CaloCellGeometry::Pt3D Pt3D;
1115typedef CaloCellGeometry::Pt3DVec Pt3DVec;
16+ typedef CaloCellGeometry::Tr3D Tr3D;
17+
18+ typedef CaloSubdetectorGeometry::CCGFloat CCGFloat;
19+
20+ // #define EDM_ML_DEBUG
1221
1322ZdcGeometry::ZdcGeometry ()
1423 : theTopology(new ZdcTopology),
@@ -66,6 +75,9 @@ void ZdcGeometry::newCell(const GlobalPoint& f1,
6675 const CCGFloat* parm,
6776 const DetId& detId) {
6877 const CaloGenericDetId cgid (detId);
78+ #ifdef EDM_ML_DEBUG
79+ edm::LogVerbatim (" ZDCGeom" ) << " ZDCGeometry " << HcalZDCDetId (detId) << " Generic ID " << std::hex << cgid.rawId () << std::dec << " ZDC? " << cgid.isZDC ();
80+ #endif
6981 assert (cgid.isZDC ());
7082
7183 const unsigned int di (cgid.denseIndex ());
@@ -81,3 +93,70 @@ const CaloCellGeometry* ZdcGeometry::getGeometryRawPtr(uint32_t index) const {
8193 const CaloCellGeometry* cell (&m_cellVec[index]);
8294 return (((cell == nullptr ) || (nullptr == cell->param ())) ? nullptr : cell);
8395}
96+
97+ void ZdcGeometry::getSummary (CaloSubdetectorGeometry::TrVec& tVec,
98+ CaloSubdetectorGeometry::IVec& iVec,
99+ CaloSubdetectorGeometry::DimVec& dVec,
100+ CaloSubdetectorGeometry::IVec& /* dins*/ ) const {
101+ tVec.reserve (m_validIds.size () * numberOfTransformParms ());
102+ iVec.reserve (numberOfShapes () == 1 ? 1 : m_validIds.size ());
103+ dVec.reserve (numberOfShapes () * numberOfParametersPerShape ());
104+
105+ for (const auto & pv : parVecVec ()) {
106+ for (float iv : pv) {
107+ dVec.emplace_back (iv);
108+ }
109+ }
110+
111+ for (uint32_t i (0 ); i != m_validIds.size (); ++i) {
112+ Tr3D tr;
113+ std::shared_ptr<const CaloCellGeometry> ptr (cellGeomPtr (i));
114+ #ifdef EDM_ML_DEBUG
115+ edm::LogVerbatim (" ZDCGeom" ) << " ZDCGeometry:Summary " << i << " :" << HcalZDCDetId::kSizeForDenseIndexingRun1 << " Pointer " << ptr << " :" << (nullptr != ptr);
116+ #endif
117+ if (i < static_cast <int32_t >(HcalZDCDetId::kSizeForDenseIndexingRun1 ))
118+ assert (nullptr != ptr);
119+ if (ptr != nullptr ) {
120+ ptr->getTransform (tr, (Pt3DVec*)nullptr );
121+
122+ if (Tr3D () == tr) { // for preshower there is no rotation
123+ const GlobalPoint& gp (ptr->getPosition ());
124+ tr = HepGeom::Translate3D (gp.x (), gp.y (), gp.z ());
125+ }
126+
127+ const CLHEP::Hep3Vector tt (tr.getTranslation ());
128+ tVec.emplace_back (tt.x ());
129+ tVec.emplace_back (tt.y ());
130+ tVec.emplace_back (tt.z ());
131+ if (6 == numberOfTransformParms ()) {
132+ const CLHEP::HepRotation rr (tr.getRotation ());
133+ const ROOT::Math::Transform3D rtr (rr.xx (), rr.xy (), rr.xz (), tt.x (), rr.yx (), rr.yy (), rr.yz (), tt.y (), rr.zx (), rr.zy (), rr.zz (), tt.z ());
134+ ROOT::Math::EulerAngles ea;
135+ rtr.GetRotation (ea);
136+ tVec.emplace_back (ea.Phi ());
137+ tVec.emplace_back (ea.Theta ());
138+ tVec.emplace_back (ea.Psi ());
139+ }
140+
141+ const CCGFloat* par (ptr->param ());
142+
143+ unsigned int ishape (9999 );
144+ for (unsigned int ivv (0 ); ivv != parVecVec ().size (); ++ivv) {
145+ bool ok (true );
146+ const CCGFloat* pv (&(*parVecVec ()[ivv].begin ()));
147+ for (unsigned int k (0 ); k != numberOfParametersPerShape (); ++k) {
148+ ok = ok && (fabs (par[k] - pv[k]) < 1 .e -6 );
149+ }
150+ if (ok) {
151+ ishape = ivv;
152+ break ;
153+ }
154+ }
155+ assert (9999 != ishape);
156+
157+ const unsigned int nn ((numberOfShapes () == 1 ) ? (unsigned int )1 : m_validIds.size ());
158+ if (iVec.size () < nn)
159+ iVec.emplace_back (ishape);
160+ }
161+ }
162+ }
0 commit comments