CMS 3D CMS Logo

List of all members | 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

Public Member Functions

std::stringstream & getLTCConfigStream ()
 
 PixelLTCConfig (std::vector< std::vector< std::string > > &tableMat)
 
 PixelLTCConfig (std::string filename)
 
void writeASCII (std::string dir) const override
 
void writeXML (pos::PixelConfigKey key, int version, std::string path) const override
 
void writeXML (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
- Public Member Functions inherited from pos::PixelConfigBase
std::string creator ()
 
std::string date ()
 
std::string description ()
 
std::string getAuthor () const
 
std::string getComment () const
 
 PixelConfigBase (std::string description, std::string creator, std::string date)
 
void setAuthor (std::string author)
 
void setComment (std::string comment)
 
virtual void writeXML (std::ofstream *out) const
 
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
 
virtual void writeXMLTrailer (std::ofstream *out) const
 
virtual ~PixelConfigBase ()
 

Private Attributes

std::stringstream ltcConfigStream_
 

Detailed Description

This is the documentation about PixelLTCConfig...

" "

This class reads the LTC configuration file

Definition at line 29 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 59 of file PixelLTCConfig.cc.

References gather_cfg::cout, recoMuon::in, mps_splice::line, ltcConfigStream_, and AlCaHLTBitMon_QueryRunRegistry::string.

59  : PixelConfigBase(" ", " ", " ") {
60  std::string mthn = "[PixelLTCConfig::PixelLTCConfig()]\t\t\t ";
61  std::ifstream in(filename.c_str());
62 
63  if (!in.good()) {
64  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
65  throw std::runtime_error("Failed to open file " + filename);
66  } else {
67  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
68  }
69 
70  //ltcConfigPath_ = filename;
71  string line;
72  while (!in.eof()) {
73  getline(in, line);
74  ltcConfigStream_ << line << endl;
75  }
76 }
std::stringstream ltcConfigStream_
PixelConfigBase(std::string description, std::string creator, std::string date)

Member Function Documentation

std::stringstream& pos::PixelLTCConfig::getLTCConfigStream ( )
inline
void PixelLTCConfig::writeASCII ( std::string  dir) const
overridevirtual

Implements pos::PixelConfigBase.

Definition at line 78 of file PixelLTCConfig.cc.

References corrVsCorr::filename, ltcConfigStream_, MillePedeFileConverter_cfg::out, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getLTCConfigStream(), and writeXMLHeader().

78  {
79  if (!dir.empty())
80  dir += "/";
81  std::string filename = dir + "LTCConfiguration.txt";
82  std::ofstream out(filename.c_str());
83 
84  //std::ifstream in(ltcConfigPath_.c_str());
85  //assert(in.good());
86 
87  string configstr = ltcConfigStream_.str();
88 
89  out << configstr << endl;
90 
91  out.close();
92 }
std::stringstream ltcConfigStream_
void pos::PixelLTCConfig::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlineoverridevirtual
void PixelLTCConfig::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 140 of file PixelLTCConfig.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

140  {
141  std::string mthn = "[PixelLTCConfig::writeXML()]\t\t\t ";
142 
143  *outstream << " <DATA>" << std::endl;
144  *outstream << " <LTC_OBJ_DATA_FILE>./LTCConfiguration.txt</LTC_OBJ_DATA_FILE>" << std::endl;
145  *outstream << " </DATA>" << std::endl;
146 }
void PixelLTCConfig::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 95 of file PixelLTCConfig.cc.

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

Referenced by writeXML().

100  {
101  std::string mthn = "[PixelLTCConfig::writeXMLHeader()]\t\t\t ";
102  std::stringstream maskFullPath;
103 
104  writeASCII(path);
105 
106  maskFullPath << path << "/Pixel_LtcParameters_" << PixelTimeFormatter::getmSecTime() << ".xml";
107  std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << maskFullPath.str() << std::endl;
108 
109  outstream->open(maskFullPath.str().c_str());
110 
111  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
112  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
113  *outstream << "" << std::endl;
114  *outstream << " <HEADER>" << std::endl;
115  *outstream << " <TYPE>" << std::endl;
116  *outstream << " <EXTENSION_TABLE_NAME>PIXEL_LTC_PARAMETERS</EXTENSION_TABLE_NAME>" << std::endl;
117  *outstream << " <NAME>LTC Configuration Parameters</NAME>" << std::endl;
118  *outstream << " </TYPE>" << std::endl;
119  *outstream << " <RUN>" << std::endl;
120  *outstream << " <RUN_TYPE>LTC Configuration Parameters</RUN_TYPE>" << std::endl;
121  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
122  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl;
123  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl;
124  *outstream << " </RUN>" << std::endl;
125  *outstream << " </HEADER>" << std::endl;
126  *outstream << "" << std::endl;
127  *outstream << " <DATA_SET>" << std::endl;
128  *outstream << "" << std::endl;
129  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl;
130  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl;
131  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl;
132  *outstream << "" << std::endl;
133  *outstream << " <PART>" << std::endl;
134  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
135  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
136  *outstream << " </PART>" << std::endl;
137 }
static std::string getmSecTime(void)
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
void writeASCII(std::string dir) const override
void PixelLTCConfig::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 149 of file PixelLTCConfig.cc.

References gather_cfg::cout, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by writeXML().

151  {
152  std::string mthn = "[PixelLTCConfig::writeXMLTrailer()]\t\t\t ";
153 
154  *outstream << " </DATA_SET>" << std::endl;
155  *outstream << "</ROOT>" << std::endl;
156 
157  outstream->close();
158  std::cout << __LINE__ << "]\t" << mthn << "Data written " << std::endl;
159 }

Member Data Documentation

std::stringstream pos::PixelLTCConfig::ltcConfigStream_
private

Definition at line 51 of file PixelLTCConfig.h.

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