CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Member Functions

XMLLUTLoader Class Reference

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

Inheritance diagram for XMLLUTLoader:
XMLDOMBlock

List of all members.

Classes

struct  _checksumsDBConfig
struct  _loaderBaseConfig
struct  _lutDBConfig

Public Types

typedef
XMLLUTLoader::_checksumsDBConfig 
checksumsDBConfig
typedef
XMLLUTLoader::_loaderBaseConfig 
loaderBaseConfig
typedef XMLLUTLoader::_lutDBConfig lutDBConfig

Public Member Functions

int addChecksums (checksumsDBConfig *config, std::string templateFileName="HCAL_TRIG_PRIM_LOOKUP_TABLE.checksums.template")
int addLUT (lutDBConfig *config, std::string templateFileName="HCAL_TRIG_PRIM_LOOKUP_TABLE.dataset.template")
int createLoader (std::vector< int > crate_number, std::vector< std::string > file_name)
 XMLLUTLoader (XMLProcessor::loaderBaseConfig *config, std::string templateBase="HCAL_TRIG_PRIM_LOOKUP_TABLE.XMLloader.template")
 XMLLUTLoader ()
virtual ~XMLLUTLoader ()

Private Member Functions

const XMLLUTLoaderoperator= (const XMLLUTLoader &)
 XMLLUTLoader (const XMLLUTLoader &)

Detailed Description

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

Usage: <usage>

Definition at line 30 of file XMLLUTLoader.h.


Member Typedef Documentation


Constructor & Destructor Documentation

XMLLUTLoader::XMLLUTLoader ( )

Definition at line 48 of file XMLLUTLoader.cc.

{
}
XMLLUTLoader::XMLLUTLoader ( XMLProcessor::loaderBaseConfig config,
std::string  templateBase = "HCAL_TRIG_PRIM_LOOKUP_TABLE.XMLloader.template" 
)

Definition at line 52 of file XMLLUTLoader.cc.

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

                                                                                          : XMLDOMBlock( templateBase )
{
  setTagValue( "EXTENSION_TABLE_NAME", config -> extention_table_name );
  setTagValue( "NAME", config -> name );
  setTagAttribute( "RUN", "mode", config -> run_mode );
  setTagAttribute( "DATA_SET", "id", config -> data_set_id );
  setTagAttribute( "IOV", "id", config -> iov_id );
  setTagValue( "INTERVAL_OF_VALIDITY_BEGIN", config -> iov_begin );
  setTagValue( "INTERVAL_OF_VALIDITY_END", config -> iov_end );
  setTagAttribute( "TAG", "id", config -> tag_id );
  setTagAttribute( "TAG", "mode", config -> tag_mode );
  setTagValue( "TAG_NAME", config -> tag_name );
  setTagValue( "DETECTOR_NAME", config -> detector_name );
  setTagValue( "COMMENT_DESCRIPTION", config -> comment_description );

  setTagAttribute( "TAG", "idref", config -> tag_id, 1 );
  setTagAttribute( "IOV", "idref", config -> iov_id, 1 );
  setTagAttribute( "DATA_SET", "idref", config -> data_set_id, 1 );
}
XMLLUTLoader::~XMLLUTLoader ( ) [virtual]

Definition at line 77 of file XMLLUTLoader.cc.

{
}
XMLLUTLoader::XMLLUTLoader ( const XMLLUTLoader ) [private]

Member Function Documentation

int XMLLUTLoader::addChecksums ( checksumsDBConfig config,
std::string  templateFileName = "HCAL_TRIG_PRIM_LOOKUP_TABLE.checksums.template" 
)

Definition at line 123 of file XMLLUTLoader.cc.

References XMLDOMBlock::document, XMLDOMBlock::getDocument(), dbtoconf::root, XMLDOMBlock::setTagValue(), and BeamSplash_cfg::version.

Referenced by createLoader().

{
  DOMElement * root = document -> getDocumentElement();

  XMLDOMBlock dataSetDoc( templateFileName );
  DOMDocument * dataSet = dataSetDoc . getDocument();

  // changes to the Checksums <data_set> node
  setTagValue( "VERSION", config -> version, 0, dataSet );
  setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
  char timebuf[50];
  //strftime( timebuf, 50, "%c", gmtime( &(config -> create_timestamp) ) );
  strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
  setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
  setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
  setTagValue( "COMMENT_DESCRIPTION", config -> comment_description, 0, dataSet );
  setTagValue( "NAME_LABEL", config -> name_label, 0, dataSet );
  setTagValue( "TRIG_PRIM_LOOKUPTBL_DATA_FILE", config -> trig_prim_lookuptbl_data_file, 0, dataSet );
  setTagValue( "CRATE", config -> crate, 0, dataSet );

  // copy the <data_set> node into the final XML
  DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
  root -> appendChild( cloneDataSet );

  return 0;
}
int XMLLUTLoader::addLUT ( lutDBConfig config,
std::string  templateFileName = "HCAL_TRIG_PRIM_LOOKUP_TABLE.dataset.template" 
)

Definition at line 96 of file XMLLUTLoader.cc.

References XMLDOMBlock::document, XMLDOMBlock::getDocument(), dbtoconf::root, XMLDOMBlock::setTagValue(), and BeamSplash_cfg::version.

Referenced by createLoader().

{
  DOMElement * root = document -> getDocumentElement();

  XMLDOMBlock dataSetDoc( templateFileName );
  DOMDocument * dataSet = dataSetDoc . getDocument();

  // changes to the LUT <data_set> node
  setTagValue( "VERSION", config -> version, 0, dataSet );
  setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
  char timebuf[50];
  //strftime( timebuf, 50, "%c", gmtime( &(config -> create_timestamp) ) );
  strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
  setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
  setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
  setTagValue( "KIND_OF_PART", config -> kind_of_part, 0, dataSet );
  setTagValue( "NAME_LABEL", config -> name_label, 0, dataSet );
  setTagValue( "TRIG_PRIM_LOOKUPTBL_DATA_FILE", config -> trig_prim_lookuptbl_data_file, 0, dataSet );
  setTagValue( "CRATE", config -> crate, 0, dataSet );
  
  // copy the <data_set> node into the final XML
  DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
  root -> appendChild( cloneDataSet );

  return 0;
}
int XMLLUTLoader::createLoader ( std::vector< int >  crate_number,
std::vector< std::string >  file_name 
)

Definition at line 150 of file XMLLUTLoader.cc.

References addChecksums(), addLUT(), python::multivaluedict::append(), begin, dbtoconf::conf, end, and XMLDOMBlock::write().

{
  XMLLUTLoader::lutDBConfig conf;
  XMLLUTLoader::checksumsDBConfig CSconf;

  for ( std::vector<std::string>::const_iterator _file = file_name . begin(); _file != file_name . end(); _file++ )
    {
      conf . trig_prim_lookuptbl_data_file = *_file;
      conf . trig_prim_lookuptbl_data_file += ".dat";
      conf . crate = crate_number[ _file - file_name . begin() ];

      char _buf[128];
      sprintf( _buf, "CRATE%.2d", conf . crate );
      std::string _namelabel;
      _namelabel . append( _buf );
      conf . name_label = _namelabel;
      addLUT( &conf );
    }
  
  CSconf . trig_prim_lookuptbl_data_file += ".dat";
  addChecksums( &CSconf );
  write( "LUTLoader.xml" );

  return 0;
}
const XMLLUTLoader& XMLLUTLoader::operator= ( const XMLLUTLoader ) [private]