16 XERCES_CPP_NAMESPACE_USE
20 DOMElement* rootElem =
document -> getDocumentElement();
30 DOMElement* rootElem =
document -> getDocumentElement();
43 std::map<std::string,int> double_entry;
45 std::map<std::string,std::map<std::string,std::map<std::string,std::map<int,std::string> > > >::const_iterator rbx_slot;
46 for (rbx_slot = hw_map .
begin(); rbx_slot != hw_map .
end(); rbx_slot++){
50 _p . kind_of_part =
"HCAL RBX Slot";
51 _p . name_label = rbx_slot ->
first;
53 DOMElement * rbx_slot_children_elem = (DOMElement *)rbx_slot_elem -> getElementsByTagName(
XMLString::transcode(
"CHILDREN"))->item(0);
55 std::map<std::string,std::map<std::string,std::map<int,std::string> > >::const_iterator rbx;
56 for (rbx = rbx_slot->second .
begin(); rbx != rbx_slot->second .
end(); rbx++){
59 _p2 . kind_of_part =
"HCAL RBX";
60 _p2 . name_label = rbx ->
first;
61 DOMElement * rbx_elem =
addPart( rbx_slot_children_elem, _p2 );
62 DOMElement * rbx_children_elem = (DOMElement *)rbx_elem -> getElementsByTagName(
XMLString::transcode(
"CHILDREN"))->item(0);
64 std::map<std::string,std::map<int,std::string> >::const_iterator
rm;
65 for (rm = rbx->second .
begin(); rm != rbx->second .
end(); rm++){
68 _p3 . kind_of_part =
"HCAL Readout Module";
69 _p3 . barcode = rm ->
first;
70 DOMElement * rm_elem =
addPart( rbx_children_elem, _p3 );
71 DOMElement * rm_children_elem = (DOMElement *)rm_elem -> getElementsByTagName(
XMLString::transcode(
"CHILDREN"))->item(0);
73 std::map<int,std::string>::const_iterator qie;
74 for (qie = rm->second .
begin(); qie != rm->second .
end(); qie++){
77 _p4 . kind_of_part =
"HCAL QIE Card";
78 _p4 . barcode = qie ->
second;
79 _p4 .
comment =
"HCAL hardware remapping by Gena Kukartsev";
80 _p4 . attr_name =
"QIE Card Position";
81 std::stringstream _buffer;
83 _buffer << qie->first;
84 _p4 . attr_value = _buffer . str();
87 unsigned int _nqie = double_entry.size();
88 double_entry[_p4 . barcode]++;
89 if (double_entry.size() == _nqie){
90 std::cout <<
"QIE #" << _p4.
barcode <<
" found " << double_entry[_p4 . barcode] <<
"times!" << std::endl;
92 addPart( rm_children_elem, _p4 );
114 child -> appendChild( kindElem );
116 kindElem -> appendChild( _kind );
118 child -> appendChild( nameElem );
120 nameElem -> appendChild( _name );
123 child -> appendChild( barElem );
125 barElem -> appendChild( _code );
128 child -> appendChild( commentElem );
130 commentElem -> appendChild( _comment );
134 child -> appendChild( predefined_attr_elem );
136 predefined_attr_elem -> appendChild( attr_elem );
138 attr_elem -> appendChild( attr_name_elem );
140 attr_name_elem -> appendChild( _name );
142 attr_elem -> appendChild( attr_value_elem );
144 attr_value_elem -> appendChild( _value );
146 child -> appendChild( childrenElem );
148 parent -> appendChild( child );
XERCES_CPP_NAMESPACE::DOMDocument * document
virtual ~HcalHardwareXml()
U second(std::pair< T, U > const &p)
XMLCh * transcode(const T &fInput)
XERCES_CPP_NAMESPACE::DOMElement * partsElem
XERCES_CPP_NAMESPACE::DOMElement * addPart(XERCES_CPP_NAMESPACE::DOMElement *parent, HcalPart &part)
int addHardware(std::map< std::string, std::map< std::string, std::map< std::string, std::map< int, std::string > > > > &hw_map)
tuple size
Write out results.