CMS 3D CMS Logo

XMLRBXPedestalsLoader Class Reference

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

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

Inheritance diagram for XMLRBXPedestalsLoader:

XMLDOMBlock

List of all members.

Public Types

typedef
XMLRBXPedestalsLoader::_datasetDBConfig 
datasetDBConfig
typedef struct
XMLRBXPedestalsLoader::_loaderBaseConfig 
loaderBaseConfig

Public Member Functions

int addRBXSlot (datasetDBConfig *config, string brickFileName, string rbx_config_type="pedestals", string templateFileName="HCAL_RBX_PEDESTALS_TYPE01.dataset.template")
 XMLRBXPedestalsLoader (loaderBaseConfig *config, string templateBase="HCAL_RBX_PEDESTALS_TYPE01.XMLloader.template")
virtual ~XMLRBXPedestalsLoader ()

Protected Member Functions

int fixRbxName (string &)
int init (void)

Protected Attributes

MemBufInputSource * _data_gol
MemBufInputSource * _data_ped_delay

Private Member Functions

const XMLRBXPedestalsLoaderoperator= (const XMLRBXPedestalsLoader &)
 XMLRBXPedestalsLoader (const XMLRBXPedestalsLoader &)

Classes

struct  _datasetDBConfig
struct  _loaderBaseConfig


Detailed Description

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

Usage: <usage>

Definition at line 30 of file XMLRBXPedestalsLoader.h.


Member Typedef Documentation

typedef XMLRBXPedestalsLoader::_datasetDBConfig XMLRBXPedestalsLoader::datasetDBConfig

typedef struct XMLRBXPedestalsLoader::_loaderBaseConfig XMLRBXPedestalsLoader::loaderBaseConfig


Constructor & Destructor Documentation

XMLRBXPedestalsLoader::XMLRBXPedestalsLoader ( loaderBaseConfig config,
string  templateBase = "HCAL_RBX_PEDESTALS_TYPE01.XMLloader.template" 
)

Definition at line 56 of file XMLRBXPedestalsLoader.cc.

References init(), name, XMLDOMBlock::setTagAttribute(), and XMLDOMBlock::setTagValue().

00056                                                                                              : XMLDOMBlock( templateBase )
00057 {
00058 
00059   init();
00060 
00061   setTagValue( "EXTENSION_TABLE_NAME", config -> extention_table_name );
00062   setTagValue( "NAME", config -> name );
00063   setTagAttribute( "RUN", "mode", config -> run_mode );
00064   setTagAttribute( "DATA_SET", "id", config -> data_set_id );
00065   setTagAttribute( "IOV", "id", config -> iov_id );
00066   setTagValue( "INTERVAL_OF_VALIDITY_BEGIN", config -> iov_begin );
00067   setTagValue( "INTERVAL_OF_VALIDITY_END", config -> iov_end );
00068   setTagAttribute( "TAG", "id", config -> tag_id );
00069   setTagAttribute( "TAG", "mode", config -> tag_mode );
00070   setTagValue( "TAG_NAME", config -> tag_name );
00071   setTagValue( "DETECTOR_NAME", config -> detector_name );
00072   setTagValue( "COMMENT_DESCRIPTION", config -> elements_comment_description );
00073   setTagAttribute( "TAG", "idref", config -> tag_id, 1 );
00074   setTagAttribute( "IOV", "idref", config -> iov_id, 1 );
00075   setTagAttribute( "DATA_SET", "idref", config -> data_set_id, 1 );
00076 }

XMLRBXPedestalsLoader::~XMLRBXPedestalsLoader (  )  [virtual]

Definition at line 79 of file XMLRBXPedestalsLoader.cc.

References _data_gol, and _data_ped_delay.

00080 {
00081   if( _data_ped_delay ) delete _data_ped_delay;
00082   if( _data_gol ) delete _data_gol;
00083 }

XMLRBXPedestalsLoader::XMLRBXPedestalsLoader ( const XMLRBXPedestalsLoader  )  [private]


Member Function Documentation

int XMLRBXPedestalsLoader::addRBXSlot ( datasetDBConfig config,
string  brickFileName,
string  rbx_config_type = "pedestals",
string  templateFileName = "HCAL_RBX_PEDESTALS_TYPE01.dataset.template" 
)

Definition at line 86 of file XMLRBXPedestalsLoader.cc.

References _data_gol, _data_ped_delay, XMLProcessor::_toXMLCh(), GenMuonPlsPt100GeV_cfg::cout, data, XMLDOMBlock::document, lat::endl(), cmsRelvalreport::exit, XMLDOMBlock::getDocument(), XMLDOMBlock::getTagAttribute(), XMLDOMBlock::getTagValue(), pydbsAccessor::root, XMLDOMBlock::setTagValue(), and version().

00087 {
00088   DOMElement * root = document -> getDocumentElement();
00089 
00090   XMLDOMBlock dataSetDoc( templateFileName );
00091   DOMDocument * dataSet = dataSetDoc . getDocument();
00092 
00093   char timebuf[50];
00094   strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
00095   setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
00096   setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
00097   setTagValue( "VERSION", config -> version, 0, dataSet );
00098   setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
00099   setTagValue( "COMMENT_DESCRIPTION", config -> comment_description, 0, dataSet );
00100   setTagValue( "NAME_LABEL", config -> name_label, 0, dataSet );
00101   setTagValue( "KIND_OF_PART", config -> kind_of_part, 0, dataSet );
00102 
00103   // <DATA/>
00104   //XMLDOMBlock rbxBrickDoc( "rbx_HBM01_PEDESTAL.xml" );
00105   XMLDOMBlock rbxBrickDoc( brickFileName );
00106   DOMDocument * rbxBrick = rbxBrickDoc . getDocument();
00107   for ( int _item = 0; _item < rbxBrick -> getElementsByTagName( XMLProcessor::_toXMLCh( "Data" ) ) -> getLength(); _item++ )
00108     {
00109       DOMElement * dataset_root = dataSet -> getDocumentElement();
00110 
00111       string _rm = rbxBrickDoc . getTagAttribute( "Data", "rm", _item );
00112       string _qie = rbxBrickDoc . getTagAttribute( "Data", "card", _item );
00113       string _adc;
00114 
00115       MemBufInputSource * _data; // a container for the XML template for a data block
00116       if ( rbx_config_type == "pedestals" || rbx_config_type == "delays" ){
00117         _adc = rbxBrickDoc . getTagAttribute( "Data", "qie", _item );
00118         _data = _data_ped_delay;
00119       }
00120       else if ( rbx_config_type == "gols" ){
00121         _adc = rbxBrickDoc . getTagAttribute( "Data", "gol", _item );
00122         _data = _data_gol;
00123       }
00124       else{
00125         cout << "XMLRBXPedestalsLoader::addRBXSlot(): Unknown config type... exiting" << endl;
00126         exit(1);
00127       }
00128       XMLDOMBlock dataDoc( *_data );
00129       DOMDocument * data = dataDoc . getDocument();
00130       string _value = rbxBrickDoc . getTagValue( "Data", _item );
00131       setTagValue( "MODULE_POSITION", _rm, 0, data );
00132       setTagValue( "QIE_CARD_POSITION", _qie, 0, data );
00133       if ( rbx_config_type == "pedestals" || rbx_config_type == "delays" ){
00134         setTagValue( "QIE_ADC_NUMBER", _adc, 0, data );
00135       }
00136       else if ( rbx_config_type == "gols" ){
00137         setTagValue( "FIBER_NUMBER", _adc, 0, data );
00138       }
00139       else{
00140         cout << "XMLRBXPedestalsLoader::addRBXSlot(): Unknown config type... exiting" << endl;
00141         exit(1);
00142       }
00143       setTagValue( "INTEGER_VALUE", _value, 0, data );
00144       DOMNode * cloneData = dataSet -> importNode( data -> getDocumentElement(), true );
00145       dataset_root -> appendChild( cloneData );
00146     }
00147 
00148   // copy the <data_set> node into the final XML
00149   DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
00150   root -> appendChild( cloneDataSet );
00151 
00152   // update header from the brick
00153   string _name;
00154   int parameter_iter = -1;
00155   do
00156     {
00157       parameter_iter++;
00158       _name = rbxBrickDoc . getTagAttribute( "Parameter", "name", parameter_iter );
00159       //cout << _name << endl;
00160     } while( _name != "CREATIONTAG" ); 
00161   string _creationtag = rbxBrickDoc . getTagValue( "Parameter", parameter_iter );
00162   //cout << _creationtag << endl;
00163   //setTagValue( "TAG_NAME", _creationtag );    // uncomment if want to pick up tag name from the brick set
00164 
00165   parameter_iter = -1;
00166   do
00167     {
00168       parameter_iter++;
00169       _name = rbxBrickDoc . getTagAttribute( "Parameter", "name", parameter_iter );
00170       //cout << _name << endl;
00171     } while( _name != "RBX" ); 
00172   string _rbx = rbxBrickDoc . getTagValue( "Parameter", parameter_iter );
00173 
00174   // name_label fix - should be temporary
00175   //fixRbxName( _rbx );
00176   cout << _rbx << endl;
00177   setTagValue( "NAME_LABEL", _rbx );  
00178 
00179   return 0;
00180 }

int XMLRBXPedestalsLoader::fixRbxName ( string &  rbx  )  [protected]

Definition at line 182 of file XMLRBXPedestalsLoader.cc.

00183 {
00184   string _fourth = rbx . substr(0,4);
00185   if ( _fourth == "HBM0" || _fourth == "HBP0" || _fourth == "HEP0" || _fourth == "HFP0" || _fourth == "HOP0" || _fourth == "HOM0" ) rbx . erase( 3, 1 );
00186 
00187   if ( rbx == "HO0M02" ) rbx = "HO0M2";
00188   if ( rbx == "HO0M04" ) rbx = "HO0M4";
00189   if ( rbx == "HO0M06" ) rbx = "HO0M6";
00190   if ( rbx == "HO0M08" ) rbx = "HO0M8";
00191   if ( rbx == "HO0M10" ) rbx = "HO0M10";
00192   if ( rbx == "HO0M12" ) rbx = "HO0M12";
00193   if ( rbx == "HO0P02" ) rbx = "HO0P2";
00194   if ( rbx == "HO0P04" ) rbx = "HO0P4";
00195   if ( rbx == "HO0P06" ) rbx = "HO0P6";
00196   if ( rbx == "HO0P08" ) rbx = "HO0P8";
00197   if ( rbx == "HO0P10" ) rbx = "HO0P10";
00198   if ( rbx == "HO0P12" ) rbx = "HO0P12";
00199 
00200   return 0;
00201 }

int XMLRBXPedestalsLoader::init ( void   )  [protected]

Definition at line 203 of file XMLRBXPedestalsLoader.cc.

References _data_gol, and _data_ped_delay.

Referenced by XMLRBXPedestalsLoader().

00204 {
00205   // define the <DATA/> template for pedestals and zero delays
00206   static const char * _str =  "\
00207   <DATA>\n\
00208    <MODULE_POSITION>2</MODULE_POSITION>\n\
00209    <QIE_CARD_POSITION>1</QIE_CARD_POSITION>\n\
00210    <QIE_ADC_NUMBER>0</QIE_ADC_NUMBER>\n\
00211    <INTEGER_VALUE>4</INTEGER_VALUE>\n\
00212   </DATA>\n\
00213   ";
00214   const XMLByte * _template = (const XMLByte *)_str;
00215   _data_ped_delay = new MemBufInputSource( _template, strlen( (const char *)_template ), "_data_ped_delay", false );
00216 
00217   // define the <DATA/> template for gol currents
00218   static const char * _str2 =  "\
00219   <DATA>\n\
00220    <MODULE_POSITION>2</MODULE_POSITION>\n\
00221    <QIE_CARD_POSITION>1</QIE_CARD_POSITION>\n\
00222    <FIBER_NUMBER>0</FIBER_NUMBER>\n\
00223    <INTEGER_VALUE>4</INTEGER_VALUE>\n\
00224   </DATA>\n\
00225   ";
00226   const XMLByte * _template2 = (const XMLByte *)_str2;
00227   _data_gol = new MemBufInputSource( _template2, strlen( (const char *)_template2 ), "_data_gol", false );
00228 
00229   return 0;
00230 }

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


Member Data Documentation

MemBufInputSource* XMLRBXPedestalsLoader::_data_gol [protected]

Definition at line 78 of file XMLRBXPedestalsLoader.h.

Referenced by addRBXSlot(), init(), and ~XMLRBXPedestalsLoader().

MemBufInputSource* XMLRBXPedestalsLoader::_data_ped_delay [protected]

Definition at line 77 of file XMLRBXPedestalsLoader.h.

Referenced by addRBXSlot(), init(), and ~XMLRBXPedestalsLoader().


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