CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTGeometryParserFromDDD.cc
Go to the documentation of this file.
1 
10 
11 using namespace std;
12 
13 
14 DTGeometryParserFromDDD::DTGeometryParserFromDDD(const DDCompactView* cview, const MuonDDDConstants& muonConstants, map<DTLayerId,std::pair<unsigned int,unsigned int> > &theLayerIdWiresMap ){
15 
16  try {
17  std::string attribute = "MuStructure";
18  std::string value = "MuonBarrelDT";
19  DDValue val(attribute, value, 0.0);
20 
21  // Asking only for the Muon DTs
23  filter.setCriteria(val, // name & value of a variable
26  true, // compare strings otherwise doubles
27  true // use merged-specifics or simple-specifics
28  );
29  DDFilteredView fview(*cview);
30  fview.addFilter(filter);
31 
32  parseGeometry(fview, muonConstants, theLayerIdWiresMap);
33  }
34  catch (const cms::Exception & e ) {
35  std::cerr << "DTGeometryParserFromDDD::build() : DDD Exception: something went wrong during XML parsing!" << std::endl
36  << " Message: " << e << std::endl
37  << " Terminating execution ... " << std::endl;
38  throw;
39  }
40  catch (const exception & e) {
41  std::cerr << "DTGeometryParserFromDDD::build() : an unexpected exception occured: " << e.what() << std::endl;
42  throw;
43  }
44  catch (...) {
45  std::cerr << "DTGeometryParserFromDDD::build() : An unexpected exception occured!" << std::endl
46  << " Terminating execution ... " << std::endl;
47  std::unexpected();
48  }
49 }
50 
52 }
53 
54 void DTGeometryParserFromDDD::parseGeometry(DDFilteredView& fv, const MuonDDDConstants& muonConstants, map<DTLayerId,std::pair<unsigned int,unsigned int> > &theLayerIdWiresMap ) {
55 
56  bool doChamber = fv.firstChild();
57 
58  // Loop on chambers
59  int ChamCounter=0;
60  while (doChamber){
61  ChamCounter++;
62 
63  // Loop on SLs
64  bool doSL = fv.firstChild();
65  int SLCounter=0;
66  while (doSL) {
67  SLCounter++;
68 
69  bool doL = fv.firstChild();
70  int LCounter=0;
71  // Loop on SLs
72  while (doL) {
73  LCounter++;
74  //DTLayer* layer =
75  buildLayer(fv, muonConstants, theLayerIdWiresMap);
76 
77  fv.parent();
78  doL = fv.nextSibling(); // go to next layer
79  } // layers
80 
81  fv.parent();
82  doSL = fv.nextSibling(); // go to next SL
83  } // sls
84 
85  fv.parent();
86  doChamber = fv.nextSibling(); // go to next chamber
87  } // chambers
88 
89 }
90 
91 
93  map<DTLayerId,std::pair<unsigned int,unsigned int> > &theLayerIdWiresMap ) {
94  MuonDDDNumbering mdddnum(muonConstants);
95  DTNumberingScheme dtnum(muonConstants);
96  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
97  DTLayerId layId(rawid);
98 
99  // Loop on wires
100  bool doWire = fv.firstChild();
101  int WCounter=0;
102  int firstWire=fv.copyno();
103  while (doWire) {
104  WCounter++;
105  doWire = fv.nextSibling(); // next wire
106  }
107  theLayerIdWiresMap[layId] = (make_pair(firstWire,WCounter));
108 }
109 
bool parent()
set the current node to the parent node ...
void addFilter(const DDFilter &, log_op op=AND)
void parseGeometry(DDFilteredView &fv, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
bool nextSibling()
set the current node to the next sibling ...
DTGeometryParserFromDDD(const DDCompactView *cview, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
Constructor.
type of data representation of DDCompactView
Definition: DDCompactView.h:77
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
dictionary map
Definition: Association.py:196
int copyno() const
Copy number associated with the current node.
int getDetId(const MuonBaseNumber num) const
bool firstChild()
set the current node to the first child ...
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history)
void buildLayer(DDFilteredView &fv, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37