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

GEMGeometrybuild (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
 
GEMGeometrybuildGeometry (DDFilteredView &fview, const MuonDDDConstants &muonConstants)
 
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
Port of: MuDDDGEMBuilder (ORCA)
M. Maggi - INFN Bari

Definition at line 28 of file GEMGeometryBuilderFromDDD.cc.

29 { }
GEMGeometryBuilderFromDDD::~GEMGeometryBuilderFromDDD ( )

Definition at line 31 of file GEMGeometryBuilderFromDDD.cc.

32 { }

Member Function Documentation

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

Definition at line 238 of file GEMGeometryBuilderFromDDD.cc.

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

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

239  {
240  // extract the position
241  const DDTranslation & trans(fv.translation());
242  const Surface::PositionType posResult(float(trans.x()/cm),
243  float(trans.y()/cm),
244  float(trans.z()/cm));
245 
246  // now the rotation
247  // DDRotationMatrix tmp = fv.rotation();
248  // === DDD uses 'active' rotations - see CLHEP user guide ===
249  // ORCA uses 'passive' rotation.
250  // 'active' and 'passive' rotations are inverse to each other
251  // DDRotationMatrix tmp = fv.rotation();
252  DDRotationMatrix rotation = fv.rotation();//REMOVED .Inverse();
253  DD3Vector x, y, z;
254  rotation.GetComponents(x,y,z);
255  // LogDebug("GEMGeometryBuilderFromDDD") << "translation: "<< fv.translation() << std::endl;
256  // LogDebug("GEMGeometryBuilderFromDDD") << "rotation : "<< fv.rotation() << std::endl;
257  // LogDebug("GEMGeometryBuilderFromDDD") << "INVERSE rotation manually: \n"
258  // << x.X() << ", " << x.Y() << ", " << x.Z() << std::endl
259  // << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl
260  // << z.X() << ", " << z.Y() << ", " << z.Z() << std::endl;
261 
262  Surface::RotationType rotResult(float(x.X()),float(x.Y()),float(x.Z()),
263  float(y.X()),float(y.Y()),float(y.Z()),
264  float(z.X()),float(z.Y()),float(z.Z()));
265 
266  //Change of axes for the forward
267  Basic3DVector<float> newX(1.,0.,0.);
268  Basic3DVector<float> newY(0.,0.,1.);
269  Basic3DVector<float> newZ(0.,1.,0.);
270  // Odd chambers are inverted in gem.xml
271  if (isOddChamber) newY *= -1;
272 
273  rotResult.rotateAxes(newX, newY, newZ);
274 
275  return RCPBoundPlane( new BoundPlane( posResult, rotResult, bounds));
276 }
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.
GEMGeometry * GEMGeometryBuilderFromDDD::build ( const DDCompactView cview,
const MuonDDDConstants muonConstants 
)

Definition at line 34 of file GEMGeometryBuilderFromDDD.cc.

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

Referenced by GEMGeometryESModule::produce().

35 {
36  std::string attribute = "MuStructure"; // "ReadOutName"; // could come from .orcarc
37  std::string value = "MuonEndCapGEM"; // "MuonGEMHits"; // could come from .orcarc
38 
39 
40  // Asking only for the MuonGEM's
41  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
42  DDFilteredView fview(*cview,filter);
43 
44  return this->buildGeometry(fview, muonConstants);
45 }
GEMGeometry * buildGeometry(DDFilteredView &fview, const MuonDDDConstants &muonConstants)
Definition: value.py:1
GEMChamber * GEMGeometryBuilderFromDDD::buildChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 173 of file GEMGeometryBuilderFromDDD.cc.

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

Referenced by buildGeometry().

173  {
174  LogDebug("GEMGeometryBuilderFromDDD") << "buildChamber "<<fv.logicalPart().name().name() <<" "<< detId <<std::endl;
175 
177  std::vector<double> dpar = solid.solidA().parameters();
178 
179  double dy = dpar[0]/cm;//length is along local Y
180  double dz = dpar[3]/cm;// thickness is long local Z
181  double dx1= dpar[4]/cm;// bottom width is along local X
182  double dx2= dpar[8]/cm;// top width is along local X
183  dpar = solid.solidB().parameters();
184  dz += dpar[3]/cm;// chamber thickness
185 
186  bool isOdd = detId.chamber()%2;
187  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1,dx2,dy,dz), isOdd ));
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:147
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:665
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:659
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
GEMEtaPartition * GEMGeometryBuilderFromDDD::buildEtaPartition ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 194 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(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by buildGeometry().

194  {
195  LogDebug("GEMGeometryBuilderFromDDD") << "buildEtaPartition "<<fv.logicalPart().name().name() <<" "<< detId <<std::endl;
196 
197  // EtaPartition specific parameter (nstrips and npads)
198  DDValue numbOfStrips("nStrips");
199  DDValue numbOfPads("nPads");
200  std::vector<const DDsvalues_type* > specs(fv.specifics());
201  std::vector<const DDsvalues_type* >::iterator is = specs.begin();
202  double nStrips = 0., nPads = 0.;
203  for (;is != specs.end(); is++){
204  if (DDfetch( *is, numbOfStrips)) nStrips = numbOfStrips.doubles()[0];
205  if (DDfetch( *is, numbOfPads)) nPads = numbOfPads.doubles()[0];
206  }
207  LogDebug("GEMGeometryBuilderFromDDD")
208  << ((nStrips == 0. ) ? ("No nStrips found!!") : ("Number of strips: " + boost::lexical_cast<std::string>(nStrips)));
209  LogDebug("GEMGeometryBuilderFromDDD")
210  << ((nPads == 0. ) ? ("No nPads found!!") : ("Number of pads: " + boost::lexical_cast<std::string>(nPads)));
211 
212  // EtaPartition specific parameter (size)
213  std::vector<double> dpar = fv.logicalPart().solid().parameters();
214 
215  double be = dpar[4]/cm; // half bottom edge
216  double te = dpar[8]/cm; // half top edge
217  double ap = dpar[0]/cm; // half apothem
218  double ti = 0.4/cm; // half thickness
219 
220  std::vector<float> pars;
221  pars.push_back(be);
222  pars.push_back(te);
223  pars.push_back(ap);
224  pars.push_back(nStrips);
225  pars.push_back(nPads);
226 
227  bool isOdd = detId.chamber()%2;
228  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(be, te, ap, ti), isOdd ));
229  std::string name = fv.logicalPart().name().name();
231 
232  LogDebug("GEMGeometryBuilderFromDDD") << "size "<< be << " " << te << " " << ap << " " << ti <<std::endl;
233  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
234  return etaPartition;
235 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:147
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:80
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:90
GEMGeometry * GEMGeometryBuilderFromDDD::buildGeometry ( DDFilteredView fview,
const MuonDDDConstants muonConstants 
)
private

Definition at line 47 of file GEMGeometryBuilderFromDDD.cc.

References GEMRing::add(), GEMStation::add(), GEMRegion::add(), GEMChamber::add(), GEMSuperChamber::add(), GEMGeometry::add(), GEMNumberingScheme::baseNumberToUnitNumber(), buildChamber(), buildEtaPartition(), buildSuperChamber(), GEMGeometry::chamber(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), geometry, 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 build().

48 {
49  LogDebug("GEMGeometryBuilderFromDDD") <<"Building the geometry service";
51  LogDebug("GEMGeometryBuilderFromDDD") << "About to run through the GEM structure\n"
52  <<" First logical part "
53  <<fv.logicalPart().name().name();
54 
55 
56 
57  bool doSuper = fv.firstChild();
58  LogDebug("GEMGeometryBuilderFromDDD") << "doSuperChamber = " << doSuper;
59  // loop over superchambers
60  while (doSuper){
61 
62  // getting chamber id from eta partitions
63  fv.firstChild();fv.firstChild();
64  MuonDDDNumbering mdddnumCh(muonConstants);
65  GEMNumberingScheme gemNumCh(muonConstants);
66  int rawidCh = gemNumCh.baseNumberToUnitNumber(mdddnumCh.geoHistoryToBaseNumber(fv.geoHistory()));
67  GEMDetId detIdCh = GEMDetId(rawidCh);
68  // back to chambers
69  fv.parent();fv.parent();
70 
71  // currently there is no superchamber in the geometry
72  // only 2 chambers are present separated by a gap.
73  // making superchamber out of the first chamber layer including the gap between chambers
74  if (detIdCh.layer() == 1){// only make superChambers when doing layer 1
75  GEMSuperChamber *gemSuperChamber = buildSuperChamber(fv, detIdCh);
76  geometry->add(gemSuperChamber);
77  }
78  GEMChamber *gemChamber = buildChamber(fv, detIdCh);
79 
80  // loop over chambers
81  // only 1 chamber
82  bool doChambers = fv.firstChild();
83  while (doChambers){
84 
85  // loop over GEMEtaPartitions
86  bool doEtaPart = fv.firstChild();
87  while (doEtaPart){
88 
89  MuonDDDNumbering mdddnum(muonConstants);
90  GEMNumberingScheme gemNum(muonConstants);
91  int rawid = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
92  GEMDetId detId = GEMDetId(rawid);
93 
94  GEMEtaPartition *etaPart = buildEtaPartition(fv, detId);
95  gemChamber->add(etaPart);
96  geometry->add(etaPart);
97  doEtaPart = fv.nextSibling();
98  }
99  fv.parent();
100 
101  geometry->add(gemChamber);
102 
103  doChambers = fv.nextSibling();
104  }
105  fv.parent();
106 
107  doSuper = fv.nextSibling();
108  }
109 
110  auto& superChambers(geometry->superChambers());
111  // construct the regions, stations and rings.
112  for (int re = -1; re <= 1; re = re+2) {
113  GEMRegion* region = new GEMRegion(re);
114  for (int st=1; st<=GEMDetId::maxStationId; ++st) {
115  GEMStation* station = new GEMStation(re, st);
116  std::string sign( re==-1 ? "-" : "");
117  std::string name("GE" + sign + std::to_string(st) + "/1");
118  station->setName(name);
119  for (int ri=1; ri<=1; ++ri) {
120  GEMRing* ring = new GEMRing(re, st, ri);
121  for (unsigned sch=0; sch<superChambers.size(); ++sch){
122  GEMSuperChamber* superChamber = const_cast<GEMSuperChamber*>(superChambers.at(sch));
123  const GEMDetId detId(superChamber->id());
124  if (detId.region() != re || detId.station() != st || detId.ring() != ri) continue;
125 
126  auto ch1 = geometry->chamber(GEMDetId(detId.region(),detId.ring(),detId.station(),1,detId.chamber(),0));
127  auto ch2 = geometry->chamber(GEMDetId(detId.region(),detId.ring(),detId.station(),2,detId.chamber(),0));
128  superChamber->add(const_cast<GEMChamber*>(ch1));
129  superChamber->add(const_cast<GEMChamber*>(ch2));
130 
131  ring->add(superChamber);
132  LogDebug("GEMGeometryBuilderFromDDD") << "Adding super chamber " << detId << " to ring: "
133  << "re " << re << " st " << st << " ri " << ri << std::endl;
134  }
135  LogDebug("GEMGeometryBuilderFromDDD") << "Adding ring " << ri << " to station " << "re " << re << " st " << st << std::endl;
136  station->add(const_cast<GEMRing*>(ring));
137  geometry->add(const_cast<GEMRing*>(ring));
138  }
139  LogDebug("GEMGeometryBuilderFromDDD") << "Adding station " << st << " to region " << re << std::endl;
140  region->add(const_cast<GEMStation*>(station));
141  geometry->add(const_cast<GEMStation*>(station));
142  }
143  LogDebug("GEMGeometryBuilderFromDDD") << "Adding region " << re << " to the geometry " << std::endl;
144  geometry->add(const_cast<GEMRegion*>(region));
145  }
146 
147  return geometry;
148 }
#define LogDebug(id)
void add(GEMChamber *ch)
Add chamber to the super chamber which takes ownership.
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:26
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:75
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
void add(GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:104
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.
ESHandle< TrackerGeometry > geometry
void add(GEMStation *st)
Add station to the region which takes ownership.
Definition: GEMRegion.cc:25
GEMSuperChamber * GEMGeometryBuilderFromDDD::buildSuperChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 150 of file GEMGeometryBuilderFromDDD.cc.

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

Referenced by buildGeometry().

150  {
151  LogDebug("GEMGeometryBuilderFromDDD") << "buildSuperChamber "<<fv.logicalPart().name().name() <<" "<< detId <<std::endl;
152 
154  std::vector<double> dpar = solid.solidA().parameters();
155 
156  double dy = dpar[0]/cm;//length is along local Y
157  double dz = dpar[3]/cm;// thickness is long local Z
158  double dx1= dpar[4]/cm;// bottom width is along local X
159  double dx2= dpar[8]/cm;// top width is along local X
160  dpar = solid.solidB().parameters();
161  dz += dpar[3]/cm;// chamber thickness
162  dz *=2; // 2 chambers in superchamber
163  dz += 2.105;// gap between chambers
164 
165  bool isOdd = detId.chamber()%2;
166  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1,dx2,dy,dz), isOdd ));
167  LogDebug("GEMGeometryBuilderFromDDD") << "size "<< dx1 << " " << dx2 << " " << dy << " " << dz <<std::endl;
168 
169  GEMSuperChamber* superChamber = new GEMSuperChamber(detId.superChamberId(), surf);
170  return superChamber;
171 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:147
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:665
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
DDSolid solidA(void) const
Definition: DDSolid.cc:659
const std::string & name() const
Returns the name.
Definition: DDName.cc:90

Member Data Documentation

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

Definition at line 37 of file GEMGeometryBuilderFromDDD.h.