34 using namespace geant_units::operators;
46 return this->buildGeometry(fview, muonConstants);
55 return this->buildGeometry(fview, muonConstants);
63 LogTrace(
"ME0Geometry") <<
"Building the geometry service";
64 LogTrace(
"ME0Geometry") <<
"About to run through the ME0 structure\n"
72 LogTrace(
"ME0Geometry") <<
"doChamber = fv.firstChild() = " << testChambers;
74 while (testChambers) {
85 LogTrace(
"ME0Geometry") <<
"In DoChambers Loop :: ME0DetId " << detId <<
" = " << detId.
rawId()
86 <<
" (which belongs to ME0Chamber " << detIdCh <<
" = " << detIdCh.
rawId() <<
")";
89 std::vector<double> dpar2 = solid2.
parameters();
90 std::stringstream parameters2;
91 for (
unsigned int i = 0;
i < dpar2.size(); ++
i) {
92 parameters2 <<
" dpar[" <<
i <<
"]=" <<
convertMmToCm(dpar2[
i]) <<
"cm ";
94 LogTrace(
"ME0Geometry") <<
"Second level parameters: vector with size = " << dpar2.size() <<
" and elements "
99 LogTrace(
"ME0Geometry") <<
"doLayer = fv.firstChild() = " << doLayers;
108 LogTrace(
"ME0Geometry") <<
"In DoLayers Loop :: ME0DetId " << detId <<
" = " << detId.
rawId()
109 <<
" (which belongs to ME0Layer " << detIdLa <<
" = " << detIdLa.
rawId() <<
")";
112 std::vector<double> dpar3 = solid3.
parameters();
113 std::stringstream parameters3;
114 for (
unsigned int i = 0;
i < dpar3.size(); ++
i) {
115 parameters3 <<
" dpar[" <<
i <<
"]=" <<
convertMmToCm(dpar3[
i]) <<
"cm ";
117 LogTrace(
"ME0Geometry") <<
"Third level parameters: vector with size = " << dpar3.size() <<
" and elements "
118 << parameters3.str();
121 LogTrace(
"ME0Geometry") <<
"doEtaPart = fv.firstChild() = " << doEtaParts;
123 LogTrace(
"ME0Geometry") <<
"In DoEtaParts Loop :: ME0DetId " << detId <<
" = " << detId.
rawId();
126 std::vector<double> dpar4 = solid4.
parameters();
127 std::stringstream parameters4;
128 for (
unsigned int i = 0;
i < dpar4.size(); ++
i) {
129 parameters4 <<
" dpar[" <<
i <<
"]=" <<
convertMmToCm(dpar4[
i]) <<
"cm ";
131 LogTrace(
"ME0Geometry") <<
"Fourth level parameters: vector with size = " << dpar4.size() <<
" and elements "
132 << parameters4.str();
135 LogTrace(
"ME0Geometry") <<
"doEtaPart = fv.nextSibling() = " << doEtaParts;
139 <<
" will now ask for nextSibling";
141 LogTrace(
"ME0Geometry") <<
"doLayer = fv.nextSibling() = " << doLayers;
145 <<
" will now ask for nextSibling";
147 LogTrace(
"ME0Geometry") <<
"doChamber = fv.nextSibling() = " << testChambers;
177 ME0Chamber* me0Chamber = buildChamber(fv, detIdCh);
178 geometry->
add(me0Chamber);
195 ME0Layer* me0Layer = buildLayer(fv, detIdLa);
196 me0Chamber->
add(me0Layer);
197 geometry->
add(me0Layer);
213 me0Layer->
add(etaPart);
214 geometry->
add(etaPart);
233 std::vector<double> dpar = solid.
parameters();
242 LogTrace(
"ME0Geometry") <<
" dpar is vector with size = " << dpar.size() << std::endl;
243 for (
unsigned int i = 0;
i < dpar.size(); ++
i) {
246 LogTrace(
"ME0Geometry") <<
"size b: " << b <<
"cm, B: " << B <<
"cm, L: " << L <<
"cm, T: " << T <<
"cm "
261 std::vector<double> dpar = solid.
parameters();
269 LogTrace(
"ME0Geometry") <<
" dpar is vector with size = " << dpar.size() << std::endl;
270 for (
unsigned int i = 0;
i < dpar.size(); ++
i) {
273 LogTrace(
"ME0Geometry") <<
"size b: " << b <<
"cm, B: " << B <<
"cm, L: " << L <<
"cm, t: " << t <<
"cm "
287 DDValue numbOfStrips(
"nStrips");
289 std::vector<const DDsvalues_type*> specs(fv.
specifics());
290 double nStrips = 0., nPads = 0.;
291 for (
const auto& is : specs) {
293 nStrips = numbOfStrips.
doubles()[0];
295 nPads = numbOfPads.
doubles()[0];
298 LogTrace(
"ME0Geometry") << ((nStrips == 0.) ? (
"No nStrips found!!")
299 : (
"Number of strips: " + std::to_string(nStrips)));
300 LogTrace(
"ME0Geometry") << ((nPads == 0.) ? (
"No nPads found!!") : (
"Number of pads: " + std::to_string(nPads)));
311 LogTrace(
"ME0Geometry") <<
" dpar is vector with size = " << dpar.size() << std::endl;
312 for (
unsigned int i = 0;
i < dpar.size(); ++
i) {
315 LogTrace(
"ME0Geometry") <<
"size b: " << b <<
"cm, B: " << B <<
"cm, L: " << L <<
"cm, t: " << t <<
"cm "
319 std::vector<float> pars;
320 pars.emplace_back(b);
321 pars.emplace_back(B);
322 pars.emplace_back(L);
323 pars.emplace_back(nStrips);
324 pars.emplace_back(nPads);
337 bool isOddChamber)
const {
345 rotation.GetComponents(x, y, z);
375 static constexpr uint32_t levelChamber = 7;
376 static constexpr uint32_t levelLayer = 8;
377 uint32_t theLevelPart = muonConstants.
getValue(
"level");
378 uint32_t theSectorLevel = muonConstants.
getValue(
"m0_sector") / theLevelPart;
380 std::vector<ME0Layer*>
layers;
391 << theSectorLevel <<
":" <<
history.tags.size() <<
":" << fv.
level();
392 for (
unsigned int k = 0;
k <
history.tags.size(); ++
k)
397 if (fv.
level() == levelChamber) {
399 ME0Chamber* me0Chamber = buildChamber(fv, detId);
400 chambers.emplace_back(me0Chamber);
401 }
else if (fv.
level() == levelLayer) {
403 ME0Layer* me0Layer = buildLayer(fv, detId);
404 layers.emplace_back(me0Layer);
405 }
else if (
history.tags.size() > theSectorLevel) {
408 geometry->
add(etaPart);
413 for (
auto&
layer : layers) {
422 for (
auto& chamber : chambers) {
424 for (
auto&
layer : layers) {
429 geometry->
add(chamber);
437 double L = k_ScaleFromDD4hep * dpar[3];
438 double T = k_ScaleFromDD4hep * dpar[2];
439 double b = k_ScaleFromDD4hep * dpar[0];
440 double B = k_ScaleFromDD4hep * dpar[1];
451 double L = k_ScaleFromDD4hep * dpar[3];
452 double t = k_ScaleFromDD4hep * dpar[2];
453 double b = k_ScaleFromDD4hep * dpar[0];
454 double B = k_ScaleFromDD4hep * dpar[1];
471 double b = k_ScaleFromDD4hep * dpar[0];
472 double B = k_ScaleFromDD4hep * dpar[1];
473 double L = k_ScaleFromDD4hep * dpar[3];
474 double t = k_ScaleFromDD4hep * dpar[2];
476 const std::vector<float> pars{float(dpar[0]), float(dpar[1]), float(dpar[3]), float(
nStrips), float(nPads)};
492 bool isOddChamber)
const {
494 const Double_t* trans = fv.
trans();
496 k_ScaleFromDD4hep * trans[0], k_ScaleFromDD4hep * trans[1], k_ScaleFromDD4hep * trans[2]);
502 rotation.GetComponents(x, y, z);
Log< level::Info, true > LogVerbatim
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
bool parent()
set the current node to the parent node ...
ME0BoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
ME0DetId layerId() const
Return the corresponding LayerId (mask eta partition)
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history) const
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
int getValue(const std::string &name) const
ME0DetId chamberId() const
Return the corresponding ChamberId (mask layers)
ME0Geometry * build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
bool nextSibling()
set the current node to the next sibling ...
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
constexpr uint32_t rawId() const
get the raw id
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
int baseNumberToUnitNumber(const MuonBaseNumber &) const override
Compact representation of the geometrical detector hierarchy.
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
static constexpr uint32_t chamberIdMask_
void add(ME0Layer *layer)
Add Layer to the chamber which takes ownership.
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
tuple nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
constexpr std::array< uint8_t, layerIndexSize > layer
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const ExpandedNodes & history()
The numbering history of the current node.
const Double_t * rot() const
The absolute rotation of the current node.
void add(const ME0EtaPartition *roll)
Add EtaPartition to the layer which takes ownership.
static const std::string B
std::string_view name() const
bool firstChild()
set the current node to the first child
const std::vector< ME0EtaPartition const * > & etaPartitions() const
Return a vector of all ME0 eta partitions.
static constexpr uint32_t layerIdMask_
const Double_t * trans() const
The absolute translation of the current node.
ME0Geometry * buildGeometry(DDFilteredView &fview, const MuonGeometryConstants &muonConstants)
void add(ME0EtaPartition *etaPartition)
Add a ME0 etaPartition to the Geometry.
bool firstChild()
set the current node to the first child ...
constexpr NumType convertMmToCm(NumType millimeters)
ME0Layer * buildLayer(DDFilteredView &fv, ME0DetId detId) const
const std::vector< double > parameters() const
extract shape parameters
ME0Chamber * buildChamber(DDFilteredView &fv, ME0DetId detId) const
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< const DDsvalues_type * > specifics() const
const int level() const
get Iterator level
static char chambers[264][20]
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
const std::string & name() const
Returns the name.
ME0EtaPartition * buildEtaPartition(DDFilteredView &fv, ME0DetId detId) const