CMS 3D CMS Logo

HGCalParametersFromDD.cc
Go to the documentation of this file.
2 
10 
11 //#define EDM_ML_DEBUG
12 using namespace geant_units::operators;
13 
15  HGCalParameters& php,
16  const std::string& name,
17  const std::string& namew,
18  const std::string& namec,
19  const std::string& namet) {
20 #ifdef EDM_ML_DEBUG
21  edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD (DDD)::build called with "
22  << "names " << name << ":" << namew << ":" << namec << ":" << namet;
23 #endif
24 
25  // Special parameters at simulation level
26  std::string attribute = "Volume";
28  DDValue val(attribute, value, 0.0);
30  DDFilteredView fv(*cpv, filter);
31  bool ok = fv.firstChild();
33 #ifdef EDM_ML_DEBUG
34  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode ";
35 #endif
36  if (ok) {
38  php.mode_ = HGCalGeometryMode::getGeometryMode("GeometryMode", sv);
39 #ifdef EDM_ML_DEBUG
40  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode " << php.mode_ << ":"
46 #endif
47  php.levelZSide_ = 3; // Default level for ZSide
48  php.detectorType_ = 0; // These two parameters are
49  php.firstMixedLayer_ = -1; // defined for post TDR geometry
50  php.useSimWt_ = 1; // energy weighting for SimHits
51  php.layerRotation_ = 0; // default layer rotation angle
52  php.cassettes_ = 0; // default number of cassettes
53  php.nphiCassette_ = 0; // default number of phi's per cassette
54  php.phiOffset_ = 0; // default value of phi offset for cassette
55  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
57  attribute = "OnlyForHGCalNumbering";
58  value = namet;
59  DDValue val2(attribute, value, 0.0);
60  DDSpecificsMatchesValueFilter filter2{val2};
61  DDFilteredView fv2(*cpv, filter2);
62  bool ok2 = fv2.firstChild();
63  if (ok2) {
66 #ifdef EDM_ML_DEBUG
67  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
69 #endif
70  }
71  php.minTileSize_ = 0;
72  php.waferMaskMode_ = 0;
73  php.waferZSide_ = 0;
74  }
78  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
79  php.levelZSide_ = static_cast<int>(getDDDValue("LevelZSide", sv));
80  php.nCellsFine_ = php.nCellsCoarse_ = 0;
81  php.firstLayer_ = 1;
82  php.firstMixedLayer_ = static_cast<int>(getDDDValue("FirstMixedLayer", sv));
83  php.detectorType_ = static_cast<int>(getDDDValue("DetectorType", sv));
84  php.minTileSize_ = 0;
85  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
86  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
88  php.useSimWt_ = static_cast<int>(getDDDValue("UseSimWt", sv));
89  php.layerRotation_ = getDDDValue("LayerRotation", sv);
90  }
93  php.cassettes_ = getDDDValue("Cassettes", sv);
94 #ifdef EDM_ML_DEBUG
95  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
96  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
97  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
98  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Layer Rotation "
99  << convertRadToDeg(php.layerRotation_) << " Cassettes " << php.cassettes_
100  << " UseSimWt " << php.useSimWt_;
101 #endif
102  attribute = "OnlyForHGCalNumbering";
103  value = namet;
104  DDValue val2(attribute, value, 0.0);
105  DDSpecificsMatchesValueFilter filter2{val2};
106  DDFilteredView fv2(*cpv, filter2);
107  bool ok2 = fv2.firstChild();
108  if (ok2) {
109  DDsvalues_type sv2(fv2.mergedSpecifics());
110  mode = HGCalGeometryMode::getGeometryWaferMode("WaferMode", sv2);
111  php.nCellsFine_ = static_cast<int>(getDDDValue("NumberOfCellsFine", sv2));
112  php.nCellsCoarse_ = static_cast<int>(getDDDValue("NumberOfCellsCoarse", sv2));
113  php.waferSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferSize", sv2);
114  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv2);
115  php.sensorSeparation_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("SensorSeparation", sv2);
116  php.mouseBite_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MouseBite", sv2);
117  php.waferR_ = HGCalParameters::k_ScaleToDDD * php.waferSize_ * tan30deg_;
118  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
119  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
122  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
123  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
124  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
125  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
126  << ":" << php.waferR_;
127 #endif
128  for (int k = 0; k < 2; ++k)
129  getCellPosition(php, k);
130  }
131  }
132  if (php.mode_ == HGCalGeometryMode::Hexagon) {
133  // Load the SpecPars
134  php.firstLayer_ = 1;
135  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
136  // Load the Geometry parameters
137  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
138  // Load cell parameters
139  geom->loadCellParsHexagon(cpv, php);
140  // Set complete fill mode
141  php.defineFull_ = false;
142  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
143  // Load the SpecPars
144  php.firstLayer_ = 1;
145  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
146  // Load the Geometry parameters
147  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
148  // Modify some constants
149  geom->loadWaferHexagon(php);
150  // Load cell parameters
151  geom->loadCellParsHexagon(cpv, php);
152  // Set complete fill mode
153  php.defineFull_ = true;
154  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
155  // Load the SpecPars
156  geom->loadSpecParsHexagon8(fv, php);
157  // Load Geometry parameters
158  geom->loadGeometryHexagon8(fv, php, 1);
159  // Set complete fill mode
160  php.defineFull_ = false;
161  // Load wafer positions
162  geom->loadWaferHexagon8(php);
164  // Load the SpecPars
165  geom->loadSpecParsHexagon8(fv, php);
166  // Load Geometry parameters
167  geom->loadGeometryHexagon8(fv, php, 1);
168  // Set complete fill mode
169  php.defineFull_ = true;
170  // Load wafer positions
171  geom->loadWaferHexagon8(php);
173  // Load the SpecPars
174  geom->loadSpecParsHexagon8(fv, php);
175  // Load Geometry parameters
176  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
177  // Set complete fill mode
178  php.defineFull_ = true;
179  // Load wafer positions
180  geom->loadWaferHexagon8(php);
184  // Load maximum eta & top level
185  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
186  php.firstLayer_ = (int)(getDDDValue("FirstLayer", sv));
187  php.firstMixedLayer_ = (int)(getDDDValue("FirstMixedLayer", sv));
188  php.detectorType_ = (int)(getDDDValue("DetectorType", sv));
189  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv);
190  php.minTileSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MinimumTileSize", sv);
191  php.waferSize_ = php.waferR_ = 0;
192  php.sensorSeparation_ = php.mouseBite_ = 0;
193  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
194  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
196  php.useSimWt_ = static_cast<int>(getDDDValue("UseSimWt", sv));
198  php.cassettes_ = getDDDValue("Cassettes", sv);
199 #ifdef EDM_ML_DEBUG
200  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
201  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
202  << php.detectorType_ << " thickenss " << php.waferThick_ << " Tile Mask Mode "
203  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Cassettes "
204  << php.cassettes_ << " UseSimWt " << php.useSimWt_;
205 #endif
206  // Load the SpecPars
207  geom->loadSpecParsTrapezoid(fv, php);
208  // Load Geometry parameters
209  geom->loadGeometryHexagon8(fv, php, php.firstLayer_);
210  // Load cell positions
211  geom->loadCellTrapezoid(php);
212  } else {
213  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
214  << ":" << namec;
215  throw cms::Exception("DDException")
216  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
217  }
218  } else {
219  edm::LogError("HGCalGeom") << " Attribute " << val << " not found but needed.";
220  throw cms::Exception("DDException") << "Attribute " << val << " not found but needed.";
221  }
222 #ifdef EDM_ML_DEBUG
223  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
224  << " with flag " << ok;
225 #endif
226  return ok;
227 }
228 
230  HGCalParameters& php,
231  const std::string& name,
232  const std::string& namew,
233  const std::string& namec,
234  const std::string& namet,
235  const std::string& name2) {
236 #ifdef EDM_ML_DEBUG
237  edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD (DD4hep)::build called with "
238  << "names " << name << ":" << namew << ":" << namec << ":" << namet << ":" << name2;
239 #endif
240  cms::DDVectorsMap vmap = cpv->detector()->vectors();
241  const cms::DDFilter filter("Volume", name);
242  cms::DDFilteredView fv((*cpv), filter);
243  std::vector<std::string> tempS;
244  std::vector<double> tempD;
245  bool ok = fv.firstChild();
246  tempS = fv.get<std::vector<std::string> >(name2, "GeometryMode");
247  if (tempS.empty()) {
248  tempS = fv.get<std::vector<std::string> >(name, "GeometryMode");
249  }
250  std::string sv = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Hexagon8Full";
252 #ifdef EDM_ML_DEBUG
253  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode ";
254 #endif
255 
256  if (ok) {
258 #ifdef EDM_ML_DEBUG
259  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode " << php.mode_ << ":"
266 #endif
267  php.levelZSide_ = 3; // Default level for ZSide
268  php.detectorType_ = 0; // These two parameters are
269  php.firstMixedLayer_ = -1; // defined for post TDR geometry
270  php.useSimWt_ = 1; // energy weighting for SimHits
271  php.layerRotation_ = 0; // default layer rotation angle
272  php.cassettes_ = 0; // default number of cassettes
273  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
275  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
276  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Polyhedra";
278 #ifdef EDM_ML_DEBUG
279  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
281 #endif
282  php.minTileSize_ = 0;
283  php.waferMaskMode_ = 0;
284  php.waferZSide_ = 0;
285  }
289  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
290  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
291  php.levelZSide_ = static_cast<int>(tempD[0]);
292  php.nCellsFine_ = php.nCellsCoarse_ = 0;
293  php.firstLayer_ = 1;
294  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
295  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
296  tempD = fv.get<std::vector<double> >(name, "DetectorType");
297  php.detectorType_ = static_cast<int>(tempD[0]);
298  php.minTileSize_ = 0;
299  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
300  php.waferMaskMode_ = static_cast<int>(tempD[0]);
301  tempD = fv.get<std::vector<double> >(name, "WaferZside");
302  php.waferZSide_ = static_cast<int>(tempD[0]);
304  tempD = fv.get<std::vector<double> >(name, "LayerRotation");
305  php.layerRotation_ = tempD[0];
306  tempD = fv.get<std::vector<double> >(name, "UseSimWt");
307  php.useSimWt_ = tempD[0];
308  }
311  tempD = fv.get<std::vector<double> >(name, "Cassettes");
312  php.cassettes_ = static_cast<int>(tempD[0]);
313  }
314 #ifdef EDM_ML_DEBUG
315  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
316  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
317  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
318  << php.waferMaskMode_ << " ZSide " << php.waferZSide_ << " Layer Rotation "
319  << convertRadToDeg(php.layerRotation_) << " Cassettes " << php.cassettes_
320  << " UseSimWt " << php.useSimWt_;
321 #endif
322 
323  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
324  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::ExtrudedPolygon";
326  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsFine");
327  php.nCellsFine_ = static_cast<int>(tempD[0]);
328  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsCoarse");
329  php.nCellsCoarse_ = static_cast<int>(tempD[0]);
330  tempD = fv.get<std::vector<double> >(namet, "WaferSize");
332  tempD = fv.get<std::vector<double> >(namet, "WaferThickness");
334  tempD = fv.get<std::vector<double> >(namet, "SensorSeparation");
336  tempD = fv.get<std::vector<double> >(namet, "MouseBite");
338  php.waferR_ = HGCalParameters::k_ScaleToDDD * php.waferSize_ * tan30deg_;
339  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
340  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
341 #ifdef EDM_ML_DEBUG
342  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
343  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
344  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
345  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
346  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
347  << ":" << php.waferR_;
348 #endif
349  for (int k = 0; k < 2; ++k)
350  getCellPosition(php, k);
351  }
352  if (php.mode_ == HGCalGeometryMode::Hexagon) {
353  // Load the SpecPars
354  php.firstLayer_ = 1;
355  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
356  // Load the Geometry parameters
357  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
358  // Load cell parameters
359  geom->loadCellParsHexagon(vmap, php);
360  // Set complete fill mode
361  php.defineFull_ = false;
362  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
363  // Load the SpecPars
364  php.firstLayer_ = 1;
365  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
366  // Load the Geometry parameters
367  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
368  // Modify some constants
369  geom->loadWaferHexagon(php);
370  // Load cell parameters
371  geom->loadCellParsHexagon(vmap, php);
372  // Set complete fill mode
373  php.defineFull_ = true;
374  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
375  // Load the SpecPars
376  geom->loadSpecParsHexagon8(fv, vmap, php, name);
377  // Load Geometry parameters
378  geom->loadGeometryHexagon8(cpv, php, name, 1);
379  // Set complete fill mode
380  php.defineFull_ = false;
381  // Load wafer positions
382  geom->loadWaferHexagon8(php);
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_ = true;
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->loadGeometryHexagonModule(cpv, php, name, namec, 1);
397  // Set complete fill mode
398  php.defineFull_ = true;
399  // Load wafer positions
400  geom->loadWaferHexagon8(php);
404  // Load maximum eta & top level
405  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
406  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
407  php.levelZSide_ = static_cast<int>(tempD[0]);
408  php.nCellsFine_ = php.nCellsCoarse_ = 0;
409  tempD = fv.get<std::vector<double> >(name, "FirstLayer");
410  php.firstLayer_ = static_cast<int>(tempD[0]);
411  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
412  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
413  tempD = fv.get<std::vector<double> >(name, "DetectorType");
414  php.detectorType_ = static_cast<int>(tempD[0]);
415  tempD = fv.get<std::vector<double> >(name, "WaferThickness");
417  tempD = fv.get<std::vector<double> >(name, "MinimumTileSize");
419  php.waferSize_ = php.waferR_ = 0;
420  php.sensorSeparation_ = php.mouseBite_ = 0;
421  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
422  php.waferMaskMode_ = static_cast<int>(tempD[0]);
423  tempD = fv.get<std::vector<double> >(name, "WaferZside");
424  php.waferZSide_ = static_cast<int>(tempD[0]);
426  tempD = fv.get<std::vector<double> >(name, "UseSimWt");
427  php.useSimWt_ = tempD[0];
428  }
430  tempD = fv.get<std::vector<double> >(name, "Cassettes");
431  php.cassettes_ = static_cast<int>(tempD[0]);
432  }
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_ << " Cassettes " << php.cassettes_ << " UseSimWt "
439  << php.useSimWt_;
440 #endif
441  // Load the SpecPars
442  geom->loadSpecParsTrapezoid(fv, vmap, php, name);
443  // Load Geometry parameters
444  geom->loadGeometryHexagon8(cpv, php, name, php.firstLayer_);
445  // Load cell positions
446  geom->loadCellTrapezoid(php);
447  } else {
448  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
449  << ":" << namec;
450  throw cms::Exception("DDException")
451  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
452  }
453  } else {
454  edm::LogError("HGCalGeom") << " Attribute Volume:" << name << " not found but needed.";
455  throw cms::Exception("DDException") << "Attribute Volume:" << name << " not found but needed.";
456  }
457 #ifdef EDM_ML_DEBUG
458  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
459  << " with flag " << ok;
460 #endif
461  return ok;
462 }
463 
465  if (type == 1) {
466  php.cellCoarseX_.clear();
467  php.cellCoarseY_.clear();
468  } else {
469  php.cellFineX_.clear();
470  php.cellFineY_.clear();
471  }
472  HGCalParameters::wafer_map cellIndex;
473 #ifdef EDM_ML_DEBUG
474  std::vector<int> indtypes;
475 #endif
476  int N = (type == 1) ? php.nCellsCoarse_ : php.nCellsFine_;
477  double R = php.waferSize_ / (3 * N);
478  double r = 0.5 * R * sqrt(3.0);
479  int n2 = N / 2;
480  int ipos(0);
481  for (int u = 0; u < 2 * N; ++u) {
482  for (int v = 0; v < 2 * N; ++v) {
483  if (((v - u) < N) && (u - v) <= N) {
484  double yp = (u - 0.5 * v - n2) * 2 * r;
485  double xp = (1.5 * (v - N) + 1.0) * R;
486  int id = v * 100 + u;
487 #ifdef EDM_ML_DEBUG
488  indtypes.emplace_back(id);
489 #endif
490  if (type == 1) {
491  php.cellCoarseX_.emplace_back(xp);
492  php.cellCoarseY_.emplace_back(yp);
493  } else {
494  php.cellFineX_.emplace_back(xp);
495  php.cellFineY_.emplace_back(yp);
496  }
497  cellIndex[id] = ipos;
498  ++ipos;
499  }
500  }
501  }
502  if (type == 1)
503  php.cellCoarseIndex_ = cellIndex;
504  else
505  php.cellFineIndex_ = cellIndex;
506 
507 #ifdef EDM_ML_DEBUG
508  if (type == 1) {
509  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellCoarseX_.size()
510  << " cells";
511  for (unsigned int k = 0; k < php.cellCoarseX_.size(); ++k) {
512  int id = indtypes[k];
513  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellCoarseIndex_[id] << " X "
514  << php.cellCoarseX_[k] << " Y " << php.cellCoarseY_[k];
515  }
516  } else {
517  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellFineX_.size() << " cells";
518  for (unsigned int k = 0; k < php.cellFineX_.size(); ++k) {
519  int id = indtypes[k];
520  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellFineIndex_[k] << " X "
521  << php.cellFineX_[k] << " Y " << php.cellFineY_[k];
522  }
523  }
524 #endif
525 }
526 
528  DDValue val(s);
529  if (DDfetch(&sv, val)) {
530  const std::vector<double>& fvec = val.doubles();
531  if (fvec.empty()) {
532  throw cms::Exception("HGCalGeom") << "getDDDValue::Failed to get " << s << " tag.";
533  }
534  return fvec[0];
535  } else {
536  throw cms::Exception("HGCalGeom") << "getDDDValue::Failed to fetch " << s << " tag";
537  }
538 }
539 
540 std::vector<double> HGCalParametersFromDD::getDDDArray(const char* s, const DDsvalues_type& sv) {
541  DDValue val(s);
542  if (DDfetch(&sv, val)) {
543  const std::vector<double>& fvec = val.doubles();
544  if (fvec.empty()) {
545  throw cms::Exception("HGCalGeom") << "getDDDArray::Failed to get " << s << " tag.";
546  }
547  return fvec;
548  } else {
549  throw cms::Exception("HGCalGeom") << "getDDDArray:Failed to fetch " << s << " tag";
550  }
551 }
Log< level::Info, true > LogVerbatim
static constexpr int scintillatorCassette
wafer_map cellFineIndex_
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< double > cellFineY_
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34
Log< level::Error, false > LogError
bool build(const DDCompactView *cpv, HGCalParameters &php, const std::string &name, const std::string &namew, const std::string &namec, const std::string &namet)
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
HGCalGeometryMode::GeometryMode mode_
std::unordered_map< std::string, std::vector< double > > DDVectorsMap
Definition: DDNamespace.h:20
WaferMode getGeometryWaferMode(const char *s, const DDsvalues_type &sv)
std::vector< double > cellCoarseX_
static constexpr int siliconCassetteHE
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > cellSize_
T sqrt(T t)
Definition: SSEVec.h:19
static constexpr int siliconCassetteEE
GeometryMode getGeometryMode(const char *s, const DDsvalues_type &sv)
static constexpr double k_ScaleFromDD4hep
Definition: value.py:1
bool firstChild()
set the current node to the first child
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
DDsvalues_type mergedSpecifics() const
T get(const std::string &)
extract attribute value
static constexpr double k_ScaleToDDD
#define N
Definition: blowfish.cc:9
std::unordered_map< int32_t, int32_t > wafer_map
double getDDDValue(const char *s, const DDsvalues_type &sv)
wafer_map cellCoarseIndex_
std::vector< double > cellFineX_
static constexpr double k_ScaleFromDDD
bool firstChild()
set the current node to the first child ...
std::vector< int > levelT_
std::vector< double > cellCoarseY_
cms::DDVectorsMap const & vectors() const
Definition: DDDetector.h:17
std::vector< double > getDDDArray(const char *s, const DDsvalues_type &sv)
void getCellPosition(HGCalParameters &php, int type)