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 39 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.

27 { }
GEMGeometryBuilderFromDDD::~GEMGeometryBuilderFromDDD ( )

Definition at line 29 of file GEMGeometryBuilderFromDDD.cc.

30 { }

Member Function Documentation

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

Definition at line 246 of file GEMGeometryBuilderFromDDD.cc.

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

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

247  {
248  // extract the position
249  const DDTranslation & trans(fv.translation());
250  const Surface::PositionType posResult(float(trans.x()/cm),
251  float(trans.y()/cm),
252  float(trans.z()/cm));
253 
254  // now the rotation
255  const DDRotationMatrix& rotation = fv.rotation();
256  DD3Vector x, y, z;
257  rotation.GetComponents(x,y,z);
258 
259  Surface::RotationType rotResult(float(x.X()),float(x.Y()),float(x.Z()),
260  float(y.X()),float(y.Y()),float(y.Z()),
261  float(z.X()),float(z.Y()),float(z.Z()));
262 
263  //Change of axes for the forward
264  Basic3DVector<float> newX(1.,0.,0.);
265  Basic3DVector<float> newY(0.,0.,1.);
266  Basic3DVector<float> newZ(0.,1.,0.);
267 
268  // Odd chambers are inverted in gem.xml
269  if (isOddChamber) newY *= -1;
270 
271  rotResult.rotateAxes(newX, newY, newZ);
272 
273  return RCPBoundPlane( new BoundPlane( posResult, rotResult, bounds));
274 }
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Plane BoundPlane
Definition: Plane.h:95
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 33 of file GEMGeometryBuilderFromDDD.cc.

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

Referenced by GEMGeometryESModule::produce().

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

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

173 {
174  LogDebug("GEMGeometryBuilderFromDDD") << "buildChamber "
175  << fv.logicalPart().name().name()
176  << " " << detId << std::endl;
177 
179  std::vector<double> dpar = solid.solidA().parameters();
180 
181  double dy = dpar[0]/cm;//length is along local Y
182  double dz = dpar[3]/cm;// thickness is long local Z
183  double dx1= dpar[4]/cm;// bottom width is along local X
184  double dx2= dpar[8]/cm;// top width is along local X
185  dpar = solid.solidB().parameters();
186  dz += dpar[3]/cm;// chamber thickness
187 
188  bool isOdd = detId.chamber()%2;
189  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1,dx2,dy,dz), isOdd ));
190 
191  LogDebug("GEMGeometryBuilderFromDDD") << "size "<< dx1 << " " << dx2 << " " << dy << " " << dz << std::endl;
192 
193  GEMChamber* chamber = new GEMChamber(detId.chamberId(), surf);
194  return chamber;
195 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:144
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:74
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: GEMDetId.h:74
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:616
GEMDetId chamberId() const
Return the corresponding ChamberId.
Definition: GEMDetId.h:85
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
DDSolid solidA(void) const
Definition: DDSolid.cc:610
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
GEMEtaPartition * GEMGeometryBuilderFromDDD::buildEtaPartition ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 198 of file GEMGeometryBuilderFromDDD.cc.

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

Referenced by build().

200 {
201  LogDebug("GEMGeometryBuilderFromDDD") << "buildEtaPartition "
202  << fv.logicalPart().name().name()
203  << " " << detId << std::endl;
204 
205  // EtaPartition specific parameter (nstrips and npads)
206  DDValue numbOfStrips("nStrips");
207  DDValue numbOfPads("nPads");
208  std::vector<const DDsvalues_type* > specs(fv.specifics());
209  std::vector<const DDsvalues_type* >::iterator is = specs.begin();
210  double nStrips = 0., nPads = 0.;
211  for (;is != specs.end(); is++){
212  if (DDfetch( *is, numbOfStrips)) nStrips = numbOfStrips.doubles()[0];
213  if (DDfetch( *is, numbOfPads)) nPads = numbOfPads.doubles()[0];
214  }
215  LogDebug("GEMGeometryBuilderFromDDD")
216  << ((nStrips == 0. ) ? ("No nStrips found!!") : ("Number of strips: " + std::to_string(nStrips)));
217  LogDebug("GEMGeometryBuilderFromDDD")
218  << ((nPads == 0. ) ? ("No nPads found!!") : ("Number of pads: " + std::to_string(nPads)));
219 
220  // EtaPartition specific parameter (size)
221  std::vector<double> dpar = fv.logicalPart().solid().parameters();
222 
223  double be = dpar[4]/cm; // half bottom edge
224  double te = dpar[8]/cm; // half top edge
225  double ap = dpar[0]/cm; // half apothem
226  double ti = 0.4/cm; // half thickness
227 
228  std::vector<float> pars;
229  pars.emplace_back(be);
230  pars.emplace_back(te);
231  pars.emplace_back(ap);
232  pars.emplace_back(nStrips);
233  pars.emplace_back(nPads);
234 
235  bool isOdd = detId.chamber()%2;
236  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(be, te, ap, ti), isOdd ));
237  std::string name = fv.logicalPart().name().name();
239 
240  LogDebug("GEMGeometryBuilderFromDDD") << "size "<< be << " " << te << " " << ap << " " << ti <<std::endl;
241  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
242  return etaPartition;
243 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:144
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:74
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: GEMDetId.h:74
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:81
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
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:53
GEMSuperChamber * GEMGeometryBuilderFromDDD::buildSuperChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

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

144 {
145  LogDebug("GEMGeometryBuilderFromDDD") << "buildSuperChamber "
146  << fv.logicalPart().name().name()
147  << " " << detId << std::endl;
148 
150  std::vector<double> dpar = solid.solidA().parameters();
151 
152  double dy = dpar[0]/cm;//length is along local Y
153  double dz = dpar[3]/cm;// thickness is long local Z
154  double dx1= dpar[4]/cm;// bottom width is along local X
155  double dx2= dpar[8]/cm;// top width is along local X
156  dpar = solid.solidB().parameters();
157  dz += dpar[3]/cm;// chamber thickness
158  dz *=2; // 2 chambers in superchamber
159  dz += 2.105;// gap between chambers
160 
161  bool isOdd = detId.chamber()%2;
162  RCPBoundPlane surf( boundPlane( fv, new TrapezoidalPlaneBounds( dx1, dx2, dy, dz), isOdd ));
163 
164  LogDebug("GEMGeometryBuilderFromDDD") << "size "<< dx1 << " " << dx2 << " " << dy << " " << dz <<std::endl;
165 
166  GEMSuperChamber* superChamber = new GEMSuperChamber(detId.superChamberId(), surf);
167  return superChamber;
168 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:144
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:74
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: GEMDetId.h:74
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
GEMDetId superChamberId() const
Return the corresponding superChamberId.
Definition: GEMDetId.h:90
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
DDSolid solidB(void) const
Definition: DDSolid.cc:616
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
DDSolid solidA(void) const
Definition: DDSolid.cc:610
const std::string & name() const
Returns the name.
Definition: DDName.cc:53

Member Data Documentation

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

Definition at line 37 of file GEMGeometryBuilderFromDDD.h.