CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DTTPGLutFile Class Reference

#include <DTTPGLutFile.h>

Public Member Functions

bool bad ()
 return status of file stream More...
 
void close ()
 close file More...
 
 DTTPGLutFile (const std::string name="")
 constructor More...
 
 DTTPGLutFile (const DTTPGLutFile &)
 copy constructor More...
 
std::string getName () const
 return filename More...
 
bool good ()
 return status of file stream More...
 
void ignoreLines (int n)
 read and ignore n lines from file More...
 
int open ()
 open file More...
 
DTTPGLutFileoperator= (const DTTPGLutFile &)
 assignment operator More...
 
int readHex ()
 read one hex from file More...
 
int readInteger ()
 read one integer from file More...
 
std::string readString ()
 read one string from file More...
 
virtual ~DTTPGLutFile ()
 destructor More...
 

Private Attributes

std::string m_file
 
std::ifstream m_fin
 

Detailed Description

Auxiliary class to handle Look-up table files

Date:
2007/10/23 13:44:22
Revision:
1.1
Author
N. Neumeister CERN EP

Definition at line 37 of file DTTPGLutFile.h.

Constructor & Destructor Documentation

DTTPGLutFile::DTTPGLutFile ( const std::string  name = "")

constructor

DTTPGLutFile::DTTPGLutFile ( const DTTPGLutFile in)

copy constructor

Definition at line 45 of file DTTPGLutFile.cc.

45 : m_file(in.m_file) {}
std::string m_file
Definition: DTTPGLutFile.h:83
DTTPGLutFile::~DTTPGLutFile ( )
virtual

destructor

Definition at line 52 of file DTTPGLutFile.cc.

52 {}

Member Function Documentation

bool DTTPGLutFile::bad ( )
inline

return status of file stream

Definition at line 63 of file DTTPGLutFile.h.

References m_fin.

63 { return m_fin.bad(); }
std::ifstream m_fin
Definition: DTTPGLutFile.h:82
void DTTPGLutFile::close ( void  )
inline
std::string DTTPGLutFile::getName ( void  ) const
inline

return filename

Definition at line 54 of file DTTPGLutFile.h.

References m_file.

54 { return m_file; }
std::string m_file
Definition: DTTPGLutFile.h:83
bool DTTPGLutFile::good ( )
inline

return status of file stream

Definition at line 60 of file DTTPGLutFile.h.

References m_fin.

60 { return m_fin.good(); }
std::ifstream m_fin
Definition: DTTPGLutFile.h:82
void DTTPGLutFile::ignoreLines ( int  n)

read and ignore n lines from file

Definition at line 81 of file DTTPGLutFile.cc.

References i, m_fin, and n.

81  {
82 
83  char buf[256];
84  for ( int i = 0; i < n; i++ ) m_fin.getline(buf,256);
85 
86 }
int i
Definition: DBlmapReader.cc:9
std::ifstream m_fin
Definition: DTTPGLutFile.h:82
int DTTPGLutFile::open ( )

open file

Definition at line 66 of file DTTPGLutFile.cc.

References gather_cfg::cout, cmsPerfSuiteHarvest::file_name, recoMuon::in, m_file, and m_fin.

Referenced by DTTracoLUTs::load().

66  {
67 
68  const char* file_name = m_file.c_str();
69  m_fin.open(file_name,ios::in);
70  if ( !m_fin ) {
71  cout << "can not open file : " << file_name << endl;
72  return -1;
73  }
74  else {
75  return 0;
76  }
77 
78 }
std::string m_file
Definition: DTTPGLutFile.h:83
std::ifstream m_fin
Definition: DTTPGLutFile.h:82
tuple cout
Definition: gather_cfg.py:121
DTTPGLutFile & DTTPGLutFile::operator= ( const DTTPGLutFile lut)

assignment operator

Definition at line 58 of file DTTPGLutFile.cc.

References m_file.

58  {
59 
60  m_file = lut.m_file;
61  return *this;
62 
63 }
std::string m_file
Definition: DTTPGLutFile.h:83
int DTTPGLutFile::readHex ( )

read one hex from file

Definition at line 98 of file DTTPGLutFile.cc.

References m_fin, and tmp.

Referenced by DTTracoLUTs::load().

98  {
99 
100  int tmp = 0;
101  m_fin >> hex >> tmp;
102  return tmp;
103 
104 }
std::ifstream m_fin
Definition: DTTPGLutFile.h:82
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
int DTTPGLutFile::readInteger ( )

read one integer from file

Definition at line 89 of file DTTPGLutFile.cc.

References m_fin, and tmp.

89  {
90 
91  int tmp = 0;
92  m_fin >> tmp;
93  return tmp;
94 
95 }
std::ifstream m_fin
Definition: DTTPGLutFile.h:82
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
string DTTPGLutFile::readString ( )

read one string from file

Definition at line 107 of file DTTPGLutFile.cc.

References m_fin, and tmp.

107  {
108 
109  string tmp;
110  m_fin >> tmp;
111  return tmp;
112 
113 }
std::ifstream m_fin
Definition: DTTPGLutFile.h:82
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100

Member Data Documentation

std::string DTTPGLutFile::m_file
private

Definition at line 83 of file DTTPGLutFile.h.

Referenced by getName(), open(), and operator=().

std::ifstream DTTPGLutFile::m_fin
private

Definition at line 82 of file DTTPGLutFile.h.

Referenced by bad(), close(), good(), ignoreLines(), open(), readHex(), readInteger(), and readString().