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_ << ":"
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  php.calibCellRHD_ = 0; // default value of R of HD calibration cells
56  php.calibCellRLD_ = 0; // default value of R of LD calibration cells
57  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
59  attribute = "OnlyForHGCalNumbering";
60  value = namet;
61  DDValue val2(attribute, value, 0.0);
62  DDSpecificsMatchesValueFilter filter2{val2};
63  DDFilteredView fv2(*cpv, filter2);
64  bool ok2 = fv2.firstChild();
65  if (ok2) {
66  DDsvalues_type sv2(fv2.mergedSpecifics());
68 #ifdef EDM_ML_DEBUG
69  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
71 #endif
72  }
73  php.minTileSize_ = 0;
74  php.waferMaskMode_ = 0;
75  php.waferZSide_ = 0;
76  }
80  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
81  php.levelZSide_ = static_cast<int>(getDDDValue("LevelZSide", sv));
82  php.nCellsFine_ = php.nCellsCoarse_ = 0;
83  php.firstLayer_ = 1;
84  php.firstMixedLayer_ = static_cast<int>(getDDDValue("FirstMixedLayer", sv));
85  php.detectorType_ = static_cast<int>(getDDDValue("DetectorType", sv));
86  php.minTileSize_ = 0;
87  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
88  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
91  php.useSimWt_ = static_cast<int>(getDDDValue("UseSimWt", sv));
92  php.layerRotation_ = getDDDValue("LayerRotation", sv);
93  }
96  php.cassettes_ = getDDDValue("Cassettes", sv);
97 #ifdef EDM_ML_DEBUG
98  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
99  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
100  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
101  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Layer Rotation "
102  << convertRadToDeg(php.layerRotation_) << " Cassettes " << php.cassettes_
103  << " UseSimWt " << php.useSimWt_;
104 #endif
105  attribute = "OnlyForHGCalNumbering";
106  value = namet;
107  DDValue val2(attribute, value, 0.0);
108  DDSpecificsMatchesValueFilter filter2{val2};
109  DDFilteredView fv2(*cpv, filter2);
110  bool ok2 = fv2.firstChild();
111  if (ok2) {
112  DDsvalues_type sv2(fv2.mergedSpecifics());
113  mode = HGCalGeometryMode::getGeometryWaferMode("WaferMode", sv2);
114  php.nCellsFine_ = static_cast<int>(getDDDValue("NumberOfCellsFine", sv2));
115  php.nCellsCoarse_ = static_cast<int>(getDDDValue("NumberOfCellsCoarse", sv2));
116  php.waferSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferSize", sv2);
117  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv2);
118  php.sensorSeparation_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("SensorSeparation", sv2);
119  php.sensorSizeOffset_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("SensorSizeOffset", sv2);
120  php.guardRingOffset_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("GuardRingOffset", sv2);
121  php.mouseBite_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MouseBite", sv2);
122  php.useOffset_ = static_cast<int>(getDDDValue("UseOffset", sv2));
124  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
125  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
126 #ifdef EDM_ML_DEBUG
127  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
128  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
129  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
130  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
131  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":"
132  << php.sensorSizeOffset_ << ":" << php.guardRingOffset_ << ":" << php.mouseBite_
133  << ":" << php.useOffset_ << ":" << php.waferR_;
134 #endif
135  for (int k = 0; k < 2; ++k)
136  getCellPosition(php, k);
137  }
138  }
139  if (php.mode_ == HGCalGeometryMode::Hexagon) {
140  // Load the SpecPars
141  php.firstLayer_ = 1;
142  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
143  // Load the Geometry parameters
144  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
145  // Load cell parameters
146  geom->loadCellParsHexagon(cpv, php);
147  // Set complete fill mode
148  php.defineFull_ = false;
149  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
150  // Load the SpecPars
151  php.firstLayer_ = 1;
152  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
153  // Load the Geometry parameters
154  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
155  // Modify some constants
156  geom->loadWaferHexagon(php);
157  // Load cell parameters
158  geom->loadCellParsHexagon(cpv, php);
159  // Set complete fill mode
160  php.defineFull_ = true;
161  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
162  // Load the SpecPars
163  geom->loadSpecParsHexagon8(fv, php);
164  // Load Geometry parameters
165  geom->loadGeometryHexagon8(fv, php, 1);
166  // Set complete fill mode
167  php.defineFull_ = false;
168  // Load wafer positions
169  geom->loadWaferHexagon8(php);
171  // Load the SpecPars
172  geom->loadSpecParsHexagon8(fv, php);
173  // Load Geometry parameters
174  geom->loadGeometryHexagon8(fv, php, 1);
175  // Set complete fill mode
176  php.defineFull_ = true;
177  // Load wafer positions
178  geom->loadWaferHexagon8(php);
181  // Load the SpecPars
182  geom->loadSpecParsHexagon8(fv, php);
183  // Load Geometry parameters
184  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
185  // Set complete fill mode
186  php.defineFull_ = true;
187  // Load wafer positions
188  geom->loadWaferHexagon8(php);
192  // Load maximum eta & top level
193  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
194  php.firstLayer_ = (int)(getDDDValue("FirstLayer", sv));
195  php.firstMixedLayer_ = (int)(getDDDValue("FirstMixedLayer", sv));
196  php.detectorType_ = (int)(getDDDValue("DetectorType", sv));
197  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv);
198  php.minTileSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MinimumTileSize", sv);
199  php.waferSize_ = php.waferR_ = 0;
200  php.sensorSeparation_ = php.mouseBite_ = 0;
201  php.sensorSizeOffset_ = php.guardRingOffset_ = php.useOffset_ = 0;
202  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
203  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
205  php.useSimWt_ = static_cast<int>(getDDDValue("UseSimWt", sv));
207  php.cassettes_ = getDDDValue("Cassettes", sv);
208 #ifdef EDM_ML_DEBUG
209  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
210  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
211  << php.detectorType_ << " thickenss " << php.waferThick_ << " Tile Mask Mode "
212  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Cassettes "
213  << php.cassettes_ << " UseSimWt " << php.useSimWt_;
214 #endif
215  // Load the SpecPars
216  geom->loadSpecParsTrapezoid(fv, php);
217  // Load Geometry parameters
218  geom->loadGeometryHexagon8(fv, php, php.firstLayer_);
219  // Load cell positions
220  geom->loadCellTrapezoid(php);
221  } else {
222  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
223  << ":" << namec;
224  throw cms::Exception("DDException")
225  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
226  }
227  } else {
228  edm::LogError("HGCalGeom") << " Attribute " << val << " not found but needed.";
229  throw cms::Exception("DDException") << "Attribute " << val << " not found but needed.";
230  }
231 #ifdef EDM_ML_DEBUG
232  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
233  << " with flag " << ok;
234 #endif
235  return ok;
236 }
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 238 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_.

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

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

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

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

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

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