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 MuonDDDConstants &muonConstants, RecoIdealGeometry &rgeo)
 
 GEMGeometryParsFromDD ()
 
 ~GEMGeometryParsFromDD ()
 

Private Member Functions

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

Detailed Description

Build the GEMGeometry ftom the DDD description

Author
M. Maggi - INFN Bari

Definition at line 22 of file GEMGeometryParsFromDD.h.

Constructor & Destructor Documentation

GEMGeometryParsFromDD::GEMGeometryParsFromDD ( )

Implementation of the GEM Geometry Builder from DDD

Author
M. Maggi - INFN Bari

Definition at line 24 of file GEMGeometryParsFromDD.cc.

24 {}
GEMGeometryParsFromDD::~GEMGeometryParsFromDD ( )

Definition at line 26 of file GEMGeometryParsFromDD.cc.

26 {}

Member Function Documentation

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

Definition at line 28 of file GEMGeometryParsFromDD.cc.

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

Referenced by GEMRecoIdealDBLoader::beginRun().

30  {
31  std::string attribute = "MuStructure";
32  std::string value = "MuonEndCapGEM";
33 
34  // Asking only for the MuonGEM's
35  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
36  DDFilteredView fv(*cview, filter);
37 
38  this->buildGeometry(fv, muonConstants, rgeo);
39 }
void buildGeometry(DDFilteredView &fview, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rgeo)
Definition: value.py:1
void GEMGeometryParsFromDD::buildChamber ( DDFilteredView fv,
GEMDetId  detId,
RecoIdealGeometry rgeo 
)
private

Definition at line 119 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().

119  {
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 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:121
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:59
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
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.
DDSolid solidB(void) const
Definition: DDSolid.cc:468
GEMDetId chamberId() const
Definition: GEMDetId.h:193
std::vector< double > getRotation(DDFilteredView &fv)
DDSolid solidA(void) const
Definition: DDSolid.cc:466
std::vector< double > getTranslation(DDFilteredView &fv)
const std::string & name() const
Returns the name.
Definition: DDName.cc:40
void GEMGeometryParsFromDD::buildEtaPartition ( DDFilteredView fv,
GEMDetId  detId,
RecoIdealGeometry rgeo 
)
private

Definition at line 142 of file GEMGeometryParsFromDD.cc.

References DDfetch(), DDValue::doubles(), 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(), and HistogramManager_cfi::specs.

Referenced by buildGeometry().

142  {
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 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:121
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:59
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
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.
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)
std::vector< double > getTranslation(DDFilteredView &fv)
std::vector< const DDsvalues_type * > specifics() const
const std::string & name() const
Returns the name.
Definition: DDName.cc:40
void GEMGeometryParsFromDD::buildGeometry ( DDFilteredView fview,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rgeo 
)
private

Definition at line 41 of file GEMGeometryParsFromDD.cc.

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

Referenced by build().

43  {
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 }
#define LogDebug(id)
void buildEtaPartition(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
int layer() const
Definition: GEMDetId.h:184
void buildChamber(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
void buildSuperChamber(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
void GEMGeometryParsFromDD::buildSuperChamber ( DDFilteredView fv,
GEMDetId  detId,
RecoIdealGeometry rgeo 
)
private

Definition at line 93 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().

93  {
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 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:121
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:59
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
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.
GEMDetId superChamberId() const
Definition: GEMDetId.h:196
DDSolid solidB(void) const
Definition: DDSolid.cc:468
std::vector< double > getRotation(DDFilteredView &fv)
DDSolid solidA(void) const
Definition: DDSolid.cc:466
std::vector< double > getTranslation(DDFilteredView &fv)
const std::string & name() const
Returns the name.
Definition: DDName.cc:40
std::vector< double > GEMGeometryParsFromDD::getRotation ( DDFilteredView fv)
private

Definition at line 183 of file GEMGeometryParsFromDD.cc.

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

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

183  {
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 }
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
std::vector< double > GEMGeometryParsFromDD::getTranslation ( DDFilteredView fv)
private

Definition at line 178 of file GEMGeometryParsFromDD.cc.

References DDFilteredView::translation().

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

178  {
179  const DDTranslation& tran = fv.translation();
180  return {tran.x(), tran.y(), tran.z()};
181 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
const DDTranslation & translation() const
The absolute translation of the current node.