CMS 3D CMS Logo

GEMGeometryBuilder.cc
Go to the documentation of this file.
1 /*
2 //\class GEMGeometryBuilder
3 
4  Description: GEM Geometry builder from DD and DD4hep
5  DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari)
6  Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4hep migration)
7  Updated by Sunanda Banerjee (Fermilab) to make it working for dd4hep
8  Updated: 7 August 2020
9  Updated by Ian J. Watson (ian.james.watson@cern.ch) to allow GE2/1 demonstrator to be built
10  Updated: 7 December 2021
11  Updated by Yechan Kang (yechan.kang@cern.ch) to allow GE2/1 demonstrator to be built while 2 GE2/1 layers are in the other region during 2024
12  Updated : 13 Feburary 2024
13 */
17 
23 
28 
31 
33 
35 
36 #include <algorithm>
37 #include <iostream>
38 #include <string>
39 
40 using namespace geant_units::operators;
41 
42 //#define EDM_ML_DEBUG
43 
45 
47 
48 // DDD
50  const DDCompactView* cview,
51  const MuonGeometryConstants& muonConstants) {
52  std::string attribute = "MuStructure";
53  std::string value = "MuonEndCapGEM";
54 
55  // Asking only for the MuonGEM's
56  DDSpecificsMatchesValueFilter filterGE2{DDValue(attribute, value, 0.0)};
57  DDFilteredView fvGE2(*cview, filterGE2);
58 
59  MuonGeometryNumbering mdddnum(muonConstants);
60  GEMNumberingScheme gemNum(muonConstants);
61 
62  // Check for the demonstrator geometry (only 1 chamber of GE2/1)
63  int nGE21 = 0;
64  bool doSuper = fvGE2.firstChild();
65  while (doSuper) {
66  // getting chamber id from eta partitions
67  fvGE2.firstChild();
68  fvGE2.firstChild();
69  int rawidCh = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fvGE2.geoHistory()));
70  GEMDetId detIdCh = GEMDetId(rawidCh);
71  if (detIdCh.station() == 2)
72  nGE21++;
73 
74  // back to chambers
75  fvGE2.parent();
76  fvGE2.parent();
77  doSuper = fvGE2.nextSibling();
78  }
79  bool demonstratorGeometry = nGE21 % 2 == 1;
80 
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("Geometry") << "Found " << nGE21 << " GE2/1 chambers. Demonstrator geometry on? "
83  << demonstratorGeometry;
84 #endif
85 
86  // Asking only for the MuonGEM's
88  DDFilteredView fv(*cview, filter);
89 
90 #ifdef EDM_ML_DEBUG
91  edm::LogVerbatim("Geometry") << "Building the geometry service";
92  edm::LogVerbatim("Geometry") << "About to run through the GEM structure\n"
93  << " First logical part " << fv.logicalPart().name().name();
94 #endif
95  doSuper = fv.firstChild();
96 
97 #ifdef EDM_ML_DEBUG
98  edm::LogVerbatim("Geometry") << "doSuperChamber = " << doSuper << " with " << fv.geoHistory() << " Levels "
99  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
100  ;
101 #endif
102  // loop over superchambers
103  std::vector<GEMSuperChamber*> superChambers;
104  while (doSuper) {
105  // getting chamber id from eta partitions
106  fv.firstChild();
107  fv.firstChild();
108 
109 #ifdef EDM_ML_DEBUG
110  edm::LogVerbatim("Geometry") << "MuonGeometry 1 " << fv.geoHistory() << " Levels "
111  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
112 #endif
113  int rawidCh = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
114  GEMDetId detIdCh = GEMDetId(rawidCh);
115 
116  // back to chambers
117 
118  fv.parent();
119  fv.parent();
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("Geometry") << "MuonGeometry 2 " << fv.geoHistory() << " Levels "
122  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
124 #endif
125  // currently there is no superchamber in the geometry
126  // only 2 chambers are present separated by a gap.
127  // making superchamber out of the first chamber layer including the gap between chambers
128 
129  // In Run 3 we also have a GE2/1 station at layer 2. We make sure
130  // the superchamber gets built but also we build on the first
131  // layer for the other stations so the superchamber is in the
132  // right position there.
133  if ((detIdCh.layer() == 1) || (detIdCh.layer() == 2 and detIdCh.station() == 2 and demonstratorGeometry)) {
134  GEMSuperChamber* gemSuperChamber = buildSuperChamber(fv, detIdCh);
135  superChambers.push_back(gemSuperChamber);
136  }
137  GEMChamber* gemChamber = ((detIdCh.station() == GEMDetId::minStationId0) ? nullptr : buildChamber(fv, detIdCh));
138 
139  // loop over chambers
140  // only 1 chamber
141  bool doChambers = fv.firstChild();
142  bool loopExecuted = false;
143 
144  while (doChambers) {
145  loopExecuted = true;
146 
147  if (detIdCh.station() == GEMDetId::minStationId0) {
148  fv.firstChild();
151  fv.parent();
152 #ifdef EDM_ML_DEBUG
153  edm::LogVerbatim("Geometry") << "MuonGeometry 3 " << fv.geoHistory() << " Levels "
154  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
156 #endif
157  gemChamber = buildChamber(fv, detId);
158  }
159 
160  // loop over GEMEtaPartitions
161  bool doEtaPart = fv.firstChild();
162 
163  while (doEtaPart) {
164 #ifdef EDM_ML_DEBUG
165  edm::LogVerbatim("Geometry") << "MuonGeometry 4 " << fv.geoHistory() << " Levels "
166  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
167 #endif
168  int rawid = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
169  GEMDetId detId = GEMDetId(rawid);
170  GEMEtaPartition* etaPart = buildEtaPartition(fv, detId);
171  gemChamber->add(etaPart);
172  theGeometry.add(etaPart);
173  doEtaPart = fv.nextSibling();
174  }
175 
176  fv.parent();
177 
178  theGeometry.add(gemChamber);
179 
180  doChambers = fv.nextSibling();
181  }
182  fv.parent();
183 
184  doSuper = fv.nextSibling();
185 
186  if (!loopExecuted) {
187  delete gemChamber;
188  }
189  }
190 
191  buildRegions(theGeometry, superChambers, demonstratorGeometry);
192 }
193 
195 #ifdef EDM_ML_DEBUG
196  edm::LogVerbatim("Geometry") << "buildSuperChamber " << fv.logicalPart().name().name() << " " << detId;
197 #endif
199  bool ge0Station = detId.station() == GEMDetId::minStationId0;
200  std::vector<double> dpar = ge0Station ? solid.parameters() : solid.solidA().parameters();
201 
202  double dy = convertMmToCm(dpar[0]); //length is along local Y
203  double dz = convertMmToCm(dpar[3]); // thickness is long local Z
204  double dx1 = convertMmToCm(dpar[4]); // bottom width is along local X
205  double dx2 = convertMmToCm(dpar[8]); // top width is along local X
206 
207  if (!ge0Station) {
208  const int nch = 2;
209  const double chgap = 2.105;
210 
211  dpar = solid.solidB().parameters();
212 
213  dz += convertMmToCm(dpar[3]); // chamber thickness
214  dz *= nch; // 2 chambers in superchamber
215  dz += chgap; // gap between chambers
216  }
217 
218  bool isOdd = detId.chamber() % 2;
219  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
220 
221 #ifdef EDM_ML_DEBUG
222  edm::LogVerbatim("Geometry") << "size " << dx1 << " " << dx2 << " " << dy << " " << dz;
223 #endif
224  GEMSuperChamber* superChamber = new GEMSuperChamber(detId.superChamberId(), surf);
225  return superChamber;
226 }
227 
229 #ifdef EDM_ML_DEBUG
230  edm::LogVerbatim("Geometry") << "buildChamber " << fv.logicalPart().name().name() << " " << detId;
231 #endif
233  bool ge0Station = detId.station() == GEMDetId::minStationId0;
234  std::vector<double> dpar = ge0Station ? solid.parameters() : solid.solidA().parameters();
235 
236  double dy = convertMmToCm(dpar[0]); //length is along local Y
237  double dz = convertMmToCm(dpar[3]); // thickness is long local Z
238  double dx1 = convertMmToCm(dpar[4]); // bottom width is along local X
239  double dx2 = convertMmToCm(dpar[8]); // top width is along local X
240 
241  if (!ge0Station) {
242  dpar = solid.solidB().parameters();
243  dz += convertMmToCm(dpar[3]); // chamber thickness
244  }
245 
246  bool isOdd = ge0Station ? false : detId.chamber() % 2;
247 
248  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
249 
250 #ifdef EDM_ML_DEBUG
251  edm::LogVerbatim("Geometry") << "size " << dx1 << " " << dx2 << " " << dy << " " << dz;
252 #endif
253  GEMChamber* chamber = new GEMChamber(detId.chamberId(), surf);
254  return chamber;
255 }
256 
258 #ifdef EDM_ML_DEBUG
259  edm::LogVerbatim("Geometry") << "buildEtaPartition " << fv.logicalPart().name().name() << " " << detId;
260 #endif
261  // EtaPartition specific parameter (nstrips and npads)
262  DDValue numbOfStrips("nStrips");
263  DDValue numbOfPads("nPads");
264  DDValue delPhi("dPhi");
265  std::vector<const DDsvalues_type*> specs(fv.specifics());
266  std::vector<const DDsvalues_type*>::iterator is = specs.begin();
267  double nStrips = 0., nPads = 0., dPhi = 0.;
268  for (; is != specs.end(); is++) {
269  if (DDfetch(*is, numbOfStrips))
270  nStrips = numbOfStrips.doubles()[0];
271  if (DDfetch(*is, numbOfPads))
272  nPads = numbOfPads.doubles()[0];
273  if (DDfetch(*is, delPhi))
274  dPhi = delPhi.doubles()[0];
275  }
276 #ifdef EDM_ML_DEBUG
277  edm::LogVerbatim("Geometry") << ((nStrips == 0.) ? ("No nStrips found!!")
278  : ("Number of strips: " + std::to_string(nStrips)));
279  edm::LogVerbatim("Geometry") << ((nPads == 0.) ? ("No nPads found!!") : ("Number of pads: " + std::to_string(nPads)));
280 #endif
281  // EtaPartition specific parameter (size)
282  std::vector<double> dpar = fv.logicalPart().solid().parameters();
283 
284  double be = convertMmToCm(dpar[4]); // half bottom edge
285  double te = convertMmToCm(dpar[8]); // half top edge
286  double ap = convertMmToCm(dpar[0]); // half apothem
287  double ti = 0.4; // half thickness
288 
289  std::vector<float> pars;
290  pars.emplace_back(be);
291  pars.emplace_back(te);
292  pars.emplace_back(ap);
293  pars.emplace_back(nStrips);
294  pars.emplace_back(nPads);
295  pars.emplace_back(dPhi);
296 
297  bool isOdd = detId.chamber() % 2;
298  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(be, te, ap, ti), isOdd));
299  std::string name = fv.logicalPart().name().name();
301 
302 #ifdef EDM_ML_DEBUG
303  edm::LogVerbatim("Geometry") << "size " << be << " " << te << " " << ap << " " << ti;
304 #endif
305  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
306  return etaPartition;
307 }
308 
310  Bounds* bounds,
311  bool isOddChamber) const {
312  // extract the position
313  const DDTranslation& trans(fv.translation());
314  const Surface::PositionType posResult(convertMmToCm(trans.x()), convertMmToCm(trans.y()), convertMmToCm(trans.z()));
315 
316  // now the rotation
317  const DDRotationMatrix& rotation = fv.rotation();
318  DD3Vector x, y, z;
319  rotation.GetComponents(x, y, z);
320 
321  Surface::RotationType rotResult(float(x.X()),
322  float(x.Y()),
323  float(x.Z()),
324  float(y.X()),
325  float(y.Y()),
326  float(y.Z()),
327  float(z.X()),
328  float(z.Y()),
329  float(z.Z()));
330 
331  //Change of axes for the forward
332  Basic3DVector<float> newX(1., 0., 0.);
333  Basic3DVector<float> newY(0., 0., -1.);
334  Basic3DVector<float> newZ(0., 1., 0.);
335 
336  rotResult.rotateAxes(newX, newY, newZ);
337 
338  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
339 }
340 
341 // DD4hep
342 
344  const cms::DDCompactView* cview,
345  const MuonGeometryConstants& muonConstants) {
346  std::string attribute = "MuStructure";
347  std::string value = "MuonEndCapGEM";
348  const cms::DDFilter filterGE2(attribute, value);
349  cms::DDFilteredView fvGE2(*cview, filterGE2);
350 
351  MuonGeometryNumbering mdddnum(muonConstants);
352  GEMNumberingScheme gemNum(muonConstants);
353  static constexpr uint32_t levelChamb = 7;
354  int chamb(0), region(0);
355  int theLevelPart = muonConstants.getValue("level");
356  int theRingLevel = muonConstants.getValue("mg_ring") / theLevelPart;
357  int theSectorLevel = muonConstants.getValue("mg_sector") / theLevelPart;
358 
359  // Check for the demonstrator geometry (only 1 chamber of GE2/1)
360  int nGE21 = 0;
361  while (fvGE2.firstChild()) {
362  const auto& history = fvGE2.history();
363  MuonBaseNumber num(mdddnum.geoHistoryToBaseNumber(history));
365  if (detId.station() == GEMDetId::minStationId0) {
366  } else {
367  if (fvGE2.level() == levelChamb) {
368  if (detId.station() == 2)
369  nGE21++;
370  }
371  }
372  }
373 
374  bool demonstratorGeometry = nGE21 % 2 == 1;
375 #ifdef EDM_ML_DEBUG
376  edm::LogVerbatim("Geometry") << "Found " << nGE21 << " GE2/1 chambers. Demonstrator geometry on? "
377  << demonstratorGeometry;
378 #endif
379 
380  const cms::DDFilter filter(attribute, value);
381  cms::DDFilteredView fv(*cview, filter);
382  std::vector<GEMSuperChamber*> superChambers;
383  std::vector<GEMChamber*> chambers;
384 
385  while (fv.firstChild()) {
386  const auto& history = fv.history();
387  MuonBaseNumber num(mdddnum.geoHistoryToBaseNumber(history));
389 #ifdef EDM_ML_DEBUG
390  edm::LogVerbatim("Geometry") << fv.name() << " with " << history.tags.size() << " Levels and ID " << detId
391  << " Mask " << std::hex << GEMDetId::chamberIdMask << std::dec << " and "
392  << GEMDetId(((detId.rawId()) & GEMDetId::chamberIdMask)) << " Levels " << theRingLevel
393  << ":" << theSectorLevel << ":" << history.tags.size() << ":" << fv.level();
394  for (unsigned int k = 0; k < history.tags.size(); ++k)
395  edm::LogVerbatim("Geometry") << "[" << k << "] Tag " << history.tags[k] << " Offset " << history.offsets[k]
396  << " copy " << history.copyNos[k];
397 #endif
398 
399  if (detId.station() == GEMDetId::minStationId0) {
400  if (num.getLevels() == theRingLevel) {
401  if (detId.region() != region) {
402  region = detId.region();
403  chamb = 0;
404  }
405  ++chamb;
406  detId = GEMDetId(detId.region(), detId.ring(), detId.station(), detId.layer(), chamb, 0);
407  GEMSuperChamber* gemSuperChamber = buildSuperChamber(fv, detId);
408  superChambers.emplace_back(gemSuperChamber);
409  } else if (num.getLevels() == theSectorLevel) {
410  GEMChamber* gemChamber = buildChamber(fv, detId);
411  chambers.emplace_back(gemChamber);
412  } else {
413  GEMEtaPartition* etaPart = buildEtaPartition(fv, detId);
414  theGeometry.add(etaPart);
415  }
416  } else {
417  if (fv.level() == levelChamb) {
418  if ((detId.layer() == 1) || (detId.layer() == 2 and detId.station() == 2 and demonstratorGeometry)) {
419  GEMSuperChamber* gemSuperChamber = buildSuperChamber(fv, detId);
420  superChambers.emplace_back(gemSuperChamber);
421  }
422  GEMChamber* gemChamber = buildChamber(fv, detId);
423  chambers.emplace_back(gemChamber);
424  } else if (num.getLevels() > theSectorLevel) {
425  GEMEtaPartition* etaPart = buildEtaPartition(fv, detId);
426  theGeometry.add(etaPart);
427  }
428  }
429  }
430 
431  auto& partitions = theGeometry.etaPartitions();
432  for (auto& gemChamber : chambers) {
433  uint32_t id0 = ((gemChamber->id().rawId()) & GEMDetId::chamberIdMask);
434  for (auto& etaPart : partitions) {
435  if (((etaPart->id().rawId()) & GEMDetId::chamberIdMask) == id0) {
436  gemChamber->add(etaPart);
437  }
438  }
439  theGeometry.add(gemChamber);
440  }
441 
442  buildRegions(theGeometry, superChambers, demonstratorGeometry);
443 }
444 
446  cms::DDSolid solid(fv.solid());
447  auto solidA = solid.solidA();
448  std::vector<double> dpar = solidA.dimensions();
449 
450  double dy = k_ScaleFromDD4hep * dpar[3]; //length is along local Y
451  double dz = k_ScaleFromDD4hep * dpar[2]; // thickness is long local Z
452  double dx1 = k_ScaleFromDD4hep * dpar[0]; // bottom width is along local X
453  double dx2 = k_ScaleFromDD4hep * dpar[1]; // top width is along loc
454 
455  auto solidB = solid.solidB();
456  dpar = solidB.dimensions();
457  const int nch = 2;
458  const double chgap = 2.105;
459 
460  dz += (k_ScaleFromDD4hep * dpar[2]); // chamber thickness
461  dz *= nch; // 2 chambers in superchamber
462  dz += chgap; // gap between chambers
463 
464  bool isOdd = detId.chamber() % 2;
465  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
466 
467  GEMSuperChamber* superChamber = new GEMSuperChamber(detId.superChamberId(), surf);
468  return superChamber;
469 }
470 
472  cms::DDSolid solid(fv.solid());
473  auto solidA = solid.solidA();
474  std::vector<double> dpar = solidA.dimensions();
475 
476  double dy = k_ScaleFromDD4hep * dpar[3]; //length is along local Y
477  double dz = k_ScaleFromDD4hep * dpar[2]; // thickness is long local Z
478  double dx1 = k_ScaleFromDD4hep * dpar[0]; // bottom width is along local X
479  double dx2 = k_ScaleFromDD4hep * dpar[1]; // top width is along local X
480 
481  auto solidB = solid.solidB();
482  dpar = solidB.dimensions();
483 
484  dz += (k_ScaleFromDD4hep * dpar[2]); // chamber thickness
485 
486  bool isOdd = detId.chamber() % 2;
487  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
488 
489  GEMChamber* chamber = new GEMChamber(detId.chamberId(), surf);
490  return chamber;
491 }
492 
494  // EtaPartition specific parameter (nstrips and npads)
495 
496  auto nStrips = fv.get<double>("nStrips");
497  auto nPads = fv.get<double>("nPads");
498  auto dPhi = fv.get<double>("dPhi");
499  // EtaPartition specific parameter (size)
500 
501  std::vector<double> dpar = fv.parameters();
502 
503  double ti = 0.4; // half thickness
504 
505  const std::vector<float> pars{float(k_ScaleFromDD4hep * dpar[0]),
506  float(k_ScaleFromDD4hep * dpar[1]),
507  float(k_ScaleFromDD4hep * dpar[3]),
508  float(nStrips),
509  float(nPads),
510  float(dPhi)};
511 
512  bool isOdd = detId.chamber() % 2;
513  RCPBoundPlane surf(
514  boundPlane(fv,
516  k_ScaleFromDD4hep * dpar[0], k_ScaleFromDD4hep * dpar[1], k_ScaleFromDD4hep * dpar[3], ti),
517  isOdd));
518 
519  std::string_view name = fv.name();
520 
522 
523  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
524  return etaPartition;
525 }
526 
528  Bounds* bounds,
529  bool isOddChamber) const {
530  // extract the position
531  const Double_t* tran = fv.trans();
532  Surface::PositionType posResult(
533  k_ScaleFromDD4hep * tran[0], k_ScaleFromDD4hep * tran[1], k_ScaleFromDD4hep * tran[2]);
534 
535  // now the rotation
536  DDRotationMatrix rota;
537  fv.rot(rota);
538  DD3Vector x, y, z;
539  rota.GetComponents(x, y, z);
540  Surface::RotationType rotResult(float(x.X()),
541  float(x.Y()),
542  float(x.Z()),
543  float(y.X()),
544  float(y.Y()),
545  float(y.Z()),
546  float(z.X()),
547  float(z.Y()),
548  float(z.Z()));
549 
550  //Change of axes for the forward
551  Basic3DVector<float> newX(1., 0., 0.);
552  Basic3DVector<float> newY(0., 0., -1.);
553  Basic3DVector<float> newZ(0., 1., 0.);
554 
555  rotResult.rotateAxes(newX, newY, newZ);
556 
557  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
558 }
559 
561  const std::vector<GEMSuperChamber*>& superChambers,
562  bool demonstratorGeometry) {
563  // construct the regions, stations and rings.
564  for (int re = -1; re <= 1; re = re + 2) {
565  GEMRegion* region = new GEMRegion(re);
566  for (int st = GEMDetId::minStationId0; st <= GEMDetId::maxStationId; ++st) {
567  bool ge0Station = st == GEMDetId::minStationId0;
568  GEMStation* station = new GEMStation(re, st);
569  std::string sign(re == -1 ? "-" : "");
570  std::string suffix = ge0Station ? "" : "/1";
571  std::string name = "GE" + sign + std::to_string(st) + suffix;
572  station->setName(name);
573  bool foundSuperChamber = false;
574  for (int ri = 1; ri <= 1; ++ri) {
575  GEMRing* ring = new GEMRing(re, st, ri);
576  for (auto superChamber : superChambers) {
577  const GEMDetId detId(superChamber->id());
578  if (detId.region() != re || detId.station() != st || detId.ring() != ri)
579  continue;
580 
581  foundSuperChamber = true;
582  int nlayers = ge0Station ? GEMDetId::maxLayerId0 : GEMDetId::maxLayerId;
583 
584  // GEMDetId::minLayerId is to id the superchamber, so minLayerId+1 is the first layer
585  for (int la = GEMDetId::minLayerId + 1; la <= nlayers; ++la) {
586  GEMDetId chId(detId.region(), detId.ring(), detId.station(), la, detId.chamber(), 0);
587  auto chamber = theGeometry.chamber(chId);
588  if (!chamber) {
589  // this particular layer 1 chamber *should* be missing in the demonstrator geometry (we only have layer 2)
590  if (!demonstratorGeometry or not(chId.station() == 2)) {
591  edm::LogWarning("GEMGeometryBuilder") << "Missing chamber " << chId;
592  }
593  } else {
594  superChamber->add(chamber);
595  }
596  }
597  ring->add(superChamber);
598  theGeometry.add(superChamber);
599 #ifdef EDM_ML_DEBUG
600  edm::LogVerbatim("Geometry") << "Adding super chamber " << detId << " to ring: "
601  << "re " << re << " st " << st << " ri " << ri;
602 #endif
603  }
604 #ifdef EDM_ML_DEBUG
605  edm::LogVerbatim("Geometry") << "Adding ring " << ri << " to station "
606  << "re " << re << " st " << st;
607 #endif
608  if (foundSuperChamber) {
609  station->add(ring);
610  theGeometry.add(ring);
611  } else
612  delete ring;
613  }
614  if (!foundSuperChamber) {
615 #ifdef EDM_ML_DEBUG
616  edm::LogVerbatim("Geometry") << "No superchamber found: re:" << re << " st:" << st;
617 #endif
618  delete station;
619  } else {
620 #ifdef EDM_ML_DEBUG
621  edm::LogVerbatim("Geometry") << "Adding station " << st << " to region " << re;
622 #endif
623  region->add(station);
624  theGeometry.add(station);
625  }
626  }
627 #ifdef EDM_ML_DEBUG
628  edm::LogVerbatim("Geometry") << "Adding region " << re << " to the geometry ";
629 #endif
630  theGeometry.add(region);
631  }
632 }
int getValue(const std::string &name) const
Log< level::Info, true > LogVerbatim
DDSolid solidA(void) const
Definition: DDSolid.cc:470
bool parent()
set the current node to the parent node ...
constexpr int station() const
Definition: GEMDetId.h:179
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
Definition: DDValue.cc:111
bool nextSibling()
set the current node to the next sibling ...
GEMChamber * buildChamber(DDFilteredView &fv, GEMDetId detId) const
Plane BoundPlane
Definition: Plane.h:94
const Double_t * rot() const
The absolute rotation of the current node.
void buildRegions(GEMGeometry &, const std::vector< GEMSuperChamber *> &, bool demonstratorGeometry)
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
GEMEtaPartition * buildEtaPartition(DDFilteredView &fv, GEMDetId detId) const
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
constexpr int layer() const
Definition: GEMDetId.h:190
dd4hep::Solid solidA() const
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
static constexpr int32_t maxLayerId0
Definition: GEMDetId.h:31
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...
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
std::string_view name() const
const Double_t * trans() const
The absolute translation of the current node.
static double delPhi(const double phi1, const double phi2)
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
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
Definition: GEMDetId.h:70
GEMSuperChamber * buildSuperChamber(DDFilteredView &fv, GEMDetId detId) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
void build(GEMGeometry &theGeometry, const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
static constexpr int32_t maxStationId
Definition: GEMDetId.h:27
const int level() const
get Iterator level
Definition: value.py:1
DDSolid solidB(void) const
Definition: DDSolid.cc:472
bool firstChild()
set the current node to the first child
const N & name() const
Definition: DDBase.h:59
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
T get(const std::string &)
extract attribute value
std::vector< const DDsvalues_type * > specifics() const
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:32
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
dd4hep::Solid solid() const
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
bool firstChild()
set the current node to the first child ...
float x
int baseNumberToUnitNumber(const MuonBaseNumber &) const override
Definition: Bounds.h:18
Log< level::Warning, false > LogWarning
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
const DDTranslation & translation() const
The absolute translation of the current node.
void add(const GEMEtaPartition *roll)
Add EtaPartition to the chamber which takes ownership.
Definition: GEMChamber.cc:21
const std::vector< double > parameters() const
extract shape parameters
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
static constexpr int32_t minLayerId
Definition: GEMDetId.h:30
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history) const
const GEMChamber * chamber(GEMDetId id) const
Definition: GEMGeometry.cc:73
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40