CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Static Private Attributes
HGCalParametersFromDD Class Reference

#include <HGCalParametersFromDD.h>

Public Member Functions

bool build (const DDCompactView *cpv, HGCalParameters &php, const std::string &name, const std::string &namew, const std::string &namec, const std::string &namet)
 
bool build (const cms::DDCompactView *cpv, HGCalParameters &php, const std::string &name, const std::string &namew, const std::string &namec, const std::string &namet, const std::string &name2)
 
 HGCalParametersFromDD ()
 
virtual ~HGCalParametersFromDD ()
 

Private Member Functions

void getCellPosition (HGCalParameters &php, int type)
 
std::vector< double > getDDDArray (const char *s, const DDsvalues_type &sv)
 
double getDDDValue (const char *s, const DDsvalues_type &sv)
 

Static Private Attributes

static constexpr double tan30deg_ = 0.5773502693
 

Detailed Description

Definition at line 12 of file HGCalParametersFromDD.h.

Constructor & Destructor Documentation

HGCalParametersFromDD::HGCalParametersFromDD ( )
inline

Definition at line 14 of file HGCalParametersFromDD.h.

14 {}
virtual HGCalParametersFromDD::~HGCalParametersFromDD ( )
inlinevirtual

Definition at line 15 of file HGCalParametersFromDD.h.

15 {}

Member Function Documentation

bool HGCalParametersFromDD::build ( const DDCompactView cpv,
HGCalParameters php,
const std::string &  name,
const std::string &  namew,
const std::string &  namec,
const std::string &  namet 
)

Definition at line 57 of file HGCalParametersFromDD.cc.

References HGCalParameters::cellSize_, angle_units::operators::convertRadToDeg(), dbl_to_int(), HGCalParameters::defineFull_, HGCalParameters::detectorType_, Exception, HGCalGeometryMode::ExtrudedPolygon, alcazmumu_cfi::filter, DDFilteredView::firstChild(), HGCalParameters::firstLayer_, HGCalParameters::firstMixedLayer_, relativeConstraints::geom, HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8File, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::Hexagon8Module, HGCalGeometryMode::HexagonFull, isotrackApplyRegressor::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, HGCalParameters::layerRotation_, HGCalParameters::levelT_, HGCalParameters::levelZSide_, DDFilteredView::mergedSpecifics(), HGCalParameters::minTileSize_, universalConfigTemplate::mode, HGCalParameters::mode_, HGCalParameters::mouseBite_, mergeVDriftHistosByStation::name, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, convertSQLiteXML::ok, HGCalGeometryMode::Polyhedra, HGCalParameters::sensorSeparation_, AlCaHLTBitMon_QueryRunRegistry::string, HGCalGeometryMode::Trapezoid, HGCalGeometryMode::TrapezoidFile, HGCalGeometryMode::TrapezoidModule, hgcalPerformanceValidation::val, relativeConstraints::value, HGCalParameters::waferMaskMode_, HGCalParameters::waferR_, HGCalParameters::waferSize_, HGCalParameters::waferThick_, and HGCalParameters::waferZSide_.

Referenced by PHGCalParametersDBBuilder::beginRun().

62  {
63 #ifdef EDM_ML_DEBUG
64  edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD (DDD)::build called with "
65  << "names " << name << ":" << namew << ":" << namec << ":" << namet;
66 #endif
67 
68  // Special parameters at simulation level
69  std::string attribute = "Volume";
71  DDValue val(attribute, value, 0.0);
73  DDFilteredView fv(*cpv, filter);
74  bool ok = fv.firstChild();
76 
77  if (ok) {
78  DDsvalues_type sv(fv.mergedSpecifics());
79  php.mode_ = getGeometryMode("GeometryMode", sv);
80 #ifdef EDM_ML_DEBUG
81  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode " << php.mode_ << ":"
87 #endif
88  php.levelZSide_ = 3; // Default level for ZSide
89  php.detectorType_ = 0; // These two parameters are
90  php.firstMixedLayer_ = -1; // defined for post TDR geometry
91  php.layerRotation_ = 0; // default layer rotation angle
92  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
94  attribute = "OnlyForHGCalNumbering";
95  value = namet;
96  DDValue val2(attribute, value, 0.0);
97  DDSpecificsMatchesValueFilter filter2{val2};
98  DDFilteredView fv2(*cpv, filter2);
99  bool ok2 = fv2.firstChild();
100  if (ok2) {
101  DDsvalues_type sv2(fv2.mergedSpecifics());
102  mode = getGeometryWaferMode("WaferMode", sv2);
103 #ifdef EDM_ML_DEBUG
104  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
106 #endif
107  }
108  php.minTileSize_ = 0;
109  php.waferMaskMode_ = 0;
110  php.waferZSide_ = 0;
111  }
114  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
115  php.levelZSide_ = static_cast<int>(getDDDValue("LevelZSide", sv));
116  php.nCellsFine_ = php.nCellsCoarse_ = 0;
117  php.firstLayer_ = 1;
118  php.firstMixedLayer_ = static_cast<int>(getDDDValue("FirstMixedLayer", sv));
119  php.detectorType_ = static_cast<int>(getDDDValue("DetectorType", sv));
120  php.minTileSize_ = 0;
121  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
122  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
124  php.layerRotation_ = getDDDValue("LayerRotation", sv);
125 #ifdef EDM_ML_DEBUG
126  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
127  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
128  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
129  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Layer Rotation "
131 #endif
132  attribute = "OnlyForHGCalNumbering";
133  value = namet;
134  DDValue val2(attribute, value, 0.0);
135  DDSpecificsMatchesValueFilter filter2{val2};
136  DDFilteredView fv2(*cpv, filter2);
137  bool ok2 = fv2.firstChild();
138  if (ok2) {
139  DDsvalues_type sv2(fv2.mergedSpecifics());
140  mode = getGeometryWaferMode("WaferMode", sv2);
141  php.nCellsFine_ = static_cast<int>(getDDDValue("NumberOfCellsFine", sv2));
142  php.nCellsCoarse_ = static_cast<int>(getDDDValue("NumberOfCellsCoarse", sv2));
143  php.waferSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferSize", sv2);
144  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv2);
145  php.sensorSeparation_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("SensorSeparation", sv2);
146  php.mouseBite_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MouseBite", sv2);
148  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
149  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
150 #ifdef EDM_ML_DEBUG
151  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
152  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
153  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
154  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
155  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
156  << ":" << php.waferR_;
157 #endif
158  for (int k = 0; k < 2; ++k)
159  getCellPosition(php, k);
160  }
161  }
162  if (php.mode_ == HGCalGeometryMode::Hexagon) {
163  // Load the SpecPars
164  php.firstLayer_ = 1;
165  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
166  // Load the Geometry parameters
167  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
168  // Load cell parameters
169  geom->loadCellParsHexagon(cpv, php);
170  // Set complete fill mode
171  php.defineFull_ = false;
172  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
173  // Load the SpecPars
174  php.firstLayer_ = 1;
175  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
176  // Load the Geometry parameters
177  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
178  // Modify some constants
179  geom->loadWaferHexagon(php);
180  // Load cell parameters
181  geom->loadCellParsHexagon(cpv, php);
182  // Set complete fill mode
183  php.defineFull_ = true;
184  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
185  // Load the SpecPars
186  geom->loadSpecParsHexagon8(fv, php);
187  // Load Geometry parameters
188  geom->loadGeometryHexagon8(fv, php, 1);
189  // Set complete fill mode
190  php.defineFull_ = false;
191  // Load wafer positions
192  geom->loadWaferHexagon8(php);
194  // Load the SpecPars
195  geom->loadSpecParsHexagon8(fv, php);
196  // Load Geometry parameters
197  geom->loadGeometryHexagon8(fv, php, 1);
198  // Set complete fill mode
199  php.defineFull_ = true;
200  // Load wafer positions
201  geom->loadWaferHexagon8(php);
202  } else if (php.mode_ == HGCalGeometryMode::Hexagon8Module) {
203  // Load the SpecPars
204  geom->loadSpecParsHexagon8(fv, php);
205  // Load Geometry parameters
206  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
207  // Set complete fill mode
208  php.defineFull_ = true;
209  // Load wafer positions
210  geom->loadWaferHexagon8(php);
212  (php.mode_ == HGCalGeometryMode::TrapezoidModule)) {
213  // Load maximum eta & top level
214  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
215  php.firstLayer_ = (int)(getDDDValue("FirstLayer", sv));
216  php.firstMixedLayer_ = (int)(getDDDValue("FirstMixedLayer", sv));
217  php.detectorType_ = (int)(getDDDValue("DetectorType", sv));
218  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv);
219  php.minTileSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MinimumTileSize", sv);
220  php.waferSize_ = php.waferR_ = 0;
221  php.sensorSeparation_ = php.mouseBite_ = 0;
222  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
223  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
224 #ifdef EDM_ML_DEBUG
225  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
226  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
227  << php.detectorType_ << " thickenss " << php.waferThick_ << " Tile Mask Mode "
228  << php.waferMaskMode_ << " Zside " << php.waferZSide_;
229 #endif
230  // Load the SpecPars
231  geom->loadSpecParsTrapezoid(fv, php);
232  // Load Geometry parameters
233  geom->loadGeometryHexagon8(fv, php, php.firstLayer_);
234  // Load cell positions
235  geom->loadCellTrapezoid(php);
236  } else {
237  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
238  << ":" << namec;
239  throw cms::Exception("DDException")
240  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
241  }
242  } else {
243  edm::LogError("HGCalGeom") << " Attribute " << val << " not found but needed.";
244  throw cms::Exception("DDException") << "Attribute " << val << " not found but needed.";
245  }
246 #ifdef EDM_ML_DEBUG
247  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
248  << " with flag " << ok;
249 #endif
250  return ok;
251 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Log< level::Error, false > LogError
HGCalGeometryMode::GeometryMode mode_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > cellSize_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
static constexpr double k_ScaleToDDD
double getDDDValue(const char *s, const DDsvalues_type &sv)
static constexpr double k_ScaleFromDDD
std::vector< int > levelT_
std::vector< double > getDDDArray(const char *s, const DDsvalues_type &sv)
static constexpr double tan30deg_
void getCellPosition(HGCalParameters &php, int type)
bool HGCalParametersFromDD::build ( const cms::DDCompactView cpv,
HGCalParameters php,
const std::string &  name,
const std::string &  namew,
const std::string &  namec,
const std::string &  namet,
const std::string &  name2 
)

Definition at line 253 of file HGCalParametersFromDD.cc.

References HGCalParameters::cellSize_, angle_units::operators::convertRadToDeg(), dbl_to_int(), HGCalParameters::defineFull_, cms::DDCompactView::detector(), HGCalParameters::detectorType_, Exception, HGCalGeometryMode::ExtrudedPolygon, alcazmumu_cfi::filter, cms::DDFilteredView::firstChild(), HGCalParameters::firstLayer_, HGCalParameters::firstMixedLayer_, relativeConstraints::geom, cms::DDFilteredView::get(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8File, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::Hexagon8Module, HGCalGeometryMode::HexagonFull, isotrackApplyRegressor::k, HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::k_ScaleToDDD, HGCalParameters::layerRotation_, HGCalParameters::levelT_, HGCalParameters::levelZSide_, HGCalParameters::minTileSize_, universalConfigTemplate::mode, HGCalParameters::mode_, HGCalParameters::mouseBite_, mergeVDriftHistosByStation::name, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, convertSQLiteXML::ok, HGCalGeometryMode::Polyhedra, HGCalParameters::sensorSeparation_, AlCaHLTBitMon_QueryRunRegistry::string, HGCalGeometryMode::Trapezoid, HGCalGeometryMode::TrapezoidFile, HGCalGeometryMode::TrapezoidModule, cms::DDDetector::vectors(), HGCalParameters::waferMaskMode_, HGCalParameters::waferR_, HGCalParameters::waferSize_, HGCalParameters::waferThick_, and HGCalParameters::waferZSide_.

259  {
260 #ifdef EDM_ML_DEBUG
261  edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD (DD4hep)::build called with "
262  << "names " << name << ":" << namew << ":" << namec << ":" << namet << ":" << name2;
263 #endif
264  cms::DDVectorsMap vmap = cpv->detector()->vectors();
265  const cms::DDFilter filter("Volume", name);
266  cms::DDFilteredView fv((*cpv), filter);
267  std::vector<std::string> tempS;
268  std::vector<double> tempD;
269  bool ok = fv.firstChild();
270  tempS = fv.get<std::vector<std::string> >(name2, "GeometryMode");
271  if (tempS.empty()) {
272  tempS = fv.get<std::vector<std::string> >(name, "GeometryMode");
273  }
274  std::string sv = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Hexagon8Full";
276 
277  if (ok) {
278  php.mode_ = getGeometryMode(sv);
279 #ifdef EDM_ML_DEBUG
280  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode " << php.mode_ << ":"
286 #endif
287  php.levelZSide_ = 3; // Default level for ZSide
288  php.detectorType_ = 0; // These two parameters are
289  php.firstMixedLayer_ = -1; // defined for post TDR geometry
290  php.layerRotation_ = 0; // default layer rotation angle
291  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
293  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
294  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Polyhedra";
295  mode = getGeometryWaferMode(sv2);
296 #ifdef EDM_ML_DEBUG
297  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
299 #endif
300  php.minTileSize_ = 0;
301  php.waferMaskMode_ = 0;
302  php.waferZSide_ = 0;
303  }
306  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
307  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
308  php.levelZSide_ = static_cast<int>(tempD[0]);
309  php.nCellsFine_ = php.nCellsCoarse_ = 0;
310  php.firstLayer_ = 1;
311  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
312  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
313  tempD = fv.get<std::vector<double> >(name, "DetectorType");
314  php.detectorType_ = static_cast<int>(tempD[0]);
315  php.minTileSize_ = 0;
316  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
317  php.waferMaskMode_ = static_cast<int>(tempD[0]);
318  tempD = fv.get<std::vector<double> >(name, "WaferZside");
319  php.waferZSide_ = static_cast<int>(tempD[0]);
321  tempD = fv.get<std::vector<double> >(name, "LayerRotation");
322  php.layerRotation_ = tempD[0];
323  }
324 #ifdef EDM_ML_DEBUG
325  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
326  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
327  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
328  << php.waferMaskMode_ << " ZSide " << php.waferZSide_ << " Layer Rotation "
330 #endif
331 
332  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
333  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::ExtrudedPolygon";
334  mode = getGeometryWaferMode(sv2);
335  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsFine");
336  php.nCellsFine_ = static_cast<int>(tempD[0]);
337  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsCoarse");
338  php.nCellsCoarse_ = static_cast<int>(tempD[0]);
339  tempD = fv.get<std::vector<double> >(namet, "WaferSize");
341  tempD = fv.get<std::vector<double> >(namet, "WaferThickness");
343  tempD = fv.get<std::vector<double> >(namet, "SensorSeparation");
345  tempD = fv.get<std::vector<double> >(namet, "MouseBite");
348  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
349  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
350 #ifdef EDM_ML_DEBUG
351  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
352  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
353  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
354  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
355  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
356  << ":" << php.waferR_;
357 #endif
358  for (int k = 0; k < 2; ++k)
359  getCellPosition(php, k);
360  }
361  if (php.mode_ == HGCalGeometryMode::Hexagon) {
362  // Load the SpecPars
363  php.firstLayer_ = 1;
364  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
365  // Load the Geometry parameters
366  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
367  // Load cell parameters
368  geom->loadCellParsHexagon(vmap, php);
369  // Set complete fill mode
370  php.defineFull_ = false;
371  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
372  // Load the SpecPars
373  php.firstLayer_ = 1;
374  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
375  // Load the Geometry parameters
376  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
377  // Modify some constants
378  geom->loadWaferHexagon(php);
379  // Load cell parameters
380  geom->loadCellParsHexagon(vmap, php);
381  // Set complete fill mode
382  php.defineFull_ = true;
383  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
384  // Load the SpecPars
385  geom->loadSpecParsHexagon8(fv, vmap, php, name);
386  // Load Geometry parameters
387  geom->loadGeometryHexagon8(cpv, php, name, 1);
388  // Set complete fill mode
389  php.defineFull_ = false;
390  // Load wafer positions
391  geom->loadWaferHexagon8(php);
393  // Load the SpecPars
394  geom->loadSpecParsHexagon8(fv, vmap, php, name);
395  // Load Geometry parameters
396  geom->loadGeometryHexagon8(cpv, php, name, 1);
397  // Set complete fill mode
398  php.defineFull_ = true;
399  // Load wafer positions
400  geom->loadWaferHexagon8(php);
401  } else if (php.mode_ == HGCalGeometryMode::Hexagon8Module) {
402  // Load the SpecPars
403  geom->loadSpecParsHexagon8(fv, vmap, php, name);
404  // Load Geometry parameters
405  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
406  // Set complete fill mode
407  php.defineFull_ = true;
408  // Load wafer positions
409  geom->loadWaferHexagon8(php);
411  (php.mode_ == HGCalGeometryMode::TrapezoidModule)) {
412  // Load maximum eta & top level
413  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
414  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
415  php.levelZSide_ = static_cast<int>(tempD[0]);
416  php.nCellsFine_ = php.nCellsCoarse_ = 0;
417  tempD = fv.get<std::vector<double> >(name, "FirstLayer");
418  php.firstLayer_ = static_cast<int>(tempD[0]);
419  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
420  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
421  tempD = fv.get<std::vector<double> >(name, "DetectorType");
422  php.detectorType_ = static_cast<int>(tempD[0]);
423  tempD = fv.get<std::vector<double> >(name, "WaferThickness");
425  tempD = fv.get<std::vector<double> >(name, "MinimumTileSize");
427  php.waferSize_ = php.waferR_ = 0;
428  php.sensorSeparation_ = php.mouseBite_ = 0;
429  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
430  php.waferMaskMode_ = static_cast<int>(tempD[0]);
431  tempD = fv.get<std::vector<double> >(name, "WaferZside");
432  php.waferZSide_ = static_cast<int>(tempD[0]);
433 #ifdef EDM_ML_DEBUG
434  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
435  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
436  << php.detectorType_ << " thickenss " << php.waferThick_ << " min tile size "
437  << php.minTileSize_ << " Tile Mask Mode " << php.waferMaskMode_ << " ZSide "
438  << php.waferZSide_;
439 #endif
440  // Load the SpecPars
441  geom->loadSpecParsTrapezoid(fv, vmap, php, name);
442  // Load Geometry parameters
443  geom->loadGeometryHexagon8(cpv, php, name, php.firstLayer_);
444  // Load cell positions
445  geom->loadCellTrapezoid(php);
446  } else {
447  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
448  << ":" << namec;
449  throw cms::Exception("DDException")
450  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
451  }
452  } else {
453  edm::LogError("HGCalGeom") << " Attribute Volume:" << name << " not found but needed.";
454  throw cms::Exception("DDException") << "Attribute Volume:" << name << " not found but needed.";
455  }
456 #ifdef EDM_ML_DEBUG
457  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
458  << " with flag " << ok;
459 #endif
460  return ok;
461 }
std::unordered_map< std::string, std::vector< double >> DDVectorsMap
Definition: DDNamespace.h:20
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
cms::DDVectorsMap const & vectors() const
Definition: DDDetector.h:17
Log< level::Error, false > LogError
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellSize_
static constexpr double k_ScaleFromDD4hep
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
static constexpr double k_ScaleToDDD
std::vector< int > levelT_
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34
static constexpr double tan30deg_
void getCellPosition(HGCalParameters &php, int type)
void HGCalParametersFromDD::getCellPosition ( HGCalParameters php,
int  type 
)
private

Definition at line 463 of file HGCalParametersFromDD.cc.

References HGCalParameters::cellCoarseIndex_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineIndex_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, gpuClustering::id, isotrackApplyRegressor::k, N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, dttmaxenums::R, alignCSCRings::r, mathSSE::sqrt(), findQualityFiles::v, and HGCalParameters::waferSize_.

463  {
464  if (type == 1) {
465  php.cellCoarseX_.clear();
466  php.cellCoarseY_.clear();
467  } else {
468  php.cellFineX_.clear();
469  php.cellFineY_.clear();
470  }
471  HGCalParameters::wafer_map cellIndex;
472 #ifdef EDM_ML_DEBUG
473  std::vector<int> indtypes;
474 #endif
475  int N = (type == 1) ? php.nCellsCoarse_ : php.nCellsFine_;
476  double R = php.waferSize_ / (3 * N);
477  double r = 0.5 * R * sqrt(3.0);
478  int n2 = N / 2;
479  int ipos(0);
480  for (int u = 0; u < 2 * N; ++u) {
481  for (int v = 0; v < 2 * N; ++v) {
482  if (((v - u) < N) && (u - v) <= N) {
483  double yp = (u - 0.5 * v - n2) * 2 * r;
484  double xp = (1.5 * (v - N) + 1.0) * R;
485  int id = v * 100 + u;
486 #ifdef EDM_ML_DEBUG
487  indtypes.emplace_back(id);
488 #endif
489  if (type == 1) {
490  php.cellCoarseX_.emplace_back(xp);
491  php.cellCoarseY_.emplace_back(yp);
492  } else {
493  php.cellFineX_.emplace_back(xp);
494  php.cellFineY_.emplace_back(yp);
495  }
496  cellIndex[id] = ipos;
497  ++ipos;
498  }
499  }
500  }
501  if (type == 1)
502  php.cellCoarseIndex_ = cellIndex;
503  else
504  php.cellFineIndex_ = cellIndex;
505 
506 #ifdef EDM_ML_DEBUG
507  if (type == 1) {
508  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellCoarseX_.size()
509  << " cells";
510  for (unsigned int k = 0; k < php.cellCoarseX_.size(); ++k) {
511  int id = indtypes[k];
512  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellCoarseIndex_[id] << " X "
513  << php.cellCoarseX_[k] << " Y " << php.cellCoarseY_[k];
514  }
515  } else {
516  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellFineX_.size() << " cells";
517  for (unsigned int k = 0; k < php.cellFineX_.size(); ++k) {
518  int id = indtypes[k];
519  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellFineIndex_[k] << " X "
520  << php.cellFineX_[k] << " Y " << php.cellFineY_[k];
521  }
522  }
523 #endif
524 }
Log< level::Info, true > LogVerbatim
wafer_map cellFineIndex_
uint16_t *__restrict__ id
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
T sqrt(T t)
Definition: SSEVec.h:19
#define N
Definition: blowfish.cc:9
std::unordered_map< int32_t, int32_t > wafer_map
wafer_map cellCoarseIndex_
std::vector< double > cellFineX_
std::vector< double > cellCoarseY_
std::vector< double > HGCalParametersFromDD::getDDDArray ( const char *  s,
const DDsvalues_type sv 
)
private

Definition at line 539 of file HGCalParametersFromDD.cc.

References DDfetch(), DDValue::doubles(), Exception, and hgcalPerformanceValidation::val.

539  {
540  DDValue val(s);
541  if (DDfetch(&sv, val)) {
542  const std::vector<double>& fvec = val.doubles();
543  if (fvec.empty()) {
544  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag.";
545  }
546  return fvec;
547  } else {
548  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag";
549  }
550 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
double HGCalParametersFromDD::getDDDValue ( const char *  s,
const DDsvalues_type sv 
)
private

Definition at line 526 of file HGCalParametersFromDD.cc.

References DDfetch(), DDValue::doubles(), Exception, and hgcalPerformanceValidation::val.

526  {
527  DDValue val(s);
528  if (DDfetch(&sv, val)) {
529  const std::vector<double>& fvec = val.doubles();
530  if (fvec.empty()) {
531  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag.";
532  }
533  return fvec[0];
534  } else {
535  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag";
536  }
537 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79

Member Data Documentation

constexpr double HGCalParametersFromDD::tan30deg_ = 0.5773502693
staticprivate

Definition at line 35 of file HGCalParametersFromDD.h.