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