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

References HGCalParameters::calibCellRHD_, HGCalParameters::calibCellRLD_, 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::getGeometryMode(), HGCalGeometryMode::getGeometryWaferMode(), HGCalParameters::guardRingOffset_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8CalibCell, 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_, HGCalParameters::sensorSizeOffset_, HGCalGeomParameters::siliconCassetteEE, HGCalGeomParameters::siliconCassetteHE, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalGeometryMode::Trapezoid, HGCalGeometryMode::TrapezoidCassette, HGCalGeometryMode::TrapezoidFile, HGCalGeometryMode::TrapezoidModule, HGCalParameters::useOffset_, HGCalParameters::useSimWt_, heppy_batch::val, HGCalParameters::waferMaskMode_, HGCalParameters::waferR_, HGCalParameters::waferSize_, HGCalParameters::waferThick_, and HGCalParameters::waferZSide_.

Referenced by PHGCalParametersDBBuilder::beginRun().

19  {
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) {
37  DDsvalues_type sv(fv.mergedSpecifics());
38  php.mode_ = HGCalGeometryMode::getGeometryMode("GeometryMode", sv);
39 #ifdef EDM_ML_DEBUG
40  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode " << php.mode_ << ":"
48 #endif
49  php.levelZSide_ = 3; // Default level for ZSide
50  php.detectorType_ = 0; // These two parameters are
51  php.firstMixedLayer_ = -1; // defined for post TDR geometry
52  php.useSimWt_ = 1; // energy weighting for SimHits
53  php.layerRotation_ = 0; // default layer rotation angle
54  php.cassettes_ = 0; // default number of cassettes
55  php.nphiCassette_ = 0; // default number of phi's per cassette
56  php.phiOffset_ = 0; // default value of phi offset for cassette
57  php.calibCellRHD_ = 0; // default value of R of HD calibration cells
58  php.calibCellRLD_ = 0; // default value of R of LD calibration cells
59  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
61  attribute = "OnlyForHGCalNumbering";
62  value = namet;
63  DDValue val2(attribute, value, 0.0);
64  DDSpecificsMatchesValueFilter filter2{val2};
65  DDFilteredView fv2(*cpv, filter2);
66  bool ok2 = fv2.firstChild();
67  if (ok2) {
68  DDsvalues_type sv2(fv2.mergedSpecifics());
70 #ifdef EDM_ML_DEBUG
71  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
73 #endif
74  }
75  php.minTileSize_ = 0;
76  php.waferMaskMode_ = 0;
77  php.waferZSide_ = 0;
78  }
82  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
83  php.levelZSide_ = static_cast<int>(getDDDValue("LevelZSide", sv));
84  php.nCellsFine_ = php.nCellsCoarse_ = 0;
85  php.firstLayer_ = 1;
86  php.firstMixedLayer_ = static_cast<int>(getDDDValue("FirstMixedLayer", sv));
87  php.detectorType_ = static_cast<int>(getDDDValue("DetectorType", sv));
88  php.minTileSize_ = 0;
89  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
90  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
93  php.useSimWt_ = static_cast<int>(getDDDValue("UseSimWt", sv));
94  php.layerRotation_ = getDDDValue("LayerRotation", sv);
95  }
98  php.cassettes_ = getDDDValue("Cassettes", sv);
99 #ifdef EDM_ML_DEBUG
100  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
101  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
102  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
103  << php.waferMaskMode_ << " ZSide " << php.waferZSide_ << " Layer Rotation "
104  << convertRadToDeg(php.layerRotation_) << " Cassettes " << php.cassettes_
105  << " UseSimWt " << php.useSimWt_;
106 #endif
107  attribute = "OnlyForHGCalNumbering";
108  value = namet;
109  DDValue val2(attribute, value, 0.0);
110  DDSpecificsMatchesValueFilter filter2{val2};
111  DDFilteredView fv2(*cpv, filter2);
112  bool ok2 = fv2.firstChild();
113  if (ok2) {
114  DDsvalues_type sv2(fv2.mergedSpecifics());
115  mode = HGCalGeometryMode::getGeometryWaferMode("WaferMode", sv2);
116  php.nCellsFine_ = static_cast<int>(getDDDValue("NumberOfCellsFine", sv2));
117  php.nCellsCoarse_ = static_cast<int>(getDDDValue("NumberOfCellsCoarse", sv2));
118  php.waferSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferSize", sv2);
119  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv2);
120  php.sensorSeparation_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("SensorSeparation", sv2);
121  php.sensorSizeOffset_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("SensorSizeOffset", sv2);
122  php.guardRingOffset_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("GuardRingOffset", sv2);
123  php.mouseBite_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MouseBite", sv2);
124  php.useOffset_ = static_cast<int>(getDDDValue("UseOffset", sv2));
126  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
127  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
128 #ifdef EDM_ML_DEBUG
129  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
130  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
131  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
132  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
133  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":"
134  << php.sensorSizeOffset_ << ":" << php.guardRingOffset_ << ":" << php.mouseBite_
135  << ":" << php.useOffset_ << ":" << php.waferR_;
136 #endif
137  for (int k = 0; k < 2; ++k)
138  getCellPosition(php, k);
139  }
140  }
141  if (php.mode_ == HGCalGeometryMode::Hexagon) {
142  // Load the SpecPars
143  php.firstLayer_ = 1;
144  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
145  // Load the Geometry parameters
146  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
147  // Load cell parameters
148  geom->loadCellParsHexagon(cpv, php);
149  // Set complete fill mode
150  php.defineFull_ = false;
151  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
152  // Load the SpecPars
153  php.firstLayer_ = 1;
154  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
155  // Load the Geometry parameters
156  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
157  // Modify some constants
158  geom->loadWaferHexagon(php);
159  // Load cell parameters
160  geom->loadCellParsHexagon(cpv, php);
161  // Set complete fill mode
162  php.defineFull_ = true;
163  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
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_ = false;
170  // Load wafer positions
171  geom->loadWaferHexagon8(php);
173  // Load the SpecPars
174  geom->loadSpecParsHexagon8(fv, php);
175  // Load Geometry parameters
176  geom->loadGeometryHexagon8(fv, php, 1);
177  // Set complete fill mode
178  php.defineFull_ = true;
179  // Load wafer positions
180  geom->loadWaferHexagon8(php);
183  // Load the SpecPars
184  geom->loadSpecParsHexagon8(fv, php);
185  // Load Geometry parameters
186  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
187  // Set complete fill mode
188  php.defineFull_ = true;
189  // Load wafer positions
190  geom->loadWaferHexagon8(php);
194  // Load maximum eta & top level
195  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
196  php.firstLayer_ = (int)(getDDDValue("FirstLayer", sv));
197  php.firstMixedLayer_ = (int)(getDDDValue("FirstMixedLayer", sv));
198  php.detectorType_ = (int)(getDDDValue("DetectorType", sv));
199  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv);
200  php.minTileSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MinimumTileSize", sv);
201  php.waferSize_ = php.waferR_ = 0;
202  php.sensorSeparation_ = php.mouseBite_ = 0;
203  php.sensorSizeOffset_ = php.guardRingOffset_ = php.useOffset_ = 0;
204  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
205  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
207  php.useSimWt_ = static_cast<int>(getDDDValue("UseSimWt", sv));
209  php.cassettes_ = getDDDValue("Cassettes", sv);
210 #ifdef EDM_ML_DEBUG
211  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
212  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
213  << php.detectorType_ << " thickenss " << php.waferThick_ << " Tile Mask Mode "
214  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Cassettes "
215  << php.cassettes_ << " UseSimWt " << php.useSimWt_;
216 #endif
217  // Load the SpecPars
218  geom->loadSpecParsTrapezoid(fv, php);
219  // Load Geometry parameters
220  geom->loadGeometryHexagon8(fv, php, php.firstLayer_);
221  // Load cell positions
222  geom->loadCellTrapezoid(php);
223  } else {
224  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
225  << ":" << namec;
226  throw cms::Exception("DDException")
227  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
228  }
229  } else {
230  edm::LogError("HGCalGeom") << " Attribute " << val << " not found but needed.";
231  throw cms::Exception("DDException") << "Attribute " << val << " not found but needed.";
232  }
233 #ifdef EDM_ML_DEBUG
234  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
235  << " with flag " << ok;
236 #endif
237  return ok;
238 }
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_
WaferMode getGeometryWaferMode(const char *s, const DDsvalues_type &sv)
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
GeometryMode getGeometryMode(const char *s, const DDsvalues_type &sv)
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 240 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::getGeometryMode(), HGCalGeometryMode::getGeometryWaferMode(), HGCalParameters::guardRingOffset_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8CalibCell, 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_, HGCalParameters::sensorSizeOffset_, HGCalGeomParameters::siliconCassetteEE, HGCalGeomParameters::siliconCassetteHE, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalGeometryMode::Trapezoid, HGCalGeometryMode::TrapezoidCassette, HGCalGeometryMode::TrapezoidFile, HGCalGeometryMode::TrapezoidModule, HGCalParameters::useOffset_, HGCalParameters::useSimWt_, cms::DDDetector::vectors(), HGCalParameters::waferMaskMode_, HGCalParameters::waferR_, HGCalParameters::waferSize_, HGCalParameters::waferThick_, and HGCalParameters::waferZSide_.

246  {
247 #ifdef EDM_ML_DEBUG
248  edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD (DD4hep)::build called with "
249  << "names " << name << ":" << namew << ":" << namec << ":" << namet << ":" << name2;
250 #endif
251  cms::DDVectorsMap vmap = cpv->detector()->vectors();
252  const cms::DDFilter filter("Volume", name);
253  cms::DDFilteredView fv((*cpv), filter);
254  std::vector<std::string> tempS;
255  std::vector<double> tempD;
256  bool ok = fv.firstChild();
257  tempS = fv.get<std::vector<std::string> >(name2, "GeometryMode");
258  if (tempS.empty()) {
259  tempS = fv.get<std::vector<std::string> >(name, "GeometryMode");
260  }
261  std::string sv = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Hexagon8Full";
263 #ifdef EDM_ML_DEBUG
264  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode ";
265 #endif
266 
267  if (ok) {
269 #ifdef EDM_ML_DEBUG
270  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode " << php.mode_ << ":"
276  << ":" << HGCalGeometryMode::TrapezoidCassette << ":"
278 #endif
279  php.levelZSide_ = 3; // Default level for ZSide
280  php.detectorType_ = 0; // These two parameters are
281  php.firstMixedLayer_ = -1; // defined for post TDR geometry
282  php.useSimWt_ = 1; // energy weighting for SimHits
283  php.layerRotation_ = 0; // default layer rotation angle
284  php.cassettes_ = 0; // default number of cassettes
285  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
287  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
288  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Polyhedra";
290 #ifdef EDM_ML_DEBUG
291  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
293 #endif
294  php.minTileSize_ = 0;
295  php.waferMaskMode_ = 0;
296  php.waferZSide_ = 0;
297  }
301  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
302  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
303  php.levelZSide_ = static_cast<int>(tempD[0]);
304  php.nCellsFine_ = php.nCellsCoarse_ = 0;
305  php.firstLayer_ = 1;
306  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
307  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
308  tempD = fv.get<std::vector<double> >(name, "DetectorType");
309  php.detectorType_ = static_cast<int>(tempD[0]);
310  php.minTileSize_ = 0;
311  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
312  php.waferMaskMode_ = static_cast<int>(tempD[0]);
313  tempD = fv.get<std::vector<double> >(name, "WaferZside");
314  php.waferZSide_ = static_cast<int>(tempD[0]);
317  tempD = fv.get<std::vector<double> >(name, "LayerRotation");
318  php.layerRotation_ = tempD[0];
319  tempD = fv.get<std::vector<double> >(name, "UseSimWt");
320  php.useSimWt_ = tempD[0];
321  }
324  tempD = fv.get<std::vector<double> >(name, "Cassettes");
325  php.cassettes_ = static_cast<int>(tempD[0]);
326  }
327 #ifdef EDM_ML_DEBUG
328  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
329  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
330  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
331  << php.waferMaskMode_ << " ZSide " << php.waferZSide_ << " Layer Rotation "
332  << convertRadToDeg(php.layerRotation_) << " Cassettes " << php.cassettes_
333  << " UseSimWt " << php.useSimWt_;
334 #endif
335 
336  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
337  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::ExtrudedPolygon";
339  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsFine");
340  php.nCellsFine_ = static_cast<int>(tempD[0]);
341  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsCoarse");
342  php.nCellsCoarse_ = static_cast<int>(tempD[0]);
343  tempD = fv.get<std::vector<double> >(namet, "WaferSize");
345  tempD = fv.get<std::vector<double> >(namet, "WaferThickness");
347  tempD = fv.get<std::vector<double> >(namet, "SensorSeparation");
349  tempD = fv.get<std::vector<double> >(namet, "SensorSizeOffset");
351  tempD = fv.get<std::vector<double> >(namet, "GuardRingOffset");
353  tempD = fv.get<std::vector<double> >(namet, "MouseBite");
355  tempD = fv.get<std::vector<double> >(namet, "UseOffset");
356  php.useOffset_ = static_cast<int>(tempD[0]);
358  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
359  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
360 #ifdef EDM_ML_DEBUG
361  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
362  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
363  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
364  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
365  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":"
366  << php.sensorSizeOffset_ << ":" << php.guardRingOffset_ << ":" << php.mouseBite_
367  << ":" << php.useOffset_ << ":" << php.waferR_;
368 #endif
369  for (int k = 0; k < 2; ++k)
370  getCellPosition(php, k);
371  }
372  if (php.mode_ == HGCalGeometryMode::Hexagon) {
373  // Load the SpecPars
374  php.firstLayer_ = 1;
375  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
376  // Load the Geometry parameters
377  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
378  // Load cell parameters
379  geom->loadCellParsHexagon(vmap, php);
380  // Set complete fill mode
381  php.defineFull_ = false;
382  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
383  // Load the SpecPars
384  php.firstLayer_ = 1;
385  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
386  // Load the Geometry parameters
387  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
388  // Modify some constants
389  geom->loadWaferHexagon(php);
390  // Load cell parameters
391  geom->loadCellParsHexagon(vmap, php);
392  // Set complete fill mode
393  php.defineFull_ = true;
394  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
395  // Load the SpecPars
396  geom->loadSpecParsHexagon8(fv, vmap, php, name);
397  // Load Geometry parameters
398  geom->loadGeometryHexagon8(cpv, php, name, 1);
399  // Set complete fill mode
400  php.defineFull_ = false;
401  // Load wafer positions
402  geom->loadWaferHexagon8(php);
404  // Load the SpecPars
405  geom->loadSpecParsHexagon8(fv, vmap, php, name);
406  // Load Geometry parameters
407  geom->loadGeometryHexagon8(cpv, php, name, 1);
408  // Set complete fill mode
409  php.defineFull_ = true;
410  // Load wafer positions
411  geom->loadWaferHexagon8(php);
414  // Load the SpecPars
415  geom->loadSpecParsHexagon8(fv, vmap, php, name);
416  // Load Geometry parameters
417  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
418  // Set complete fill mode
419  php.defineFull_ = true;
420  // Load wafer positions
421  geom->loadWaferHexagon8(php);
425  // Load maximum eta & top level
426  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
427  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
428  php.levelZSide_ = static_cast<int>(tempD[0]);
429  php.nCellsFine_ = php.nCellsCoarse_ = 0;
430  tempD = fv.get<std::vector<double> >(name, "FirstLayer");
431  php.firstLayer_ = static_cast<int>(tempD[0]);
432  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
433  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
434  tempD = fv.get<std::vector<double> >(name, "DetectorType");
435  php.detectorType_ = static_cast<int>(tempD[0]);
436  tempD = fv.get<std::vector<double> >(name, "WaferThickness");
438  tempD = fv.get<std::vector<double> >(name, "MinimumTileSize");
440  php.waferSize_ = php.waferR_ = 0;
441  php.sensorSeparation_ = php.mouseBite_ = 0;
442  php.sensorSizeOffset_ = php.guardRingOffset_ = php.useOffset_ = 0;
443  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
444  php.waferMaskMode_ = static_cast<int>(tempD[0]);
445  tempD = fv.get<std::vector<double> >(name, "WaferZside");
446  php.waferZSide_ = static_cast<int>(tempD[0]);
448  tempD = fv.get<std::vector<double> >(name, "UseSimWt");
449  php.useSimWt_ = tempD[0];
450  }
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_ << " UseSimWt "
461  << php.useSimWt_;
462 #endif
463  // Load the SpecPars
464  geom->loadSpecParsTrapezoid(fv, vmap, php, name);
465  // Load Geometry parameters
466  geom->loadGeometryHexagon8(cpv, php, name, php.firstLayer_);
467  // Load cell positions
468  geom->loadCellTrapezoid(php);
469  } else {
470  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
471  << ":" << namec;
472  throw cms::Exception("DDException")
473  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
474  }
475  } else {
476  edm::LogError("HGCalGeom") << " Attribute Volume:" << name << " not found but needed.";
477  throw cms::Exception("DDException") << "Attribute Volume:" << name << " not found but needed.";
478  }
479 #ifdef EDM_ML_DEBUG
480  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
481  << " with flag " << ok;
482 #endif
483  return ok;
484 }
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
WaferMode getGeometryWaferMode(const char *s, const DDsvalues_type &sv)
static constexpr int siliconCassetteHE
std::vector< double > cellSize_
static constexpr int siliconCassetteEE
GeometryMode getGeometryMode(const char *s, const DDsvalues_type &sv)
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 486 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_.

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

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

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

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

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