CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
HGCalParametersFromDD Class Reference

#include <HGCalParametersFromDD.h>

Public Member Functions

bool build (const DDCompactView *, HGCalParameters &, const std::string &, const std::string &, const std::string &, const std::string &)
 
bool build (const cms::DDCompactView *, HGCalParameters &, const std::string &, const std::string &, const std::string &, const std::string &, const std::string &)
 
 HGCalParametersFromDD ()
 
virtual ~HGCalParametersFromDD ()
 

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)
 

Detailed Description

Definition at line 12 of file HGCalParametersFromDD.h.

Constructor & Destructor Documentation

HGCalParametersFromDD::HGCalParametersFromDD ( )
inline

Definition at line 14 of file HGCalParametersFromDD.h.

14 {}
virtual HGCalParametersFromDD::~HGCalParametersFromDD ( )
inlinevirtual

Member Function Documentation

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

References HGCalParameters::cellSize_, funct::cos(), dbl_to_int(), HGCalParameters::defineFull_, HGCalParameters::detectorType_, Exception, HGCalGeometryMode::ExtrudedPolygon, ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), HGCalParameters::firstLayer_, HGCalParameters::firstMixedLayer_, relativeConstraints::geom, HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::HexagonFull, createfilelist::int, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, HGCalParameters::levelT_, HGCalParameters::levelZSide_, DDFilteredView::mergedSpecifics(), HGCalParameters::minTileSize_, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, HGCalParameters::mode_, HGCalParameters::mouseBite_, Skims_PA_cff::name, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, convertSQLiteXML::ok, HGCalGeometryMode::Polyhedra, HGCalParameters::sensorSeparation_, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalGeometryMode::Trapezoid, heppy_batch::val, HGCalParameters::waferR_, HGCalParameters::waferSize_, and HGCalParameters::waferThick_.

Referenced by PHGCalParametersDBBuilder::beginRun(), and ~HGCalParametersFromDD().

61  {
62 #ifdef EDM_ML_DEBUG
63  edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD (DDD)::build called with "
64  << "names " << name << ":" << namew << ":" << namec << ":" << namet;
65 #endif
66 
67  // Special parameters at simulation level
68  std::string attribute = "Volume";
70  DDValue val(attribute, value, 0.0);
72  DDFilteredView fv(*cpv, filter);
73  bool ok = fv.firstChild();
75 
76  if (ok) {
77  DDsvalues_type sv(fv.mergedSpecifics());
78  php.mode_ = getGeometryMode("GeometryMode", sv);
79 #ifdef EDM_ML_DEBUG
80  edm::LogVerbatim("HGCalGeom") << "GeometryMode " << php.mode_ << ":" << HGCalGeometryMode::Hexagon << ":"
84 #endif
85  php.levelZSide_ = 3; // Default level for ZSide
86  php.detectorType_ = 0; // These two parameters are
87  php.firstMixedLayer_ = -1; // defined for post TDR geometry
88  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
90  attribute = "OnlyForHGCalNumbering";
91  value = namet;
92  DDValue val2(attribute, value, 0.0);
93  DDSpecificsMatchesValueFilter filter2{val2};
94  DDFilteredView fv2(*cpv, filter2);
95  bool ok2 = fv2.firstChild();
96  if (ok2) {
97  DDsvalues_type sv2(fv2.mergedSpecifics());
98  mode = getGeometryWaferMode("WaferMode", sv2);
99 #ifdef EDM_ML_DEBUG
100  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
102 #endif
103  }
104  php.minTileSize_ = 0;
105  }
107  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
108  php.levelZSide_ = static_cast<int>(getDDDValue("LevelZSide", sv));
109  php.nCellsFine_ = php.nCellsCoarse_ = 0;
110  php.firstLayer_ = 1;
111  php.firstMixedLayer_ = static_cast<int>(getDDDValue("FirstMixedLayer", sv));
112  php.detectorType_ = static_cast<int>(getDDDValue("DetectorType", sv));
113  php.minTileSize_ = 0;
114 #ifdef EDM_ML_DEBUG
115  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
116  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
117  << php.firstMixedLayer_ << " Det Type " << php.detectorType_;
118 #endif
119  attribute = "OnlyForHGCalNumbering";
120  value = namet;
121  DDValue val2(attribute, value, 0.0);
122  DDSpecificsMatchesValueFilter filter2{val2};
123  DDFilteredView fv2(*cpv, filter2);
124  bool ok2 = fv2.firstChild();
125  if (ok2) {
126  DDsvalues_type sv2(fv2.mergedSpecifics());
127  mode = getGeometryWaferMode("WaferMode", sv2);
128  php.nCellsFine_ = static_cast<int>(getDDDValue("NumberOfCellsFine", sv2));
129  php.nCellsCoarse_ = static_cast<int>(getDDDValue("NumberOfCellsCoarse", sv2));
130  php.waferSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferSize", sv2);
131  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv2);
132  php.sensorSeparation_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("SensorSeparation", sv2);
133  php.mouseBite_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MouseBite", sv2);
134  php.waferR_ = 0.5 * HGCalParameters::k_ScaleToDDD * php.waferSize_ / std::cos(30._deg);
135  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
136  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
137 #ifdef EDM_ML_DEBUG
138  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
139  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
140  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
141  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
142  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
143  << ":" << php.waferR_;
144 #endif
145  for (int k = 0; k < 2; ++k)
146  getCellPosition(php, k);
147  }
148  }
149  if (php.mode_ == HGCalGeometryMode::Hexagon) {
150  // Load the SpecPars
151  php.firstLayer_ = 1;
152  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
153  // Load the Geometry parameters
154  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
155  // Load cell parameters
156  geom->loadCellParsHexagon(cpv, php);
157  // Set complete fill mode
158  php.defineFull_ = false;
159  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
160  // Load the SpecPars
161  php.firstLayer_ = 1;
162  geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
163  // Load the Geometry parameters
164  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
165  // Modify some constants
166  geom->loadWaferHexagon(php);
167  // Load cell parameters
168  geom->loadCellParsHexagon(cpv, php);
169  // Set complete fill mode
170  php.defineFull_ = true;
171  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
172  // Load the SpecPars
173  geom->loadSpecParsHexagon8(fv, php);
174  // Load Geometry parameters
175  geom->loadGeometryHexagon8(fv, php, 1);
176  // Set complete fill mode
177  php.defineFull_ = false;
178  // Load wafer positions
179  geom->loadWaferHexagon8(php);
180  } else if (php.mode_ == HGCalGeometryMode::Hexagon8Full) {
181  // Load the SpecPars
182  geom->loadSpecParsHexagon8(fv, php);
183  // Load Geometry parameters
184  geom->loadGeometryHexagon8(fv, php, 1);
185  // Set complete fill mode
186  php.defineFull_ = true;
187  // Load wafer positions
188  geom->loadWaferHexagon8(php);
189  } else if (php.mode_ == HGCalGeometryMode::Trapezoid) {
190  // Load maximum eta & top level
191  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv));
192  php.firstLayer_ = (int)(getDDDValue("FirstLayer", sv));
193  php.firstMixedLayer_ = (int)(getDDDValue("FirstMixedLayer", sv));
194  php.detectorType_ = (int)(getDDDValue("DetectorType", sv));
195  php.waferThick_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("WaferThickness", sv);
196  php.minTileSize_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MinimumTileSize", sv);
197  php.waferSize_ = php.waferR_ = 0;
198  php.sensorSeparation_ = php.mouseBite_ = 0;
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_;
203 #endif
204  // Load the SpecPars
205  geom->loadSpecParsTrapezoid(fv, php);
206  // Load Geometry parameters
207  geom->loadGeometryHexagon8(fv, php, php.firstLayer_);
208  // Load cell positions
209  geom->loadCellTrapezoid(php);
210  } else {
211  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
212  << ":" << namec;
213  throw cms::Exception("DDException")
214  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
215  }
216  } else {
217  edm::LogError("HGCalGeom") << " Attribute " << val << " not found but needed.";
218  throw cms::Exception("DDException") << "Attribute " << val << " not found but needed.";
219  }
220 #ifdef EDM_ML_DEBUG
221  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
222  << " with flag " << ok;
223 #endif
224  return ok;
225 }
HGCalGeometryMode::GeometryMode mode_
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
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > cellSize_
static double k_ScaleFromDDD
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Definition: value.py:1
static double k_ScaleToDDD
double getDDDValue(const char *s, const DDsvalues_type &sv)
std::vector< int > levelT_
std::vector< double > getDDDArray(const char *s, const DDsvalues_type &sv)
void getCellPosition(HGCalParameters &php, int type)
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 227 of file HGCalParametersFromDD.cc.

References HGCalParameters::cellSize_, funct::cos(), dbl_to_int(), HGCalParameters::defineFull_, cms::DDCompactView::detector(), HGCalParameters::detectorType_, Exception, HGCalGeometryMode::ExtrudedPolygon, cms::DDSpecParRegistry::filter(), HGCalParameters::firstLayer_, HGCalParameters::firstMixedLayer_, relativeConstraints::geom, HGCalGeometryMode::Hexagon, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, HGCalGeometryMode::HexagonFull, dqmdumpme::k, HGCalParameters::k_ScaleFromDD4Hep, HGCalParameters::k_ScaleToDDD, HGCalParameters::levelT_, HGCalParameters::levelZSide_, HGCalParameters::minTileSize_, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, HGCalParameters::mode_, HGCalParameters::mouseBite_, Skims_PA_cff::name, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, convertSQLiteXML::ok, HGCalGeometryMode::Polyhedra, HGCalParameters::sensorSeparation_, cms::DDCompactView::specpars(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalGeometryMode::Trapezoid, cms::DDDetector::vectors(), HGCalParameters::waferR_, HGCalParameters::waferSize_, HGCalParameters::waferThick_, and cms::DDDetector::worldVolume().

233  {
234 #ifdef EDM_ML_DEBUG
235  edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD (DD4Hep)::build called with "
236  << "names " << name << ":" << namew << ":" << namec << ":" << namet;
237 #endif
238  cms::DDFilteredView fv(cpv->detector(), cpv->detector()->worldVolume());
239  cms::DDVectorsMap vmap = cpv->detector()->vectors();
240  std::vector<std::string> tempS;
241  std::vector<double> tempD;
242  tempS = fv.get<std::vector<std::string> >(name, "GeometryMode");
243  std::string sv = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Hexagon8Full";
244  std::string attribute = "Volume";
245  cms::DDSpecParRefs refs;
246  const cms::DDSpecParRegistry& mypar = cpv->specpars();
247  mypar.filter(refs, attribute, name);
248  fv.mergedSpecifics(refs);
249  bool ok = fv.firstChild();
251 
252  if (ok) {
253  php.mode_ = getGeometryMode(sv);
254 #ifdef EDM_ML_DEBUG
255  edm::LogVerbatim("HGCalGeom") << "GeometryMode " << php.mode_ << ":" << HGCalGeometryMode::Hexagon << ":"
259 #endif
260  php.levelZSide_ = 3; // Default level for ZSide
261  php.detectorType_ = 0; // These two parameters are
262  php.firstMixedLayer_ = -1; // defined for post TDR geometry
263  std::unique_ptr<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
265  tempS = fv.get<std::vector<std::string> >(name, "WaferMode");
266  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::Polyhedra";
267  mode = getGeometryWaferMode(sv2);
268 #ifdef EDM_ML_DEBUG
269  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
271 #endif
272  php.minTileSize_ = 0;
273  }
275  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
276  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
277  php.levelZSide_ = static_cast<int>(tempD[0]);
278  php.nCellsFine_ = php.nCellsCoarse_ = 0;
279  php.firstLayer_ = 1;
280  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
281  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
282  tempD = fv.get<std::vector<double> >(name, "DetectorType");
283  php.detectorType_ = static_cast<int>(tempD[0]);
284  php.minTileSize_ = 0;
285 #ifdef EDM_ML_DEBUG
286  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level "
287  << php.levelZSide_ << " first layers " << php.firstLayer_ << ":"
288  << php.firstMixedLayer_ << " Det Type " << php.detectorType_;
289 #endif
290 
291  tempS = fv.get<std::vector<std::string> >(name, "WaferMode");
292  std::string sv2 = (!tempS.empty()) ? tempS[0] : "HGCalGeometryMode::ExtrudedPolygon";
293  mode = getGeometryWaferMode(sv2);
294  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsFine");
295  php.nCellsFine_ = static_cast<int>(tempD[0]);
296  tempD = fv.get<std::vector<double> >(namet, "NumberOfCellsCoarse");
297  php.nCellsCoarse_ = static_cast<int>(tempD[0]);
298  tempD = fv.get<std::vector<double> >(namet, "WaferSize");
300  tempD = fv.get<std::vector<double> >(namet, "WaferThickness");
302  tempD = fv.get<std::vector<double> >(namet, "SensorSeparation");
304  tempD = fv.get<std::vector<double> >(namet, "MouseBite");
306  php.waferR_ = 0.5 * HGCalParameters::k_ScaleToDDD * php.waferSize_ / std::cos(30._deg);
307  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
308  php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
309 #ifdef EDM_ML_DEBUG
310  edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra << ":"
311  << HGCalGeometryMode::ExtrudedPolygon << " # of cells|size for fine/coarse "
312  << php.nCellsFine_ << ":" << php.cellSize_[0] << ":" << php.nCellsCoarse_ << ":"
313  << php.cellSize_[1] << " wafer Params " << php.waferSize_ << ":" << php.waferR_
314  << ":" << php.waferThick_ << ":" << php.sensorSeparation_ << ":" << php.mouseBite_
315  << ":" << php.waferR_;
316 #endif
317  for (int k = 0; k < 2; ++k)
318  getCellPosition(php, k);
319  }
320  if (php.mode_ == HGCalGeometryMode::Hexagon) {
321  // Load the SpecPars
322  php.firstLayer_ = 1;
323  geom->loadSpecParsHexagon(fv, php, cpv, name, namew, namec, name2);
324  // Load the Geometry parameters
325  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
326  // Load cell parameters
327  geom->loadCellParsHexagon(vmap, php);
328  // Set complete fill mode
329  php.defineFull_ = false;
330  } else if (php.mode_ == HGCalGeometryMode::HexagonFull) {
331  // Load the SpecPars
332  php.firstLayer_ = 1;
333  geom->loadSpecParsHexagon(fv, php, cpv, name, namew, namec, name2);
334  // Load the Geometry parameters
335  geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
336  // Modify some constants
337  geom->loadWaferHexagon(php);
338  // Load cell parameters
339  geom->loadCellParsHexagon(vmap, php);
340  // Set complete fill mode
341  php.defineFull_ = true;
342  } else if (php.mode_ == HGCalGeometryMode::Hexagon8) {
343  // Load the SpecPars
344  geom->loadSpecParsHexagon8(fv, vmap, php, name);
345  // Load Geometry parameters
346  geom->loadGeometryHexagon8(fv, php, 1);
347  // Set complete fill mode
348  php.defineFull_ = false;
349  // Load wafer positions
350  geom->loadWaferHexagon8(php);
351  } else if (php.mode_ == HGCalGeometryMode::Hexagon8Full) {
352  // Load the SpecPars
353  geom->loadSpecParsHexagon8(fv, vmap, php, name);
354  // Load Geometry parameters
355  geom->loadGeometryHexagon8(fv, php, 1);
356  // Set complete fill mode
357  php.defineFull_ = true;
358  // Load wafer positions
359  geom->loadWaferHexagon8(php);
360  } else if (php.mode_ == HGCalGeometryMode::Trapezoid) {
361  // Load maximum eta & top level
362  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(name, "LevelTop"));
363  tempD = fv.get<std::vector<double> >(name, "LevelZSide");
364  php.levelZSide_ = static_cast<int>(tempD[0]);
365  php.nCellsFine_ = php.nCellsCoarse_ = 0;
366  tempD = fv.get<std::vector<double> >(name, "FirstLayer");
367  php.firstLayer_ = static_cast<int>(tempD[0]);
368  tempD = fv.get<std::vector<double> >(name, "FirstMixedLayer");
369  php.firstMixedLayer_ = static_cast<int>(tempD[0]);
370  tempD = fv.get<std::vector<double> >(name, "DetectorType");
371  php.detectorType_ = static_cast<int>(tempD[0]);
372  tempD = fv.get<std::vector<double> >(name, "WaferThickness");
374  tempD = fv.get<std::vector<double> >(name, "MinimumTileSize");
376  php.waferSize_ = php.waferR_ = 0;
377  php.sensorSeparation_ = php.mouseBite_ = 0;
378 #ifdef EDM_ML_DEBUG
379  edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " first layers "
380  << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type "
381  << php.detectorType_ << " thickenss " << php.waferThick_ << " min tile size "
382  << php.minTileSize_;
383 #endif
384  // Load the SpecPars
385  geom->loadSpecParsTrapezoid(fv, vmap, php, name);
386  // Load Geometry parameters
387  geom->loadGeometryHexagon8(fv, php, php.firstLayer_);
388  // Load cell positions
389  geom->loadCellTrapezoid(php);
390  } else {
391  edm::LogError("HGCalGeom") << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew
392  << ":" << namec;
393  throw cms::Exception("DDException")
394  << "Unknown Geometry type " << php.mode_ << " for HGCal " << name << ":" << namew << ":" << namec;
395  }
396  } else {
397  edm::LogError("HGCalGeom") << " Attribute " << attribute << ":" << name << " not found but needed.";
398  throw cms::Exception("DDException") << "Attribute " << attribute << ":" << name << " not found but needed.";
399  }
400 #ifdef EDM_ML_DEBUG
401  edm::LogVerbatim("HGCalGeom") << "Return from HGCalParametersFromDD::build"
402  << " with flag " << ok;
403 #endif
404  return ok;
405 }
Volume worldVolume() const
Handle to the world volume containing everything.
Definition: DDDetector.cc:41
void filter(DDSpecParRefs &, std::string_view, std::string_view) const
HGCalGeometryMode::GeometryMode mode_
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
DDVectorsMap const & vectors() const
Definition: DDDetector.h:22
std::vector< double > cellSize_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
tbb::concurrent_unordered_map< std::string, tbb::concurrent_vector< double >> DDVectorsMap
Definition: DDNamespace.h:14
static double k_ScaleToDDD
std::vector< const DDSpecPar * > DDSpecParRefs
static double k_ScaleFromDD4Hep
DDSpecParRegistry const & specpars() const
Definition: DDCompactView.h:33
std::vector< int > levelT_
const cms::DDDetector * detector() const
Definition: DDCompactView.h:32
void getCellPosition(HGCalParameters &php, int type)
void HGCalParametersFromDD::getCellPosition ( HGCalParameters php,
int  type 
)
private

Definition at line 407 of file HGCalParametersFromDD.cc.

References HGCalParameters::cellCoarseIndex_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineIndex_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, triggerObjects_cff::id, dqmdumpme::k, N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, dttmaxenums::R, alignCSCRings::r, mathSSE::sqrt(), findQualityFiles::v, and HGCalParameters::waferSize_.

Referenced by ~HGCalParametersFromDD().

407  {
408  if (type == 1) {
409  php.cellCoarseX_.clear();
410  php.cellCoarseY_.clear();
411  } else {
412  php.cellFineX_.clear();
413  php.cellFineY_.clear();
414  }
415  HGCalParameters::wafer_map cellIndex;
416 #ifdef EDM_ML_DEBUG
417  std::vector<int> indtypes;
418 #endif
419  int N = (type == 1) ? php.nCellsCoarse_ : php.nCellsFine_;
420  double R = php.waferSize_ / (3 * N);
421  double r = 0.5 * R * sqrt(3.0);
422  int n2 = N / 2;
423  int ipos(0);
424  for (int u = 0; u < 2 * N; ++u) {
425  for (int v = 0; v < 2 * N; ++v) {
426  if (((v - u) < N) && (u - v) <= N) {
427  double yp = (u - 0.5 * v - n2) * 2 * r;
428  double xp = (1.5 * (v - N) + 1.0) * R;
429  int id = v * 100 + u;
430 #ifdef EDM_ML_DEBUG
431  indtypes.emplace_back(id);
432 #endif
433  if (type == 1) {
434  php.cellCoarseX_.emplace_back(xp);
435  php.cellCoarseY_.emplace_back(yp);
436  } else {
437  php.cellFineX_.emplace_back(xp);
438  php.cellFineY_.emplace_back(yp);
439  }
440  cellIndex[id] = ipos;
441  ++ipos;
442  }
443  }
444  }
445  if (type == 1)
446  php.cellCoarseIndex_ = cellIndex;
447  else
448  php.cellFineIndex_ = cellIndex;
449 #ifdef EDM_ML_DEBUG
450  if (type == 1) {
451  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellCoarseX_.size()
452  << " cells";
453  for (unsigned int k = 0; k < php.cellCoarseX_.size(); ++k) {
454  int id = indtypes[k];
455  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellCoarseIndex_[id] << " X "
456  << php.cellCoarseX_[k] << " Y " << php.cellCoarseY_[k];
457  }
458  } else {
459  edm::LogVerbatim("HGCalGeom") << "CellPosition for type " << type << " for " << php.cellFineX_.size() << " cells";
460  for (unsigned int k = 0; k < php.cellCoarseX_.size(); ++k) {
461  int id = indtypes[k];
462  edm::LogVerbatim("HGCalGeom") << "[" << k << "] ID " << id << ":" << php.cellFineIndex_[k] << " X "
463  << php.cellFineX_[k] << " Y " << php.cellFineY_[k];
464  }
465  }
466 #endif
467 }
type
Definition: HCALResponse.h:21
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_
std::vector< double > HGCalParametersFromDD::getDDDArray ( const char *  s,
const DDsvalues_type sv 
)
private

Definition at line 482 of file HGCalParametersFromDD.cc.

References DDfetch(), DDValue::doubles(), Exception, and heppy_batch::val.

Referenced by ~HGCalParametersFromDD().

482  {
483  DDValue val(s);
484  if (DDfetch(&sv, val)) {
485  const std::vector<double>& fvec = val.doubles();
486  if (fvec.empty()) {
487  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag.";
488  }
489  return fvec;
490  } else {
491  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag";
492  }
493 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
double HGCalParametersFromDD::getDDDValue ( const char *  s,
const DDsvalues_type sv 
)
private

Definition at line 469 of file HGCalParametersFromDD.cc.

References DDfetch(), DDValue::doubles(), Exception, and heppy_batch::val.

Referenced by ~HGCalParametersFromDD().

469  {
470  DDValue val(s);
471  if (DDfetch(&sv, val)) {
472  const std::vector<double>& fvec = val.doubles();
473  if (fvec.empty()) {
474  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag.";
475  }
476  return fvec[0];
477  } else {
478  throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag";
479  }
480 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79