CMS 3D CMS Logo

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 ()=default
 
virtual ~HGCalParametersFromDD ()=default
 

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::HGCalParametersFromDD ( )
default

◆ ~HGCalParametersFromDD()

virtual HGCalParametersFromDD::~HGCalParametersFromDD ( )
virtualdefault

Member Function Documentation

◆ build() [1/2]

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::cassettes_, HGCalParameters::cellSize_, angle_units::operators::convertRadToDeg(), dbl_to_int(), HGCalParameters::defineFull_, HGCalParameters::detectorType_, Exception, HGCalGeometryMode::ExtrudedPolygon, ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), HGCalParameters::firstLayer_, HGCalParameters::firstMixedLayer_, relativeConstraints::geom, HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Cassette, HGCalGeometryMode::Hexagon8File, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::Hexagon8Module, HGCalGeometryMode::HexagonFull, createfilelist::int, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, HGCalParameters::layerRotation_, HGCalParameters::levelT_, HGCalParameters::levelZSide_, DDFilteredView::mergedSpecifics(), HGCalParameters::minTileSize_, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, HGCalParameters::mode_, HGCalParameters::mouseBite_, Skims_PA_cff::name, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::nphiCassette_, convertSQLiteXML::ok, HGCalParameters::phiOffset_, HGCalGeometryMode::Polyhedra, HGCalGeomParameters::scintillatorCassette, HGCalParameters::sensorSeparation_, HGCalGeomParameters::siliconCassetteEE, HGCalGeomParameters::siliconCassetteHE, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalGeometryMode::Trapezoid, HGCalGeometryMode::TrapezoidCassette, HGCalGeometryMode::TrapezoidFile, HGCalGeometryMode::TrapezoidModule, HGCalParameters::useSimWt_, heppy_batch::val, 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 #ifdef EDM_ML_DEBUG
77  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode ";
78 #endif
79  if (ok) {
80  DDsvalues_type sv(fv.mergedSpecifics());
81  php.mode_ = getGeometryMode("GeometryMode", sv);
82 #ifdef EDM_ML_DEBUG
83  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode " << php.mode_ << ":"
89 #endif
90  php.levelZSide_ = 3; // Default level for ZSide
91  php.detectorType_ = 0; // These two parameters are
92  php.firstMixedLayer_ = -1; // defined for post TDR geometry
93  php.useSimWt_ = 1; // energy weighting for SimHits
94  php.layerRotation_ = 0; // default layer rotation angle
95  php.cassettes_ = 0; // default number of cassettes
96  php.nphiCassette_ = 0; // default number of phi's per cassette
97  php.phiOffset_ = 0; // default value of phi offset for cassette
98  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
100  attribute = "OnlyForHGCalNumbering";
101  value = namet;
102  DDValue val2(attribute, value, 0.0);
103  DDSpecificsMatchesValueFilter filter2{val2};
104  DDFilteredView fv2(*cpv, filter2);
105  bool ok2 = fv2.firstChild();
106  if (ok2) {
107  DDsvalues_type sv2(fv2.mergedSpecifics());
108  mode = getGeometryWaferMode("WaferMode", sv2);
109 #ifdef EDM_ML_DEBUG
110  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
112 #endif
113  }
114  php.minTileSize_ = 0;
115  php.waferMaskMode_ = 0;
116  php.waferZSide_ = 0;
117  }
121  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
122  php.levelZSide_ = static_cast<int>(getDDDValue("LevelZSide", sv));
123  php.nCellsFine_ = php.nCellsCoarse_ = 0;
124  php.firstLayer_ = 1;
125  php.firstMixedLayer_ = static_cast<int>(getDDDValue("FirstMixedLayer", sv));
126  php.detectorType_ = static_cast<int>(getDDDValue("DetectorType", sv));
127  php.minTileSize_ = 0;
128  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
129  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
131  php.useSimWt_ = static_cast<int>(getDDDValue("UseSimWt", sv));
132  php.layerRotation_ = getDDDValue("LayerRotation", sv);
133  }
136  php.cassettes_ = getDDDValue("Cassettes", sv);
137 #ifdef EDM_ML_DEBUG
138  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
139  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
140  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
141  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Layer Rotation "
142  << convertRadToDeg(php.layerRotation_) << " Cassettes " << php.cassettes_
143  << " UseSimWt " << php.useSimWt_;
144 #endif
145  attribute = "OnlyForHGCalNumbering";
146  value = namet;
147  DDValue val2(attribute, value, 0.0);
148  DDSpecificsMatchesValueFilter filter2{val2};
149  DDFilteredView fv2(*cpv, filter2);
150  bool ok2 = fv2.firstChild();
151  if (ok2) {
152  DDsvalues_type sv2(fv2.mergedSpecifics());
153  mode = getGeometryWaferMode("WaferMode", sv2);
154  php.nCellsFine_ = static_cast<int>(getDDDValue("NumberOfCellsFine", sv2));
155  php.nCellsCoarse_ = static_cast<int>(getDDDValue("NumberOfCellsCoarse", sv2));
156  php.waferSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferSize", sv2);
157  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv2);
158  php.sensorSeparation_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("SensorSeparation", sv2);
159  php.mouseBite_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MouseBite", sv2);
161  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
162  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
163 #ifdef EDM_ML_DEBUG
164  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
165  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
166  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
167  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
168  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
169  << ":" << php.waferR_;
170 #endif
171  for (int k = 0; k < 2; ++k)
172  getCellPosition(php, k);
173  }
174  }
175  if (php.mode_ == HGCalGeometryMode::Hexagon) {
176  // Load the SpecPars
177  php.firstLayer_ = 1;
178  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
179  // Load the Geometry parameters
180  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
181  // Load cell parameters
182  geom->loadCellParsHexagon(cpv, php);
183  // Set complete fill mode
184  php.defineFull_ = false;
185  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
186  // Load the SpecPars
187  php.firstLayer_ = 1;
188  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
189  // Load the Geometry parameters
190  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
191  // Modify some constants
192  geom->loadWaferHexagon(php);
193  // Load cell parameters
194  geom->loadCellParsHexagon(cpv, php);
195  // Set complete fill mode
196  php.defineFull_ = true;
197  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
198  // Load the SpecPars
199  geom->loadSpecParsHexagon8(fv, php);
200  // Load Geometry parameters
201  geom->loadGeometryHexagon8(fv, php, 1);
202  // Set complete fill mode
203  php.defineFull_ = false;
204  // Load wafer positions
205  geom->loadWaferHexagon8(php);
207  // Load the SpecPars
208  geom->loadSpecParsHexagon8(fv, php);
209  // Load Geometry parameters
210  geom->loadGeometryHexagon8(fv, php, 1);
211  // Set complete fill mode
212  php.defineFull_ = true;
213  // Load wafer positions
214  geom->loadWaferHexagon8(php);
216  // Load the SpecPars
217  geom->loadSpecParsHexagon8(fv, php);
218  // Load Geometry parameters
219  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
220  // Set complete fill mode
221  php.defineFull_ = true;
222  // Load wafer positions
223  geom->loadWaferHexagon8(php);
227  // Load maximum eta & top level
228  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
229  php.firstLayer_ = (int)(getDDDValue("FirstLayer", sv));
230  php.firstMixedLayer_ = (int)(getDDDValue("FirstMixedLayer", sv));
231  php.detectorType_ = (int)(getDDDValue("DetectorType", sv));
232  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv);
233  php.minTileSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MinimumTileSize", sv);
234  php.waferSize_ = php.waferR_ = 0;
235  php.sensorSeparation_ = php.mouseBite_ = 0;
236  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
237  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
239  php.useSimWt_ = static_cast<int>(getDDDValue("UseSimWt", sv));
241  php.cassettes_ = getDDDValue("Cassettes", sv);
242 #ifdef EDM_ML_DEBUG
243  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
244  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
245  << php.detectorType_ << " thickenss " << php.waferThick_ << " Tile Mask Mode "
246  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Cassettes "
247  << php.cassettes_ << " UseSimWt " << php.useSimWt_;
248 #endif
249  // Load the SpecPars
250  geom->loadSpecParsTrapezoid(fv, php);
251  // Load Geometry parameters
252  geom->loadGeometryHexagon8(fv, php, php.firstLayer_);
253  // Load cell positions
254  geom->loadCellTrapezoid(php);
255  } else {
256  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
257  << ":" << namec;
258  throw cms::Exception("DDException")
259  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
260  }
261  } else {
262  edm::LogError("HGCalGeom") << " Attribute " << val << " not found but needed.";
263  throw cms::Exception("DDException") << "Attribute " << val << " not found but needed.";
264  }
265 #ifdef EDM_ML_DEBUG
266  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
267  << " with flag " << ok;
268 #endif
269  return ok;
270 }
Log< level::Info, true > LogVerbatim
static constexpr int scintillatorCassette
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Log< level::Error, false > LogError
HGCalGeometryMode::GeometryMode mode_
static constexpr int siliconCassetteHE
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > cellSize_
static constexpr int siliconCassetteEE
Definition: value.py:1
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)

◆ build() [2/2]

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 272 of file HGCalParametersFromDD.cc.

References HGCalParameters::cassettes_, HGCalParameters::cellSize_, angle_units::operators::convertRadToDeg(), dbl_to_int(), HGCalParameters::defineFull_, cms::DDCompactView::detector(), HGCalParameters::detectorType_, Exception, HGCalGeometryMode::ExtrudedPolygon, ALCARECOTkAlBeamHalo_cff::filter, cms::DDFilteredView::firstChild(), HGCalParameters::firstLayer_, HGCalParameters::firstMixedLayer_, relativeConstraints::geom, cms::DDFilteredView::get(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Cassette, HGCalGeometryMode::Hexagon8File, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::Hexagon8Module, HGCalGeometryMode::HexagonFull, dqmdumpme::k, HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::k_ScaleToDDD, HGCalParameters::layerRotation_, HGCalParameters::levelT_, HGCalParameters::levelZSide_, HGCalParameters::minTileSize_, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, HGCalParameters::mode_, HGCalParameters::mouseBite_, Skims_PA_cff::name, hfnoseParametersInitialization_cfi::name2, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, convertSQLiteXML::ok, HGCalGeometryMode::Polyhedra, HGCalGeomParameters::scintillatorCassette, HGCalParameters::sensorSeparation_, HGCalGeomParameters::siliconCassetteEE, HGCalGeomParameters::siliconCassetteHE, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalGeometryMode::Trapezoid, HGCalGeometryMode::TrapezoidCassette, HGCalGeometryMode::TrapezoidFile, HGCalGeometryMode::TrapezoidModule, HGCalParameters::useSimWt_, cms::DDDetector::vectors(), HGCalParameters::waferMaskMode_, HGCalParameters::waferR_, HGCalParameters::waferSize_, HGCalParameters::waferThick_, and HGCalParameters::waferZSide_.

278  {
279 #ifdef EDM_ML_DEBUG
280  edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD (DD4hep)::build called with "
281  << "names " << name << ":" << namew << ":" << namec << ":" << namet << ":" << name2;
282 #endif
283  cms::DDVectorsMap vmap = cpv->detector()->vectors();
284  const cms::DDFilter filter("Volume", name);
285  cms::DDFilteredView fv((*cpv), filter);
286  std::vector<std::string> tempS;
287  std::vector<double> tempD;
288  bool ok = fv.firstChild();
289  tempS = fv.get<std::vector<std::string> >(name2, "GeometryMode");
290  if (tempS.empty()) {
291  tempS = fv.get<std::vector<std::string> >(name, "GeometryMode");
292  }
293  std::string sv = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Hexagon8Full";
295 #ifdef EDM_ML_DEBUG
296  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode ";
297 #endif
298 
299  if (ok) {
300  php.mode_ = getGeometryMode(sv);
301 #ifdef EDM_ML_DEBUG
302  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode " << php.mode_ << ":"
309 #endif
310  php.levelZSide_ = 3; // Default level for ZSide
311  php.detectorType_ = 0; // These two parameters are
312  php.firstMixedLayer_ = -1; // defined for post TDR geometry
313  php.useSimWt_ = 1; // energy weighting for SimHits
314  php.layerRotation_ = 0; // default layer rotation angle
315  php.cassettes_ = 0; // default number of cassettes
316  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
318  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
319  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Polyhedra";
320  mode = getGeometryWaferMode(sv2);
321 #ifdef EDM_ML_DEBUG
322  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
324 #endif
325  php.minTileSize_ = 0;
326  php.waferMaskMode_ = 0;
327  php.waferZSide_ = 0;
328  }
332  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
333  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
334  php.levelZSide_ = static_cast<int>(tempD[0]);
335  php.nCellsFine_ = php.nCellsCoarse_ = 0;
336  php.firstLayer_ = 1;
337  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
338  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
339  tempD = fv.get<std::vector<double> >(name, "DetectorType");
340  php.detectorType_ = static_cast<int>(tempD[0]);
341  php.minTileSize_ = 0;
342  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
343  php.waferMaskMode_ = static_cast<int>(tempD[0]);
344  tempD = fv.get<std::vector<double> >(name, "WaferZside");
345  php.waferZSide_ = static_cast<int>(tempD[0]);
347  tempD = fv.get<std::vector<double> >(name, "LayerRotation");
348  php.layerRotation_ = tempD[0];
349  tempD = fv.get<std::vector<double> >(name, "UseSimWt");
350  php.useSimWt_ = tempD[0];
351  }
354  tempD = fv.get<std::vector<double> >(name, "Cassettes");
355  php.cassettes_ = static_cast<int>(tempD[0]);
356  }
357 #ifdef EDM_ML_DEBUG
358  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
359  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
360  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
361  << php.waferMaskMode_ << " ZSide " << php.waferZSide_ << " Layer Rotation "
362  << convertRadToDeg(php.layerRotation_) << " Cassettes " << php.cassettes_
363  << " UseSimWt " << php.useSimWt_;
364 #endif
365 
366  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
367  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::ExtrudedPolygon";
368  mode = getGeometryWaferMode(sv2);
369  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsFine");
370  php.nCellsFine_ = static_cast<int>(tempD[0]);
371  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsCoarse");
372  php.nCellsCoarse_ = static_cast<int>(tempD[0]);
373  tempD = fv.get<std::vector<double> >(namet, "WaferSize");
375  tempD = fv.get<std::vector<double> >(namet, "WaferThickness");
377  tempD = fv.get<std::vector<double> >(namet, "SensorSeparation");
379  tempD = fv.get<std::vector<double> >(namet, "MouseBite");
382  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
383  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
384 #ifdef EDM_ML_DEBUG
385  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
386  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
387  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
388  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
389  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
390  << ":" << php.waferR_;
391 #endif
392  for (int k = 0; k < 2; ++k)
393  getCellPosition(php, k);
394  }
395  if (php.mode_ == HGCalGeometryMode::Hexagon) {
396  // Load the SpecPars
397  php.firstLayer_ = 1;
398  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
399  // Load the Geometry parameters
400  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
401  // Load cell parameters
402  geom->loadCellParsHexagon(vmap, php);
403  // Set complete fill mode
404  php.defineFull_ = false;
405  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
406  // Load the SpecPars
407  php.firstLayer_ = 1;
408  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
409  // Load the Geometry parameters
410  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
411  // Modify some constants
412  geom->loadWaferHexagon(php);
413  // Load cell parameters
414  geom->loadCellParsHexagon(vmap, php);
415  // Set complete fill mode
416  php.defineFull_ = true;
417  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
418  // Load the SpecPars
419  geom->loadSpecParsHexagon8(fv, vmap, php, name);
420  // Load Geometry parameters
421  geom->loadGeometryHexagon8(cpv, php, name, 1);
422  // Set complete fill mode
423  php.defineFull_ = false;
424  // Load wafer positions
425  geom->loadWaferHexagon8(php);
427  // Load the SpecPars
428  geom->loadSpecParsHexagon8(fv, vmap, php, name);
429  // Load Geometry parameters
430  geom->loadGeometryHexagon8(cpv, php, name, 1);
431  // Set complete fill mode
432  php.defineFull_ = true;
433  // Load wafer positions
434  geom->loadWaferHexagon8(php);
436  // Load the SpecPars
437  geom->loadSpecParsHexagon8(fv, vmap, php, name);
438  // Load Geometry parameters
439  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
440  // Set complete fill mode
441  php.defineFull_ = true;
442  // Load wafer positions
443  geom->loadWaferHexagon8(php);
447  // Load maximum eta & top level
448  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
449  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
450  php.levelZSide_ = static_cast<int>(tempD[0]);
451  php.nCellsFine_ = php.nCellsCoarse_ = 0;
452  tempD = fv.get<std::vector<double> >(name, "FirstLayer");
453  php.firstLayer_ = static_cast<int>(tempD[0]);
454  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
455  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
456  tempD = fv.get<std::vector<double> >(name, "DetectorType");
457  php.detectorType_ = static_cast<int>(tempD[0]);
458  tempD = fv.get<std::vector<double> >(name, "WaferThickness");
460  tempD = fv.get<std::vector<double> >(name, "MinimumTileSize");
462  php.waferSize_ = php.waferR_ = 0;
463  php.sensorSeparation_ = php.mouseBite_ = 0;
464  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
465  php.waferMaskMode_ = static_cast<int>(tempD[0]);
466  tempD = fv.get<std::vector<double> >(name, "WaferZside");
467  php.waferZSide_ = static_cast<int>(tempD[0]);
469  tempD = fv.get<std::vector<double> >(name, "UseSimWt");
470  php.useSimWt_ = tempD[0];
471  }
473  tempD = fv.get<std::vector<double> >(name, "Cassettes");
474  php.cassettes_ = static_cast<int>(tempD[0]);
475  }
476 #ifdef EDM_ML_DEBUG
477  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
478  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
479  << php.detectorType_ << " thickenss " << php.waferThick_ << " min tile size "
480  << php.minTileSize_ << " Tile Mask Mode " << php.waferMaskMode_ << " ZSide "
481  << php.waferZSide_ << " Cassettes " << php.cassettes_ << " UseSimWt "
482  << php.useSimWt_;
483 #endif
484  // Load the SpecPars
485  geom->loadSpecParsTrapezoid(fv, vmap, php, name);
486  // Load Geometry parameters
487  geom->loadGeometryHexagon8(cpv, php, name, php.firstLayer_);
488  // Load cell positions
489  geom->loadCellTrapezoid(php);
490  } else {
491  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
492  << ":" << namec;
493  throw cms::Exception("DDException")
494  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
495  }
496  } else {
497  edm::LogError("HGCalGeom") << " Attribute Volume:" << name << " not found but needed.";
498  throw cms::Exception("DDException") << "Attribute Volume:" << name << " not found but needed.";
499  }
500 #ifdef EDM_ML_DEBUG
501  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
502  << " with flag " << ok;
503 #endif
504  return ok;
505 }
Log< level::Info, true > LogVerbatim
static constexpr int scintillatorCassette
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34
Log< level::Error, false > LogError
HGCalGeometryMode::GeometryMode mode_
std::unordered_map< std::string, std::vector< double > > DDVectorsMap
Definition: DDNamespace.h:20
static constexpr int siliconCassetteHE
std::vector< double > cellSize_
static constexpr int siliconCassetteEE
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_
cms::DDVectorsMap const & vectors() const
Definition: DDDetector.h:17
static constexpr double tan30deg_
void getCellPosition(HGCalParameters &php, int type)

◆ getCellPosition()

void HGCalParametersFromDD::getCellPosition ( HGCalParameters php,
int  type 
)
private

Definition at line 507 of file HGCalParametersFromDD.cc.

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

507  {
508  if (type == 1) {
509  php.cellCoarseX_.clear();
510  php.cellCoarseY_.clear();
511  } else {
512  php.cellFineX_.clear();
513  php.cellFineY_.clear();
514  }
515  HGCalParameters::wafer_map cellIndex;
516 #ifdef EDM_ML_DEBUG
517  std::vector<int> indtypes;
518 #endif
519  int N = (type == 1) ? php.nCellsCoarse_ : php.nCellsFine_;
520  double R = php.waferSize_ / (3 * N);
521  double r = 0.5 * R * sqrt(3.0);
522  int n2 = N / 2;
523  int ipos(0);
524  for (int u = 0; u < 2 * N; ++u) {
525  for (int v = 0; v < 2 * N; ++v) {
526  if (((v - u) < N) && (u - v) <= N) {
527  double yp = (u - 0.5 * v - n2) * 2 * r;
528  double xp = (1.5 * (v - N) + 1.0) * R;
529  int id = v * 100 + u;
530 #ifdef EDM_ML_DEBUG
531  indtypes.emplace_back(id);
532 #endif
533  if (type == 1) {
534  php.cellCoarseX_.emplace_back(xp);
535  php.cellCoarseY_.emplace_back(yp);
536  } else {
537  php.cellFineX_.emplace_back(xp);
538  php.cellFineY_.emplace_back(yp);
539  }
540  cellIndex[id] = ipos;
541  ++ipos;
542  }
543  }
544  }
545  if (type == 1)
546  php.cellCoarseIndex_ = cellIndex;
547  else
548  php.cellFineIndex_ = cellIndex;
549 
550 #ifdef EDM_ML_DEBUG
551  if (type == 1) {
552  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellCoarseX_.size()
553  << " cells";
554  for (unsigned int k = 0; k < php.cellCoarseX_.size(); ++k) {
555  int id = indtypes[k];
556  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellCoarseIndex_[id] << " X "
557  << php.cellCoarseX_[k] << " Y " << php.cellCoarseY_[k];
558  }
559  } else {
560  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellFineX_.size() << " cells";
561  for (unsigned int k = 0; k < php.cellFineX_.size(); ++k) {
562  int id = indtypes[k];
563  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellFineIndex_[k] << " X "
564  << php.cellFineX_[k] << " Y " << php.cellFineY_[k];
565  }
566  }
567 #endif
568 }
Log< level::Info, true > LogVerbatim
wafer_map cellFineIndex_
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_

◆ getDDDArray()

std::vector< double > HGCalParametersFromDD::getDDDArray ( const char *  s,
const DDsvalues_type sv 
)
private

Definition at line 583 of file HGCalParametersFromDD.cc.

References DDfetch(), Exception, alignCSCRings::s, pfDeepBoostedJetPreprocessParams_cfi::sv, and heppy_batch::val.

583  {
584  DDValue val(s);
585  if (DDfetch(&sv, val)) {
586  const std::vector<double>& fvec = val.doubles();
587  if (fvec.empty()) {
588  throw cms::Exception("HGCalGeom") << "getDDDArray::Failed to get " << s << " tag.";
589  }
590  return fvec;
591  } else {
592  throw cms::Exception("HGCalGeom") << "getDDDArray:Failed to fetch " << s << " tag";
593  }
594 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79

◆ getDDDValue()

double HGCalParametersFromDD::getDDDValue ( const char *  s,
const DDsvalues_type sv 
)
private

Definition at line 570 of file HGCalParametersFromDD.cc.

References DDfetch(), Exception, alignCSCRings::s, pfDeepBoostedJetPreprocessParams_cfi::sv, and heppy_batch::val.

570  {
571  DDValue val(s);
572  if (DDfetch(&sv, val)) {
573  const std::vector<double>& fvec = val.doubles();
574  if (fvec.empty()) {
575  throw cms::Exception("HGCalGeom") << "getDDDValue::Failed to get " << s << " tag.";
576  }
577  return fvec[0];
578  } else {
579  throw cms::Exception("HGCalGeom") << "getDDDValue::Failed to fetch " << s << " tag";
580  }
581 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79

Member Data Documentation

◆ tan30deg_

constexpr double HGCalParametersFromDD::tan30deg_ = 0.5773502693
staticprivate

Definition at line 35 of file HGCalParametersFromDD.h.