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 //--------------
47 // Destructor --
48 //--------------
49 
51 
52 //--------------
53 // Operations --
54 //--------------
55 
57 
58  m_file = lut.m_file;
59  return *this;
60 
61 }
62 
63 
65 
66  const char* file_name = m_file.c_str();
67  m_fin.open(file_name,ios::in);
68  if ( !m_fin ) {
69  cout << "can not open file : " << file_name << endl;
70  return -1;
71  }
72  else {
73  return 0;
74  }
75 
76 }
77 
78 
80 
81  char buf[256];
82  for ( int i = 0; i < n; i++ ) m_fin.getline(buf,256);
83 
84 }
85 
86 
88 
89  int tmp = 0;
90  m_fin >> tmp;
91  return tmp;
92 
93 }
94 
95 
97 
98  int tmp = 0;
99  m_fin >> hex >> tmp;
100  return tmp;
101 
102 }
103 
104 
106 
107  string tmp;
108  m_fin >> tmp;
109  return tmp;
110 
111 }
virtual ~DTTPGLutFile()
destructor
Definition: DTTPGLutFile.cc:50
void ignoreLines(int n)
read and ignore n lines from file
Definition: DTTPGLutFile.cc:79
std::string readString()
read one string from file
std::string m_file
Definition: DTTPGLutFile.h:81
DTTPGLutFile & operator=(const DTTPGLutFile &)
assignment operator
Definition: DTTPGLutFile.cc:56
DTTPGLutFile(const std::string name="")
constructor
int readHex()
read one hex from file
Definition: DTTPGLutFile.cc:96
std::ifstream m_fin
Definition: DTTPGLutFile.h:80
int readInteger()
read one integer from file
Definition: DTTPGLutFile.cc:87
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
int open()
open file
Definition: DTTPGLutFile.cc:64