CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 // Destructor --
50 //--------------
52 
53 //--------------
54 // Operations --
55 //--------------
56 
57 //
58 // assignment operator
59 //
61  m_file = lut.m_file;
62  return *this;
63 }
64 
65 //
66 // open file
67 //
69  const char* file_name = m_file.c_str();
70  m_fin.open(file_name, ios::in);
71  if (!m_fin) {
72  cout << "can not open file : " << file_name << endl;
73  return -1;
74  } else {
75  return 0;
76  }
77 }
78 
79 //
80 // read and ignore n lines from file
81 //
83  char buf[256];
84  for (int i = 0; i < n; i++)
85  m_fin.getline(buf, 256);
86 }
87 
88 //
89 // read one integer from file
90 //
92  int tmp = 0;
93  m_fin >> tmp;
94  return tmp;
95 }
96 
97 //
98 // read one hex from file
99 //
101  int tmp = 0;
102  m_fin >> hex >> tmp;
103  return tmp;
104 }
105 
106 //
107 // read one string from file
108 //
110  string tmp;
111  m_fin >> tmp;
112  return tmp;
113 }
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
std::string readString()
read one string from file
int readInteger()
read one integer from file
std::string m_file
virtual ~L1TriggerLutFile()
destructor
tuple cout
Definition: gather_cfg.py:144
tmp
align.sh
Definition: createJobs.py:716
int open()
open file