CMS 3D CMS Logo

HcalHardwareXml Class Reference

Description: <one line="" class="" summary>="">. More...

#include <CaloOnlineTools/HcalOnlineDb/interface/HcalHardwareXml.h>

Inheritance diagram for HcalHardwareXml:

XMLDOMBlock

List of all members.

Public Member Functions

int addHardware (std::map< string, map< string, map< string, map< int, string > > > > &hw_map)
 HcalHardwareXml (std::string _type)
 HcalHardwareXml ()
virtual ~HcalHardwareXml ()

Private Member Functions

DOMElement * addPart (DOMElement *parent, HcalPart &part)
 HcalHardwareXml (const HcalHardwareXml &)
const HcalHardwareXmloperator= (const HcalHardwareXml &)

Private Attributes

DOMElement * partsElem


Detailed Description

Description: <one line="" class="" summary>="">.

Usage: <usage>

Definition at line 39 of file HcalHardwareXml.h.


Constructor & Destructor Documentation

HcalHardwareXml::HcalHardwareXml (  ) 

Definition at line 18 of file HcalHardwareXml.cc.

References XMLDOMBlock::document, partsElem, and transcode().

00018                                  : XMLDOMBlock()
00019 {
00020 
00021   DOMElement* rootElem = document -> getDocumentElement();
00022 
00023   partsElem = document->createElement( XMLString::transcode("PARTS") );
00024   rootElem->appendChild(partsElem);
00025 }

HcalHardwareXml::HcalHardwareXml ( std::string  _type  ) 

HcalHardwareXml::~HcalHardwareXml (  )  [virtual]

Definition at line 156 of file HcalHardwareXml.cc.

00157 {
00158 }

HcalHardwareXml::HcalHardwareXml ( const HcalHardwareXml  )  [private]


Member Function Documentation

int HcalHardwareXml::addHardware ( std::map< string, map< string, map< string, map< int, string > > > > &  hw_map  ) 

Definition at line 40 of file HcalHardwareXml.cc.

References addPart(), _HcalPart::barcode, begin, comment, GenMuonPlsPt100GeV_cfg::cout, end, lat::endl(), first, mode, partsElem, edm::second(), and transcode().

00041 {
00042   //hw_map["HO001"]["HORBX09"]["200351"][2]="101295";
00043 
00044   map<string,int> double_entry; // to check for double entries
00045 
00046   map<string,map<string,map<string,map<int,string> > > >::const_iterator rbx_slot;
00047   for (rbx_slot = hw_map . begin(); rbx_slot != hw_map . end(); rbx_slot++){
00048 
00049     HcalPart _p;
00050     _p . mode = "find";
00051     _p . kind_of_part = "HCAL RBX Slot";
00052     _p . name_label = rbx_slot -> first;
00053     DOMElement * rbx_slot_elem = addPart( partsElem, _p );
00054     DOMElement * rbx_slot_children_elem = (DOMElement *)rbx_slot_elem -> getElementsByTagName(XMLString::transcode("CHILDREN"))->item(0);
00055 
00056     map<string,map<string,map<int,string> > >::const_iterator rbx;
00057     for (rbx = rbx_slot->second . begin(); rbx != rbx_slot->second . end(); rbx++){
00058       HcalPart _p2;
00059       _p2 . mode = "find";
00060       _p2 . kind_of_part = "HCAL RBX";
00061       _p2 . name_label = rbx -> first;
00062       DOMElement * rbx_elem = addPart( rbx_slot_children_elem, _p2 );
00063       DOMElement * rbx_children_elem = (DOMElement *)rbx_elem -> getElementsByTagName(XMLString::transcode("CHILDREN"))->item(0);
00064 
00065       map<string,map<int,string> >::const_iterator rm;
00066       for (rm = rbx->second . begin(); rm != rbx->second . end(); rm++){
00067         HcalPart _p3;
00068         _p3 . mode = "find";
00069         _p3 . kind_of_part = "HCAL Readout Module";
00070         _p3 . barcode = rm -> first;
00071         DOMElement * rm_elem = addPart( rbx_children_elem, _p3 );
00072         DOMElement * rm_children_elem = (DOMElement *)rm_elem -> getElementsByTagName(XMLString::transcode("CHILDREN"))->item(0);
00073         
00074         map<int,string>::const_iterator qie;
00075         for (qie = rm->second . begin(); qie != rm->second . end(); qie++){
00076           HcalPart _p4;
00077           _p4 . mode = "find";
00078           _p4 . kind_of_part = "HCAL QIE Card";
00079           _p4 . barcode = qie -> second;
00080           _p4 . comment = "HCAL hardware remapping by Gena Kukartsev";
00081           _p4 . attr_name = "QIE Card Position";
00082           stringstream _buffer;
00083           _buffer . str("");
00084           _buffer << qie->first;
00085           _p4 . attr_value = _buffer . str();
00086 
00087           // check for multiple QIE entries
00088           int _nqie = double_entry.size();
00089           double_entry[_p4 . barcode]++;
00090           if (double_entry.size() == _nqie){
00091             cout << "QIE #" << _p4.barcode << " found " << double_entry[_p4 . barcode] << "times!" << endl;
00092           }else{
00093             addPart( rm_children_elem, _p4 );
00094           }
00095         }      
00096       }      
00097     }
00098   }
00099 
00100   return 0;
00101 }

DOMElement * HcalHardwareXml::addPart ( DOMElement *  parent,
HcalPart part 
) [private]

Definition at line 103 of file HcalHardwareXml.cc.

References _HcalPart::attr_name, _HcalPart::attr_value, _HcalPart::barcode, _HcalPart::comment, XMLDOMBlock::document, _HcalPart::kind_of_part, _HcalPart::mode, _HcalPart::name_label, size, and transcode().

Referenced by addHardware().

00104 {
00105   
00106   DOMElement * child    = document -> createElement( XMLString::transcode( "PART" ) );
00107   child -> setAttribute( XMLString::transcode("mode"), XMLString::transcode(part.mode.c_str()) );
00108 
00109   DOMElement * kindElem = document -> createElement( XMLString::transcode( "KIND_OF_PART" ) );
00110   DOMElement * nameElem = document -> createElement( XMLString::transcode( "NAME_LABEL" ) );
00111   DOMElement * barElem  = document -> createElement( XMLString::transcode( "BARCODE" ) );
00112   DOMElement * childrenElem  = document -> createElement( XMLString::transcode( "CHILDREN" ) );
00113   DOMElement * commentElem  = document -> createElement( XMLString::transcode( "COMMENT_DESCRIPTION" ) );
00114 
00115   child -> appendChild( kindElem );
00116   DOMText * _kind = document -> createTextNode( XMLString::transcode(part.kind_of_part.c_str()));
00117   kindElem -> appendChild( _kind );
00118   if (part.name_label . size() > 0){
00119     child -> appendChild( nameElem );
00120     DOMText * _name = document -> createTextNode( XMLString::transcode(part.name_label.c_str()));
00121     nameElem -> appendChild( _name );
00122   }
00123   if (part.barcode . size() > 0){
00124     child -> appendChild( barElem );
00125     DOMText * _code = document -> createTextNode( XMLString::transcode(part.barcode.c_str()));
00126     barElem -> appendChild( _code );
00127   }
00128   if (part.comment . size() > 0){
00129     child -> appendChild( commentElem );
00130     DOMText * _comment = document -> createTextNode( XMLString::transcode(part.comment.c_str()));
00131     commentElem -> appendChild( _comment );
00132   }
00133   if (part.attr_name . size() > 0 || part.attr_value . size() > 0){
00134     DOMElement * predefined_attr_elem  = document -> createElement( XMLString::transcode( "PREDEFINED_ATTRIBUTES" ) );
00135     child -> appendChild( predefined_attr_elem );
00136     DOMElement * attr_elem  = document -> createElement( XMLString::transcode( "ATTRIBUTE" ) );
00137     predefined_attr_elem -> appendChild( attr_elem );
00138     DOMElement * attr_name_elem  = document -> createElement( XMLString::transcode( "NAME" ) );
00139     attr_elem -> appendChild( attr_name_elem );
00140     DOMText * _name = document -> createTextNode( XMLString::transcode(part.attr_name.c_str()));
00141     attr_name_elem -> appendChild( _name );
00142     DOMElement * attr_value_elem  = document -> createElement( XMLString::transcode( "VALUE" ) );
00143     attr_elem -> appendChild( attr_value_elem );
00144     DOMText * _value = document -> createTextNode( XMLString::transcode(part.attr_value.c_str()));
00145     attr_value_elem -> appendChild( _value );
00146   }
00147   child -> appendChild( childrenElem );
00148 
00149   parent -> appendChild( child );
00150 
00151   return child;
00152 }

const HcalHardwareXml& HcalHardwareXml::operator= ( const HcalHardwareXml  )  [private]


Member Data Documentation

DOMElement* HcalHardwareXml::partsElem [private]

Definition at line 57 of file HcalHardwareXml.h.

Referenced by addHardware(), and HcalHardwareXml().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:23:42 2009 for CMSSW by  doxygen 1.5.4