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