36 using namespace geant_units::operators;
71 std::vector<GEMSuperChamber*> superChambers;
96 if (detIdCh.
layer() == 1) {
98 superChambers.push_back(gemSuperChamber);
105 bool loopExecuted =
false;
120 gemChamber = buildChamber(fv, detId);
134 gemChamber->
add(etaPart);
135 theGeometry.
add(etaPart);
141 theGeometry.
add(gemChamber);
154 buildRegions(theGeometry, superChambers);
172 const double chgap = 2.105;
181 bool isOdd = detId.
chamber() % 2;
185 edm::LogVerbatim(
"Geometry") <<
"size " << dx1 <<
" " << dx2 <<
" " << dy <<
" " <<
dz;
209 bool isOdd = ge0Station ?
false : detId.
chamber() % 2;
214 edm::LogVerbatim(
"Geometry") <<
"size " << dx1 <<
" " << dx2 <<
" " << dy <<
" " <<
dz;
225 DDValue numbOfStrips(
"nStrips");
228 std::vector<const DDsvalues_type*> specs(fv.
specifics());
229 std::vector<const DDsvalues_type*>::iterator is = specs.begin();
230 double nStrips = 0., nPads = 0., dPhi = 0.;
231 for (; is != specs.end(); is++) {
232 if (
DDfetch(*is, numbOfStrips))
233 nStrips = numbOfStrips.
doubles()[0];
235 nPads = numbOfPads.
doubles()[0];
241 : (
"Number of strips: " + std::to_string(nStrips)));
242 edm::LogVerbatim(
"Geometry") << ((nPads == 0.) ? (
"No nPads found!!") : (
"Number of pads: " + std::to_string(nPads)));
252 std::vector<float> pars;
253 pars.emplace_back(be);
254 pars.emplace_back(te);
255 pars.emplace_back(ap);
256 pars.emplace_back(nStrips);
257 pars.emplace_back(nPads);
258 pars.emplace_back(dPhi);
260 bool isOdd = detId.
chamber() % 2;
266 edm::LogVerbatim(
"Geometry") <<
"size " << be <<
" " << te <<
" " << ap <<
" " << ti;
274 bool isOddChamber)
const {
282 rotation.GetComponents(x, y, z);
316 static constexpr uint32_t levelChamb = 7;
318 int theLevelPart = muonConstants.
getValue(
"level");
319 int theRingLevel = muonConstants.
getValue(
"mg_ring") / theLevelPart;
320 int theSectorLevel = muonConstants.
getValue(
"mg_sector") / theLevelPart;
321 std::vector<GEMSuperChamber*> superChambers;
332 <<
":" << theSectorLevel <<
":" <<
history.tags.size() <<
":" << fv.
level();
333 for (
unsigned int k = 0;
k <
history.tags.size(); ++
k)
339 if (
num.getLevels() == theRingLevel) {
340 if (detId.region() !=
region) {
341 region = detId.region();
345 detId =
GEMDetId(detId.region(), detId.ring(), detId.station(), detId.layer(), chamb, 0);
347 superChambers.emplace_back(gemSuperChamber);
348 }
else if (
num.getLevels() == theSectorLevel) {
349 GEMChamber* gemChamber = buildChamber(fv, detId);
350 chambers.emplace_back(gemChamber);
353 theGeometry.
add(etaPart);
356 if (fv.
level() == levelChamb) {
357 if (detId.layer() == 1) {
359 superChambers.emplace_back(gemSuperChamber);
361 GEMChamber* gemChamber = buildChamber(fv, detId);
362 chambers.emplace_back(gemChamber);
363 }
else if (
num.getLevels() > theSectorLevel) {
365 theGeometry.
add(etaPart);
371 for (
auto& gemChamber : chambers) {
375 gemChamber->add(etaPart);
378 theGeometry.
add(gemChamber);
381 buildRegions(theGeometry, superChambers);
386 auto solidA = solid.
solidA();
387 std::vector<double> dpar = solidA.dimensions();
389 double dy = k_ScaleFromDD4hep * dpar[3];
390 double dz = k_ScaleFromDD4hep * dpar[2];
391 double dx1 = k_ScaleFromDD4hep * dpar[0];
392 double dx2 = k_ScaleFromDD4hep * dpar[1];
394 auto solidB = solid.solidB();
395 dpar = solidB.dimensions();
397 const double chgap = 2.105;
399 dz += (k_ScaleFromDD4hep * dpar[2]);
403 bool isOdd = detId.
chamber() % 2;
412 auto solidA = solid.
solidA();
413 std::vector<double> dpar = solidA.dimensions();
415 double dy = k_ScaleFromDD4hep * dpar[3];
416 double dz = k_ScaleFromDD4hep * dpar[2];
417 double dx1 = k_ScaleFromDD4hep * dpar[0];
418 double dx2 = k_ScaleFromDD4hep * dpar[1];
420 auto solidB = solid.solidB();
421 dpar = solidB.dimensions();
423 dz += (k_ScaleFromDD4hep * dpar[2]);
425 bool isOdd = detId.
chamber() % 2;
436 auto nPads = fv.
get<
double>(
"nPads");
437 auto dPhi = fv.
get<
double>(
"dPhi");
444 const std::vector<float> pars{float(k_ScaleFromDD4hep * dpar[0]),
445 float(k_ScaleFromDD4hep * dpar[1]),
446 float(k_ScaleFromDD4hep * dpar[3]),
451 bool isOdd = detId.
chamber() % 2;
455 k_ScaleFromDD4hep * dpar[0], k_ScaleFromDD4hep * dpar[1], k_ScaleFromDD4hep * dpar[3], ti),
468 bool isOddChamber)
const {
470 const Double_t* tran = fv.
trans();
472 k_ScaleFromDD4hep * tran[0], k_ScaleFromDD4hep * tran[1], k_ScaleFromDD4hep * tran[2]);
478 rota.GetComponents(x, y, z);
501 for (
int re = -1; re <= 1; re = re + 2) {
510 bool foundSuperChamber =
false;
511 for (
int ri = 1; ri <= 1; ++ri) {
513 for (
auto superChamber : superChambers) {
514 const GEMDetId detId(superChamber->id());
515 if (detId.region() != re || detId.station() != st || detId.ring() != ri)
518 foundSuperChamber =
true;
523 GEMDetId chId(detId.region(), detId.ring(), detId.station(), la, detId.chamber(), 0);
524 auto chamber = theGeometry.
chamber(chId);
528 superChamber->add(chamber);
531 ring->
add(superChamber);
532 theGeometry.
add(superChamber);
534 edm::LogVerbatim(
"Geometry") <<
"Adding super chamber " << detId <<
" to ring: "
535 <<
"re " << re <<
" st " << st <<
" ri " << ri;
540 <<
"re " << re <<
" st " << st;
542 if (foundSuperChamber) {
544 theGeometry.
add(ring);
547 if (!foundSuperChamber) {
549 edm::LogVerbatim(
"Geometry") <<
"No superchamber found: re:" << re <<
" st:" << st;
554 edm::LogVerbatim(
"Geometry") <<
"Adding station " << st <<
" to region " << re;
556 region->
add(station);
557 theGeometry.
add(station);
561 edm::LogVerbatim(
"Geometry") <<
"Adding region " << re <<
" to the geometry ";
563 theGeometry.
add(region);
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 ...
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
int getValue(const std::string &name) const
bool nextSibling()
set the current node to the next sibling ...
dd4hep::Solid solidA() const
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
GEMEtaPartition * buildEtaPartition(DDFilteredView &fv, GEMDetId detId) const
void buildRegions(GEMGeometry &, const std::vector< GEMSuperChamber * > &)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Compact representation of the geometrical detector hierarchy.
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
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...
void add(GEMRing *ring)
Add ring to the station which takes ownership.
void add(GEMSuperChamber *ch)
Add super chamber to the ring which takes ownership.
static constexpr int32_t maxLayerId0
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
DDSolid solidB(void) const
static double delPhi(const double phi1, const double phi2)
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const ExpandedNodes & history()
The numbering history of the current node.
static constexpr uint32_t chamberIdMask
static constexpr int32_t minStationId0
void build(GEMGeometry &theGeometry, const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
static constexpr int32_t maxStationId
const Double_t * rot() const
The absolute rotation of the current node.
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
constexpr GEMDetId chamberId() const
void setName(std::string name)
Set the station name.
std::string_view name() const
bool firstChild()
set the current node to the first child
DDSolid solidA(void) const
T get(const std::string &)
extract attribute value
const Double_t * trans() const
The absolute translation of the current node.
GEMChamber * buildChamber(DDFilteredView &fv, GEMDetId detId) const
constexpr int chamber() const
constexpr int layer() const
const GEMChamber * chamber(GEMDetId id) const
constexpr int station() const
static constexpr int32_t maxLayerId
bool firstChild()
set the current node to the first child ...
constexpr NumType convertMmToCm(NumType millimeters)
int baseNumberToUnitNumber(const MuonBaseNumber &) const override
void add(GEMStation *st)
Add station to the region which takes ownership.
GEMSuperChamber * buildSuperChamber(DDFilteredView &fv, GEMDetId detId) const
const std::vector< double > parameters() const
extract shape parameters
const DDTranslation & translation() const
The absolute translation of the current node.
constexpr GEMDetId superChamberId() const
std::vector< const DDsvalues_type * > specifics() const
Log< level::Warning, false > LogWarning
const int level() const
get Iterator level
static char chambers[264][20]
void add(const GEMEtaPartition *roll)
Add EtaPartition to the chamber which takes ownership.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
static constexpr int32_t minLayerId
const std::string & name() const
Returns the name.
dd4hep::Solid solid() const
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.