CMS 3D CMS Logo

GEMGeometryParsFromDD.cc
Go to the documentation of this file.
1 
7 
12 
16 
18 
19 #include "CLHEP/Units/GlobalSystemOfUnits.h"
20 
21 #include <iostream>
22 #include <algorithm>
23 
25 
27 
29  const MuonGeometryConstants& muonConstants,
30  RecoIdealGeometry& rgeo) {
31  std::string attribute = "MuStructure";
32  std::string value = "MuonEndCapGEM";
33 
34  // Asking only for the MuonGEM's
36  DDFilteredView fv(*cview, filter);
37 
38  this->buildGeometry(fv, muonConstants, rgeo);
39 }
40 
42  const MuonGeometryConstants& muonConstants,
43  RecoIdealGeometry& rgeo) {
44  LogDebug("GEMGeometryParsFromDD") << "Building the geometry service";
45  LogDebug("GEMGeometryParsFromDD") << "About to run through the GEM structure\n"
46  << " First logical part " << fv.logicalPart().name().name();
47 
48  MuonDDDNumbering muonDDDNumbering(muonConstants);
49  GEMNumberingScheme gemNumbering(muonConstants);
50 
51  bool doSuper = fv.firstChild();
52  LogDebug("GEMGeometryParsFromDD") << "doSuperChamber = " << doSuper;
53  // loop over superchambers
54  while (doSuper) {
55  // getting chamber id from eta partitions
56  fv.firstChild();
57  fv.firstChild();
58  GEMDetId detIdCh =
59  GEMDetId(gemNumbering.baseNumberToUnitNumber(muonDDDNumbering.geoHistoryToBaseNumber(fv.geoHistory())));
60  // back to chambers
61  fv.parent();
62  fv.parent();
63 
64  // currently there is no superchamber in the geometry
65  // only 2 chambers are present separated by a gap.
66  // making superchamber out of the first chamber layer including the gap between chambers
67  if (detIdCh.layer() == 1) { // only make superChambers when doing layer 1
68  buildSuperChamber(fv, detIdCh, rgeo);
69  }
70  buildChamber(fv, detIdCh, rgeo);
71 
72  // loop over chambers
73  // only 1 chamber
74  bool doChambers = fv.firstChild();
75  while (doChambers) {
76  // loop over GEMEtaPartitions
77  bool doEtaPart = fv.firstChild();
78  while (doEtaPart) {
79  GEMDetId detId =
80  GEMDetId(gemNumbering.baseNumberToUnitNumber(muonDDDNumbering.geoHistoryToBaseNumber(fv.geoHistory())));
81  buildEtaPartition(fv, detId, rgeo);
82 
83  doEtaPart = fv.nextSibling();
84  }
85  fv.parent();
86  doChambers = fv.nextSibling();
87  }
88  fv.parent();
89  doSuper = fv.nextSibling();
90  }
91 }
92 
94  LogDebug("GEMGeometryParsFromDD") << "buildSuperChamber " << fv.logicalPart().name().name() << " " << detId
95  << std::endl;
96 
98  std::vector<double> dpar = solid.solidA().parameters();
99 
100  double dy = dpar[0]; //length is along local Y
101  double dz = dpar[3]; // thickness is long local Z
102  double dx1 = dpar[4]; // bottom width is along local X
103  double dx2 = dpar[8]; // top width is along local X
104  dpar = solid.solidB().parameters();
105  dz += dpar[3]; // chamber thickness
106  dz *= 2; // 2 chambers in superchamber
107  dz += 2.105; // gap between chambers
108 
109  GEMDetId gemid = detId.superChamberId();
110 
111  std::vector<double> pars{dx1, dx2, dy, dz};
112  std::vector<double> vtra = getTranslation(fv);
113  std::vector<double> vrot = getRotation(fv);
114 
115  LogDebug("GEMGeometryParsFromDD") << "dimension dx1 " << dx1 << ", dx2 " << dx2 << ", dy " << dy << ", dz " << dz;
116  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
117 }
118 
120  LogDebug("GEMGeometryParsFromDD") << "buildChamber " << fv.logicalPart().name().name() << " " << detId << std::endl;
121 
123  std::vector<double> dpar = solid.solidA().parameters();
124 
125  double dy = dpar[0]; //length is along local Y
126  double dz = dpar[3]; // thickness is long local Z
127  double dx1 = dpar[4]; // bottom width is along local X
128  double dx2 = dpar[8]; // top width is along local X
129  dpar = solid.solidB().parameters();
130  dz += dpar[3]; // chamber thickness
131 
132  GEMDetId gemid = detId.chamberId();
133 
134  std::vector<double> pars{dx1, dx2, dy, dz};
135  std::vector<double> vtra = getTranslation(fv);
136  std::vector<double> vrot = getRotation(fv);
137 
138  LogDebug("GEMGeometryParsFromDD") << "dimension dx1 " << dx1 << ", dx2 " << dx2 << ", dy " << dy << ", dz " << dz;
139  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
140 }
141 
143  LogDebug("GEMGeometryParsFromDD") << "buildEtaPartition " << fv.logicalPart().name().name() << " " << detId
144  << std::endl;
145 
146  // EtaPartition specific parameter (nstrips and npads)
147  DDValue numbOfStrips("nStrips");
148  DDValue numbOfPads("nPads");
149  const std::vector<const DDsvalues_type*>& specs = fv.specifics();
150  double nStrips = 0., nPads = 0.;
151  for (auto const& is : specs) {
152  if (DDfetch(is, numbOfStrips))
153  nStrips = numbOfStrips.doubles()[0];
154  if (DDfetch(is, numbOfPads))
155  nPads = numbOfPads.doubles()[0];
156  }
157  LogDebug("GEMGeometryParsFromDD") << ((nStrips == 0.) ? ("No nStrips found!!")
158  : ("Number of strips: " + std::to_string(nStrips)));
159  LogDebug("GEMGeometryParsFromDD") << ((nPads == 0.) ? ("No nPads found!!")
160  : ("Number of pads: " + std::to_string(nPads)));
161 
162  // EtaPartition specific parameter (size)
163  std::vector<double> dpar = fv.logicalPart().solid().parameters();
164 
165  double dy = dpar[0]; //length is along local Y
166  double dz = dpar[3]; //0.4;// thickness is long local Z
167  double dx1 = dpar[4]; // bottom width is along local X
168  double dx2 = dpar[8]; // top width is along local X
169 
170  std::vector<double> pars{dx1, dx2, dy, dz, nStrips, nPads};
171  std::vector<double> vtra = getTranslation(fv);
172  std::vector<double> vrot = getRotation(fv);
173 
174  LogDebug("GEMGeometryParsFromDD") << "dimension dx1 " << dx1 << ", dx2 " << dx2 << ", dy " << dy << ", dz " << dz;
175  rgeo.insert(detId.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
176 }
177 
179  const DDTranslation& tran = fv.translation();
180  return {tran.x(), tran.y(), tran.z()};
181 }
182 
184  const DDRotationMatrix& rota = fv.rotation(); //.Inverse();
185  DD3Vector x, y, z;
186  rota.GetComponents(x, y, z);
187  return {x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z()};
188 }
DDBooleanSolid::solidB
DDSolid solidB(void) const
Definition: DDSolid.cc:468
MuonDDDNumbering
Definition: MuonDDDNumbering.h:24
MuonGeometryConstants
Definition: MuonGeometryConstants.h:20
DDAxes::y
GEMNumberingScheme
Definition: GEMNumberingScheme.h:9
MuonDDDNumbering::geoHistoryToBaseNumber
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history) const
Definition: MuonDDDNumbering.cc:37
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:184
GEMGeometryParsFromDD::getRotation
std::vector< double > getRotation(DDFilteredView &fv)
Definition: GEMGeometryParsFromDD.cc:183
GEMGeometryParsFromDD::~GEMGeometryParsFromDD
~GEMGeometryParsFromDD()
Definition: GEMGeometryParsFromDD.cc:26
DDFilteredView::logicalPart
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
Definition: DDFilteredView.cc:16
HistogramManager_cfi.specs
specs
Definition: HistogramManager_cfi.py:80
Basic3DVector.h
GEMDetId::superChamberId
constexpr GEMDetId superChamberId() const
Definition: GEMDetId.h:196
DDAxes::x
DDFilteredView::parent
bool parent()
set the current node to the parent node ...
Definition: DDFilteredView.cc:161
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
DDBooleanSolid
Definition: DDSolid.h:173
GEMGeometryParsFromDD::buildSuperChamber
void buildSuperChamber(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
Definition: GEMGeometryParsFromDD.cc:93
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
GEMNumberingScheme.h
DDFilteredView.h
GEMNumberingScheme::baseNumberToUnitNumber
int baseNumberToUnitNumber(const MuonBaseNumber &) override
Definition: GEMNumberingScheme.cc:26
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
DDBase::name
const N & name() const
Definition: DDBase.h:59
DDAxes::z
GEMGeometryParsFromDD::build
void build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
Definition: GEMGeometryParsFromDD.cc:28
DDSolid.h
DDFilteredView::nextSibling
bool nextSibling()
set the current node to the next sibling ...
Definition: DDFilteredView.cc:124
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
RecoIdealGeometry.h
GEMGeometryParsFromDD.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
MuonBaseNumber.h
GEMDetId
Definition: GEMDetId.h:17
DDFilter.h
value
Definition: value.py:1
DDName::name
const std::string & name() const
Returns the name.
Definition: DDName.cc:40
PVValHelper::dy
Definition: PVValidationHelpers.h:49
DDFilteredView::geoHistory
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
Definition: DDFilteredView.cc:30
DDFilteredView::specifics
std::vector< const DDsvalues_type * > specifics() const
Definition: DDFilteredView.cc:32
me0TriggerPseudoDigis_cff.nStrips
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
Definition: me0TriggerPseudoDigis_cff.py:26
GEMGeometryParsFromDD::buildEtaPartition
void buildEtaPartition(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
Definition: GEMGeometryParsFromDD.cc:142
GEMDetId.h
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
GEMGeometryParsFromDD::buildChamber
void buildChamber(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
Definition: GEMGeometryParsFromDD.cc:119
PVValHelper::dz
Definition: PVValidationHelpers.h:50
DDValue
Definition: DDValue.h:21
DDFilteredView::translation
const DDTranslation & translation() const
The absolute translation of the current node.
Definition: DDFilteredView.cc:26
GEMDetId::chamberId
constexpr GEMDetId chamberId() const
Definition: GEMDetId.h:193
GEMGeometryParsFromDD::getTranslation
std::vector< double > getTranslation(DDFilteredView &fv)
Definition: GEMGeometryParsFromDD.cc:178
DDSolid::parameters
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:121
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
DDFilteredView::rotation
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Definition: DDFilteredView.cc:28
GEMGeometryParsFromDD::buildGeometry
void buildGeometry(DDFilteredView &fview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)
Definition: GEMGeometryParsFromDD.cc:41
DDBooleanSolid::solidA
DDSolid solidA(void) const
Definition: DDSolid.cc:466
DDValue::doubles
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
Definition: DDValue.cc:111
DDFilteredView
Definition: DDFilteredView.h:20
MuonDDDNumbering.h
RecoIdealGeometry::insert
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
Definition: RecoIdealGeometry.h:33
DDLogicalPart::solid
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Definition: DDLogicalPart.cc:120
RecoIdealGeometry
Definition: RecoIdealGeometry.h:28
GEMGeometryParsFromDD::GEMGeometryParsFromDD
GEMGeometryParsFromDD()
Definition: GEMGeometryParsFromDD.cc:24