21 DOMElement* rootElem =
document -> getDocumentElement();
31 DOMElement* rootElem =
document -> getDocumentElement();
44 std::map<std::string,int> double_entry;
46 std::map<std::string,std::map<std::string,std::map<std::string,std::map<int,std::string> > > >::const_iterator rbx_slot;
47 for (rbx_slot = hw_map .
begin(); rbx_slot != hw_map .
end(); rbx_slot++){
51 _p . kind_of_part =
"HCAL RBX Slot";
52 _p . name_label = rbx_slot ->
first;
54 DOMElement * rbx_slot_children_elem = (DOMElement *)rbx_slot_elem -> getElementsByTagName(XMLString::transcode(
"CHILDREN"))->item(0);
56 std::map<std::string,std::map<std::string,std::map<int,std::string> > >::const_iterator rbx;
57 for (rbx = rbx_slot->second .
begin(); rbx != rbx_slot->second .
end(); rbx++){
60 _p2 . kind_of_part =
"HCAL RBX";
61 _p2 . name_label = rbx ->
first;
62 DOMElement * rbx_elem =
addPart( rbx_slot_children_elem, _p2 );
63 DOMElement * rbx_children_elem = (DOMElement *)rbx_elem -> getElementsByTagName(XMLString::transcode(
"CHILDREN"))->item(0);
65 std::map<std::string,std::map<int,std::string> >::const_iterator
rm;
66 for (rm = rbx->second .
begin(); rm != rbx->second .
end(); rm++){
69 _p3 . kind_of_part =
"HCAL Readout Module";
70 _p3 . barcode = rm ->
first;
71 DOMElement * rm_elem =
addPart( rbx_children_elem, _p3 );
72 DOMElement * rm_children_elem = (DOMElement *)rm_elem -> getElementsByTagName(XMLString::transcode(
"CHILDREN"))->item(0);
74 std::map<int,std::string>::const_iterator qie;
75 for (qie = rm->second .
begin(); qie != rm->second .
end(); qie++){
78 _p4 . kind_of_part =
"HCAL QIE Card";
79 _p4 . barcode = qie ->
second;
80 _p4 .
comment =
"HCAL hardware remapping by Gena Kukartsev";
81 _p4 . attr_name =
"QIE Card Position";
82 std::stringstream _buffer;
84 _buffer << qie->first;
85 _p4 . attr_value = _buffer . str();
88 unsigned int _nqie = double_entry.size();
89 double_entry[_p4 . barcode]++;
90 if (double_entry.size() == _nqie){
91 std::cout <<
"QIE #" << _p4.
barcode <<
" found " << double_entry[_p4 . barcode] <<
"times!" << std::endl;
93 addPart( rm_children_elem, _p4 );
106 DOMElement *
child =
document -> createElement( XMLString::transcode(
"PART" ) );
107 child -> setAttribute( XMLString::transcode(
"mode"), XMLString::transcode(part.
mode.c_str()) );
109 DOMElement * kindElem =
document -> createElement( XMLString::transcode(
"KIND_OF_PART" ) );
110 DOMElement * nameElem =
document -> createElement( XMLString::transcode(
"NAME_LABEL" ) );
111 DOMElement * barElem =
document -> createElement( XMLString::transcode(
"BARCODE" ) );
112 DOMElement * childrenElem =
document -> createElement( XMLString::transcode(
"CHILDREN" ) );
113 DOMElement * commentElem =
document -> createElement( XMLString::transcode(
"COMMENT_DESCRIPTION" ) );
115 child -> appendChild( kindElem );
117 kindElem -> appendChild( _kind );
119 child -> appendChild( nameElem );
120 DOMText * _name =
document -> createTextNode( XMLString::transcode(part.
name_label.c_str()));
121 nameElem -> appendChild( _name );
124 child -> appendChild( barElem );
125 DOMText * _code =
document -> createTextNode( XMLString::transcode(part.
barcode.c_str()));
126 barElem -> appendChild( _code );
129 child -> appendChild( commentElem );
130 DOMText * _comment =
document -> createTextNode( XMLString::transcode(part.
comment.c_str()));
131 commentElem -> appendChild( _comment );
134 DOMElement * predefined_attr_elem =
document -> createElement( XMLString::transcode(
"PREDEFINED_ATTRIBUTES" ) );
135 child -> appendChild( predefined_attr_elem );
136 DOMElement * attr_elem =
document -> createElement( XMLString::transcode(
"ATTRIBUTE" ) );
137 predefined_attr_elem -> appendChild( attr_elem );
138 DOMElement * attr_name_elem =
document -> createElement( XMLString::transcode(
"NAME" ) );
139 attr_elem -> appendChild( attr_name_elem );
140 DOMText * _name =
document -> createTextNode( XMLString::transcode(part.
attr_name.c_str()));
141 attr_name_elem -> appendChild( _name );
142 DOMElement * attr_value_elem =
document -> createElement( XMLString::transcode(
"VALUE" ) );
143 attr_elem -> appendChild( attr_value_elem );
144 DOMText * _value =
document -> createTextNode( XMLString::transcode(part.
attr_value.c_str()));
145 attr_value_elem -> appendChild( _value );
147 child -> appendChild( childrenElem );
149 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.