CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
DTGeometryParserFromDDD Class Reference

#include <DTGeometryParserFromDDD.h>

Public Member Functions

 DTGeometryParserFromDDD (const DDCompactView *cview, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
 Constructor. More...
 
 ~DTGeometryParserFromDDD ()
 Destructor. More...
 

Private Member Functions

void buildLayer (DDFilteredView &fv, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
 
void parseGeometry (DDFilteredView &fv, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
 

Detailed Description

Class which read the geometry from DDD to provide a map between layerId and pairs with first wire number, total number of wires.

Author
S. Bolognesi - INFN Torino

Definition at line 21 of file DTGeometryParserFromDDD.h.

Constructor & Destructor Documentation

DTGeometryParserFromDDD::DTGeometryParserFromDDD ( const DDCompactView cview,
const MuonDDDConstants muonConstants,
std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &  theLayerIdWiresMap 
)

Constructor.

Definition at line 12 of file DTGeometryParserFromDDD.cc.

References MessageLogger_cfi::cerr, MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, ALCARECOTkAlBeamHalo_cff::filter, and AlCaHLTBitMon_QueryRunRegistry::string.

12  {
13 
14  try {
15  std::string attribute = "MuStructure";
16  std::string value = "MuonBarrelDT";
17 
18  // Asking only for the Muon DTs
19  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
20  DDFilteredView fview(*cview,filter);
21 
22  parseGeometry(fview, muonConstants, theLayerIdWiresMap);
23  }
24  catch (const cms::Exception & e ) {
25  std::cerr << "DTGeometryParserFromDDD::build() : DDD Exception: something went wrong during XML parsing!" << std::endl
26  << " Message: " << e << std::endl
27  << " Terminating execution ... " << std::endl;
28  throw;
29  }
30  catch (const exception & e) {
31  std::cerr << "DTGeometryParserFromDDD::build() : an unexpected exception occured: " << e.what() << std::endl;
32  throw;
33  }
34  catch (...) {
35  std::cerr << "DTGeometryParserFromDDD::build() : An unexpected exception occured!" << std::endl
36  << " Terminating execution ... " << std::endl;
37  std::unexpected();
38  }
39 }
void parseGeometry(DDFilteredView &fv, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
Definition: value.py:1
DTGeometryParserFromDDD::~DTGeometryParserFromDDD ( )

Destructor.

Definition at line 41 of file DTGeometryParserFromDDD.cc.

41  {
42 }

Member Function Documentation

void DTGeometryParserFromDDD::buildLayer ( DDFilteredView fv,
const MuonDDDConstants muonConstants,
std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &  theLayerIdWiresMap 
)
private

Definition at line 82 of file DTGeometryParserFromDDD.cc.

References DDFilteredView::copyno(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and DDFilteredView::nextSibling().

83  {
84  MuonDDDNumbering mdddnum(muonConstants);
85  DTNumberingScheme dtnum(muonConstants);
86  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
87  DTLayerId layId(rawid);
88 
89  // Loop on wires
90  bool doWire = fv.firstChild();
91  int WCounter=0;
92  int firstWire=fv.copyno();
93  while (doWire) {
94  WCounter++;
95  doWire = fv.nextSibling(); // next wire
96  }
97  theLayerIdWiresMap[layId] = (make_pair(firstWire,WCounter));
98 }
bool nextSibling()
set the current node to the next sibling ...
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.
bool firstChild()
set the current node to the first child ...
void DTGeometryParserFromDDD::parseGeometry ( DDFilteredView fv,
const MuonDDDConstants muonConstants,
std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &  theLayerIdWiresMap 
)
private

Definition at line 44 of file DTGeometryParserFromDDD.cc.

References DDFilteredView::firstChild(), DDFilteredView::nextSibling(), and DDFilteredView::parent().

44  {
45 
46  bool doChamber = fv.firstChild();
47 
48  // Loop on chambers
49  int ChamCounter=0;
50  while (doChamber){
51  ChamCounter++;
52 
53  // Loop on SLs
54  bool doSL = fv.firstChild();
55  int SLCounter=0;
56  while (doSL) {
57  SLCounter++;
58 
59  bool doL = fv.firstChild();
60  int LCounter=0;
61  // Loop on SLs
62  while (doL) {
63  LCounter++;
64  //DTLayer* layer =
65  buildLayer(fv, muonConstants, theLayerIdWiresMap);
66 
67  fv.parent();
68  doL = fv.nextSibling(); // go to next layer
69  } // layers
70 
71  fv.parent();
72  doSL = fv.nextSibling(); // go to next SL
73  } // sls
74 
75  fv.parent();
76  doChamber = fv.nextSibling(); // go to next chamber
77  } // chambers
78 
79 }
bool parent()
set the current node to the parent node ...
bool nextSibling()
set the current node to the next sibling ...
bool firstChild()
set the current node to the first child ...
void buildLayer(DDFilteredView &fv, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)