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 (const std::shared_ptr< 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 243 of file GEMGeometryBuilderFromDDD.cc.

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

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

244  {
245  // extract the position
246  const DDTranslation & trans(fv.translation());
247  const Surface::PositionType posResult(float(trans.x()/cm),
248  float(trans.y()/cm),
249  float(trans.z()/cm));
250 
251  // now the rotation
252  const DDRotationMatrix& rotation = fv.rotation();
253  DD3Vector x, y, z;
254  rotation.GetComponents(x,y,z);
255 
256  Surface::RotationType rotResult(float(x.X()),float(x.Y()),float(x.Z()),
257  float(y.X()),float(y.Y()),float(y.Z()),
258  float(z.X()),float(z.Y()),float(z.Z()));
259 
260  //Change of axes for the forward
261  Basic3DVector<float> newX(1.,0.,0.);
262  Basic3DVector<float> newY(0.,0.,1.);
263  Basic3DVector<float> newZ(0.,1.,0.);
264 
265  // Odd chambers are inverted in gem.xml
266  if (isOddChamber) newY *= -1;
267 
268  rotResult.rotateAxes(newX, newY, newZ);
269 
270  return RCPBoundPlane( new BoundPlane( posResult, rotResult, bounds));
271 }
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Plane BoundPlane
Definition: Plane.h:95
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.
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
void GEMGeometryBuilderFromDDD::build ( const std::shared_ptr< 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(), GEMNumberingScheme::baseNumberToUnitNumber(), buildChamber(), buildEtaPartition(), buildSuperChamber(), 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, and AlCaHLTBitMon_QueryRunRegistry::string.

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  while (doChambers){
76 
77  // loop over GEMEtaPartitions
78  bool doEtaPart = fv.firstChild();
79  while (doEtaPart){
80 
81  MuonDDDNumbering mdddnum(muonConstants);
82  GEMNumberingScheme gemNum(muonConstants);
83  int rawid = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
84  GEMDetId detId = GEMDetId(rawid);
85 
86  GEMEtaPartition *etaPart = buildEtaPartition(fv, detId);
87  gemChamber->add(etaPart);
88  theGeometry->add(etaPart);
89  doEtaPart = fv.nextSibling();
90  }
91  fv.parent();
92 
93  theGeometry->add(gemChamber);
94 
95  doChambers = fv.nextSibling();
96  }
97  fv.parent();
98 
99  doSuper = fv.nextSibling();
100  }
101 
102  auto& superChambers(theGeometry->superChambers());
103  // construct the regions, stations and rings.
104  for (int re = -1; re <= 1; re = re+2) {
105  GEMRegion* region = new GEMRegion(re);
106  for (int st=1; st<=GEMDetId::maxStationId; ++st) {
107  GEMStation* station = new GEMStation(re, st);
108  std::string sign( re==-1 ? "-" : "");
109  std::string name("GE" + sign + std::to_string(st) + "/1");
110  station->setName(name);
111  for (int ri=1; ri<=1; ++ri) {
112  GEMRing* ring = new GEMRing(re, st, ri);
113  for (auto sch : superChambers){
114  GEMSuperChamber* superChamber = const_cast<GEMSuperChamber*>(sch);
115  const GEMDetId detId(superChamber->id());
116  if (detId.region() != re || detId.station() != st || detId.ring() != ri) continue;
117 
118  superChamber->add( theGeometry->chamber(GEMDetId(detId.region(),detId.ring(),detId.station(),1,detId.chamber(),0)));
119  superChamber->add( theGeometry->chamber(GEMDetId(detId.region(),detId.ring(),detId.station(),2,detId.chamber(),0)));
120 
121  ring->add(superChamber);
122  LogDebug("GEMGeometryBuilderFromDDD") << "Adding super chamber " << detId << " to ring: "
123  << "re " << re << " st " << st << " ri " << ri << std::endl;
124  }
125  LogDebug("GEMGeometryBuilderFromDDD") << "Adding ring " << ri << " to station " << "re " << re << " st " << st << std::endl;
126  station->add(ring);
127  theGeometry->add(ring);
128  }
129  LogDebug("GEMGeometryBuilderFromDDD") << "Adding station " << st << " to region " << re << std::endl;
130  region->add(station);
131  theGeometry->add(station);
132  }
133  LogDebug("GEMGeometryBuilderFromDDD") << "Adding region " << re << " to the geometry " << std::endl;
134  theGeometry->add(region);
135  }
136 }
#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
GEMChamber * buildChamber(DDFilteredView &fv, GEMDetId detId) const
GEMEtaPartition * buildEtaPartition(DDFilteredView &fv, GEMDetId detId) const
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
GEMChamber * GEMGeometryBuilderFromDDD::buildChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

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

170 {
171  LogDebug("GEMGeometryBuilderFromDDD") << "buildChamber "
172  << fv.logicalPart().name().name()
173  << " " << detId << std::endl;
174 
176  std::vector<double> dpar = solid.solidA().parameters();
177 
178  double dy = dpar[0]/cm;//length is along local Y
179  double dz = dpar[3]/cm;// thickness is long local Z
180  double dx1= dpar[4]/cm;// bottom width is along local X
181  double dx2= dpar[8]/cm;// top width is along local X
182  dpar = solid.solidB().parameters();
183  dz += dpar[3]/cm;// chamber thickness
184 
185  bool isOdd = detId.chamber()%2;
186  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1,dx2,dy,dz), isOdd ));
187 
188  LogDebug("GEMGeometryBuilderFromDDD") << "size "<< dx1 << " " << dx2 << " " << dy << " " << dz << std::endl;
189 
190  GEMChamber* chamber = new GEMChamber(detId.chamberId(), surf);
191  return chamber;
192 }
#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:78
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:617
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:611
const std::string & name() const
Returns the name.
Definition: DDName.cc:88
GEMEtaPartition * GEMGeometryBuilderFromDDD::buildEtaPartition ( DDFilteredView fv,
GEMDetId  detId 
) const
private

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

197 {
198  LogDebug("GEMGeometryBuilderFromDDD") << "buildEtaPartition "
199  << fv.logicalPart().name().name()
200  << " " << detId << std::endl;
201 
202  // EtaPartition specific parameter (nstrips and npads)
203  DDValue numbOfStrips("nStrips");
204  DDValue numbOfPads("nPads");
205  std::vector<const DDsvalues_type* > specs(fv.specifics());
206  std::vector<const DDsvalues_type* >::iterator is = specs.begin();
207  double nStrips = 0., nPads = 0.;
208  for (;is != specs.end(); is++){
209  if (DDfetch( *is, numbOfStrips)) nStrips = numbOfStrips.doubles()[0];
210  if (DDfetch( *is, numbOfPads)) nPads = numbOfPads.doubles()[0];
211  }
212  LogDebug("GEMGeometryBuilderFromDDD")
213  << ((nStrips == 0. ) ? ("No nStrips found!!") : ("Number of strips: " + std::to_string(nStrips)));
214  LogDebug("GEMGeometryBuilderFromDDD")
215  << ((nPads == 0. ) ? ("No nPads found!!") : ("Number of pads: " + std::to_string(nPads)));
216 
217  // EtaPartition specific parameter (size)
218  std::vector<double> dpar = fv.logicalPart().solid().parameters();
219 
220  double be = dpar[4]/cm; // half bottom edge
221  double te = dpar[8]/cm; // half top edge
222  double ap = dpar[0]/cm; // half apothem
223  double ti = 0.4/cm; // half thickness
224 
225  std::vector<float> pars;
226  pars.emplace_back(be);
227  pars.emplace_back(te);
228  pars.emplace_back(ap);
229  pars.emplace_back(nStrips);
230  pars.emplace_back(nPads);
231 
232  bool isOdd = detId.chamber()%2;
233  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(be, te, ap, ti), isOdd ));
234  std::string name = fv.logicalPart().name().name();
236 
237  LogDebug("GEMGeometryBuilderFromDDD") << "size "<< be << " " << te << " " << ap << " " << ti <<std::endl;
238  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
239  return etaPartition;
240 }
#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:78
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:88
GEMSuperChamber * GEMGeometryBuilderFromDDD::buildSuperChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

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

Member Data Documentation

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

Definition at line 37 of file GEMGeometryBuilderFromDDD.h.