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(), 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_, HGCalGeomParameters::siliconCassetteEE, HGCalGeomParameters::siliconCassetteHE, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalGeometryMode::Trapezoid, HGCalGeometryMode::TrapezoidCassette, HGCalGeometryMode::TrapezoidFile, HGCalGeometryMode::TrapezoidModule, 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.mouseBite_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MouseBite", sv2);
118  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
119  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
122  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
123  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
124  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
125  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
126  << ":" << php.waferR_;
127 #endif
128  for (int k = 0; k < 2; ++k)
129  getCellPosition(php, k);
130  }
131  }
132  if (php.mode_ == HGCalGeometryMode::Hexagon) {
133  // Load the SpecPars
134  php.firstLayer_ = 1;
135  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
136  // Load the Geometry parameters
137  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
138  // Load cell parameters
139  geom->loadCellParsHexagon(cpv, php);
140  // Set complete fill mode
141  php.defineFull_ = false;
142  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
143  // Load the SpecPars
144  php.firstLayer_ = 1;
145  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
146  // Load the Geometry parameters
147  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
148  // Modify some constants
149  geom->loadWaferHexagon(php);
150  // Load cell parameters
151  geom->loadCellParsHexagon(cpv, php);
152  // Set complete fill mode
153  php.defineFull_ = true;
154  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
155  // Load the SpecPars
156  geom->loadSpecParsHexagon8(fv, php);
157  // Load Geometry parameters
158  geom->loadGeometryHexagon8(fv, php, 1);
159  // Set complete fill mode
160  php.defineFull_ = false;
161  // Load wafer positions
162  geom->loadWaferHexagon8(php);
164  // Load the SpecPars
165  geom->loadSpecParsHexagon8(fv, php);
166  // Load Geometry parameters
167  geom->loadGeometryHexagon8(fv, php, 1);
168  // Set complete fill mode
169  php.defineFull_ = true;
170  // Load wafer positions
171  geom->loadWaferHexagon8(php);
173  // Load the SpecPars
174  geom->loadSpecParsHexagon8(fv, php);
175  // Load Geometry parameters
176  geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
177  // Set complete fill mode
178  php.defineFull_ = true;
179  // Load wafer positions
180  geom->loadWaferHexagon8(php);
184  // Load maximum eta & top level
185  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
186  php.firstLayer_ = (int)(getDDDValue("FirstLayer", sv));
187  php.firstMixedLayer_ = (int)(getDDDValue("FirstMixedLayer", sv));
188  php.detectorType_ = (int)(getDDDValue("DetectorType", sv));
189  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv);
190  php.minTileSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MinimumTileSize", sv);
191  php.waferSize_ = php.waferR_ = 0;
192  php.sensorSeparation_ = php.mouseBite_ = 0;
193  php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
194  php.waferZSide_ = static_cast<int>(getDDDValue("WaferZside", sv));
196  php.useSimWt_ = static_cast<int>(getDDDValue("UseSimWt", sv));
198  php.cassettes_ = getDDDValue("Cassettes", sv);
199 #ifdef EDM_ML_DEBUG
200  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
201  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
202  << php.detectorType_ << " thickenss " << php.waferThick_ << " Tile Mask Mode "
203  << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Cassettes "
204  << php.cassettes_ << " UseSimWt " << php.useSimWt_;
205 #endif
206  // Load the SpecPars
207  geom->loadSpecParsTrapezoid(fv, php);
208  // Load Geometry parameters
209  geom->loadGeometryHexagon8(fv, php, php.firstLayer_);
210  // Load cell positions
211  geom->loadCellTrapezoid(php);
212  } else {
213  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
214  << ":" << namec;
215  throw cms::Exception("DDException")
216  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
217  }
218  } else {
219  edm::LogError("HGCalGeom") << " Attribute " << val << " not found but needed.";
220  throw cms::Exception("DDException") << "Attribute " << val << " not found but needed.";
221  }
222 #ifdef EDM_ML_DEBUG
223  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
224  << " with flag " << ok;
225 #endif
226  return ok;
227 }
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 229 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(), 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_, HGCalGeomParameters::siliconCassetteEE, HGCalGeomParameters::siliconCassetteHE, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalGeometryMode::Trapezoid, HGCalGeometryMode::TrapezoidCassette, HGCalGeometryMode::TrapezoidFile, HGCalGeometryMode::TrapezoidModule, HGCalParameters::useSimWt_, cms::DDDetector::vectors(), HGCalParameters::waferMaskMode_, HGCalParameters::waferR_, HGCalParameters::waferSize_, HGCalParameters::waferThick_, and HGCalParameters::waferZSide_.

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

464  {
465  if (type == 1) {
466  php.cellCoarseX_.clear();
467  php.cellCoarseY_.clear();
468  } else {
469  php.cellFineX_.clear();
470  php.cellFineY_.clear();
471  }
472  HGCalParameters::wafer_map cellIndex;
473 #ifdef EDM_ML_DEBUG
474  std::vector<int> indtypes;
475 #endif
476  int N = (type == 1) ? php.nCellsCoarse_ : php.nCellsFine_;
477  double R = php.waferSize_ / (3 * N);
478  double r = 0.5 * R * sqrt(3.0);
479  int n2 = N / 2;
480  int ipos(0);
481  for (int u = 0; u < 2 * N; ++u) {
482  for (int v = 0; v < 2 * N; ++v) {
483  if (((v - u) < N) && (u - v) <= N) {
484  double yp = (u - 0.5 * v - n2) * 2 * r;
485  double xp = (1.5 * (v - N) + 1.0) * R;
486  int id = v * 100 + u;
487 #ifdef EDM_ML_DEBUG
488  indtypes.emplace_back(id);
489 #endif
490  if (type == 1) {
491  php.cellCoarseX_.emplace_back(xp);
492  php.cellCoarseY_.emplace_back(yp);
493  } else {
494  php.cellFineX_.emplace_back(xp);
495  php.cellFineY_.emplace_back(yp);
496  }
497  cellIndex[id] = ipos;
498  ++ipos;
499  }
500  }
501  }
502  if (type == 1)
503  php.cellCoarseIndex_ = cellIndex;
504  else
505  php.cellFineIndex_ = cellIndex;
506 
507 #ifdef EDM_ML_DEBUG
508  if (type == 1) {
509  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellCoarseX_.size()
510  << " cells";
511  for (unsigned int k = 0; k < php.cellCoarseX_.size(); ++k) {
512  int id = indtypes[k];
513  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellCoarseIndex_[id] << " X "
514  << php.cellCoarseX_[k] << " Y " << php.cellCoarseY_[k];
515  }
516  } else {
517  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellFineX_.size() << " cells";
518  for (unsigned int k = 0; k < php.cellFineX_.size(); ++k) {
519  int id = indtypes[k];
520  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellFineIndex_[k] << " X "
521  << php.cellFineX_[k] << " Y " << php.cellFineY_[k];
522  }
523  }
524 #endif
525 }
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 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") << "getDDDArray::Failed to get " << s << " tag.";
546  }
547  return fvec;
548  } else {
549  throw cms::Exception("HGCalGeom") << "getDDDArray:Failed to fetch " << s << " tag";
550  }
551 }
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 527 of file HGCalParametersFromDD.cc.

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

527  {
528  DDValue val(s);
529  if (DDfetch(&sv, val)) {
530  const std::vector<double>& fvec = val.doubles();
531  if (fvec.empty()) {
532  throw cms::Exception("HGCalGeom") << "getDDDValue::Failed to get " << s << " tag.";
533  }
534  return fvec[0];
535  } else {
536  throw cms::Exception("HGCalGeom") << "getDDDValue::Failed to fetch " << s << " tag";
537  }
538 }
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.