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

Definition at line 14 of file HGCalParametersFromDD.h.

14 {}

◆ ~HGCalParametersFromDD()

virtual HGCalParametersFromDD::~HGCalParametersFromDD ( )
inlinevirtual

Definition at line 15 of file HGCalParametersFromDD.h.

15 {}

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_, 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, 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  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode ";
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  php.cassettes_ = 0; // default number of cassettes
93  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
95  attribute = "OnlyForHGCalNumbering";
96  value = namet;
97  DDValue val2(attribute, value, 0.0);
98  DDSpecificsMatchesValueFilter filter2{val2};
99  DDFilteredView fv2(*cpv, filter2);
100  bool ok2 = fv2.firstChild();
101  if (ok2) {
102  DDsvalues_type sv2(fv2.mergedSpecifics());
103  mode = getGeometryWaferMode("WaferMode", sv2);
104 #ifdef EDM_ML_DEBUG
105  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
107 #endif
108  }
109  php.minTileSize_ = 0;
110  php.waferMaskMode_ = 0;
111  php.waferZSide_ = 0;
112  }
116  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
117  php.levelZSide_ = static_cast<int>(getDDDValue("LevelZSide", sv));
118  php.nCellsFine_ = php.nCellsCoarse_ = 0;
119  php.firstLayer_ = 1;
120  php.firstMixedLayer_ = static_cast<int>(getDDDValue("FirstMixedLayer", sv));
121  php.detectorType_ = static_cast<int>(getDDDValue("DetectorType", sv));
122  php.minTileSize_ = 0;
123  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
124  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
126  php.layerRotation_ = getDDDValue("LayerRotation", sv);
129  php.cassettes_ = getDDDValue("Cassettes", sv);
130 #ifdef EDM_ML_DEBUG
131  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
132  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
133  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
134  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Layer Rotation "
135  << convertRadToDeg(php.layerRotation_) << " Cassettes " << php.cassettes_;
136 #endif
137  attribute = "OnlyForHGCalNumbering";
138  value = namet;
139  DDValue val2(attribute, value, 0.0);
140  DDSpecificsMatchesValueFilter filter2{val2};
141  DDFilteredView fv2(*cpv, filter2);
142  bool ok2 = fv2.firstChild();
143  if (ok2) {
144  DDsvalues_type sv2(fv2.mergedSpecifics());
145  mode = getGeometryWaferMode("WaferMode", sv2);
146  php.nCellsFine_ = static_cast<int>(getDDDValue("NumberOfCellsFine", sv2));
147  php.nCellsCoarse_ = static_cast<int>(getDDDValue("NumberOfCellsCoarse", sv2));
148  php.waferSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferSize", sv2);
149  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv2);
150  php.sensorSeparation_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("SensorSeparation", sv2);
151  php.mouseBite_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MouseBite", sv2);
153  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
154  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
155 #ifdef EDM_ML_DEBUG
156  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
157  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
158  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
159  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
160  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
161  << ":" << php.waferR_;
162 #endif
163  for (int k = 0; k < 2; ++k)
164  getCellPosition(php, k);
165  }
166  }
167  if (php.mode_ == HGCalGeometryMode::Hexagon) {
168  // Load the SpecPars
169  php.firstLayer_ = 1;
170  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
171  // Load the Geometry parameters
172  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
173  // Load cell parameters
174  geom->loadCellParsHexagon(cpv, php);
175  // Set complete fill mode
176  php.defineFull_ = false;
177  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
178  // Load the SpecPars
179  php.firstLayer_ = 1;
180  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
181  // Load the Geometry parameters
182  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
183  // Modify some constants
184  geom->loadWaferHexagon(php);
185  // Load cell parameters
186  geom->loadCellParsHexagon(cpv, php);
187  // Set complete fill mode
188  php.defineFull_ = true;
189  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
190  // Load the SpecPars
191  geom->loadSpecParsHexagon8(fv, php);
192  // Load Geometry parameters
193  geom->loadGeometryHexagon8(fv, php, 1);
194  // Set complete fill mode
195  php.defineFull_ = false;
196  // Load wafer positions
197  geom->loadWaferHexagon8(php);
199  // Load the SpecPars
200  geom->loadSpecParsHexagon8(fv, php);
201  // Load Geometry parameters
202  geom->loadGeometryHexagon8(fv, php, 1);
203  // Set complete fill mode
204  php.defineFull_ = true;
205  // Load wafer positions
206  geom->loadWaferHexagon8(php);
208  // Load the SpecPars
209  geom->loadSpecParsHexagon8(fv, php);
210  // Load Geometry parameters
211  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
212  // Set complete fill mode
213  php.defineFull_ = true;
214  // Load wafer positions
215  geom->loadWaferHexagon8(php);
219  // Load maximum eta & top level
220  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
221  php.firstLayer_ = (int)(getDDDValue("FirstLayer", sv));
222  php.firstMixedLayer_ = (int)(getDDDValue("FirstMixedLayer", sv));
223  php.detectorType_ = (int)(getDDDValue("DetectorType", sv));
224  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv);
225  php.minTileSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MinimumTileSize", sv);
226  php.waferSize_ = php.waferR_ = 0;
227  php.sensorSeparation_ = php.mouseBite_ = 0;
228  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
229  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
231  php.cassettes_ = getDDDValue("Cassettes", sv);
232 #ifdef EDM_ML_DEBUG
233  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
234  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
235  << php.detectorType_ << " thickenss " << php.waferThick_ << " Tile Mask Mode "
236  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Cassettes "
237  << php.cassettes_;
238 #endif
239  // Load the SpecPars
240  geom->loadSpecParsTrapezoid(fv, php);
241  // Load Geometry parameters
242  geom->loadGeometryHexagon8(fv, php, php.firstLayer_);
243  // Load cell positions
244  geom->loadCellTrapezoid(php);
245  } else {
246  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
247  << ":" << namec;
248  throw cms::Exception("DDException")
249  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
250  }
251  } else {
252  edm::LogError("HGCalGeom") << " Attribute " << val << " not found but needed.";
253  throw cms::Exception("DDException") << "Attribute " << val << " not found but needed.";
254  }
255 #ifdef EDM_ML_DEBUG
256  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
257  << " with flag " << ok;
258 #endif
259  return ok;
260 }
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 262 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, cms::DDDetector::vectors(), HGCalParameters::waferMaskMode_, HGCalParameters::waferR_, HGCalParameters::waferSize_, HGCalParameters::waferThick_, and HGCalParameters::waferZSide_.

268  {
269 #ifdef EDM_ML_DEBUG
270  edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD (DD4hep)::build called with "
271  << "names " << name << ":" << namew << ":" << namec << ":" << namet << ":" << name2;
272 #endif
273  cms::DDVectorsMap vmap = cpv->detector()->vectors();
274  const cms::DDFilter filter("Volume", name);
275  cms::DDFilteredView fv((*cpv), filter);
276  std::vector<std::string> tempS;
277  std::vector<double> tempD;
278  bool ok = fv.firstChild();
279  tempS = fv.get<std::vector<std::string> >(name2, "GeometryMode");
280  if (tempS.empty()) {
281  tempS = fv.get<std::vector<std::string> >(name, "GeometryMode");
282  }
283  std::string sv = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Hexagon8Full";
285 
286  if (ok) {
287  php.mode_ = getGeometryMode(sv);
288 #ifdef EDM_ML_DEBUG
289  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode " << php.mode_ << ":"
296 #endif
297  php.levelZSide_ = 3; // Default level for ZSide
298  php.detectorType_ = 0; // These two parameters are
299  php.firstMixedLayer_ = -1; // defined for post TDR geometry
300  php.layerRotation_ = 0; // default layer rotation angle
301  php.cassettes_ = 0; // default number of cassettes
302  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
304  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
305  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Polyhedra";
306  mode = getGeometryWaferMode(sv2);
307 #ifdef EDM_ML_DEBUG
308  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
310 #endif
311  php.minTileSize_ = 0;
312  php.waferMaskMode_ = 0;
313  php.waferZSide_ = 0;
314  }
318  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
319  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
320  php.levelZSide_ = static_cast<int>(tempD[0]);
321  php.nCellsFine_ = php.nCellsCoarse_ = 0;
322  php.firstLayer_ = 1;
323  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
324  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
325  tempD = fv.get<std::vector<double> >(name, "DetectorType");
326  php.detectorType_ = static_cast<int>(tempD[0]);
327  php.minTileSize_ = 0;
328  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
329  php.waferMaskMode_ = static_cast<int>(tempD[0]);
330  tempD = fv.get<std::vector<double> >(name, "WaferZside");
331  php.waferZSide_ = static_cast<int>(tempD[0]);
333  tempD = fv.get<std::vector<double> >(name, "LayerRotation");
334  php.layerRotation_ = tempD[0];
335  }
338  tempD = fv.get<std::vector<double> >(name, "Cassettes");
339  php.cassettes_ = static_cast<int>(tempD[0]);
340  }
341 #ifdef EDM_ML_DEBUG
342  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
343  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
344  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
345  << php.waferMaskMode_ << " ZSide " << php.waferZSide_ << " Layer Rotation "
346  << convertRadToDeg(php.layerRotation_) << " Cassettes " << php.cassettes_;
347 #endif
348 
349  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
350  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::ExtrudedPolygon";
351  mode = getGeometryWaferMode(sv2);
352  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsFine");
353  php.nCellsFine_ = static_cast<int>(tempD[0]);
354  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsCoarse");
355  php.nCellsCoarse_ = static_cast<int>(tempD[0]);
356  tempD = fv.get<std::vector<double> >(namet, "WaferSize");
358  tempD = fv.get<std::vector<double> >(namet, "WaferThickness");
360  tempD = fv.get<std::vector<double> >(namet, "SensorSeparation");
362  tempD = fv.get<std::vector<double> >(namet, "MouseBite");
365  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
366  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
367 #ifdef EDM_ML_DEBUG
368  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
369  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
370  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
371  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
372  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
373  << ":" << php.waferR_;
374 #endif
375  for (int k = 0; k < 2; ++k)
376  getCellPosition(php, k);
377  }
378  if (php.mode_ == HGCalGeometryMode::Hexagon) {
379  // Load the SpecPars
380  php.firstLayer_ = 1;
381  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
382  // Load the Geometry parameters
383  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
384  // Load cell parameters
385  geom->loadCellParsHexagon(vmap, php);
386  // Set complete fill mode
387  php.defineFull_ = false;
388  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
389  // Load the SpecPars
390  php.firstLayer_ = 1;
391  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
392  // Load the Geometry parameters
393  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
394  // Modify some constants
395  geom->loadWaferHexagon(php);
396  // Load cell parameters
397  geom->loadCellParsHexagon(vmap, php);
398  // Set complete fill mode
399  php.defineFull_ = true;
400  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
401  // Load the SpecPars
402  geom->loadSpecParsHexagon8(fv, vmap, php, name);
403  // Load Geometry parameters
404  geom->loadGeometryHexagon8(cpv, php, name, 1);
405  // Set complete fill mode
406  php.defineFull_ = false;
407  // Load wafer positions
408  geom->loadWaferHexagon8(php);
410  // Load the SpecPars
411  geom->loadSpecParsHexagon8(fv, vmap, php, name);
412  // Load Geometry parameters
413  geom->loadGeometryHexagon8(cpv, php, name, 1);
414  // Set complete fill mode
415  php.defineFull_ = true;
416  // Load wafer positions
417  geom->loadWaferHexagon8(php);
419  // Load the SpecPars
420  geom->loadSpecParsHexagon8(fv, vmap, php, name);
421  // Load Geometry parameters
422  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
423  // Set complete fill mode
424  php.defineFull_ = true;
425  // Load wafer positions
426  geom->loadWaferHexagon8(php);
430  // Load maximum eta & top level
431  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
432  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
433  php.levelZSide_ = static_cast<int>(tempD[0]);
434  php.nCellsFine_ = php.nCellsCoarse_ = 0;
435  tempD = fv.get<std::vector<double> >(name, "FirstLayer");
436  php.firstLayer_ = static_cast<int>(tempD[0]);
437  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
438  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
439  tempD = fv.get<std::vector<double> >(name, "DetectorType");
440  php.detectorType_ = static_cast<int>(tempD[0]);
441  tempD = fv.get<std::vector<double> >(name, "WaferThickness");
443  tempD = fv.get<std::vector<double> >(name, "MinimumTileSize");
445  php.waferSize_ = php.waferR_ = 0;
446  php.sensorSeparation_ = php.mouseBite_ = 0;
447  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
448  php.waferMaskMode_ = static_cast<int>(tempD[0]);
449  tempD = fv.get<std::vector<double> >(name, "WaferZside");
450  php.waferZSide_ = static_cast<int>(tempD[0]);
452  tempD = fv.get<std::vector<double> >(name, "Cassettes");
453  php.cassettes_ = static_cast<int>(tempD[0]);
454  }
455 #ifdef EDM_ML_DEBUG
456  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
457  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
458  << php.detectorType_ << " thickenss " << php.waferThick_ << " min tile size "
459  << php.minTileSize_ << " Tile Mask Mode " << php.waferMaskMode_ << " ZSide "
460  << php.waferZSide_ << " Cassettes " << php.cassettes_;
461 #endif
462  // Load the SpecPars
463  geom->loadSpecParsTrapezoid(fv, vmap, php, name);
464  // Load Geometry parameters
465  geom->loadGeometryHexagon8(cpv, php, name, php.firstLayer_);
466  // Load cell positions
467  geom->loadCellTrapezoid(php);
468  } else {
469  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
470  << ":" << namec;
471  throw cms::Exception("DDException")
472  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
473  }
474  } else {
475  edm::LogError("HGCalGeom") << " Attribute Volume:" << name << " not found but needed.";
476  throw cms::Exception("DDException") << "Attribute Volume:" << name << " not found but needed.";
477  }
478 #ifdef EDM_ML_DEBUG
479  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
480  << " with flag " << ok;
481 #endif
482  return ok;
483 }
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 485 of file HGCalParametersFromDD.cc.

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

485  {
486  if (type == 1) {
487  php.cellCoarseX_.clear();
488  php.cellCoarseY_.clear();
489  } else {
490  php.cellFineX_.clear();
491  php.cellFineY_.clear();
492  }
493  HGCalParameters::wafer_map cellIndex;
494 #ifdef EDM_ML_DEBUG
495  std::vector<int> indtypes;
496 #endif
497  int N = (type == 1) ? php.nCellsCoarse_ : php.nCellsFine_;
498  double R = php.waferSize_ / (3 * N);
499  double r = 0.5 * R * sqrt(3.0);
500  int n2 = N / 2;
501  int ipos(0);
502  for (int u = 0; u < 2 * N; ++u) {
503  for (int v = 0; v < 2 * N; ++v) {
504  if (((v - u) < N) && (u - v) <= N) {
505  double yp = (u - 0.5 * v - n2) * 2 * r;
506  double xp = (1.5 * (v - N) + 1.0) * R;
507  int id = v * 100 + u;
508 #ifdef EDM_ML_DEBUG
509  indtypes.emplace_back(id);
510 #endif
511  if (type == 1) {
512  php.cellCoarseX_.emplace_back(xp);
513  php.cellCoarseY_.emplace_back(yp);
514  } else {
515  php.cellFineX_.emplace_back(xp);
516  php.cellFineY_.emplace_back(yp);
517  }
518  cellIndex[id] = ipos;
519  ++ipos;
520  }
521  }
522  }
523  if (type == 1)
524  php.cellCoarseIndex_ = cellIndex;
525  else
526  php.cellFineIndex_ = cellIndex;
527 
528 #ifdef EDM_ML_DEBUG
529  if (type == 1) {
530  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellCoarseX_.size()
531  << " cells";
532  for (unsigned int k = 0; k < php.cellCoarseX_.size(); ++k) {
533  int id = indtypes[k];
534  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellCoarseIndex_[id] << " X "
535  << php.cellCoarseX_[k] << " Y " << php.cellCoarseY_[k];
536  }
537  } else {
538  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellFineX_.size() << " cells";
539  for (unsigned int k = 0; k < php.cellFineX_.size(); ++k) {
540  int id = indtypes[k];
541  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellFineIndex_[k] << " X "
542  << php.cellFineX_[k] << " Y " << php.cellFineY_[k];
543  }
544  }
545 #endif
546 }
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 561 of file HGCalParametersFromDD.cc.

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

561  {
562  DDValue val(s);
563  if (DDfetch(&sv, val)) {
564  const std::vector<double>& fvec = val.doubles();
565  if (fvec.empty()) {
566  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag.";
567  }
568  return fvec;
569  } else {
570  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag";
571  }
572 }
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 548 of file HGCalParametersFromDD.cc.

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

548  {
549  DDValue val(s);
550  if (DDfetch(&sv, val)) {
551  const std::vector<double>& fvec = val.doubles();
552  if (fvec.empty()) {
553  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag.";
554  }
555  return fvec[0];
556  } else {
557  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag";
558  }
559 }
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.