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 cms::cuda::assert(), 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  assert(php.nCellsFine_ != 0);
127  assert(php.nCellsCoarse_ != 0);
128  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
129  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
130 #ifdef EDM_ML_DEBUG
131  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
132  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
133  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
134  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
135  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":"
136  << php.sensorSizeOffset_ << ":" << php.guardRingOffset_ << ":" << php.mouseBite_
137  << ":" << php.useOffset_ << ":" << php.waferR_;
138 #endif
139  for (int k = 0; k < 2; ++k)
140  getCellPosition(php, k);
141  }
142  }
143  if (php.mode_ == HGCalGeometryMode::Hexagon) {
144  // Load the SpecPars
145  php.firstLayer_ = 1;
146  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
147  // Load the Geometry parameters
148  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
149  // Load cell parameters
150  geom->loadCellParsHexagon(cpv, php);
151  // Set complete fill mode
152  php.defineFull_ = false;
153  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
154  // Load the SpecPars
155  php.firstLayer_ = 1;
156  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
157  // Load the Geometry parameters
158  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
159  // Modify some constants
160  geom->loadWaferHexagon(php);
161  // Load cell parameters
162  geom->loadCellParsHexagon(cpv, php);
163  // Set complete fill mode
164  php.defineFull_ = true;
165  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
166  // Load the SpecPars
167  geom->loadSpecParsHexagon8(fv, php);
168  // Load Geometry parameters
169  geom->loadGeometryHexagon8(fv, php, 1);
170  // Set complete fill mode
171  php.defineFull_ = false;
172  // Load wafer positions
173  geom->loadWaferHexagon8(php);
175  // Load the SpecPars
176  geom->loadSpecParsHexagon8(fv, php);
177  // Load Geometry parameters
178  geom->loadGeometryHexagon8(fv, php, 1);
179  // Set complete fill mode
180  php.defineFull_ = true;
181  // Load wafer positions
182  geom->loadWaferHexagon8(php);
185  // Load the SpecPars
186  geom->loadSpecParsHexagon8(fv, php);
187  // Load Geometry parameters
188  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
189  // Set complete fill mode
190  php.defineFull_ = true;
191  // Load wafer positions
192  geom->loadWaferHexagon8(php);
196  // Load maximum eta & top level
197  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
198  php.levelZSide_ = static_cast<int>(getDDDValue("LevelZSide", sv));
199  php.firstLayer_ = (int)(getDDDValue("FirstLayer", sv));
200  php.firstMixedLayer_ = (int)(getDDDValue("FirstMixedLayer", sv));
201  php.detectorType_ = (int)(getDDDValue("DetectorType", sv));
202  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv);
203  php.minTileSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MinimumTileSize", sv);
204  php.nCellsFine_ = php.nCellsCoarse_ = 0;
205  php.waferSize_ = php.waferR_ = 0;
206  php.sensorSeparation_ = php.mouseBite_ = 0;
207  php.sensorSizeOffset_ = php.guardRingOffset_ = php.useOffset_ = 0;
208  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
209  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
211  php.useSimWt_ = static_cast<int>(getDDDValue("UseSimWt", sv));
213  php.cassettes_ = getDDDValue("Cassettes", sv);
214 #ifdef EDM_ML_DEBUG
215  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
216  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
217  << php.detectorType_ << " thickenss " << php.waferThick_ << " Tile Mask Mode "
218  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Cassettes "
219  << php.cassettes_ << " UseSimWt " << php.useSimWt_;
220 #endif
221  // Load the SpecPars
222  geom->loadSpecParsTrapezoid(fv, php);
223  // Load Geometry parameters
224  geom->loadGeometryHexagon8(fv, php, php.firstLayer_);
225  // Load cell positions
226  geom->loadCellTrapezoid(php);
227  } else {
228  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
229  << ":" << namec;
230  throw cms::Exception("DDException")
231  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
232  }
233  } else {
234  edm::LogError("HGCalGeom") << " Attribute " << val << " not found but needed.";
235  throw cms::Exception("DDException") << "Attribute " << val << " not found but needed.";
236  }
237 #ifdef EDM_ML_DEBUG
238  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
239  << " with flag " << ok;
240 #endif
241  return ok;
242 }
Log< level::Info, true > LogVerbatim
static constexpr int scintillatorCassette
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Log< level::Error, false > LogError
assert(be >=bs)
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 244 of file HGCalParametersFromDD.cc.

References cms::cuda::assert(), HGCalParameters::calibCellRHD_, HGCalParameters::calibCellRLD_, 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_, 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_, cms::DDDetector::vectors(), HGCalParameters::waferMaskMode_, HGCalParameters::waferR_, HGCalParameters::waferSize_, HGCalParameters::waferThick_, and HGCalParameters::waferZSide_.

250  {
251 #ifdef EDM_ML_DEBUG
252  edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD (DD4hep)::build called with "
253  << "names " << name << ":" << namew << ":" << namec << ":" << namet << ":" << name2;
254 #endif
255  cms::DDVectorsMap vmap = cpv->detector()->vectors();
256  const cms::DDFilter filter("Volume", name);
257  cms::DDFilteredView fv((*cpv), filter);
258  std::vector<std::string> tempS;
259  std::vector<double> tempD;
260  bool ok = fv.firstChild();
261  tempS = fv.get<std::vector<std::string> >(name2, "GeometryMode");
262  if (tempS.empty()) {
263  tempS = fv.get<std::vector<std::string> >(name, "GeometryMode");
264  }
265  std::string sv = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Hexagon8Full";
267 #ifdef EDM_ML_DEBUG
268  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode ";
269 #endif
270 
271  if (ok) {
273 #ifdef EDM_ML_DEBUG
274  edm::LogVerbatim("HGCalGeom") << "Volume " << name << " GeometryMode " << php.mode_ << ":"
280  << ":" << HGCalGeometryMode::TrapezoidCassette << ":"
282 #endif
283  php.levelZSide_ = 3; // Default level for ZSide
284  php.detectorType_ = 0; // These two parameters are
285  php.firstMixedLayer_ = -1; // defined for post TDR geometry
286  php.useSimWt_ = 1; // energy weighting for SimHits
287  php.layerRotation_ = 0; // default layer rotation angle
288  php.cassettes_ = 0; // default number of cassettes
289  php.nphiCassette_ = 0; // default number of phi's per cassette
290  php.phiOffset_ = 0; // default value of phi offset for cassette
291  php.calibCellRHD_ = 0; // default value of R of HD calibration cells
292  php.calibCellRLD_ = 0; // default value of R of LD calibration cells
293  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
295  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
296  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Polyhedra";
298 #ifdef EDM_ML_DEBUG
299  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
301 #endif
302  php.minTileSize_ = 0;
303  php.waferMaskMode_ = 0;
304  php.waferZSide_ = 0;
305  }
309  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
310  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
311  php.levelZSide_ = static_cast<int>(tempD[0]);
312  php.nCellsFine_ = php.nCellsCoarse_ = 0;
313  php.firstLayer_ = 1;
314  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
315  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
316  tempD = fv.get<std::vector<double> >(name, "DetectorType");
317  php.detectorType_ = static_cast<int>(tempD[0]);
318  php.minTileSize_ = 0;
319  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
320  php.waferMaskMode_ = static_cast<int>(tempD[0]);
321  tempD = fv.get<std::vector<double> >(name, "WaferZside");
322  php.waferZSide_ = static_cast<int>(tempD[0]);
325  tempD = fv.get<std::vector<double> >(name, "LayerRotation");
326  php.layerRotation_ = tempD[0];
327  tempD = fv.get<std::vector<double> >(name, "UseSimWt");
328  php.useSimWt_ = tempD[0];
329  }
332  tempD = fv.get<std::vector<double> >(name, "Cassettes");
333  php.cassettes_ = static_cast<int>(tempD[0]);
334  }
335 #ifdef EDM_ML_DEBUG
336  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
337  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
338  << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode "
339  << php.waferMaskMode_ << " ZSide " << php.waferZSide_ << " Layer Rotation "
340  << convertRadToDeg(php.layerRotation_) << " Cassettes " << php.cassettes_
341  << " UseSimWt " << php.useSimWt_;
342 #endif
343 
344  tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
345  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::ExtrudedPolygon";
347  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsFine");
348  php.nCellsFine_ = static_cast<int>(tempD[0]);
349  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsCoarse");
350  php.nCellsCoarse_ = static_cast<int>(tempD[0]);
351  tempD = fv.get<std::vector<double> >(namet, "WaferSize");
353  tempD = fv.get<std::vector<double> >(namet, "WaferThickness");
355  tempD = fv.get<std::vector<double> >(namet, "SensorSeparation");
357  tempD = fv.get<std::vector<double> >(namet, "SensorSizeOffset");
359  tempD = fv.get<std::vector<double> >(namet, "GuardRingOffset");
361  tempD = fv.get<std::vector<double> >(namet, "MouseBite");
363  tempD = fv.get<std::vector<double> >(namet, "UseOffset");
364  php.useOffset_ = static_cast<int>(tempD[0]);
366  assert(php.nCellsFine_ != 0);
367  assert(php.nCellsCoarse_ != 0);
368  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
369  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
370 #ifdef EDM_ML_DEBUG
371  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
372  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
373  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
374  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
375  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":"
376  << php.sensorSizeOffset_ << ":" << php.guardRingOffset_ << ":" << php.mouseBite_
377  << ":" << php.useOffset_ << ":" << php.waferR_;
378 #endif
379  for (int k = 0; k < 2; ++k)
380  getCellPosition(php, k);
381  }
382  if (php.mode_ == HGCalGeometryMode::Hexagon) {
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  // Load cell parameters
389  geom->loadCellParsHexagon(vmap, php);
390  // Set complete fill mode
391  php.defineFull_ = false;
392  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
393  // Load the SpecPars
394  php.firstLayer_ = 1;
395  geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
396  // Load the Geometry parameters
397  geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
398  // Modify some constants
399  geom->loadWaferHexagon(php);
400  // Load cell parameters
401  geom->loadCellParsHexagon(vmap, php);
402  // Set complete fill mode
403  php.defineFull_ = true;
404  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
405  // Load the SpecPars
406  geom->loadSpecParsHexagon8(fv, vmap, php, name);
407  // Load Geometry parameters
408  geom->loadGeometryHexagon8(cpv, php, name, 1);
409  // Set complete fill mode
410  php.defineFull_ = false;
411  // Load wafer positions
412  geom->loadWaferHexagon8(php);
414  // Load the SpecPars
415  geom->loadSpecParsHexagon8(fv, vmap, php, name);
416  // Load Geometry parameters
417  geom->loadGeometryHexagon8(cpv, php, name, 1);
418  // Set complete fill mode
419  php.defineFull_ = true;
420  // Load wafer positions
421  geom->loadWaferHexagon8(php);
424  // Load the SpecPars
425  geom->loadSpecParsHexagon8(fv, vmap, php, name);
426  // Load Geometry parameters
427  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
428  // Set complete fill mode
429  php.defineFull_ = true;
430  // Load wafer positions
431  geom->loadWaferHexagon8(php);
435  // Load maximum eta & top level
436  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
437  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
438  php.levelZSide_ = static_cast<int>(tempD[0]);
439  tempD = fv.get<std::vector<double> >(name, "FirstLayer");
440  php.firstLayer_ = static_cast<int>(tempD[0]);
441  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
442  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
443  tempD = fv.get<std::vector<double> >(name, "DetectorType");
444  php.detectorType_ = static_cast<int>(tempD[0]);
445  tempD = fv.get<std::vector<double> >(name, "WaferThickness");
447  tempD = fv.get<std::vector<double> >(name, "MinimumTileSize");
449  php.nCellsFine_ = php.nCellsCoarse_ = 0;
450  php.waferSize_ = php.waferR_ = 0;
451  php.sensorSeparation_ = php.mouseBite_ = 0;
452  php.sensorSizeOffset_ = php.guardRingOffset_ = php.useOffset_ = 0;
453  tempD = fv.get<std::vector<double> >(name, "WaferMaskMode");
454  php.waferMaskMode_ = static_cast<int>(tempD[0]);
455  tempD = fv.get<std::vector<double> >(name, "WaferZside");
456  php.waferZSide_ = static_cast<int>(tempD[0]);
458  tempD = fv.get<std::vector<double> >(name, "UseSimWt");
459  php.useSimWt_ = tempD[0];
460  }
462  tempD = fv.get<std::vector<double> >(name, "Cassettes");
463  php.cassettes_ = static_cast<int>(tempD[0]);
464  }
465 #ifdef EDM_ML_DEBUG
466  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
467  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
468  << php.detectorType_ << " thickenss " << php.waferThick_ << " min tile size "
469  << php.minTileSize_ << " Tile Mask Mode " << php.waferMaskMode_ << " ZSide "
470  << php.waferZSide_ << " Cassettes " << php.cassettes_ << " UseSimWt "
471  << php.useSimWt_;
472 #endif
473  // Load the SpecPars
474  geom->loadSpecParsTrapezoid(fv, vmap, php, name);
475  // Load Geometry parameters
476  geom->loadGeometryHexagon8(cpv, php, name, php.firstLayer_);
477  // Load cell positions
478  geom->loadCellTrapezoid(php);
479  } else {
480  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
481  << ":" << namec;
482  throw cms::Exception("DDException")
483  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
484  }
485  } else {
486  edm::LogError("HGCalGeom") << " Attribute Volume:" << name << " not found but needed.";
487  throw cms::Exception("DDException") << "Attribute Volume:" << name << " not found but needed.";
488  }
489 #ifdef EDM_ML_DEBUG
490  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
491  << " with flag " << ok;
492 #endif
493  return ok;
494 }
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
assert(be >=bs)
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 496 of file HGCalParametersFromDD.cc.

References cms::cuda::assert(), 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_.

496  {
497  if (type == 1) {
498  php.cellCoarseX_.clear();
499  php.cellCoarseY_.clear();
500  } else {
501  php.cellFineX_.clear();
502  php.cellFineY_.clear();
503  }
504  HGCalParameters::wafer_map cellIndex;
505 #ifdef EDM_ML_DEBUG
506  std::vector<int> indtypes;
507 #endif
508  int N = (type == 1) ? php.nCellsCoarse_ : php.nCellsFine_;
509  assert(N != 0);
510  double R = php.waferSize_ / (3 * N);
511  double r = 0.5 * R * sqrt(3.0);
512  int n2 = N / 2;
513  int ipos(0);
514  for (int u = 0; u < 2 * N; ++u) {
515  for (int v = 0; v < 2 * N; ++v) {
516  if (((v - u) < N) && (u - v) <= N) {
517  double yp = (u - 0.5 * v - n2) * 2 * r;
518  double xp = (1.5 * (v - N) + 1.0) * R;
519  int id = v * 100 + u;
520 #ifdef EDM_ML_DEBUG
521  indtypes.emplace_back(id);
522 #endif
523  if (type == 1) {
524  php.cellCoarseX_.emplace_back(xp);
525  php.cellCoarseY_.emplace_back(yp);
526  } else {
527  php.cellFineX_.emplace_back(xp);
528  php.cellFineY_.emplace_back(yp);
529  }
530  cellIndex[id] = ipos;
531  ++ipos;
532  }
533  }
534  }
535  if (type == 1)
536  php.cellCoarseIndex_ = cellIndex;
537  else
538  php.cellFineIndex_ = cellIndex;
539 
540 #ifdef EDM_ML_DEBUG
541  if (type == 1) {
542  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellCoarseX_.size()
543  << " cells";
544  for (unsigned int k = 0; k < php.cellCoarseX_.size(); ++k) {
545  int id = indtypes[k];
546  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellCoarseIndex_[id] << " X "
547  << php.cellCoarseX_[k] << " Y " << php.cellCoarseY_[k];
548  }
549  } else {
550  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellFineX_.size() << " cells";
551  for (unsigned int k = 0; k < php.cellFineX_.size(); ++k) {
552  int id = indtypes[k];
553  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellFineIndex_[k] << " X "
554  << php.cellFineX_[k] << " Y " << php.cellFineY_[k];
555  }
556  }
557 #endif
558 }
Log< level::Info, true > LogVerbatim
wafer_map cellFineIndex_
std::vector< double > cellFineY_
assert(be >=bs)
std::vector< double > cellCoarseX_
T sqrt(T t)
Definition: SSEVec.h:23
#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 573 of file HGCalParametersFromDD.cc.

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

573  {
574  DDValue val(s);
575  if (DDfetch(&sv, val)) {
576  const std::vector<double>& fvec = val.doubles();
577  if (fvec.empty()) {
578  throw cms::Exception("HGCalGeom") << "getDDDArray::Failed to get " << s << " tag.";
579  }
580  return fvec;
581  } else {
582  throw cms::Exception("HGCalGeom") << "getDDDArray:Failed to fetch " << s << " tag";
583  }
584 }
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 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") << "getDDDValue::Failed to get " << s << " tag.";
566  }
567  return fvec[0];
568  } else {
569  throw cms::Exception("HGCalGeom") << "getDDDValue::Failed to fetch " << s << " tag";
570  }
571 }
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.