CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
GEMGeometryBuilderFromDDD Class Reference

#include <GEMGeometryBuilderFromDDD.h>

Public Member Functions

void build (GEMGeometry &theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
 
 GEMGeometryBuilderFromDDD ()
 
 ~GEMGeometryBuilderFromDDD ()
 

Private Types

typedef ReferenceCountingPointer< BoundPlaneRCPBoundPlane
 

Private Member Functions

RCPBoundPlane boundPlane (const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
 
GEMChamberbuildChamber (DDFilteredView &fv, GEMDetId detId) const
 
GEMEtaPartitionbuildEtaPartition (DDFilteredView &fv, GEMDetId detId) const
 
GEMSuperChamberbuildSuperChamber (DDFilteredView &fv, GEMDetId detId) const
 

Private Attributes

std::map< GEMDetId, std::vector< GEMDetId > > chids
 

Detailed Description

Build the GEMGeometry ftom the DDD description

Author
M. Maggi - INFN Bari

Definition at line 25 of file GEMGeometryBuilderFromDDD.h.

Member Typedef Documentation

Definition at line 36 of file GEMGeometryBuilderFromDDD.h.

Constructor & Destructor Documentation

GEMGeometryBuilderFromDDD::GEMGeometryBuilderFromDDD ( )

Implementation of the GEM Geometry Builder from DDD

Author
M. Maggi - INFN Bari

Definition at line 26 of file GEMGeometryBuilderFromDDD.cc.

26 {}
GEMGeometryBuilderFromDDD::~GEMGeometryBuilderFromDDD ( )

Definition at line 28 of file GEMGeometryBuilderFromDDD.cc.

28 {}

Member Function Documentation

GEMGeometryBuilderFromDDD::RCPBoundPlane GEMGeometryBuilderFromDDD::boundPlane ( const DDFilteredView fv,
Bounds bounds,
bool  isOddChamber 
) const
private

Definition at line 235 of file GEMGeometryBuilderFromDDD.cc.

References TkRotation< T >::rotateAxes(), idealTransformation::rotation, DDFilteredView::rotation(), DDFilteredView::translation(), x, y, and z.

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

237  {
238  // extract the position
239  const DDTranslation& trans(fv.translation());
240  const Surface::PositionType posResult(float(trans.x() / cm), float(trans.y() / cm), float(trans.z() / cm));
241 
242  // now the rotation
243  const DDRotationMatrix& rotation = fv.rotation();
244  DD3Vector x, y, z;
245  rotation.GetComponents(x, y, z);
246 
247  Surface::RotationType rotResult(float(x.X()),
248  float(x.Y()),
249  float(x.Z()),
250  float(y.X()),
251  float(y.Y()),
252  float(y.Z()),
253  float(z.X()),
254  float(z.Y()),
255  float(z.Z()));
256 
257  //Change of axes for the forward
258  Basic3DVector<float> newX(1., 0., 0.);
259  Basic3DVector<float> newY(0., 0., -1.);
260  Basic3DVector<float> newZ(0., 1., 0.);
261 
262  rotResult.rotateAxes(newX, newY, newZ);
263 
264  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
265 }
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Plane BoundPlane
Definition: Plane.h:94
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
const DDTranslation & translation() const
The absolute translation of the current node.
void GEMGeometryBuilderFromDDD::build ( GEMGeometry theGeometry,
const DDCompactView cview,
const MuonDDDConstants muonConstants 
)

Definition at line 30 of file GEMGeometryBuilderFromDDD.cc.

References GEMRing::add(), GEMStation::add(), GEMRegion::add(), GEMChamber::add(), GEMGeometry::add(), GEMNumberingScheme::baseNumberToUnitNumber(), buildChamber(), buildEtaPartition(), buildSuperChamber(), GEMGeometry::chamber(), ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), GEMDetId::layer(), LogDebug, DDFilteredView::logicalPart(), GEMDetId::maxStationId, Skims_PA_cff::name, DDName::name(), DDBase< N, C >::name(), DDFilteredView::nextSibling(), DDFilteredView::parent(), HLT_2018_cff::region, relativeConstraints::ring, GEMStation::setName(), Validation_hcalonly_cfi::sign, relativeConstraints::station, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GEMGeometryESModule::produce().

32  {
33  std::string attribute = "MuStructure";
34  std::string value = "MuonEndCapGEM";
35 
36  // Asking only for the MuonGEM's
37  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
38  DDFilteredView fv(*cview, filter);
39 
40  LogDebug("GEMGeometryBuilderFromDDD") << "Building the geometry service";
41  LogDebug("GEMGeometryBuilderFromDDD") << "About to run through the GEM structure\n"
42  << " First logical part " << fv.logicalPart().name().name();
43 
44  bool doSuper = fv.firstChild();
45  LogDebug("GEMGeometryBuilderFromDDD") << "doSuperChamber = " << doSuper;
46  // loop over superchambers
47  std::vector<GEMSuperChamber*> superChambers;
48  while (doSuper) {
49  // getting chamber id from eta partitions
50  fv.firstChild();
51  fv.firstChild();
52  MuonDDDNumbering mdddnumCh(muonConstants);
53  GEMNumberingScheme gemNumCh(muonConstants);
54  int rawidCh = gemNumCh.baseNumberToUnitNumber(mdddnumCh.geoHistoryToBaseNumber(fv.geoHistory()));
55  GEMDetId detIdCh = GEMDetId(rawidCh);
56  // back to chambers
57  fv.parent();
58  fv.parent();
59 
60  // currently there is no superchamber in the geometry
61  // only 2 chambers are present separated by a gap.
62  // making superchamber out of the first chamber layer including the gap between chambers
63  if (detIdCh.layer() == 1) { // only make superChambers when doing layer 1
64  GEMSuperChamber* gemSuperChamber = buildSuperChamber(fv, detIdCh);
65  superChambers.push_back(gemSuperChamber);
66  }
67  GEMChamber* gemChamber = buildChamber(fv, detIdCh);
68 
69  // loop over chambers
70  // only 1 chamber
71  bool doChambers = fv.firstChild();
72  bool loopExecuted = false;
73  while (doChambers) {
74  loopExecuted = true;
75 
76  // loop over GEMEtaPartitions
77  bool doEtaPart = fv.firstChild();
78  while (doEtaPart) {
79  MuonDDDNumbering mdddnum(muonConstants);
80  GEMNumberingScheme gemNum(muonConstants);
81  int rawid = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
82  GEMDetId detId = GEMDetId(rawid);
83 
84  GEMEtaPartition* etaPart = buildEtaPartition(fv, detId);
85  gemChamber->add(etaPart);
86  theGeometry.add(etaPart);
87  doEtaPart = fv.nextSibling();
88  }
89  fv.parent();
90 
91  theGeometry.add(gemChamber);
92 
93  doChambers = fv.nextSibling();
94  }
95  fv.parent();
96 
97  doSuper = fv.nextSibling();
98  if (!loopExecuted)
99  delete gemChamber;
100  }
101 
102  // construct the regions, stations and rings.
103  for (int re = -1; re <= 1; re = re + 2) {
104  GEMRegion* region = new GEMRegion(re);
105  for (int st = 1; st <= GEMDetId::maxStationId; ++st) {
106  GEMStation* station = new GEMStation(re, st);
107  std::string sign(re == -1 ? "-" : "");
108  std::string name("GE" + sign + std::to_string(st) + "/1");
109  station->setName(name);
110  for (int ri = 1; ri <= 1; ++ri) {
111  GEMRing* ring = new GEMRing(re, st, ri);
112  for (auto superChamber : superChambers) {
113  const GEMDetId detId(superChamber->id());
114  if (detId.region() != re || detId.station() != st || detId.ring() != ri)
115  continue;
116 
117  superChamber->add(
118  theGeometry.chamber(GEMDetId(detId.region(), detId.ring(), detId.station(), 1, detId.chamber(), 0)));
119  superChamber->add(
120  theGeometry.chamber(GEMDetId(detId.region(), detId.ring(), detId.station(), 2, detId.chamber(), 0)));
121 
122  ring->add(superChamber);
123  theGeometry.add(superChamber);
124  LogDebug("GEMGeometryBuilderFromDDD") << "Adding super chamber " << detId << " to ring: "
125  << "re " << re << " st " << st << " ri " << ri << std::endl;
126  }
127  LogDebug("GEMGeometryBuilderFromDDD") << "Adding ring " << ri << " to station "
128  << "re " << re << " st " << st << std::endl;
129  station->add(ring);
130  theGeometry.add(ring);
131  }
132  LogDebug("GEMGeometryBuilderFromDDD") << "Adding station " << st << " to region " << re << std::endl;
133  region->add(station);
134  theGeometry.add(station);
135  }
136  LogDebug("GEMGeometryBuilderFromDDD") << "Adding region " << re << " to the geometry " << std::endl;
137  theGeometry.add(region);
138  }
139 }
#define LogDebug(id)
int ring() const
Definition: GEMDetId.h:170
static int32_t maxStationId
Definition: GEMDetId.h:26
int chamber() const
Definition: GEMDetId.h:177
void add(GEMRing *ring)
Add ring to the station which takes ownership.
Definition: GEMStation.cc:22
void add(GEMSuperChamber *ch)
Add super chamber to the ring which takes ownership.
Definition: GEMRing.cc:14
GEMSuperChamber * buildSuperChamber(DDFilteredView &fv, GEMDetId detId) const
int layer() const
Definition: GEMDetId.h:184
int station() const
Definition: GEMDetId.h:173
void add(GEMEtaPartition *roll)
Add EtaPartition to the chamber which takes ownership.
Definition: GEMChamber.cc:21
void setName(std::string name)
Set the station name.
Definition: GEMStation.cc:66
Definition: value.py:1
int region() const
Definition: GEMDetId.h:165
GEMChamber * buildChamber(DDFilteredView &fv, GEMDetId detId) const
GEMEtaPartition * buildEtaPartition(DDFilteredView &fv, GEMDetId detId) const
const GEMChamber * chamber(GEMDetId id) const
Definition: GEMGeometry.cc:73
void add(GEMStation *st)
Add station to the region which takes ownership.
Definition: GEMRegion.cc:20
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
GEMChamber * GEMGeometryBuilderFromDDD::buildChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 166 of file GEMGeometryBuilderFromDDD.cc.

References boundPlane(), relativeConstraints::chamber, GEMDetId::chamber(), GEMDetId::chamberId(), PVValHelper::dy, PVValHelper::dz, LogDebug, DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), DDSolid::parameters(), DDLogicalPart::solid(), DDBooleanSolid::solidA(), and DDBooleanSolid::solidB().

Referenced by build().

166  {
167  LogDebug("GEMGeometryBuilderFromDDD") << "buildChamber " << fv.logicalPart().name().name() << " " << detId
168  << std::endl;
169 
171  std::vector<double> dpar = solid.solidA().parameters();
172 
173  double dy = dpar[0] / cm; //length is along local Y
174  double dz = dpar[3] / cm; // thickness is long local Z
175  double dx1 = dpar[4] / cm; // bottom width is along local X
176  double dx2 = dpar[8] / cm; // top width is along local X
177  dpar = solid.solidB().parameters();
178  dz += dpar[3] / cm; // chamber thickness
179 
180  bool isOdd = detId.chamber() % 2;
181  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
182 
183  LogDebug("GEMGeometryBuilderFromDDD") << "size " << dx1 << " " << dx2 << " " << dy << " " << dz << std::endl;
184 
185  GEMChamber* chamber = new GEMChamber(detId.chamberId(), surf);
186  return chamber;
187 }
#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
int chamber() const
Definition: GEMDetId.h:177
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
DDSolid solidB(void) const
Definition: DDSolid.cc:468
GEMDetId chamberId() const
Definition: GEMDetId.h:193
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
DDSolid solidA(void) const
Definition: DDSolid.cc:466
const std::string & name() const
Returns the name.
Definition: DDName.cc:40
GEMEtaPartition * GEMGeometryBuilderFromDDD::buildEtaPartition ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 189 of file GEMGeometryBuilderFromDDD.cc.

References boundPlane(), GEMDetId::chamber(), DDfetch(), DDValue::doubles(), GeomDetEnumerators::GEM, LogDebug, DDFilteredView::logicalPart(), Skims_PA_cff::name, DDName::name(), DDBase< N, C >::name(), me0TriggerPseudoDigis_cff::nStrips, DDSolid::parameters(), DDLogicalPart::solid(), DDFilteredView::specifics(), HistogramManager_cfi::specs, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by build().

189  {
190  LogDebug("GEMGeometryBuilderFromDDD") << "buildEtaPartition " << fv.logicalPart().name().name() << " " << detId
191  << std::endl;
192 
193  // EtaPartition specific parameter (nstrips and npads)
194  DDValue numbOfStrips("nStrips");
195  DDValue numbOfPads("nPads");
196  std::vector<const DDsvalues_type*> specs(fv.specifics());
197  std::vector<const DDsvalues_type*>::iterator is = specs.begin();
198  double nStrips = 0., nPads = 0.;
199  for (; is != specs.end(); is++) {
200  if (DDfetch(*is, numbOfStrips))
201  nStrips = numbOfStrips.doubles()[0];
202  if (DDfetch(*is, numbOfPads))
203  nPads = numbOfPads.doubles()[0];
204  }
205  LogDebug("GEMGeometryBuilderFromDDD") << ((nStrips == 0.) ? ("No nStrips found!!")
206  : ("Number of strips: " + std::to_string(nStrips)));
207  LogDebug("GEMGeometryBuilderFromDDD") << ((nPads == 0.) ? ("No nPads found!!")
208  : ("Number of pads: " + std::to_string(nPads)));
209 
210  // EtaPartition specific parameter (size)
211  std::vector<double> dpar = fv.logicalPart().solid().parameters();
212 
213  double be = dpar[4] / cm; // half bottom edge
214  double te = dpar[8] / cm; // half top edge
215  double ap = dpar[0] / cm; // half apothem
216  double ti = 0.4 / cm; // half thickness
217 
218  std::vector<float> pars;
219  pars.emplace_back(be);
220  pars.emplace_back(te);
221  pars.emplace_back(ap);
222  pars.emplace_back(nStrips);
223  pars.emplace_back(nPads);
224 
225  bool isOdd = detId.chamber() % 2;
226  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(be, te, ap, ti), isOdd));
227  std::string name = fv.logicalPart().name().name();
229 
230  LogDebug("GEMGeometryBuilderFromDDD") << "size " << be << " " << te << " " << ap << " " << ti << std::endl;
231  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
232  return etaPartition;
233 }
#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
int chamber() const
Definition: GEMDetId.h:177
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
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
std::vector< const DDsvalues_type * > specifics() const
const std::string & name() const
Returns the name.
Definition: DDName.cc:40
GEMSuperChamber * GEMGeometryBuilderFromDDD::buildSuperChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 141 of file GEMGeometryBuilderFromDDD.cc.

References boundPlane(), GEMDetId::chamber(), PVValHelper::dy, PVValHelper::dz, LogDebug, DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), DDSolid::parameters(), DDLogicalPart::solid(), DDBooleanSolid::solidA(), DDBooleanSolid::solidB(), and GEMDetId::superChamberId().

Referenced by build().

141  {
142  LogDebug("GEMGeometryBuilderFromDDD") << "buildSuperChamber " << fv.logicalPart().name().name() << " " << detId
143  << std::endl;
144 
146  std::vector<double> dpar = solid.solidA().parameters();
147 
148  double dy = dpar[0] / cm; //length is along local Y
149  double dz = dpar[3] / cm; // thickness is long local Z
150  double dx1 = dpar[4] / cm; // bottom width is along local X
151  double dx2 = dpar[8] / cm; // top width is along local X
152  dpar = solid.solidB().parameters();
153  dz += dpar[3] / cm; // chamber thickness
154  dz *= 2; // 2 chambers in superchamber
155  dz += 2.105; // gap between chambers
156 
157  bool isOdd = detId.chamber() % 2;
158  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
159 
160  LogDebug("GEMGeometryBuilderFromDDD") << "size " << dx1 << " " << dx2 << " " << dy << " " << dz << std::endl;
161 
162  GEMSuperChamber* superChamber = new GEMSuperChamber(detId.superChamberId(), surf);
163  return superChamber;
164 }
#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
int chamber() const
Definition: GEMDetId.h:177
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
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
DDSolid solidB(void) const
Definition: DDSolid.cc:468
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
DDSolid solidA(void) const
Definition: DDSolid.cc:466
const std::string & name() const
Returns the name.
Definition: DDName.cc:40

Member Data Documentation

std::map<GEMDetId, std::vector<GEMDetId> > GEMGeometryBuilderFromDDD::chids
private

Definition at line 34 of file GEMGeometryBuilderFromDDD.h.