CMS 3D CMS Logo

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

#include <GEMGeometryParsFromDD.h>

Public Member Functions

void build (const DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
 
void build (const cms::DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
 
 GEMGeometryParsFromDD ()
 
 ~GEMGeometryParsFromDD ()
 

Private Member Functions

void buildChamber (DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
 
void buildChamber (cms::DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
 
void buildEtaPartition (DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
 
void buildEtaPartition (cms::DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
 
void buildGeometry (DDFilteredView &fview, DDFilteredView &fview2, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
 
void buildGeometry (cms::DDFilteredView &fview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
 
void buildSuperChamber (DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
 
void buildSuperChamber (cms::DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
 
std::vector< double > getRotation (DDFilteredView &fv)
 
std::vector< double > getRotation (cms::DDFilteredView &fv)
 
std::vector< double > getTranslation (DDFilteredView &fv)
 
std::vector< double > getTranslation (cms::DDFilteredView &fv)
 

Detailed Description

Definition at line 28 of file GEMGeometryParsFromDD.h.

Constructor & Destructor Documentation

◆ GEMGeometryParsFromDD()

GEMGeometryParsFromDD::GEMGeometryParsFromDD ( )

Definition at line 31 of file GEMGeometryParsFromDD.cc.

31 {}

◆ ~GEMGeometryParsFromDD()

GEMGeometryParsFromDD::~GEMGeometryParsFromDD ( )

Definition at line 33 of file GEMGeometryParsFromDD.cc.

33 {}

Member Function Documentation

◆ build() [1/2]

void GEMGeometryParsFromDD::build ( const DDCompactView cview,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rgeo 
)

Definition at line 37 of file GEMGeometryParsFromDD.cc.

References buildGeometry(), ALCARECOTkAlBeamHalo_cff::filter, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GEMRecoIdealDBLoader::beginRun().

39  {
40  std::string attribute = "MuStructure";
41  std::string value = "MuonEndCapGEM";
42 
43  // Asking only for the MuonGEM's
45  DDFilteredView fv(*cview, filter);
46  DDFilteredView fv2(*cview, filter);
47 
48  this->buildGeometry(fv, fv2, muonConstants, rgeo);
49 }
void buildGeometry(DDFilteredView &fview, DDFilteredView &fview2, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
Definition: value.py:1

◆ build() [2/2]

void GEMGeometryParsFromDD::build ( const cms::DDCompactView cview,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rgeo 
)

Definition at line 265 of file GEMGeometryParsFromDD.cc.

References buildGeometry(), ALCARECOTkAlBeamHalo_cff::filter, and AlCaHLTBitMon_QueryRunRegistry::string.

267  {
268  std::string attribute = "MuStructure";
269  std::string value = "MuonEndCapGEM";
270 
271  const cms::DDFilter filter(attribute, value);
272  cms::DDFilteredView fv(*cview, filter);
273 
274  this->buildGeometry(fv, muonConstants, rgeo);
275 }
void buildGeometry(DDFilteredView &fview, DDFilteredView &fview2, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
Definition: value.py:1

◆ buildChamber() [1/2]

void GEMGeometryParsFromDD::buildChamber ( DDFilteredView fv,
GEMDetId  detId,
RecoIdealGeometry rgeo 
)
private

Definition at line 175 of file GEMGeometryParsFromDD.cc.

References hcalRecHitTable_cff::detId, PVValHelper::dy, PVValHelper::dz, getRotation(), getTranslation(), RecoIdealGeometry::insert(), LogDebug, DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), DDSolid::parameters(), DetId::rawId(), DDLogicalPart::solid(), DDBooleanSolid::solidA(), and DDBooleanSolid::solidB().

Referenced by buildGeometry().

175  {
176  LogDebug("GEMGeometryParsFromDD") << "buildChamber " << fv.logicalPart().name().name() << " " << detId << std::endl;
177 
179  std::vector<double> dpar = solid.solidA().parameters();
180 
181  double dy = dpar[0]; //length is along local Y
182  double dz = dpar[3]; // thickness is long local Z
183  double dx1 = dpar[4]; // bottom width is along local X
184  double dx2 = dpar[8]; // top width is along local X
185  dpar = solid.solidB().parameters();
186  dz += dpar[3]; // chamber thickness
187 
188  GEMDetId gemid = detId.chamberId();
189 
190  std::vector<double> pars{dx1, dx2, dy, dz};
191  std::vector<double> vtra = getTranslation(fv);
192  std::vector<double> vrot = getRotation(fv);
193 
194  LogDebug("GEMGeometryParsFromDD") << "dimension dx1 " << dx1 << ", dx2 " << dx2 << ", dy " << dy << ", dz " << dz;
195  edm::LogVerbatim("GEMGeometryParsFromDD")
196  << "(4) DDD, Chamber DetID " << gemid.rawId() << " Name " << fv.logicalPart().name().name() << " dx1 " << dx1
197  << " dx2 " << dx2 << " dy " << dy << " dz " << dz;
198  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
199 }
Log< level::Info, true > LogVerbatim
DDSolid solidA(void) const
Definition: DDSolid.cc:470
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
std::vector< double > getRotation(DDFilteredView &fv)
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
DDSolid solidB(void) const
Definition: DDSolid.cc:472
const N & name() const
Definition: DDBase.h:58
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
std::vector< double > getTranslation(DDFilteredView &fv)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
#define LogDebug(id)

◆ buildChamber() [2/2]

void GEMGeometryParsFromDD::buildChamber ( cms::DDFilteredView fv,
GEMDetId  detId,
RecoIdealGeometry rgeo 
)
private

Definition at line 372 of file GEMGeometryParsFromDD.cc.

References hcalRecHitTable_cff::detId, PVValHelper::dy, PVValHelper::dz, getRotation(), getTranslation(), RecoIdealGeometry::insert(), mergeVDriftHistosByStation::name, cms::DDFilteredView::name(), DetId::rawId(), cms::DDFilteredView::solid(), cms::DDSolid::solidA(), and AlCaHLTBitMon_QueryRunRegistry::string.

372  {
373  cms::DDSolid solid(fv.solid());
374  auto solidA = solid.solidA();
375  std::vector<double> dpar = solidA.dimensions();
376 
377  double dy = dpar[3] / dd4hep::mm; //length is along local Y
378  double dz = dpar[2] / dd4hep::mm; // thickness is long local Z
379  double dx1 = dpar[0] / dd4hep::mm; // bottom width is along local X
380  double dx2 = dpar[1] / dd4hep::mm; // top width is along local X
381 
382  auto solidB = solid.solidB();
383  dpar = solidB.dimensions();
384 
385  dz += (dpar[2] / dd4hep::mm); // chamber thickness
386 
387  GEMDetId gemid = detId.chamberId();
388  std::string_view name = fv.name();
389 
390  std::vector<double> pars{dx1, dx2, dy, dz};
391  std::vector<double> vtra = getTranslation(fv);
392  std::vector<double> vrot = getRotation(fv);
393 
394  edm::LogVerbatim("GEMGeometryParsFromDD")
395  << "(4) DD4hep, Chamber DetID " << gemid.rawId() << " Name " << std::string(name) << " dx1 " << dx1 << " dx2 "
396  << dx2 << " dy " << dy << " dz " << dz;
397  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {std::string(name)});
398 }
Log< level::Info, true > LogVerbatim
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
dd4hep::Solid solidA() const
std::vector< double > getRotation(DDFilteredView &fv)
std::string_view name() const
std::vector< double > getTranslation(DDFilteredView &fv)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
dd4hep::Solid solid() const

◆ buildEtaPartition() [1/2]

void GEMGeometryParsFromDD::buildEtaPartition ( DDFilteredView fv,
GEMDetId  detId,
RecoIdealGeometry rgeo 
)
private

Definition at line 201 of file GEMGeometryParsFromDD.cc.

References DDfetch(), delPhi(), hcalRecHitTable_cff::detId, DDValue::doubles(), HLT_2024v14_cff::dPhi, PVValHelper::dy, PVValHelper::dz, getRotation(), getTranslation(), RecoIdealGeometry::insert(), LogDebug, DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), me0TriggerPseudoDigis_cff::nStrips, DDSolid::parameters(), DDLogicalPart::solid(), DDFilteredView::specifics(), HistogramManager_cfi::specs, and to_string().

Referenced by buildGeometry().

201  {
202  LogDebug("GEMGeometryParsFromDD") << "buildEtaPartition " << fv.logicalPart().name().name() << " " << detId
203  << std::endl;
204 
205  // EtaPartition specific parameter (nstrips and npads)
206  DDValue numbOfStrips("nStrips");
207  DDValue numbOfPads("nPads");
208  DDValue delPhi("dPhi");
209  const std::vector<const DDsvalues_type*>& specs = fv.specifics();
210  double nStrips = 0., nPads = 0., dPhi = 0.;
211  for (auto const& is : specs) {
212  if (DDfetch(is, numbOfStrips))
213  nStrips = numbOfStrips.doubles()[0];
214  if (DDfetch(is, numbOfPads))
215  nPads = numbOfPads.doubles()[0];
216  if (DDfetch(is, delPhi))
217  dPhi = delPhi.doubles()[0];
218  }
219  LogDebug("GEMGeometryParsFromDD") << ((nStrips == 0.) ? ("No nStrips found!!")
220  : ("Number of strips: " + std::to_string(nStrips)));
221  LogDebug("GEMGeometryParsFromDD") << ((nPads == 0.) ? ("No nPads found!!")
222  : ("Number of pads: " + std::to_string(nPads)));
223 
224  // EtaPartition specific parameter (size)
225  std::vector<double> dpar = fv.logicalPart().solid().parameters();
226 
227  double dy = dpar[0]; //length is along local Y
228  double dz = dpar[3]; //0.4;// thickness is long local Z
229  double dx1 = dpar[4]; // bottom width is along local X
230  double dx2 = dpar[8]; // top width is along local X
231 
232  std::vector<double> pars{dx1, dx2, dy, dz, nStrips, nPads, dPhi};
233  std::vector<double> vtra = getTranslation(fv);
234  std::vector<double> vrot = getRotation(fv);
235 
236  LogDebug("GEMGeometryParsFromDD") << " dx1 " << dx1 << " dx2 " << dx2 << " dy " << dy << " dz " << dz << " nStrips "
237  << nStrips << " nPads " << nPads << " dPhi " << dPhi;
238 
239  edm::LogVerbatim("GEMGeometryParsFromDD")
240  << "(5) DDD, Eta Partion DetID " << detId.rawId() << " Name " << fv.logicalPart().name().name() << " dx1 " << dx1
241  << " dx2 " << dx2 << " dy " << dy << " dz " << dz << " nStrips " << nStrips << " nPads " << nPads << " dPhi "
242  << dPhi;
243  rgeo.insert(detId.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
244 }
Log< level::Info, true > LogVerbatim
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
static std::string to_string(const XMLCh *ch)
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
std::vector< double > getRotation(DDFilteredView &fv)
static double delPhi(const double phi1, const double phi2)
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
const N & name() const
Definition: DDBase.h:58
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
std::vector< const DDsvalues_type * > specifics() const
std::vector< double > getTranslation(DDFilteredView &fv)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
#define LogDebug(id)

◆ buildEtaPartition() [2/2]

void GEMGeometryParsFromDD::buildEtaPartition ( cms::DDFilteredView fv,
GEMDetId  detId,
RecoIdealGeometry rgeo 
)
private

Definition at line 400 of file GEMGeometryParsFromDD.cc.

References hcalRecHitTable_cff::detId, HLT_2024v14_cff::dPhi, PVValHelper::dy, PVValHelper::dz, cms::DDFilteredView::get(), getRotation(), getTranslation(), RecoIdealGeometry::insert(), mergeVDriftHistosByStation::name, cms::DDFilteredView::name(), me0TriggerPseudoDigis_cff::nStrips, cms::DDFilteredView::parameters(), and AlCaHLTBitMon_QueryRunRegistry::string.

400  {
401  auto nStrips = fv.get<double>("nStrips");
402  auto nPads = fv.get<double>("nPads");
403  auto dPhi = fv.get<double>("dPhi");
404 
405  std::vector<double> dpar = fv.parameters();
406  std::string_view name = fv.name();
407 
408  double dx1 = dpar[0] / dd4hep::mm;
409  double dx2 = dpar[1] / dd4hep::mm;
410  double dy = dpar[3] / dd4hep::mm;
411  double dz = dpar[2] / dd4hep::mm;
412 
413  std::vector<double> pars{dx1, dx2, dy, dz, nStrips, nPads, dPhi};
414  std::vector<double> vtra = getTranslation(fv);
415  std::vector<double> vrot = getRotation(fv);
416 
417  edm::LogVerbatim("GEMGeometryParsFromDD")
418  << "(5) DD4hep, Eta Partion DetID " << detId.rawId() << " Name " << std::string(name) << " dx1 " << dx1 << " dx2 "
419  << dx2 << " dy " << dy << " dz " << dz << " nStrips " << nStrips << " nPads " << nPads << " dPhi " << dPhi;
420  rgeo.insert(detId.rawId(), vtra, vrot, pars, {std::string(name)});
421 }
Log< level::Info, true > LogVerbatim
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
std::vector< double > getRotation(DDFilteredView &fv)
std::string_view name() const
T get(const std::string &)
extract attribute value
std::vector< double > getTranslation(DDFilteredView &fv)
const std::vector< double > parameters() const
extract shape parameters

◆ buildGeometry() [1/2]

void GEMGeometryParsFromDD::buildGeometry ( DDFilteredView fview,
DDFilteredView fview2,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rgeo 
)
private

Definition at line 51 of file GEMGeometryParsFromDD.cc.

References GEMNumberingScheme::baseNumberToUnitNumber(), buildChamber(), buildEtaPartition(), buildSuperChamber(), hcalRecHitTable_cff::detId, DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonGeometryNumbering::geoHistoryToBaseNumber(), GEMDetId::layer(), LogDebug, DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), DDFilteredView::nextSibling(), DDFilteredView::parent(), and GEMDetId::station().

Referenced by build().

54  {
55  LogDebug("GEMGeometryParsFromDD") << "Building the geometry service";
56  LogDebug("GEMGeometryParsFromDD") << "About to run through the GEM structure\n"
57  << " First logical part " << fv.logicalPart().name().name();
58 
59  edm::LogVerbatim("GEMGeometryParsFromDD") << "(0) GEMGeometryParsFromDD - DDD ";
60  MuonGeometryNumbering muonDDDNumbering(muonConstants);
61  GEMNumberingScheme gemNumbering(muonConstants);
62 
63  // Check for the demonstrator geometry (only 1 chamber of GE2/1)
64  int nGE21 = 0;
65  bool doSuper = fvGE2.firstChild();
66  while (doSuper) {
67  // getting chamber id from eta partitions
68  fvGE2.firstChild();
69  doSuper = fvGE2.firstChild();
70  if (doSuper) {
71  int rawidCh = gemNumbering.baseNumberToUnitNumber(muonDDDNumbering.geoHistoryToBaseNumber(fvGE2.geoHistory()));
72  GEMDetId detIdCh = GEMDetId(rawidCh);
73  if (detIdCh.station() == 2)
74  nGE21++;
75 
76  // back to chambers
77  fvGE2.parent();
78  fvGE2.parent();
79  // in 2021 we have 1 demonstrator chamber in 2024 we have 3 chambers.
80  // Need to account for both
81  doSuper = (nGE21 < 4 && fvGE2.nextSibling());
82  } else {
83  edm::LogError("GEMGeometryParsFromDD") << "Failed to find next child volume. Cannot determine presence of GE 2/1";
84  }
85  }
86  bool demonstratorGeometry = nGE21 % 2 == 1;
87 
88 #ifdef EDM_ML_DEBUG
89  edm::LogVerbatim("Geometry") << "Found " << nGE21 << " GE2/1 chambers. Demonstrator geometry on? "
90  << demonstratorGeometry;
91 #endif
92 
93  doSuper = fv.firstChild();
94 
95  LogDebug("GEMGeometryParsFromDD") << "doSuperChamber = " << doSuper;
96  // loop over superchambers
97  while (doSuper) {
98  // getting chamber id from eta partitions
99  fv.firstChild();
100  doSuper = fv.firstChild();
101  if (doSuper) {
102  GEMDetId detIdCh =
103  GEMDetId(gemNumbering.baseNumberToUnitNumber(muonDDDNumbering.geoHistoryToBaseNumber(fv.geoHistory())));
104  // back to chambers
105  fv.parent();
106  fv.parent();
107 
108  // currently there is no superchamber in the geometry
109  // only 2 chambers are present separated by a gap.
110  // making superchamber out of the first chamber layer including the gap between chambers
111 
112  // In Run 3 we also have a single GE2/1 chamber at layer 2. We
113  // make sure the superchamber gets built but also we build on the
114  // first layer for the other stations so the superchamber is in
115  // the right position there.
116  if ((detIdCh.layer() == 1) || (detIdCh.layer() == 2 and detIdCh.station() == 2 and demonstratorGeometry)) {
117  buildSuperChamber(fv, detIdCh, rgeo);
118  }
119  buildChamber(fv, detIdCh, rgeo);
120 
121  // loop over chambers
122  // only 1 chamber
123  bool doChambers = fv.firstChild();
124  while (doChambers) {
125  // loop over GEMEtaPartitions
126  bool doEtaPart = fv.firstChild();
127  while (doEtaPart) {
128  GEMDetId detId =
129  GEMDetId(gemNumbering.baseNumberToUnitNumber(muonDDDNumbering.geoHistoryToBaseNumber(fv.geoHistory())));
130  buildEtaPartition(fv, detId, rgeo);
131 
132  doEtaPart = fv.nextSibling();
133  }
134  fv.parent();
135  doChambers = fv.nextSibling();
136  }
137  fv.parent();
138  doSuper = fv.nextSibling();
139  } else {
140  edm::LogError("GEMGeometryParsFromDD") << "Failed to find next child volume. Cannot build GEM chambers.";
141  }
142  }
143 }
Log< level::Info, true > LogVerbatim
constexpr int station() const
Definition: GEMDetId.h:179
Log< level::Error, false > LogError
constexpr int layer() const
Definition: GEMDetId.h:190
void buildEtaPartition(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
void buildChamber(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
void buildSuperChamber(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
#define LogDebug(id)

◆ buildGeometry() [2/2]

void GEMGeometryParsFromDD::buildGeometry ( cms::DDFilteredView fview,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rgeo 
)
private

Definition at line 277 of file GEMGeometryParsFromDD.cc.

References GEMNumberingScheme::baseNumberToUnitNumber(), buildChamber(), buildEtaPartition(), buildSuperChamber(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), cms::DDFilteredView::copyNos(), hcalRecHitTable_cff::detId, cms::DDFilteredView::firstChild(), MuonGeometryNumbering::geoHistoryToBaseNumber(), MuonGeometryConstants::getValue(), cms::DDFilteredView::goTo(), cms::DDFilteredView::history(), isotrackTrainRegressor::history, cms::DDFilteredView::level(), GEMDetId::minStationId0, EgammaValidation_cff::num, and nano_mu_digi_cff::region.

279  {
280  edm::LogVerbatim("GEMGeometryParsFromDD") << "(0) GEMGeometryParsFromDD - DD4hep ";
281 
282  MuonGeometryNumbering mdddnum(muonConstants);
283  GEMNumberingScheme gemNum(muonConstants);
284  static constexpr uint32_t levelChamb = 7;
285  int chamb(0), region(0);
286  int theLevelPart = muonConstants.getValue("level");
287  int theRingLevel = muonConstants.getValue("mg_ring") / theLevelPart;
288  int theSectorLevel = muonConstants.getValue("mg_sector") / theLevelPart;
289 
290  // Check for the demonstrator geometry (only 1 chamber of GE2/1)
291  auto start = fv.copyNos();
292  int nGE21 = 0;
293  while (nGE21 < 2 && fv.firstChild()) {
294  const auto& history = fv.history();
295  MuonBaseNumber num(mdddnum.geoHistoryToBaseNumber(history));
296  GEMDetId detId(gemNum.baseNumberToUnitNumber(num));
297  if (fv.level() == levelChamb && detId.station() == 2) {
298  nGE21++;
299  }
300  }
301  bool demonstratorGeometry = nGE21 % 2 == 1;
302 #ifdef EDM_ML_DEBUG
303  edm::LogVerbatim("Geometry") << "Found " << nGE21 << " GE2/1 chambers. Demonstrator geometry on? "
304  << demonstratorGeometry;
305 #endif
306 
307  fv.goTo(start);
308  while (fv.firstChild()) {
309  const auto& history = fv.history();
310  MuonBaseNumber num(mdddnum.geoHistoryToBaseNumber(history));
311  GEMDetId detId(gemNum.baseNumberToUnitNumber(num));
312 
313  if (detId.station() == GEMDetId::minStationId0) {
314  if (num.getLevels() == theRingLevel) {
315  if (detId.region() != region) {
316  region = detId.region();
317  chamb = 0;
318  }
319  ++chamb;
320  detId = GEMDetId(detId.region(), detId.ring(), detId.station(), detId.layer(), chamb, 0);
321  buildSuperChamber(fv, detId, rgeo);
322  } else if (num.getLevels() == theSectorLevel) {
323  buildChamber(fv, detId, rgeo);
324  } else {
325  buildEtaPartition(fv, detId, rgeo);
326  }
327  } else {
328  if (fv.level() == levelChamb) {
329  if ((detId.layer() == 1) || (detId.layer() == 2 and detId.station() == 2 and demonstratorGeometry)) {
330  buildSuperChamber(fv, detId, rgeo);
331  }
332  buildChamber(fv, detId, rgeo);
333  } else if (num.getLevels() > theSectorLevel) {
334  buildEtaPartition(fv, detId, rgeo);
335  }
336  }
337  }
338 }
Definition: start.py:1
int getValue(const std::string &name) const
Log< level::Info, true > LogVerbatim
void buildEtaPartition(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
void buildChamber(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
void buildSuperChamber(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)

◆ buildSuperChamber() [1/2]

void GEMGeometryParsFromDD::buildSuperChamber ( DDFilteredView fv,
GEMDetId  detId,
RecoIdealGeometry rgeo 
)
private

Definition at line 145 of file GEMGeometryParsFromDD.cc.

References hcalRecHitTable_cff::detId, PVValHelper::dy, PVValHelper::dz, getRotation(), getTranslation(), RecoIdealGeometry::insert(), LogDebug, DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), DDSolid::parameters(), DetId::rawId(), DDLogicalPart::solid(), DDBooleanSolid::solidA(), and DDBooleanSolid::solidB().

Referenced by buildGeometry().

145  {
146  LogDebug("GEMGeometryParsFromDD") << "buildSuperChamber " << fv.logicalPart().name().name() << " " << detId
147  << std::endl;
148 
150  std::vector<double> dpar = solid.solidA().parameters();
151 
152  GEMDetId gemid = detId.superChamberId();
153 
154  double dy = dpar[0]; //length is along local Y
155  double dz = dpar[3]; // thickness is long local Z
156  double dx1 = dpar[4]; // bottom width is along local X
157  double dx2 = dpar[8]; // top width is along local X
158  dpar = solid.solidB().parameters();
159 
160  dz += dpar[3]; // chamber thickness
161  dz *= 2; // 2 chambers in superchamber
162  dz += 2.105; // gap between chambers
163 
164  std::vector<double> pars{dx1, dx2, dy, dz};
165  std::vector<double> vtra = getTranslation(fv);
166  std::vector<double> vrot = getRotation(fv);
167 
168  LogDebug("GEMGeometryParsFromDD") << "dimension dx1 " << dx1 << ", dx2 " << dx2 << ", dy " << dy << ", dz " << dz;
169  edm::LogVerbatim("GEMGeometryParsFromDD")
170  << "(3) DDD, SuperChamber DetID " << gemid.rawId() << " Name " << fv.logicalPart().name().name() << " dx1 " << dx1
171  << " dx2 " << dx2 << " dy " << dy << " dz " << dz;
172  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
173 }
Log< level::Info, true > LogVerbatim
DDSolid solidA(void) const
Definition: DDSolid.cc:470
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
std::vector< double > getRotation(DDFilteredView &fv)
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
DDSolid solidB(void) const
Definition: DDSolid.cc:472
const N & name() const
Definition: DDBase.h:58
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
std::vector< double > getTranslation(DDFilteredView &fv)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
#define LogDebug(id)

◆ buildSuperChamber() [2/2]

void GEMGeometryParsFromDD::buildSuperChamber ( cms::DDFilteredView fv,
GEMDetId  detId,
RecoIdealGeometry rgeo 
)
private

Definition at line 340 of file GEMGeometryParsFromDD.cc.

References hcalRecHitTable_cff::detId, PVValHelper::dy, PVValHelper::dz, getRotation(), getTranslation(), RecoIdealGeometry::insert(), mergeVDriftHistosByStation::name, cms::DDFilteredView::name(), DetId::rawId(), cms::DDFilteredView::solid(), cms::DDSolid::solidA(), and AlCaHLTBitMon_QueryRunRegistry::string.

340  {
341  cms::DDSolid solid(fv.solid());
342  auto solidA = solid.solidA();
343  std::vector<double> dpar = solidA.dimensions();
344 
345  double dy = dpar[3] / dd4hep::mm; //length is along local Y
346  double dz = dpar[2] / dd4hep::mm; // thickness is long local Z
347  double dx1 = dpar[0] / dd4hep::mm; // bottom width is along local X
348  double dx2 = dpar[1] / dd4hep::mm; // top width is along loc
349 
350  auto solidB = solid.solidB();
351  dpar = solidB.dimensions();
352  const int nch = 2;
353  const double chgap = 2.105;
354 
355  GEMDetId gemid = detId.superChamberId();
356  std::string_view name = fv.name();
357 
358  dz += (dpar[2] / dd4hep::mm); // chamber thickness
359  dz *= nch; // 2 chambers in superchamber
360  dz += chgap; // gap between chambers
361 
362  std::vector<double> pars{dx1, dx2, dy, dz};
363  std::vector<double> vtra = getTranslation(fv);
364  std::vector<double> vrot = getRotation(fv);
365 
366  edm::LogVerbatim("GEMGeometryParsFromDD")
367  << "(3) DD4hep, SuperChamber DetID " << gemid.rawId() << " Name " << std::string(name) << " dx1 " << dx1
368  << " dx2 " << dx2 << " dy " << dy << " dz " << dz;
369  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {std::string(name)});
370 }
Log< level::Info, true > LogVerbatim
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
dd4hep::Solid solidA() const
std::vector< double > getRotation(DDFilteredView &fv)
std::string_view name() const
std::vector< double > getTranslation(DDFilteredView &fv)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
dd4hep::Solid solid() const

◆ getRotation() [1/2]

std::vector< double > GEMGeometryParsFromDD::getRotation ( DDFilteredView fv)
private

Definition at line 253 of file GEMGeometryParsFromDD.cc.

References DDFilteredView::rotation(), x, y, and z.

Referenced by buildChamber(), buildEtaPartition(), and buildSuperChamber().

253  {
254  const DDRotationMatrix& rota = fv.rotation(); //.Inverse();
255  DD3Vector x, y, z;
256  rota.GetComponents(x, y, z);
257  edm::LogVerbatim("GEMGeometryParsFromDD")
258  << "(2) DDD, rot matrix " << x.X() << " " << x.Y() << " " << x.Z() << " " << y.X() << " " << y.Y() << " "
259  << y.Z() << " " << z.X() << " " << z.Y() << " " << z.Z();
260  return {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()};
261 }
Log< level::Info, true > LogVerbatim
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.

◆ getRotation() [2/2]

std::vector< double > GEMGeometryParsFromDD::getRotation ( cms::DDFilteredView fv)
private

Definition at line 434 of file GEMGeometryParsFromDD.cc.

References cms::DDFilteredView::rot(), makeMuonMisalignmentScenario::rot, x, y, and z.

434  {
435  DDRotationMatrix rota;
436  fv.rot(rota);
437  DD3Vector x, y, z;
438  rota.GetComponents(x, y, z);
439  const std::vector<double> rot = {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()};
440  edm::LogVerbatim("GEMGeometryParsFromDD")
441  << "(2) DD4hep, rot matrix " << rot[0] << " " << rot[1] << " " << rot[2] << " " << rot[3] << " " << rot[4]
442  << " " << rot[5] << " " << rot[6] << " " << rot[7] << " " << rot[8];
443  return {rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]};
444 }
Log< level::Info, true > LogVerbatim
const Double_t * rot() const
The absolute rotation of the current node.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.

◆ getTranslation() [1/2]

std::vector< double > GEMGeometryParsFromDD::getTranslation ( DDFilteredView fv)
private

Definition at line 246 of file GEMGeometryParsFromDD.cc.

References DDFilteredView::translation().

Referenced by buildChamber(), buildEtaPartition(), and buildSuperChamber().

246  {
247  const DDTranslation& tran = fv.translation();
248  edm::LogVerbatim("GEMGeometryParsFromDD")
249  << "(1) DDD, tran vector " << tran.x() << " " << tran.y() << " " << tran.z();
250  return {tran.x(), tran.y(), tran.z()};
251 }
Log< level::Info, true > LogVerbatim
const DDTranslation & translation() const
The absolute translation of the current node.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ getTranslation() [2/2]

std::vector< double > GEMGeometryParsFromDD::getTranslation ( cms::DDFilteredView fv)
private

Definition at line 423 of file GEMGeometryParsFromDD.cc.

References cms::DDFilteredView::translation().

423  {
424  std::vector<double> tran(3);
425  tran[0] = static_cast<double>(fv.translation().X()) / dd4hep::mm;
426  tran[1] = static_cast<double>(fv.translation().Y()) / dd4hep::mm;
427  tran[2] = static_cast<double>(fv.translation().Z()) / dd4hep::mm;
428 
429  edm::LogVerbatim("GEMGeometryParsFromDD")
430  << "(1) DD4hep, tran vector " << tran[0] << " " << tran[1] << " " << tran[2];
431  return {tran[0], tran[1], tran[2]};
432 }
Log< level::Info, true > LogVerbatim
const Translation translation() const