CMS 3D CMS Logo

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

#include <HGCalGeometryLoader.h>

Public Types

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

Public Member Functions

HGCalGeometrybuild (const HGCalTopology &)
 
 HGCalGeometryLoader ()
 
 ~HGCalGeometryLoader ()
 

Private Member Functions

void buildGeom (const ParmVec &, const HepGeom::Transform3D &, const DetId &, HGCalGeometry *, int mode)
 

Private Attributes

int parametersPerShape_
 
const double twoBysqrt3_
 

Detailed Description

Definition at line 11 of file HGCalGeometryLoader.h.

Member Typedef Documentation

◆ CCGFloat

Definition at line 13 of file HGCalGeometryLoader.h.

◆ ParmVec

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

Definition at line 14 of file HGCalGeometryLoader.h.

Constructor & Destructor Documentation

◆ HGCalGeometryLoader()

HGCalGeometryLoader::HGCalGeometryLoader ( )

Definition at line 19 of file HGCalGeometryLoader.cc.

19 : twoBysqrt3_(2.0 / std::sqrt(3.0)) {}

◆ ~HGCalGeometryLoader()

HGCalGeometryLoader::~HGCalGeometryLoader ( )

Definition at line 21 of file HGCalGeometryLoader.cc.

21 {}

Member Function Documentation

◆ build()

HGCalGeometry * HGCalGeometryLoader::build ( const HGCalTopology topology)

Definition at line 23 of file HGCalGeometryLoader.cc.

23  {
24  // allocate geometry
26  unsigned int numberOfCells = topology.totalGeomModules(); // both sides
27  unsigned int numberExpected = topology.allGeomModules();
31  uint32_t numberOfShapes =
33 #ifdef EDM_ML_DEBUG
34  edm::LogVerbatim("HGCalGeom") << "Number of Cells " << numberOfCells << ":" << numberExpected << " for sub-detector "
35  << topology.subDetector() << " Shapes " << numberOfShapes << ":" << parametersPerShape_
36  << " mode " << mode;
37 #endif
38  geom->allocateCorners(numberOfCells);
39  geom->allocatePar(numberOfShapes, parametersPerShape_);
40 
41  // loop over modules
43  unsigned int counter(0);
44 #ifdef EDM_ML_DEBUG
45  edm::LogVerbatim("HGCalGeom") << "HGCalGeometryLoader with # of "
46  << "transformation matrices " << topology.dddConstants().getTrFormN() << " and "
47  << topology.dddConstants().volumes() << ":" << topology.dddConstants().sectors()
48  << " volumes";
49 #endif
50  for (unsigned itr = 0; itr < topology.dddConstants().getTrFormN(); ++itr) {
51  HGCalParameters::hgtrform mytr = topology.dddConstants().getTrForm(itr);
52  int zside = mytr.zp;
53  int layer = mytr.lay;
54 #ifdef EDM_ML_DEBUG
55  unsigned int kount(0);
56  edm::LogVerbatim("HGCalGeom") << "HGCalGeometryLoader:: Z:Layer " << zside << ":" << layer << " z " << mytr.h3v.z();
57 #endif
59  ForwardSubdetector subdet = topology.subDetector();
60  for (int wafer = 0; wafer < topology.dddConstants().sectors(); ++wafer) {
61  std::string code[2] = {"False", "True"};
62  if (topology.dddConstants().waferInLayer(wafer, layer, true)) {
63  int type = topology.dddConstants().waferTypeT(wafer);
64  if (type != 1)
65  type = 0;
66  DetId detId = (DetId)(HGCalDetId(subdet, zside, layer, type, wafer, 0));
67  const auto& w = topology.dddConstants().waferPosition(wafer, true);
68  double xx = (zside > 0) ? w.first : -w.first;
69  CLHEP::Hep3Vector h3v(xx, w.second, mytr.h3v.z());
70  const HepGeom::Transform3D ht3d(mytr.hr, h3v);
71 #ifdef EDM_ML_DEBUG
72  edm::LogVerbatim("HGCalGeom") << "HGCalGeometryLoader:: Wafer:Type " << wafer << ":" << type << " DetId "
73  << HGCalDetId(detId) << std::hex << " " << detId.rawId() << std::dec
74  << " transf " << ht3d.getTranslation() << " and " << ht3d.getRotation();
75 #endif
76  HGCalParameters::hgtrap vol = topology.dddConstants().getModule(wafer, true, true);
78  params[FlatHexagon::k_r] = topology.dddConstants().cellSizeHex(type);
80 
81  buildGeom(params, ht3d, detId, geom, 0);
82  counter++;
83 #ifdef EDM_ML_DEBUG
84  ++kount;
85 #endif
86  }
87  }
88  } else if (mode == HGCalGeometryMode::Trapezoid) {
89  int indx = topology.dddConstants().layerIndex(layer, true);
90  int irad = topology.dddConstants().getParameter()->iradMinBH_[indx];
91  int nphi = topology.dddConstants().getParameter()->scintCells(layer);
92  int type = topology.dddConstants().getParameter()->scintType(layer);
93  for (int md = topology.dddConstants().getParameter()->firstModule_[indx];
94  md <= topology.dddConstants().getParameter()->lastModule_[indx];
95  ++md) {
96  for (int iphi = 1; iphi <= nphi; ++iphi) {
97  DetId detId = (DetId)(HGCScintillatorDetId(type, layer, zside * irad, iphi));
98  const auto& w = topology.dddConstants().locateCellTrap(layer, irad, iphi, true);
99  double xx = (zside > 0) ? w.first : -w.first;
100  CLHEP::Hep3Vector h3v(xx, w.second, mytr.h3v.z());
101  const HepGeom::Transform3D ht3d(mytr.hr, h3v);
102 #ifdef EDM_ML_DEBUG
103  edm::LogVerbatim("HGCalGeom") << "HGCalGeometryLoader::rad:phi:type " << irad * zside << ":" << iphi << ":"
104  << type << " DetId " << HGCScintillatorDetId(detId) << " " << std::hex
105  << detId.rawId() << std::dec << " transf " << ht3d.getTranslation() << " and "
106  << ht3d.getRotation();
107 #endif
108  HGCalParameters::hgtrap vol = topology.dddConstants().getModule(md, false, true);
109  params[FlatTrd::k_dZ] = vol.dz;
115  params[FlatTrd::k_Cell] = topology.dddConstants().cellSizeHex(type);
116 
117  buildGeom(params, ht3d, detId, geom, 1);
118  counter++;
119 #ifdef EDM_ML_DEBUG
120  ++kount;
121 #endif
122  }
123  ++irad;
124  }
125  } else {
126  DetId::Detector det = topology.detector();
127  for (int wafer = 0; wafer < topology.dddConstants().sectors(); ++wafer) {
128  if (topology.dddConstants().waferInLayer(wafer, layer, true)) {
129  int copy = topology.dddConstants().getParameter()->waferCopy_[wafer];
130  int u = HGCalWaferIndex::waferU(copy);
132  int type = topology.dddConstants().getTypeHex(layer, u, v);
133  DetId detId = (topology.isHFNose() ? (DetId)(HFNoseDetId(zside, type, layer, u, v, 0, 0))
134  : (DetId)(HGCSiliconDetId(det, zside, type, layer, u, v, 0, 0)));
135  const auto& w = topology.dddConstants().waferPosition(layer, u, v, true);
136  double xx = (zside > 0) ? w.first : -w.first;
137  CLHEP::Hep3Vector h3v(xx, w.second, mytr.h3v.z());
138  const HepGeom::Transform3D ht3d(mytr.hr, h3v);
139 #ifdef EDM_ML_DEBUG
140  if (topology.isHFNose())
141  edm::LogVerbatim("HGCalGeom") << "HGCalGeometryLoader::Wafer:Type " << wafer << ":" << type << " DetId "
142  << HFNoseDetId(detId) << std::hex << " " << detId.rawId() << std::dec
143  << " trans " << ht3d.getTranslation() << " and " << ht3d.getRotation();
144  else
145  edm::LogVerbatim("HGCalGeom") << "HGCalGeometryLoader::Wafer:Type " << wafer << ":" << type << " DetId "
146  << HGCSiliconDetId(detId) << std::hex << " " << detId.rawId() << std::dec
147  << " trans " << ht3d.getTranslation() << " and " << ht3d.getRotation();
148 #endif
149  HGCalParameters::hgtrap vol = topology.dddConstants().getModule(type, false, true);
150  params[FlatHexagon::k_dZ] = vol.dz;
151  params[FlatHexagon::k_r] = topology.dddConstants().cellSizeHex(type);
153 
154  buildGeom(params, ht3d, detId, geom, 0);
155  counter++;
156 #ifdef EDM_ML_DEBUG
157  ++kount;
158 #endif
159  }
160  }
161  }
162 #ifdef EDM_ML_DEBUG
163  edm::LogVerbatim("HGCalGeom") << kount << " modules found in Layer " << layer << " Z " << zside;
164 #endif
165  }
166 
167  geom->sortDetIds();
168 
169  if (counter != numberExpected) {
170  edm::LogError("HGCalGeom") << "Inconsistent # of cells: expected " << numberExpected << ":" << numberOfCells
171  << " , inited " << counter;
172  assert(counter == numberExpected);
173  }
174 
175  return geom;
176 }

References cms::cuda::assert(), HGCalParameters::hgtrap::bl, buildGeom(), filterCSVwithJSON::copy, counter, TauDecayModes::dec, HGCalParameters::hgtrap::dz, relativeConstraints::geom, HGCalParameters::hgtrap::h, HGCalParameters::hgtrform::h3v, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, HGCalParameters::hgtrform::hr, createfilelist::int, LEDCalibrationChannels::iphi, FlatTrd::k_Alp1, FlatTrd::k_Alp2, FlatTrd::k_Cell, FlatTrd::k_dX1, FlatTrd::k_dX2, FlatTrd::k_dX3, FlatTrd::k_dX4, FlatTrd::k_dY1, FlatTrd::k_dY2, FlatTrd::k_dZ, FlatHexagon::k_dZ, HGCalGeometry::k_NumberOfParametersPerHex, HGCalGeometry::k_NumberOfParametersPerTrd, HGCalGeometry::k_NumberOfShapes, HGCalGeometry::k_NumberOfShapesTrd, FlatTrd::k_Phi, FlatHexagon::k_r, FlatHexagon::k_R, FlatTrd::k_Theta, HGCalParameters::hgtrform::lay, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, nphi, parametersPerShape_, CalibrationSummaryClient_cfi::params, DetId::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrap::tl, ecaldqm::topology(), HGCalGeometryMode::Trapezoid, twoBysqrt3_, findQualityFiles::v, w, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), geometryCSVtoXML::xx, HGCalParameters::hgtrform::zp, and ecaldqm::zside().

Referenced by HGCalGeometryESProducer::produce().

◆ buildGeom()

void HGCalGeometryLoader::buildGeom ( const ParmVec params,
const HepGeom::Transform3D &  ht3d,
const DetId detId,
HGCalGeometry geom,
int  mode 
)
private

Definition at line 178 of file HGCalGeometryLoader.cc.

179  {
180 #ifdef EDM_ML_DEBUG
181  for (int i = 0; i < parametersPerShape_; ++i)
182  edm::LogVerbatim("HGCalGeom") << "Parameter[" << i << "] : " << params[i];
183 #endif
184  if (mode == 1) {
185  std::vector<GlobalPoint> corners(FlatTrd::ncorner_);
186 
187  FlatTrd::createCorners(params, ht3d, corners);
188 
189  const CCGFloat* parmPtr(CaloCellGeometry::getParmPtr(params, geom->parMgr(), geom->parVecVec()));
190 
191  GlobalPoint front(0.25 * (corners[0].x() + corners[1].x() + corners[2].x() + corners[3].x()),
192  0.25 * (corners[0].y() + corners[1].y() + corners[2].y() + corners[3].y()),
193  0.25 * (corners[0].z() + corners[1].z() + corners[2].z() + corners[3].z()));
194 
195  GlobalPoint back(0.25 * (corners[4].x() + corners[5].x() + corners[6].x() + corners[7].x()),
196  0.25 * (corners[4].y() + corners[5].y() + corners[6].y() + corners[7].y()),
197  0.25 * (corners[4].z() + corners[5].z() + corners[6].z() + corners[7].z()));
198 
199  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
200  std::swap(front, back);
201  std::swap_ranges(corners.begin(), corners.begin() + FlatTrd::ncornerBy2_, corners.begin() + FlatTrd::ncornerBy2_);
202  }
203  geom->newCell(front, back, corners[0], parmPtr, detId);
204  } else {
205  std::vector<GlobalPoint> corners(FlatHexagon::ncorner_);
206 
207  FlatHexagon::createCorners(params, ht3d, corners);
208 
209  const CCGFloat* parmPtr(CaloCellGeometry::getParmPtr(params, geom->parMgr(), geom->parVecVec()));
210 
211  GlobalPoint front(
213  (corners[0].x() + corners[1].x() + corners[2].x() + corners[3].x() + corners[4].x() + corners[5].x()),
215  (corners[0].y() + corners[1].y() + corners[2].y() + corners[3].y() + corners[4].y() + corners[5].y()),
217  (corners[0].z() + corners[1].z() + corners[2].z() + corners[3].z() + corners[4].z() + corners[5].z()));
218 
219  GlobalPoint back(
221  (corners[6].x() + corners[7].x() + corners[8].x() + corners[9].x() + corners[10].x() + corners[11].x()),
223  (corners[6].y() + corners[7].y() + corners[8].y() + corners[9].y() + corners[10].y() + corners[11].y()),
225  (corners[6].z() + corners[7].z() + corners[8].z() + corners[9].z() + corners[10].z() + corners[11].z()));
226 
227  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
228  std::swap(front, back);
229  std::swap_ranges(
230  corners.begin(), corners.begin() + FlatHexagon::ncornerBy2_, corners.begin() + FlatHexagon::ncornerBy2_);
231  }
232  geom->newCell(front, back, corners[0], parmPtr, detId);
233  }
234 }

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

Referenced by build().

Member Data Documentation

◆ parametersPerShape_

int HGCalGeometryLoader::parametersPerShape_
private

Definition at line 25 of file HGCalGeometryLoader.h.

Referenced by build(), and buildGeom().

◆ twoBysqrt3_

const double HGCalGeometryLoader::twoBysqrt3_
private

Definition at line 24 of file HGCalGeometryLoader.h.

Referenced by build().

FlatTrd::createCorners
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition: FlatTrd.cc:133
HGCalParameters::hgtrap::bl
float bl
Definition: HGCalParameters.h:43
counter
Definition: counter.py:1
DDAxes::y
HGCalWaferIndex::waferV
static int32_t waferV(const int32_t index)
Definition: HGCalWaferIndex.cc:42
mps_fire.i
i
Definition: mps_fire.py:355
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
FlatTrd::k_Cell
static constexpr uint32_t k_Cell
Definition: FlatTrd.h:45
CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: CaloCellGeometry.cc:4
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
FlatTrd::k_Phi
static constexpr uint32_t k_Phi
Definition: FlatTrd.h:29
cms::cuda::assert
assert(be >=bs)
HGCalGeometry::k_NumberOfShapes
static constexpr unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:47
HGCalParameters::hgtrap::dz
float dz
Definition: HGCalParameters.h:43
DDAxes::x
findQualityFiles.v
v
Definition: findQualityFiles.py:179
HGCalGeometry::k_NumberOfParametersPerTrd
static constexpr unsigned int k_NumberOfParametersPerTrd
Definition: HGCalGeometry.h:44
HGCalParameters::hgtrform::zp
int zp
Definition: HGCalParameters.h:47
HFNoseDetId
Definition: HFNoseDetId.h:22
FlatTrd::k_Theta
static constexpr uint32_t k_Theta
Definition: FlatTrd.h:27
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
FlatHexagon::k_r
static constexpr uint32_t k_r
Definition: FlatHexagon.h:28
ParmVec
std::vector< float > ParmVec
Definition: FastTimeGeometry.cc:13
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
DetId
Definition: DetId.h:17
nphi
const int nphi
Definition: CMTRawAnalyzer.h:424
FlatTrd::k_dX1
static constexpr uint32_t k_dX1
Definition: FlatTrd.h:32
HGCalParameters::hgtrform::h3v
CLHEP::Hep3Vector h3v
Definition: HGCalParameters.h:48
HGCalGeometryMode::Trapezoid
Definition: HGCalGeometryMode.h:25
HGCalParameters::hgtrap::tl
float tl
Definition: HGCalParameters.h:43
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
ecaldqm::topology
const CaloTopology * topology(nullptr)
FlatTrd::k_Alp1
static constexpr uint32_t k_Alp1
Definition: FlatTrd.h:36
FlatHexagon::ncorner_
static constexpr unsigned int ncorner_
Definition: FlatHexagon.h:81
FlatTrd::k_dY2
static constexpr uint32_t k_dY2
Definition: FlatTrd.h:38
w
const double w
Definition: UKUtility.cc:23
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
FlatTrd::k_dX4
static constexpr uint32_t k_dX4
Definition: FlatTrd.h:41
HGCalGeometryLoader::twoBysqrt3_
const double twoBysqrt3_
Definition: HGCalGeometryLoader.h:24
HGCalGeometry::k_NumberOfParametersPerHex
static constexpr unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:45
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, GlobalTag >
FlatHexagon::k_R
static constexpr uint32_t k_R
Definition: FlatHexagon.h:29
HGCalGeometry
Definition: HGCalGeometry.h:30
FlatHexagon::ncornerBy2_
static constexpr unsigned int ncornerBy2_
Definition: FlatHexagon.h:82
HGCalWaferIndex::waferU
static int32_t waferU(const int32_t index)
Definition: HGCalWaferIndex.cc:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalGeometry::k_NumberOfShapesTrd
static constexpr unsigned int k_NumberOfShapesTrd
Definition: HGCalGeometry.h:48
edm::LogError
Definition: MessageLogger.h:183
FlatTrd::k_dX3
static constexpr uint32_t k_dX3
Definition: FlatTrd.h:39
FlatTrd::ncornerBy2_
static constexpr unsigned int ncornerBy2_
Definition: FlatTrd.h:98
HGCalGeometryMode::GeometryMode
GeometryMode
Definition: HGCalGeometryMode.h:25
createfilelist.int
int
Definition: createfilelist.py:10
HGCalParameters::hgtrap::h
float h
Definition: HGCalParameters.h:43
edm::LogVerbatim
Definition: MessageLogger.h:297
FlatTrd::k_dX2
static constexpr uint32_t k_dX2
Definition: FlatTrd.h:34
DetId::Detector
Detector
Definition: DetId.h:24
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:15
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
HGCalGeometryLoader::buildGeom
void buildGeom(const ParmVec &, const HepGeom::Transform3D &, const DetId &, HGCalGeometry *, int mode)
Definition: HGCalGeometryLoader.cc:178
HGCalParameters::hgtrform::lay
int lay
Definition: HGCalParameters.h:47
HGCalGeometryMode::Hexagon
Definition: HGCalGeometryMode.h:25
HGCalDetId
Definition: HGCalDetId.h:8
FlatHexagon::k_dZ
static constexpr uint32_t k_dZ
Definition: FlatHexagon.h:27
HGCalGeometryMode::HexagonFull
Definition: HGCalGeometryMode.h:25
type
type
Definition: HCALResponse.h:21
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:21
CaloCellGeometry::getParmPtr
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
Definition: CaloCellGeometry.cc:117
FlatHexagon::oneBySix_
static constexpr double oneBySix_
Definition: FlatHexagon.h:80
FlatHexagon::createCorners
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition: FlatHexagon.cc:134
HGCalParameters::hgtrform
Definition: HGCalParameters.h:46
FlatTrd::k_Alp2
static constexpr uint32_t k_Alp2
Definition: FlatTrd.h:43
FlatTrd::ncorner_
static constexpr unsigned int ncorner_
Definition: FlatTrd.h:97
HGCalParameters::hgtrap
Definition: HGCalParameters.h:41
HGCalParameters::hgtrform::hr
CLHEP::HepRotation hr
Definition: HGCalParameters.h:49
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
FlatTrd::k_dY1
static constexpr uint32_t k_dY1
Definition: FlatTrd.h:31
HGCalGeometryLoader::parametersPerShape_
int parametersPerShape_
Definition: HGCalGeometryLoader.h:25
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
FlatTrd::k_dZ
static constexpr uint32_t k_dZ
Definition: FlatTrd.h:26