test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TriggerLutFile.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1TriggerLutFile
4 //
5 // Description: Auxiliary class for
6 // Look-up table files
7 //
8 //
9 // $Date: 2007/02/27 11:43:59 $
10 // $Revision: 1.2 $
11 //
12 // Author :
13 // N. Neumeister CERN EP
14 // J. Troconiz UAM Madrid
15 //
16 //--------------------------------------------------
17 
18 //-----------------------
19 // This Class's Header --
20 //-----------------------
21 
23 
24 //---------------
25 // C++ Headers --
26 //---------------
27 
28 #include <iostream>
29 
30 //-------------------------------
31 // Collaborating Class Headers --
32 //-------------------------------
33 
34 using namespace std;
35 
36 // --------------------------------
37 // class L1TriggerLutFile
38 //---------------------------------
39 
40 //----------------
41 // Constructors --
42 //----------------
43 
44 L1TriggerLutFile::L1TriggerLutFile(const string name) : m_file(name) {}
45 
47 
48 
49 //--------------
50 // Destructor --
51 //--------------
53 
54 //--------------
55 // Operations --
56 //--------------
57 
58 //
59 // assignment operator
60 //
62 
63  m_file = lut.m_file;
64  return *this;
65 
66 }
67 
68 
69 //
70 // open file
71 //
73 
74  const char* file_name = m_file.c_str();
75  m_fin.open(file_name,ios::in);
76  if ( !m_fin ) {
77  cout << "can not open file : " << file_name << endl;
78  return -1;
79  }
80  else {
81  return 0;
82  }
83 
84 }
85 
86 
87 //
88 // read and ignore n lines from file
89 //
91 
92  char buf[256];
93  for ( int i = 0; i < n; i++ ) m_fin.getline(buf,256);
94 
95 }
96 
97 
98 //
99 // read one integer from file
100 //
102 
103  int tmp = 0;
104  m_fin >> tmp;
105  return tmp;
106 
107 }
108 
109 
110 //
111 // read one hex from file
112 //
114 
115  int tmp = 0;
116  m_fin >> hex >> tmp;
117  return tmp;
118 
119 }
120 
121 
122 //
123 // read one string from file
124 //
126 
127  string tmp;
128  m_fin >> tmp;
129  return tmp;
130 
131 }
int i
Definition: DBlmapReader.cc:9
L1TriggerLutFile & operator=(const L1TriggerLutFile &)
assignment operator
L1TriggerLutFile(const std::string name="")
constructor
int readHex()
read one hex from file
std::ifstream m_fin
void ignoreLines(int n)
read and ignore n lines from file
tuple lut
Definition: lumiPlot.py:244
std::string readString()
read one string from file
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
int readInteger()
read one integer from file
std::string m_file
virtual ~L1TriggerLutFile()
destructor
tuple cout
Definition: gather_cfg.py:121
int open()
open file