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 10 of file HGCalGeometryLoader.h.

Member Typedef Documentation

◆ CCGFloat

Definition at line 12 of file HGCalGeometryLoader.h.

◆ ParmVec

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

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

References cms::cuda::assert(), HGCalParameters::hgtrap::bl, buildGeom(), filterCSVwithJSON::copy, counter, TauDecayModes::dec, HGCalParameters::hgtrap::dz, relativeConstraints::geom, HGCalParameters::hgtrap::h, HGCalParameters::hgtrform::h3v, 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, nphi, parametersPerShape_, CalibrationSummaryClient_cfi::params, DetId::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrap::tl, ecaldqm::topology(), 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 177 of file HGCalGeometryLoader.cc.

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

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 24 of file HGCalGeometryLoader.h.

Referenced by build(), and buildGeom().

◆ twoBysqrt3_

const double HGCalGeometryLoader::twoBysqrt3_
private

Definition at line 23 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:428
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:46
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:43
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
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:23
HGCalGeometry::k_NumberOfParametersPerHex
static constexpr unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:44
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:29
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:47
FlatTrd::k_dX3
static constexpr uint32_t k_dX3
Definition: FlatTrd.h:39
FlatTrd::ncornerBy2_
static constexpr unsigned int ncornerBy2_
Definition: FlatTrd.h:98
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
createfilelist.int
int
Definition: createfilelist.py:10
HGCalParameters::hgtrap::h
float h
Definition: HGCalParameters.h:43
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:17
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:29
HGCalGeometryLoader::buildGeom
void buildGeom(const ParmVec &, const HepGeom::Transform3D &, const DetId &, HGCalGeometry *, int mode)
Definition: HGCalGeometryLoader.cc:177
HGCalParameters::hgtrform::lay
int lay
Definition: HGCalParameters.h:47
HGCalDetId
Definition: HGCalDetId.h:8
FlatHexagon::k_dZ
static constexpr uint32_t k_dZ
Definition: FlatHexagon.h:27
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:23
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
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
edm::Log
Definition: MessageLogger.h:70
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:24
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
FlatTrd::k_dZ
static constexpr uint32_t k_dZ
Definition: FlatTrd.h:26