CMS 3D CMS Logo

DTGeometryParserFromDDD.cc
Go to the documentation of this file.
1 
8 
9 using namespace std;
10 
12  const DDCompactView* cview,
13  const MuonGeometryConstants& muonConstants,
14  map<DTLayerId, std::pair<unsigned int, unsigned int> >& theLayerIdWiresMap) {
15  try {
16  std::string attribute = "MuStructure";
17  std::string value = "MuonBarrelDT";
18 
19  // Asking only for the Muon DTs
21  DDFilteredView fview(*cview, filter);
22 
23  parseGeometry(fview, muonConstants, theLayerIdWiresMap);
24  } catch (const cms::Exception& e) {
25  std::cerr << "DTGeometryParserFromDDD::build() : DDD Exception: something went wrong during XML parsing!"
26  << std::endl
27  << " Message: " << e << std::endl
28  << " Terminating execution ... " << std::endl;
29  throw;
30  } catch (const exception& e) {
31  std::cerr << "DTGeometryParserFromDDD::build() : an unexpected exception occured: " << e.what() << std::endl;
32  throw;
33  } catch (...) {
34  std::cerr << "DTGeometryParserFromDDD::build() : An unexpected exception occured!" << std::endl
35  << " Terminating execution ... " << std::endl;
36  std::unexpected();
37  }
38 }
39 
41 
43  const MuonGeometryConstants& muonConstants,
44  map<DTLayerId, std::pair<unsigned int, unsigned int> >& theLayerIdWiresMap) {
45  bool doChamber = fv.firstChild();
46 
47  // Loop on chambers
48  while (doChamber) {
49  // Loop on SLs
50  bool doSL = fv.firstChild();
51  while (doSL) {
52  bool doL = fv.firstChild();
53  // Loop on SLs
54  while (doL) {
55  //DTLayer* layer =
56  buildLayer(fv, muonConstants, theLayerIdWiresMap);
57 
58  fv.parent();
59  doL = fv.nextSibling(); // go to next layer
60  } // layers
61 
62  fv.parent();
63  doSL = fv.nextSibling(); // go to next SL
64  } // sls
65 
66  fv.parent();
67  doChamber = fv.nextSibling(); // go to next chamber
68  } // chambers
69 }
70 
72  const MuonGeometryConstants& muonConstants,
73  map<DTLayerId, std::pair<unsigned int, unsigned int> >& theLayerIdWiresMap) {
74  MuonGeometryNumbering mdddnum(muonConstants);
75  DTNumberingScheme dtnum(muonConstants);
76  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
77  DTLayerId layId(rawid);
78 
79  // Loop on wires
80  bool doWire = fv.firstChild();
81  int WCounter = 0;
82  int firstWire = fv.copyno();
83  while (doWire) {
84  WCounter++;
85  doWire = fv.nextSibling(); // next wire
86  }
87  theLayerIdWiresMap[layId] = (make_pair(firstWire, WCounter));
88 }
bool parent()
set the current node to the parent node ...
bool nextSibling()
set the current node to the next sibling ...
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
void buildLayer(DDFilteredView &fv, const MuonGeometryConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
int getDetId(const MuonBaseNumber &num) const
void parseGeometry(DDFilteredView &fv, const MuonGeometryConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
Definition: value.py:1
int copyno() const
Copy number associated with the current node.
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
DTGeometryParserFromDDD(const DDCompactView *cview, const MuonGeometryConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
Constructor.
bool firstChild()
set the current node to the first child ...
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history) const