12 using namespace geant_units::operators;
18 const std::vector<std::string>& fvec =
val.strings();
20 throw cms::Exception(
"HGCalGeom") <<
"Failed to get " << s <<
" tag.";
27 throw cms::Exception(
"HGCalGeom") <<
"Failed to get " << s <<
" tag";
38 const std::vector<std::string>& fvec =
val.strings();
40 throw cms::Exception(
"HGCalGeom") <<
"Failed to get " << s <<
" tag.";
47 throw cms::Exception(
"HGCalGeom") <<
"Failed to get " << s <<
" tag";
64 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalParametersFromDD (DDD)::build called with "
65 <<
"names " << name <<
":" << namew <<
":" << namec <<
":" << namet;
79 php.
mode_ = getGeometryMode(
"GeometryMode", sv);
92 std::unique_ptr<HGCalGeomParameters>
geom = std::make_unique<HGCalGeomParameters>();
94 attribute =
"OnlyForHGCalNumbering";
96 DDValue val2(attribute, value, 0.0);
102 mode = getGeometryWaferMode(
"WaferMode", sv2);
115 php.
levelZSide_ =
static_cast<int>(getDDDValue(
"LevelZSide", sv));
118 php.
firstMixedLayer_ =
static_cast<int>(getDDDValue(
"FirstMixedLayer", sv));
119 php.
detectorType_ =
static_cast<int>(getDDDValue(
"DetectorType", sv));
121 php.
waferMaskMode_ =
static_cast<int>(getDDDValue(
"WaferMaskMode", sv));
122 php.
waferZSide_ =
static_cast<int>(getDDDValue(
"WaferZside", sv));
132 attribute =
"OnlyForHGCalNumbering";
134 DDValue val2(attribute, value, 0.0);
140 mode = getGeometryWaferMode(
"WaferMode", sv2);
141 php.
nCellsFine_ =
static_cast<int>(getDDDValue(
"NumberOfCellsFine", sv2));
142 php.
nCellsCoarse_ =
static_cast<int>(getDDDValue(
"NumberOfCellsCoarse", sv2));
158 for (
int k = 0;
k < 2; ++
k)
159 getCellPosition(php,
k);
165 geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
167 geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
169 geom->loadCellParsHexagon(cpv, php);
175 geom->loadSpecParsHexagon(fv, php, cpv, namew, namec);
177 geom->loadGeometryHexagon(fv, php, name, cpv, namew, namec, mode);
179 geom->loadWaferHexagon(php);
181 geom->loadCellParsHexagon(cpv, php);
186 geom->loadSpecParsHexagon8(fv, php);
188 geom->loadGeometryHexagon8(fv, php, 1);
192 geom->loadWaferHexagon8(php);
195 geom->loadSpecParsHexagon8(fv, php);
197 geom->loadGeometryHexagon8(fv, php, 1);
201 geom->loadWaferHexagon8(php);
204 geom->loadSpecParsHexagon8(fv, php);
206 geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
210 geom->loadWaferHexagon8(php);
212 (php.
mode_ == HGCalGeometryMode::TrapezoidModule)) {
215 php.
firstLayer_ = (int)(getDDDValue(
"FirstLayer", sv));
222 php.
waferMaskMode_ =
static_cast<int>(getDDDValue(
"WaferMaskMode", sv));
223 php.
waferZSide_ =
static_cast<int>(getDDDValue(
"WaferZside", sv));
231 geom->loadSpecParsTrapezoid(fv, php);
233 geom->loadGeometryHexagon8(fv, php, php.
firstLayer_);
235 geom->loadCellTrapezoid(php);
237 edm::LogError(
"HGCalGeom") <<
"Unknown Geometry type " << php.
mode_ <<
" for HGCal " << name <<
":" << namew
240 <<
"Unknown Geometry type " << php.
mode_ <<
" for HGCal " << name <<
":" << namew <<
":" << namec;
243 edm::LogError(
"HGCalGeom") <<
" Attribute " << val <<
" not found but needed.";
244 throw cms::Exception(
"DDException") <<
"Attribute " << val <<
" not found but needed.";
248 <<
" with flag " <<
ok;
261 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalParametersFromDD (DD4hep)::build called with "
262 <<
"names " << name <<
":" << namew <<
":" << namec <<
":" << namet <<
":" << name2;
267 std::vector<std::string> tempS;
268 std::vector<double> tempD;
270 tempS = fv.
get<std::vector<std::string> >(name2,
"GeometryMode");
272 tempS = fv.
get<std::vector<std::string> >(
name,
"GeometryMode");
274 std::string sv = (!tempS.empty()) ? tempS[0] :
"HGCalGeometryMode::Hexagon8Full";
278 php.
mode_ = getGeometryMode(sv);
291 std::unique_ptr<HGCalGeomParameters>
geom = std::make_unique<HGCalGeomParameters>();
293 tempS = fv.
get<std::vector<std::string> >(namet,
"WaferMode");
294 std::string sv2 = (!tempS.empty()) ? tempS[0] :
"HGCalGeometryMode::Polyhedra";
295 mode = getGeometryWaferMode(sv2);
307 tempD = fv.
get<std::vector<double> >(
name,
"LevelZSide");
311 tempD = fv.
get<std::vector<double> >(
name,
"FirstMixedLayer");
313 tempD = fv.
get<std::vector<double> >(
name,
"DetectorType");
316 tempD = fv.
get<std::vector<double> >(
name,
"WaferMaskMode");
318 tempD = fv.
get<std::vector<double> >(
name,
"WaferZside");
321 tempD = fv.
get<std::vector<double> >(
name,
"LayerRotation");
332 tempS = fv.
get<std::vector<std::string> >(namet,
"WaferMode");
333 std::string sv2 = (!tempS.empty()) ? tempS[0] :
"HGCalGeometryMode::ExtrudedPolygon";
334 mode = getGeometryWaferMode(sv2);
335 tempD = fv.
get<std::vector<double> >(namet,
"NumberOfCellsFine");
337 tempD = fv.
get<std::vector<double> >(namet,
"NumberOfCellsCoarse");
339 tempD = fv.
get<std::vector<double> >(namet,
"WaferSize");
341 tempD = fv.
get<std::vector<double> >(namet,
"WaferThickness");
343 tempD = fv.
get<std::vector<double> >(namet,
"SensorSeparation");
345 tempD = fv.
get<std::vector<double> >(namet,
"MouseBite");
358 for (
int k = 0;
k < 2; ++
k)
359 getCellPosition(php,
k);
364 geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
366 geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
368 geom->loadCellParsHexagon(vmap, php);
374 geom->loadSpecParsHexagon(fv, php, name, namew, namec, name2);
376 geom->loadGeometryHexagon(cpv, php, name, namew, namec, mode);
378 geom->loadWaferHexagon(php);
380 geom->loadCellParsHexagon(vmap, php);
385 geom->loadSpecParsHexagon8(fv, vmap, php, name);
387 geom->loadGeometryHexagon8(cpv, php, name, 1);
391 geom->loadWaferHexagon8(php);
394 geom->loadSpecParsHexagon8(fv, vmap, php, name);
396 geom->loadGeometryHexagon8(cpv, php, name, 1);
400 geom->loadWaferHexagon8(php);
403 geom->loadSpecParsHexagon8(fv, vmap, php, name);
405 geom->loadGeometryHexagonModule(cpv, php, name, namec, 1);
409 geom->loadWaferHexagon8(php);
411 (php.
mode_ == HGCalGeometryMode::TrapezoidModule)) {
414 tempD = fv.
get<std::vector<double> >(
name,
"LevelZSide");
417 tempD = fv.
get<std::vector<double> >(
name,
"FirstLayer");
419 tempD = fv.
get<std::vector<double> >(
name,
"FirstMixedLayer");
421 tempD = fv.
get<std::vector<double> >(
name,
"DetectorType");
423 tempD = fv.
get<std::vector<double> >(
name,
"WaferThickness");
425 tempD = fv.
get<std::vector<double> >(
name,
"MinimumTileSize");
429 tempD = fv.
get<std::vector<double> >(
name,
"WaferMaskMode");
431 tempD = fv.
get<std::vector<double> >(
name,
"WaferZside");
441 geom->loadSpecParsTrapezoid(fv, vmap, php, name);
443 geom->loadGeometryHexagon8(cpv, php, name, php.
firstLayer_);
445 geom->loadCellTrapezoid(php);
447 edm::LogError(
"HGCalGeom") <<
"Unknown Geometry type " << php.
mode_ <<
" for HGCal " << name <<
":" << namew
450 <<
"Unknown Geometry type " << php.
mode_ <<
" for HGCal " << name <<
":" << namew <<
":" << namec;
453 edm::LogError(
"HGCalGeom") <<
" Attribute Volume:" << name <<
" not found but needed.";
454 throw cms::Exception(
"DDException") <<
"Attribute Volume:" << name <<
" not found but needed.";
458 <<
" with flag " <<
ok;
473 std::vector<int> indtypes;
477 double r = 0.5 *
R *
sqrt(3.0);
480 for (
int u = 0; u < 2 *
N; ++u) {
481 for (
int v = 0;
v < 2 *
N; ++
v) {
482 if (((
v - u) < N) && (u -
v) <= N) {
483 double yp = (u - 0.5 *
v - n2) * 2 * r;
484 double xp = (1.5 * (
v -
N) + 1.0) *
R;
485 int id =
v * 100 + u;
487 indtypes.emplace_back(
id);
496 cellIndex[
id] = ipos;
511 int id = indtypes[
k];
518 int id = indtypes[
k];
529 const std::vector<double>& fvec = val.
doubles();
531 throw cms::Exception(
"HGCalGeom") <<
"Failed to get " << s <<
" tag.";
535 throw cms::Exception(
"HGCalGeom") <<
"Failed to get " << s <<
" tag";
542 const std::vector<double>& fvec = val.
doubles();
544 throw cms::Exception(
"HGCalGeom") <<
"Failed to get " << s <<
" tag.";
548 throw cms::Exception(
"HGCalGeom") <<
"Failed to get " << s <<
" tag";
std::unordered_map< std::string, std::vector< double >> DDVectorsMap
Log< level::Info, true > LogVerbatim
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
T parseString(const std::string &value)
uint16_t *__restrict__ id
constexpr NumType convertRadToDeg(NumType radians)
std::vector< double > cellFineY_
cms::DDVectorsMap const & vectors() const
Log< level::Error, false > LogError
bool build(const DDCompactView *cpv, HGCalParameters &php, const std::string &name, const std::string &namew, const std::string &namec, const std::string &namet)
Compact representation of the geometrical detector hierarchy.
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellCoarseX_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::vector< double > cellSize_
static constexpr double k_ScaleFromDD4hep
bool firstChild()
set the current node to the first child
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
T get(const std::string &)
extract attribute value
static constexpr double k_ScaleToDDD
std::unordered_map< int32_t, int32_t > wafer_map
double getDDDValue(const char *s, const DDsvalues_type &sv)
wafer_map cellCoarseIndex_
DDsvalues_type mergedSpecifics() const
std::vector< double > cellFineX_
static constexpr double k_ScaleFromDDD
bool firstChild()
set the current node to the first child ...
std::vector< int > levelT_
std::vector< double > cellCoarseY_
std::vector< double > getDDDArray(const char *s, const DDsvalues_type &sv)
const cms::DDDetector * detector() const
void getCellPosition(HGCalParameters &php, int type)