CMS 3D CMS Logo

Public Member Functions | Private Attributes

pos::PixelLTCConfig Class Reference

This is the documentation about PixelLTCConfig... More...

#include <PixelLTCConfig.h>

Inheritance diagram for pos::PixelLTCConfig:
pos::PixelConfigBase

List of all members.

Public Member Functions

std::stringstream & getLTCConfigStream ()
 PixelLTCConfig (std::string filename)
 PixelLTCConfig (std::vector< std::vector< std::string > > &tableMat)
virtual void writeASCII (std::string dir) const
void writeXML (pos::PixelConfigKey key, int version, std::string path) const
virtual void writeXML (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
virtual void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const

Private Attributes

std::stringstream ltcConfigStream_

Detailed Description

This is the documentation about PixelLTCConfig...

" "

This class reads the LTC configuration file

Definition at line 30 of file PixelLTCConfig.h.


Constructor & Destructor Documentation

pos::PixelLTCConfig::PixelLTCConfig ( std::vector< std::vector< std::string > > &  tableMat)
PixelLTCConfig::PixelLTCConfig ( std::string  filename)

Definition at line 64 of file PixelLTCConfig.cc.

References gather_cfg::cout, recoMuon::in, geometryCSVtoXML::line, and ltcConfigStream_.

                                                :
  PixelConfigBase(" "," "," "){

    std::string mthn = "[PixelLTCConfig::PixelLTCConfig()]\t\t\t    " ;
    std::ifstream in(filename.c_str());

    if (!in.good()){
        std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
        throw std::runtime_error("Failed to open file "+filename);
    }
    else {
        std::cout << __LINE__ << "]\t" << mthn << "Opened: "         << filename << std::endl;
    }

    //ltcConfigPath_ = filename;
    string line;
    while (!in.eof()) {
       getline (in,line);
       ltcConfigStream_ << line << endl;
    }

} 

Member Function Documentation

std::stringstream& pos::PixelLTCConfig::getLTCConfigStream ( ) [inline]

Definition at line 37 of file PixelLTCConfig.h.

References ltcConfigStream_.

{return ltcConfigStream_;}
void PixelLTCConfig::writeASCII ( std::string  dir) const [virtual]

Implements pos::PixelConfigBase.

Definition at line 87 of file PixelLTCConfig.cc.

References lut2db_cfg::filename, ltcConfigStream_, and dbtoconf::out.

Referenced by writeXMLHeader().

                                                   {

  if (dir!="") dir+="/";
  std::string filename=dir+"LTCConfiguration.txt";
  std::ofstream out(filename.c_str());

  //std::ifstream in(ltcConfigPath_.c_str());
  //assert(in.good());

  string configstr = ltcConfigStream_.str();

  out << configstr << endl;

  out.close();

}
void PixelLTCConfig::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const [virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 152 of file PixelLTCConfig.cc.

{
  std::string mthn = "[PixelLTCConfig::writeXML()]\t\t\t    " ;

  *outstream << " <DATA>"                                                                                 << std::endl ;
  *outstream << "  <LTC_OBJ_DATA_FILE>./LTCConfiguration.txt</LTC_OBJ_DATA_FILE>"                         << std::endl ;
  *outstream << " </DATA>"                                                                                << std::endl ;
}
void pos::PixelLTCConfig::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const [inline, virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 40 of file PixelLTCConfig.h.

{;}
void PixelLTCConfig::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const [virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 105 of file PixelLTCConfig.cc.

References gather_cfg::cout, pos::PixelConfigBase::getAuthor(), pos::PixelConfigBase::getComment(), pos::PixelTimeFormatter::getmSecTime(), edm::service::getTime(), and writeASCII().

{
  std::string mthn = "[PixelLTCConfig::writeXMLHeader()]\t\t\t    " ;
  std::stringstream maskFullPath ;

  writeASCII(path) ;

  maskFullPath << path << "/Pixel_LtcParameters_" << PixelTimeFormatter::getmSecTime() << ".xml";
  std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << maskFullPath.str() << std::endl ;

  outstream->open(maskFullPath.str().c_str()) ;
  
  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>"                                 << std::endl ;
  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"                            << std::endl ;
  *outstream << ""                                                                                        << std::endl ; 
  *outstream << " <HEADER>"                                                                               << std::endl ; 
  *outstream << "  <TYPE>"                                                                                << std::endl ; 
  *outstream << "   <EXTENSION_TABLE_NAME>PIXEL_LTC_PARAMETERS</EXTENSION_TABLE_NAME>"                    << std::endl ; 
  *outstream << "   <NAME>LTC Configuration Parameters</NAME>"                                            << std::endl ; 
  *outstream << "  </TYPE>"                                                                               << std::endl ; 
  *outstream << "  <RUN>"                                                                                 << std::endl ; 
  *outstream << "   <RUN_TYPE>LTC Configuration Parameters</RUN_TYPE>"                                    << std::endl ; 
  *outstream << "   <RUN_NUMBER>1</RUN_NUMBER>"                                                           << std::endl ; 
  *outstream << "   <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>"   << std::endl ; 
  *outstream << "   <LOCATION>CERN P5</LOCATION>"                                                         << std::endl ; 
  *outstream << "  </RUN>"                                                                                << std::endl ; 
  *outstream << " </HEADER>"                                                                              << std::endl ; 
  *outstream << ""                                                                                        << std::endl ; 
  *outstream << " <DATA_SET>"                                                                             << std::endl ;
  *outstream << ""                                                                                        << std::endl ;
  *outstream << "  <VERSION>"             << version      << "</VERSION>"                                 << std::endl ;
  *outstream << "  <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>"                     << std::endl ;
  *outstream << "  <CREATED_BY_USER>"     << getAuthor()  << "</CREATED_BY_USER>"                         << std::endl ;
  *outstream << ""                                                                                        << std::endl ;
  *outstream << "  <PART>"                                                                                << std::endl ;
  *outstream << "   <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>"                                              << std::endl ;      
  *outstream << "   <KIND_OF_PART>Detector ROOT</KIND_OF_PART>"                                           << std::endl ;         
  *outstream << "  </PART>"                                                                               << std::endl ;

}
void PixelLTCConfig::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const [virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 164 of file PixelLTCConfig.cc.

References gather_cfg::cout.

{
  std::string mthn = "[PixelLTCConfig::writeXMLTrailer()]\t\t\t    " ;
  
  *outstream << " </DATA_SET>"                                                                            << std::endl ;
  *outstream << "</ROOT>"                                                                                 << std::endl ;
  
  outstream->close() ;
  std::cout << __LINE__ << "]\t" << mthn << "Data written "                                               << std::endl ;

}

Member Data Documentation

std::stringstream pos::PixelLTCConfig::ltcConfigStream_ [private]

Definition at line 59 of file PixelLTCConfig.h.

Referenced by getLTCConfigStream(), PixelLTCConfig(), and writeASCII().