CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HGCalTBGeometryLoader Class Reference

#include <HGCalTBGeometryLoader.h>

Public Types

typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< float > ParmVec
 

Public Member Functions

HGCalTBGeometrybuild (const HGCalTBTopology &)
 
 HGCalTBGeometryLoader ()
 
 ~HGCalTBGeometryLoader ()=default
 

Private Member Functions

void buildGeom (const ParmVec &, const HepGeom::Transform3D &, const DetId &, HGCalTBGeometry *)
 

Private Attributes

int parametersPerShape_
 
const double twoBysqrt3_
 

Detailed Description

Definition at line 10 of file HGCalTBGeometryLoader.h.

Member Typedef Documentation

◆ CCGFloat

Definition at line 12 of file HGCalTBGeometryLoader.h.

◆ ParmVec

typedef std::vector<float> HGCalTBGeometryLoader::ParmVec

Definition at line 13 of file HGCalTBGeometryLoader.h.

Constructor & Destructor Documentation

◆ HGCalTBGeometryLoader()

HGCalTBGeometryLoader::HGCalTBGeometryLoader ( )

Definition at line 15 of file HGCalTBGeometryLoader.cc.

15 : twoBysqrt3_(2.0 / std::sqrt(3.0)) {}
T sqrt(T t)
Definition: SSEVec.h:19

◆ ~HGCalTBGeometryLoader()

HGCalTBGeometryLoader::~HGCalTBGeometryLoader ( )
default

Member Function Documentation

◆ build()

HGCalTBGeometry * HGCalTBGeometryLoader::build ( const HGCalTBTopology topology)

Definition at line 17 of file HGCalTBGeometryLoader.cc.

References HGCalTBTopology::allGeomModules(), buildGeom(), HGCalTBDDDConstants::cellSizeHex(), counter, HGCalTBTopology::dddConstants(), TauDecayModes::dec, hcalRecHitTable_cff::detId, HGCalTBParameters::hgtrap::dz, relativeConstraints::geom, HGCalTBDDDConstants::getModule(), HGCalTBDDDConstants::getTrForm(), HGCalTBDDDConstants::getTrFormN(), HGCalTBParameters::hgtrform::h3v, HGCalTBParameters::hgtrform::hr, FlatHexagon::k_dZ, HGCalTBGeometry::k_NumberOfParametersPerHex, HGCalTBGeometry::k_NumberOfShapes, FlatHexagon::k_r, FlatHexagon::k_R, HGCalTBParameters::hgtrform::lay, nano_mu_digi_cff::layer, parametersPerShape_, submitPVValidationJobs::params, HGCalTBDDDConstants::sectors(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalTBTopology::subDetector(), HGCalTBTopology::totalGeomModules(), twoBysqrt3_, HGCalTBDDDConstants::volumes(), w(), HGCalTBDDDConstants::waferInLayer(), HGCalTBDDDConstants::waferPosition(), HGCalTBDDDConstants::waferTypeT(), geometryCSVtoXML::xx, HGCalTBParameters::hgtrform::zp, and ecaldqm::zside().

Referenced by HGCalTBGeometryESProducer::produce().

17  {
18  // allocate geometry
19  HGCalTBGeometry* geom = new HGCalTBGeometry(topology);
20  unsigned int numberOfCells = topology.totalGeomModules(); // both sides
21  unsigned int numberExpected = topology.allGeomModules();
23  uint32_t numberOfShapes = HGCalTBGeometry::k_NumberOfShapes;
24 #ifdef EDM_ML_DEBUG
25  edm::LogVerbatim("HGCalGeom") << "Number of Cells " << numberOfCells << ":" << numberExpected << " for sub-detector "
26  << topology.subDetector() << " Shapes " << numberOfShapes << ":" << parametersPerShape_;
27 #endif
28  geom->allocateCorners(numberOfCells);
29  geom->allocatePar(numberOfShapes, parametersPerShape_);
30 
31  // loop over modules
33  unsigned int counter(0);
34 #ifdef EDM_ML_DEBUG
35  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeometryLoader with # of "
36  << "transformation matrices " << topology.dddConstants().getTrFormN() << " and "
37  << topology.dddConstants().volumes() << ":" << topology.dddConstants().sectors()
38  << " volumes";
39 #endif
40  for (unsigned itr = 0; itr < topology.dddConstants().getTrFormN(); ++itr) {
41  HGCalTBParameters::hgtrform mytr = topology.dddConstants().getTrForm(itr);
42  int zside = mytr.zp;
43  int layer = mytr.lay;
44 #ifdef EDM_ML_DEBUG
45  unsigned int kount(0);
46  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeometryLoader:: Z:Layer " << zside << ":" << layer << " z "
47  << mytr.h3v.z();
48 #endif
49  ForwardSubdetector subdet = topology.subDetector();
50  for (int wafer = 0; wafer < topology.dddConstants().sectors(); ++wafer) {
51  std::string code[2] = {"False", "True"};
52  if (topology.dddConstants().waferInLayer(wafer, layer, true)) {
53  int type = topology.dddConstants().waferTypeT(wafer);
54  if (type != 1)
55  type = 0;
56  DetId detId = static_cast<DetId>(HGCalDetId(subdet, zside, layer, type, wafer, 0));
57  const auto& w = topology.dddConstants().waferPosition(wafer, true);
58  double xx = (zside > 0) ? w.first : -w.first;
59  CLHEP::Hep3Vector h3v(xx, w.second, mytr.h3v.z());
60  const HepGeom::Transform3D ht3d(mytr.hr, h3v);
61 #ifdef EDM_ML_DEBUG
62  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeometryLoader:: Wafer:Type " << wafer << ":" << type << " DetId "
63  << HGCalDetId(detId) << std::hex << " " << detId.rawId() << std::dec << " transf "
64  << ht3d.getTranslation() << " and " << ht3d.getRotation();
65 #endif
66  HGCalTBParameters::hgtrap vol = topology.dddConstants().getModule(wafer, true, true);
70 
71  buildGeom(params, ht3d, detId, geom);
72  counter++;
73 #ifdef EDM_ML_DEBUG
74  ++kount;
75 #endif
76  }
77  }
78 #ifdef EDM_ML_DEBUG
79  edm::LogVerbatim("HGCalGeom") << kount << " modules found in Layer " << layer << " Z " << zside;
80 #endif
81  }
82 
83  geom->sortDetIds();
84 
85  if (counter != numberExpected) {
86  edm::LogError("HGCalGeom") << "Inconsistent # of cells: expected " << numberExpected << ":" << numberOfCells
87  << " , inited " << counter;
88  }
89 
90  return geom;
91 }
unsigned int totalGeomModules() const
Log< level::Info, true > LogVerbatim
static constexpr unsigned int k_NumberOfParametersPerHex
bool waferInLayer(int wafer, int lay, bool reco) const
ForwardSubdetector subDetector() const
T w() const
int zside(DetId const &)
Log< level::Error, false > LogError
ForwardSubdetector
int waferTypeT(int wafer) const
void buildGeom(const ParmVec &, const HepGeom::Transform3D &, const DetId &, HGCalTBGeometry *)
static constexpr uint32_t k_R
Definition: FlatHexagon.h:29
static constexpr uint32_t k_r
Definition: FlatHexagon.h:28
std::vector< float > ParmVec
unsigned int volumes() const
std::pair< double, double > waferPosition(int wafer, bool reco) const
Definition: DetId.h:17
double cellSizeHex(int type) const
unsigned int getTrFormN() const
const HGCalTBDDDConstants & dddConstants() const
HGCalTBParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
static constexpr uint32_t k_dZ
Definition: FlatHexagon.h:27
unsigned int allGeomModules() const
static std::atomic< unsigned int > counter
static constexpr unsigned int k_NumberOfShapes
HGCalTBParameters::hgtrform getTrForm(unsigned int k) const

◆ buildGeom()

void HGCalTBGeometryLoader::buildGeom ( const ParmVec params,
const HepGeom::Transform3D &  ht3d,
const DetId detId,
HGCalTBGeometry geom 
)
private

Definition at line 93 of file HGCalTBGeometryLoader.cc.

References FlatHexagon::createCorners(), hcalRecHitTable_cff::detId, relativeConstraints::geom, CaloCellGeometry::getParmPtr(), mps_fire::i, PV3DBase< T, PVType, FrameType >::mag2(), FlatHexagon::ncorner_, FlatHexagon::ncornerBy2_, FlatHexagon::oneBySix_, parametersPerShape_, submitPVValidationJobs::params, std::swap(), x, y, and z.

Referenced by build().

96  {
97 #ifdef EDM_ML_DEBUG
98  for (int i = 0; i < parametersPerShape_; ++i)
99  edm::LogVerbatim("HGCalGeom") << "Parameter[" << i << "] : " << params[i];
100 #endif
101  std::vector<GlobalPoint> corners(FlatHexagon::ncorner_);
102 
103  FlatHexagon::createCorners(params, ht3d, corners);
104 
105  const CCGFloat* parmPtr(CaloCellGeometry::getParmPtr(params, geom->parMgr(), geom->parVecVec()));
106 
107  GlobalPoint front(
109  (corners[0].x() + corners[1].x() + corners[2].x() + corners[3].x() + corners[4].x() + corners[5].x()),
111  (corners[0].y() + corners[1].y() + corners[2].y() + corners[3].y() + corners[4].y() + corners[5].y()),
113  (corners[0].z() + corners[1].z() + corners[2].z() + corners[3].z() + corners[4].z() + corners[5].z()));
114 
115  GlobalPoint back(
117  (corners[6].x() + corners[7].x() + corners[8].x() + corners[9].x() + corners[10].x() + corners[11].x()),
119  (corners[6].y() + corners[7].y() + corners[8].y() + corners[9].y() + corners[10].y() + corners[11].y()),
121  (corners[6].z() + corners[7].z() + corners[8].z() + corners[9].z() + corners[10].z() + corners[11].z()));
122 
123  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
124  std::swap(front, back);
125  std::swap_ranges(
126  corners.begin(), corners.begin() + FlatHexagon::ncornerBy2_, corners.begin() + FlatHexagon::ncornerBy2_);
127  }
128  geom->newCell(front, back, corners[0], parmPtr, detId);
129 }
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition: FlatHexagon.cc:134
static constexpr unsigned int ncorner_
Definition: FlatHexagon.h:81
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
CaloCellGeometry::CCGFloat CCGFloat
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
static constexpr unsigned int ncornerBy2_
Definition: FlatHexagon.h:82
static constexpr double oneBySix_
Definition: FlatHexagon.h:80

Member Data Documentation

◆ parametersPerShape_

int HGCalTBGeometryLoader::parametersPerShape_
private

Definition at line 24 of file HGCalTBGeometryLoader.h.

Referenced by build(), and buildGeom().

◆ twoBysqrt3_

const double HGCalTBGeometryLoader::twoBysqrt3_
private

Definition at line 23 of file HGCalTBGeometryLoader.h.

Referenced by build().