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.

25 { }
GEMGeometryParsFromDD::~GEMGeometryParsFromDD ( )

Definition at line 27 of file GEMGeometryParsFromDD.cc.

28 { }

Member Function Documentation

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

Definition at line 31 of file GEMGeometryParsFromDD.cc.

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

Referenced by GEMRecoIdealDBLoader::beginRun().

33 {
34  std::string attribute = "MuStructure";
35  std::string value = "MuonEndCapGEM";
36 
37  // Asking only for the MuonGEM's
38  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
39  DDFilteredView fv(*cview,filter);
40 
41  this->buildGeometry(fv, muonConstants, rgeo);
42 }
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 127 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().

128 {
129  LogDebug("GEMGeometryParsFromDD") << "buildChamber "<<fv.logicalPart().name().name()
130  <<" "<< detId <<std::endl;
131 
133  std::vector<double> dpar = solid.solidA().parameters();
134 
135  double dy = dpar[0];//length is along local Y
136  double dz = dpar[3];// thickness is long local Z
137  double dx1= dpar[4];// bottom width is along local X
138  double dx2= dpar[8];// top width is along local X
139  dpar = solid.solidB().parameters();
140  dz += dpar[3];// chamber thickness
141 
142  GEMDetId gemid = detId.chamberId();
143 
144  std::vector<double> pars{dx1, dx2, dy, dz};
145  std::vector<double> vtra = getTranslation(fv);
146  std::vector<double> vrot = getRotation(fv);
147 
148  LogDebug("GEMGeometryParsFromDD") << "dimension dx1 "<< dx1 << ", dx2 "<< dx2 << ", dy "<< dy << ", dz "<< dz;
149  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
150 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:78
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
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:668
GEMDetId chamberId() const
Return the corresponding ChamberId.
Definition: GEMDetId.h:85
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
std::vector< double > getRotation(DDFilteredView &fv)
DDSolid solidA(void) const
Definition: DDSolid.cc:662
std::vector< double > getTranslation(DDFilteredView &fv)
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
void GEMGeometryParsFromDD::buildEtaPartition ( DDFilteredView fv,
GEMDetId  detId,
RecoIdealGeometry rgeo 
)
private

Definition at line 153 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(), DDSolid::parameters(), DetId::rawId(), DDLogicalPart::solid(), DDFilteredView::specifics(), and SiPixelPhase1DigisV_cfi::specs.

Referenced by buildGeometry().

154 {
155  LogDebug("GEMGeometryParsFromDD") << "buildEtaPartition "<<fv.logicalPart().name().name()
156  <<" "<< detId <<std::endl;
157 
158  // EtaPartition specific parameter (nstrips and npads)
159  DDValue numbOfStrips("nStrips");
160  DDValue numbOfPads("nPads");
161  const std::vector<const DDsvalues_type*> & specs = fv.specifics();
162  double nStrips = 0., nPads = 0.;
163  for ( auto const & is: specs){
164  if (DDfetch( is, numbOfStrips)) nStrips = numbOfStrips.doubles()[0];
165  if (DDfetch( is, numbOfPads)) nPads = numbOfPads.doubles()[0];
166  }
167  LogDebug("GEMGeometryParsFromDD")
168  << ((nStrips == 0. ) ? ("No nStrips found!!") : ("Number of strips: " + std::to_string(nStrips)));
169  LogDebug("GEMGeometryParsFromDD")
170  << ((nPads == 0. ) ? ("No nPads found!!") : ("Number of pads: " + std::to_string(nPads)));
171 
172  // EtaPartition specific parameter (size)
173  std::vector<double> dpar = fv.logicalPart().solid().parameters();
174 
175  double dy = dpar[0];//length is along local Y
176  double dz = dpar[3];//0.4;// thickness is long local Z
177  double dx1= dpar[4];// bottom width is along local X
178  double dx2= dpar[8];// top width is along local X
179 
180  std::vector<double> pars{dx1, dx2, dy, dz, nStrips, nPads};
181  std::vector<double> vtra = getTranslation(fv);
182  std::vector<double> vrot = getRotation(fv);
183 
184  LogDebug("GEMGeometryParsFromDD") << "dimension dx1 "<< dx1 << ", dx2 "<< dx2 << ", dy "<< dy << ", dz "<< dz;
185  rgeo.insert(detId.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
186 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:78
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
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
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
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:90
void GEMGeometryParsFromDD::buildGeometry ( DDFilteredView fview,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rgeo 
)
private

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

48 {
49  LogDebug("GEMGeometryParsFromDD") <<"Building the geometry service";
50  LogDebug("GEMGeometryParsFromDD") << "About to run through the GEM structure\n"
51  <<" First logical part "
52  <<fv.logicalPart().name().name();
53 
54  MuonDDDNumbering muonDDDNumbering(muonConstants);
55  GEMNumberingScheme gemNumbering(muonConstants);
56 
57  bool doSuper = fv.firstChild();
58  LogDebug("GEMGeometryParsFromDD") << "doSuperChamber = " << doSuper;
59  // loop over superchambers
60  while (doSuper){
61 
62  // getting chamber id from eta partitions
63  fv.firstChild();fv.firstChild();
64  GEMDetId detIdCh = GEMDetId(gemNumbering.baseNumberToUnitNumber(muonDDDNumbering.geoHistoryToBaseNumber(fv.geoHistory())));
65  // back to chambers
66  fv.parent();fv.parent();
67 
68  // currently there is no superchamber in the geometry
69  // only 2 chambers are present separated by a gap.
70  // making superchamber out of the first chamber layer including the gap between chambers
71  if (detIdCh.layer() == 1){// only make superChambers when doing layer 1
72  buildSuperChamber(fv, detIdCh, rgeo);
73  }
74  buildChamber(fv, detIdCh, rgeo);
75 
76  // loop over chambers
77  // only 1 chamber
78  bool doChambers = fv.firstChild();
79  while (doChambers){
80 
81  // loop over GEMEtaPartitions
82  bool doEtaPart = fv.firstChild();
83  while (doEtaPart){
84 
85  GEMDetId detId = GEMDetId(gemNumbering.baseNumberToUnitNumber(muonDDDNumbering.geoHistoryToBaseNumber(fv.geoHistory())));
86  buildEtaPartition(fv, detId, rgeo);
87 
88  doEtaPart = fv.nextSibling();
89  }
90  fv.parent();
91  doChambers = fv.nextSibling();
92  }
93  fv.parent();
94  doSuper = fv.nextSibling();
95  }
96 }
#define LogDebug(id)
void buildEtaPartition(DDFilteredView &fv, GEMDetId detId, RecoIdealGeometry &rgeo)
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
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 99 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().

100 {
101  LogDebug("GEMGeometryParsFromDD") << "buildSuperChamber "<<fv.logicalPart().name().name()
102  <<" "<< detId <<std::endl;
103 
105  std::vector<double> dpar = solid.solidA().parameters();
106 
107  double dy = dpar[0];//length is along local Y
108  double dz = dpar[3];// thickness is long local Z
109  double dx1= dpar[4];// bottom width is along local X
110  double dx2= dpar[8];// top width is along local X
111  dpar = solid.solidB().parameters();
112  dz += dpar[3];// chamber thickness
113  dz *=2; // 2 chambers in superchamber
114  dz += 2.105;// gap between chambers
115 
116  GEMDetId gemid = detId.superChamberId();
117 
118  std::vector<double> pars{dx1, dx2, dy, dz};
119  std::vector<double> vtra = getTranslation(fv);
120  std::vector<double> vrot = getRotation(fv);
121 
122  LogDebug("GEMGeometryParsFromDD") << "dimension dx1 "<< dx1 << ", dx2 "<< dx2 << ", dy "<< dy << ", dz "<< dz;
123  rgeo.insert(gemid.rawId(), vtra, vrot, pars, {fv.logicalPart().name().name()});
124 }
#define LogDebug(id)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:78
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
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
DDSolid solidB(void) const
Definition: DDSolid.cc:668
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
std::vector< double > getRotation(DDFilteredView &fv)
DDSolid solidA(void) const
Definition: DDSolid.cc:662
std::vector< double > getTranslation(DDFilteredView &fv)
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
std::vector< double > GEMGeometryParsFromDD::getRotation ( DDFilteredView fv)
private

Definition at line 194 of file GEMGeometryParsFromDD.cc.

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

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

195 {
196  const DDRotationMatrix& rota = fv.rotation();//.Inverse();
197  DD3Vector x, y, z;
198  rota.GetComponents(x,y,z);
199  return { x.X(), x.Y(), x.Z(),
200  y.X(), y.Y(), y.Z(),
201  z.X(), z.Y(), z.Z() };
202 }
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
std::vector< double > GEMGeometryParsFromDD::getTranslation ( DDFilteredView fv)
private

Definition at line 188 of file GEMGeometryParsFromDD.cc.

References DDFilteredView::translation().

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

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