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 );
105 DOMElement *
child =
document -> createElement( XMLString::transcode(
"PART" ) );
106 child -> setAttribute( XMLString::transcode(
"mode"), XMLString::transcode(part.
mode.c_str()) );
108 DOMElement * kindElem =
document -> createElement( XMLString::transcode(
"KIND_OF_PART" ) );
109 DOMElement * nameElem =
document -> createElement( XMLString::transcode(
"NAME_LABEL" ) );
110 DOMElement * barElem =
document -> createElement( XMLString::transcode(
"BARCODE" ) );
111 DOMElement * childrenElem =
document -> createElement( XMLString::transcode(
"CHILDREN" ) );
112 DOMElement * commentElem =
document -> createElement( XMLString::transcode(
"COMMENT_DESCRIPTION" ) );
114 child -> appendChild( kindElem );
116 kindElem -> appendChild( _kind );
118 child -> appendChild( nameElem );
119 DOMText * _name =
document -> createTextNode( XMLString::transcode(part.
name_label.c_str()));
120 nameElem -> appendChild( _name );
123 child -> appendChild( barElem );
124 DOMText * _code =
document -> createTextNode( XMLString::transcode(part.
barcode.c_str()));
125 barElem -> appendChild( _code );
128 child -> appendChild( commentElem );
129 DOMText * _comment =
document -> createTextNode( XMLString::transcode(part.
comment.c_str()));
130 commentElem -> appendChild( _comment );
133 DOMElement * predefined_attr_elem =
document -> createElement( XMLString::transcode(
"PREDEFINED_ATTRIBUTES" ) );
134 child -> appendChild( predefined_attr_elem );
135 DOMElement * attr_elem =
document -> createElement( XMLString::transcode(
"ATTRIBUTE" ) );
136 predefined_attr_elem -> appendChild( attr_elem );
137 DOMElement * attr_name_elem =
document -> createElement( XMLString::transcode(
"NAME" ) );
138 attr_elem -> appendChild( attr_name_elem );
139 DOMText * _name =
document -> createTextNode( XMLString::transcode(part.
attr_name.c_str()));
140 attr_name_elem -> appendChild( _name );
141 DOMElement * attr_value_elem =
document -> createElement( XMLString::transcode(
"VALUE" ) );
142 attr_elem -> appendChild( attr_value_elem );
143 DOMText * _value =
document -> createTextNode( XMLString::transcode(part.
attr_value.c_str()));
144 attr_value_elem -> appendChild( _value );
146 child -> appendChild( childrenElem );
148 parent -> appendChild( child );
virtual ~HcalHardwareXml()
U second(std::pair< T, U > const &p)
DOMElement * addPart(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.