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

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

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

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

553  {
554  DDValue val(s);
555  if (DDfetch(&sv, val)) {
556  const std::vector<double>& fvec = val.doubles();
557  if (fvec.empty()) {
558  throw cms::Exception("HGCalGeom") << "getDDDArray::Failed to get " << s << " tag.";
559  }
560  return fvec;
561  } else {
562  throw cms::Exception("HGCalGeom") << "getDDDArray:Failed to fetch " << s << " tag";
563  }
564 }
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 540 of file HGCalParametersFromDD.cc.

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

540  {
541  DDValue val(s);
542  if (DDfetch(&sv, val)) {
543  const std::vector<double>& fvec = val.doubles();
544  if (fvec.empty()) {
545  throw cms::Exception("HGCalGeom") << "getDDDValue::Failed to get " << s << " tag.";
546  }
547  return fvec[0];
548  } else {
549  throw cms::Exception("HGCalGeom") << "getDDDValue::Failed to fetch " << s << " tag";
550  }
551 }
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.