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 263 of file GEMGeometryParsFromDD.cc.

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

265  {
266  std::string attribute = "MuStructure";
267  std::string value = "MuonEndCapGEM";
268 
269  const cms::DDFilter filter(attribute, value);
270  cms::DDFilteredView fv(*cview, filter);
271 
272  this->buildGeometry(fv, muonConstants, rgeo);
273 }
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 173 of file GEMGeometryParsFromDD.cc.

References GEMDetId::chamberId(), 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().

173  {
174  LogDebug("GEMGeometryParsFromDD") << "buildChamber " << fv.logicalPart().name().name() << " " << detId << std::endl;
175 
177  std::vector<double> dpar = solid.solidA().parameters();
178 
179  double dy = dpar[0]; //length is along local Y
180  double dz = dpar[3]; // thickness is long local Z
181  double dx1 = dpar[4]; // bottom width is along local X
182  double dx2 = dpar[8]; // top width is along local X
183  dpar = solid.solidB().parameters();
184  dz += dpar[3]; // chamber thickness
185 
186  GEMDetId gemid = detId.chamberId();
187 
188  std::vector<double> pars{dx1, dx2, dy, dz};
189  std::vector<double> vtra = getTranslation(fv);
190  std::vector<double> vrot = getRotation(fv);
191 
192  LogDebug("GEMGeometryParsFromDD") << "dimension dx1 " << dx1 << ", dx2 " << dx2 << ", dy " << dy << ", dz " << dz;
193  edm::LogVerbatim("GEMGeometryParsFromDD")
194  << "(4) DDD, Chamber DetID " << gemid.rawId() << " Name " << fv.logicalPart().name().name() << " dx1 " << dx1
195  << " dx2 " << dx2 << " dy " << dy << " dz " << dz;
196  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
197 }
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:59
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.
constexpr GEMDetId chamberId() const
Definition: GEMDetId.h:204
#define LogDebug(id)

◆ buildChamber() [2/2]

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

Definition at line 370 of file GEMGeometryParsFromDD.cc.

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

370  {
371  cms::DDSolid solid(fv.solid());
372  auto solidA = solid.solidA();
373  std::vector<double> dpar = solidA.dimensions();
374 
375  double dy = dpar[3] / dd4hep::mm; //length is along local Y
376  double dz = dpar[2] / dd4hep::mm; // thickness is long local Z
377  double dx1 = dpar[0] / dd4hep::mm; // bottom width is along local X
378  double dx2 = dpar[1] / dd4hep::mm; // top width is along local X
379 
380  auto solidB = solid.solidB();
381  dpar = solidB.dimensions();
382 
383  dz += (dpar[2] / dd4hep::mm); // chamber thickness
384 
385  GEMDetId gemid = detId.chamberId();
386  std::string_view name = fv.name();
387 
388  std::vector<double> pars{dx1, dx2, dy, dz};
389  std::vector<double> vtra = getTranslation(fv);
390  std::vector<double> vrot = getRotation(fv);
391 
392  edm::LogVerbatim("GEMGeometryParsFromDD")
393  << "(4) DD4hep, Chamber DetID " << gemid.rawId() << " Name " << std::string(name) << " dx1 " << dx1 << " dx2 "
394  << dx2 << " dy " << dy << " dz " << dz;
395  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {std::string(name)});
396 }
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
constexpr GEMDetId chamberId() const
Definition: GEMDetId.h:204

◆ buildEtaPartition() [1/2]

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

Definition at line 199 of file GEMGeometryParsFromDD.cc.

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

Referenced by buildGeometry().

199  {
200  LogDebug("GEMGeometryParsFromDD") << "buildEtaPartition " << fv.logicalPart().name().name() << " " << detId
201  << std::endl;
202 
203  // EtaPartition specific parameter (nstrips and npads)
204  DDValue numbOfStrips("nStrips");
205  DDValue numbOfPads("nPads");
206  DDValue delPhi("dPhi");
207  const std::vector<const DDsvalues_type*>& specs = fv.specifics();
208  double nStrips = 0., nPads = 0., dPhi = 0.;
209  for (auto const& is : specs) {
210  if (DDfetch(is, numbOfStrips))
211  nStrips = numbOfStrips.doubles()[0];
212  if (DDfetch(is, numbOfPads))
213  nPads = numbOfPads.doubles()[0];
214  if (DDfetch(is, delPhi))
215  dPhi = delPhi.doubles()[0];
216  }
217  LogDebug("GEMGeometryParsFromDD") << ((nStrips == 0.) ? ("No nStrips found!!")
218  : ("Number of strips: " + std::to_string(nStrips)));
219  LogDebug("GEMGeometryParsFromDD") << ((nPads == 0.) ? ("No nPads found!!")
220  : ("Number of pads: " + std::to_string(nPads)));
221 
222  // EtaPartition specific parameter (size)
223  std::vector<double> dpar = fv.logicalPart().solid().parameters();
224 
225  double dy = dpar[0]; //length is along local Y
226  double dz = dpar[3]; //0.4;// thickness is long local Z
227  double dx1 = dpar[4]; // bottom width is along local X
228  double dx2 = dpar[8]; // top width is along local X
229 
230  std::vector<double> pars{dx1, dx2, dy, dz, nStrips, nPads, dPhi};
231  std::vector<double> vtra = getTranslation(fv);
232  std::vector<double> vrot = getRotation(fv);
233 
234  LogDebug("GEMGeometryParsFromDD") << " dx1 " << dx1 << " dx2 " << dx2 << " dy " << dy << " dz " << dz << " nStrips "
235  << nStrips << " nPads " << nPads << " dPhi " << dPhi;
236 
237  edm::LogVerbatim("GEMGeometryParsFromDD")
238  << "(5) DDD, Eta Partion DetID " << detId.rawId() << " Name " << fv.logicalPart().name().name() << " dx1 " << dx1
239  << " dx2 " << dx2 << " dy " << dy << " dz " << dz << " nStrips " << nStrips << " nPads " << nPads << " dPhi "
240  << dPhi;
241  rgeo.insert(detId.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
242 }
Log< level::Info, true > LogVerbatim
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
std::string to_string(const V &value)
Definition: OMSAccess.h:71
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
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:59
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)
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)

◆ buildEtaPartition() [2/2]

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

Definition at line 398 of file GEMGeometryParsFromDD.cc.

References HLT_2022v14_cff::dPhi, PVValHelper::dy, PVValHelper::dz, cms::DDFilteredView::get(), getRotation(), getTranslation(), RecoIdealGeometry::insert(), Skims_PA_cff::name, cms::DDFilteredView::name(), me0TriggerPseudoDigis_cff::nStrips, cms::DDFilteredView::parameters(), DetId::rawId(), and AlCaHLTBitMon_QueryRunRegistry::string.

398  {
399  auto nStrips = fv.get<double>("nStrips");
400  auto nPads = fv.get<double>("nPads");
401  auto dPhi = fv.get<double>("dPhi");
402 
403  std::vector<double> dpar = fv.parameters();
404  std::string_view name = fv.name();
405 
406  double dx1 = dpar[0] / dd4hep::mm;
407  double dx2 = dpar[1] / dd4hep::mm;
408  double dy = dpar[3] / dd4hep::mm;
409  double dz = dpar[2] / dd4hep::mm;
410 
411  std::vector<double> pars{dx1, dx2, dy, dz, nStrips, nPads, dPhi};
412  std::vector<double> vtra = getTranslation(fv);
413  std::vector<double> vrot = getRotation(fv);
414 
415  edm::LogVerbatim("GEMGeometryParsFromDD")
416  << "(5) DD4hep, Eta Partion DetID " << detId.rawId() << " Name " << std::string(name) << " dx1 " << dx1 << " dx2 "
417  << dx2 << " dy " << dy << " dz " << dz << " nStrips " << nStrips << " nPads " << nPads << " dPhi " << dPhi;
418  rgeo.insert(detId.rawId(), vtra, vrot, pars, {std::string(name)});
419 }
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)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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(), 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  doSuper = (nGE21 < 2 && fvGE2.nextSibling());
80  } else {
81  edm::LogError("GEMGeometryParsFromDD") << "Failed to find next child volume. Cannot determine presence of GE 2/1";
82  }
83  }
84  bool demonstratorGeometry = nGE21 == 1;
85 
86 #ifdef EDM_ML_DEBUG
87  edm::LogVerbatim("Geometry") << "Found " << nGE21 << " GE2/1 chambers. Demonstrator geometry on? "
88  << demonstratorGeometry;
89 #endif
90 
91  doSuper = fv.firstChild();
92 
93  LogDebug("GEMGeometryParsFromDD") << "doSuperChamber = " << doSuper;
94  // loop over superchambers
95  while (doSuper) {
96  // getting chamber id from eta partitions
97  fv.firstChild();
98  doSuper = fv.firstChild();
99  if (doSuper) {
100  GEMDetId detIdCh =
101  GEMDetId(gemNumbering.baseNumberToUnitNumber(muonDDDNumbering.geoHistoryToBaseNumber(fv.geoHistory())));
102  // back to chambers
103  fv.parent();
104  fv.parent();
105 
106  // currently there is no superchamber in the geometry
107  // only 2 chambers are present separated by a gap.
108  // making superchamber out of the first chamber layer including the gap between chambers
109 
110  // In Run 3 we also have a single GE2/1 chamber at layer 2. We
111  // make sure the superchamber gets built but also we build on the
112  // first layer for the other stations so the superchamber is in
113  // the right position there.
114  if ((detIdCh.layer() == 1) || (detIdCh.layer() == 2 and detIdCh.station() == 2 and demonstratorGeometry)) {
115  buildSuperChamber(fv, detIdCh, rgeo);
116  }
117  buildChamber(fv, detIdCh, rgeo);
118 
119  // loop over chambers
120  // only 1 chamber
121  bool doChambers = fv.firstChild();
122  while (doChambers) {
123  // loop over GEMEtaPartitions
124  bool doEtaPart = fv.firstChild();
125  while (doEtaPart) {
126  GEMDetId detId =
127  GEMDetId(gemNumbering.baseNumberToUnitNumber(muonDDDNumbering.geoHistoryToBaseNumber(fv.geoHistory())));
128  buildEtaPartition(fv, detId, rgeo);
129 
130  doEtaPart = fv.nextSibling();
131  }
132  fv.parent();
133  doChambers = fv.nextSibling();
134  }
135  fv.parent();
136  doSuper = fv.nextSibling();
137  } else {
138  edm::LogError("GEMGeometryParsFromDD") << "Failed to find next child volume. Cannot build GEM chambers.";
139  }
140  }
141 }
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 275 of file GEMGeometryParsFromDD.cc.

References GEMNumberingScheme::baseNumberToUnitNumber(), buildChamber(), buildEtaPartition(), buildSuperChamber(), cms::DDFilteredView::copyNos(), cms::DDFilteredView::firstChild(), MuonGeometryNumbering::geoHistoryToBaseNumber(), MuonGeometryConstants::getValue(), cms::DDFilteredView::goTo(), cms::DDFilteredView::history(), cms::DDFilteredView::level(), GEMDetId::minStationId0, EgammaValidation_cff::num, and HLT_2022v14_cff::region.

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

References 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(), DDBooleanSolid::solidB(), and GEMDetId::superChamberId().

Referenced by buildGeometry().

143  {
144  LogDebug("GEMGeometryParsFromDD") << "buildSuperChamber " << fv.logicalPart().name().name() << " " << detId
145  << std::endl;
146 
148  std::vector<double> dpar = solid.solidA().parameters();
149 
150  GEMDetId gemid = detId.superChamberId();
151 
152  double dy = dpar[0]; //length is along local Y
153  double dz = dpar[3]; // thickness is long local Z
154  double dx1 = dpar[4]; // bottom width is along local X
155  double dx2 = dpar[8]; // top width is along local X
156  dpar = solid.solidB().parameters();
157 
158  dz += dpar[3]; // chamber thickness
159  dz *= 2; // 2 chambers in superchamber
160  dz += 2.105; // gap between chambers
161 
162  std::vector<double> pars{dx1, dx2, dy, dz};
163  std::vector<double> vtra = getTranslation(fv);
164  std::vector<double> vrot = getRotation(fv);
165 
166  LogDebug("GEMGeometryParsFromDD") << "dimension dx1 " << dx1 << ", dx2 " << dx2 << ", dy " << dy << ", dz " << dz;
167  edm::LogVerbatim("GEMGeometryParsFromDD")
168  << "(3) DDD, SuperChamber DetID " << gemid.rawId() << " Name " << fv.logicalPart().name().name() << " dx1 " << dx1
169  << " dx2 " << dx2 << " dy " << dy << " dz " << dz;
170  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
171 }
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:59
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.
constexpr GEMDetId superChamberId() const
Definition: GEMDetId.h:207
#define LogDebug(id)

◆ buildSuperChamber() [2/2]

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

Definition at line 338 of file GEMGeometryParsFromDD.cc.

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

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

◆ getRotation() [1/2]

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

Definition at line 251 of file GEMGeometryParsFromDD.cc.

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

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

251  {
252  const DDRotationMatrix& rota = fv.rotation(); //.Inverse();
253  DD3Vector x, y, z;
254  rota.GetComponents(x, y, z);
255  edm::LogVerbatim("GEMGeometryParsFromDD")
256  << "(2) DDD, rot matrix " << x.X() << " " << x.Y() << " " << x.Z() << " " << y.X() << " " << y.Y() << " "
257  << y.Z() << " " << z.X() << " " << z.Y() << " " << z.Z();
258  return {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()};
259 }
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 432 of file GEMGeometryParsFromDD.cc.

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

432  {
433  DDRotationMatrix rota;
434  fv.rot(rota);
435  DD3Vector x, y, z;
436  rota.GetComponents(x, y, z);
437  const std::vector<double> rot = {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()};
438  edm::LogVerbatim("GEMGeometryParsFromDD")
439  << "(2) DD4hep, rot matrix " << rot[0] << " " << rot[1] << " " << rot[2] << " " << rot[3] << " " << rot[4]
440  << " " << rot[5] << " " << rot[6] << " " << rot[7] << " " << rot[8];
441  return {rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]};
442 }
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 244 of file GEMGeometryParsFromDD.cc.

References DDFilteredView::translation().

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

244  {
245  const DDTranslation& tran = fv.translation();
246  edm::LogVerbatim("GEMGeometryParsFromDD")
247  << "(1) DDD, tran vector " << tran.x() << " " << tran.y() << " " << tran.z();
248  return {tran.x(), tran.y(), tran.z()};
249 }
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 421 of file GEMGeometryParsFromDD.cc.

References cms::DDFilteredView::translation().

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