CMS 3D CMS Logo

DTTPGLutFile.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: DTTPGLutFile
4 //
5 // Description: Auxiliary class for
6 // Look-up table files
7 //
8 //
9 //
10 // Author :
11 // N. Neumeister CERN EP
12 //
13 //--------------------------------------------------
14 
15 //-----------------------
16 // This Class's Header --
17 //-----------------------
18 
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 
25 #include <iostream>
26 
27 using namespace std;
28 
29 //-------------------------------
30 // Collaborating Class Headers --
31 //-------------------------------
32 
33 // --------------------------------
34 // class DTTPGLutFile
35 //---------------------------------
36 
37 //----------------
38 // Constructors --
39 //----------------
40 
41 DTTPGLutFile::DTTPGLutFile(const string name) : m_file(name) {}
42 
43 DTTPGLutFile::DTTPGLutFile(const DTTPGLutFile &in) : m_file(in.m_file) {}
44 
45 //--------------
46 // Destructor --
47 //--------------
48 
50 
51 //--------------
52 // Operations --
53 //--------------
54 
56 
57  m_file = lut.m_file;
58  return *this;
59 }
60 
62 
63  const char *file_name = m_file.c_str();
64  m_fin.open(file_name, ios::in);
65  if (!m_fin) {
66  cout << "can not open file : " << file_name << endl;
67  return -1;
68  } else {
69  return 0;
70  }
71 }
72 
74 
75  char buf[256];
76  for (int i = 0; i < n; i++)
77  m_fin.getline(buf, 256);
78 }
79 
81 
82  int tmp = 0;
83  m_fin >> tmp;
84  return tmp;
85 }
86 
88 
89  int tmp = 0;
90  m_fin >> hex >> tmp;
91  return tmp;
92 }
93 
95 
96  string tmp;
97  m_fin >> tmp;
98  return tmp;
99 }
virtual ~DTTPGLutFile()
destructor
Definition: DTTPGLutFile.cc:49
void ignoreLines(int n)
read and ignore n lines from file
Definition: DTTPGLutFile.cc:73
std::string readString()
read one string from file
Definition: DTTPGLutFile.cc:94
std::string m_file
Definition: DTTPGLutFile.h:79
DTTPGLutFile & operator=(const DTTPGLutFile &)
assignment operator
Definition: DTTPGLutFile.cc:55
DTTPGLutFile(const std::string name="")
constructor
int readHex()
read one hex from file
Definition: DTTPGLutFile.cc:87
std::ifstream m_fin
Definition: DTTPGLutFile.h:78
int readInteger()
read one integer from file
Definition: DTTPGLutFile.cc:80
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
int open()
open file
Definition: DTTPGLutFile.cc:61