L1Trigger
L1TMuonBarrel
src
L1MuBMTEtaPatternLut.cc
Go to the documentation of this file.
1
//-------------------------------------------------
2
//
3
// Class: L1MuDTEtaPatternLut
4
//
5
// Description: Look-up table for eta track finder
6
//
7
//
8
// $Date: 2007/03/30 07:48:02 $
9
// $Revision: 1.1 $
10
//
11
// Author :
12
// N. Neumeister CERN EP
13
// J. Troconiz UAM Madrid
14
//
15
//--------------------------------------------------
16
17
//-----------------------
18
// This Class's Header --
19
//-----------------------
20
21
#include "
L1Trigger/L1TMuonBarrel/interface/L1MuBMTEtaPatternLut.h
"
22
23
//---------------
24
// C++ Headers --
25
//---------------
26
27
#include <iostream>
28
#include <iomanip>
29
#include <string>
30
31
//-------------------------------
32
// Collaborating Class Headers --
33
//-------------------------------
34
35
#include "
FWCore/ParameterSet/interface/FileInPath.h
"
36
#include "
CondFormats/L1TObjects/interface/L1TriggerLutFile.h
"
37
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
38
39
using namespace
std
;
40
41
// --------------------------------
42
// class L1MuDTEtaPatternLut
43
//---------------------------------
44
45
//----------------
46
// Constructors --
47
//----------------
48
49
L1MuBMTEtaPatternLut::L1MuBMTEtaPatternLut
() {
50
// if ( load() != 0 ) {
51
// cout << "Can not open files to load eta track finder look-up tables for DTTrackFinder!" << endl;
52
// }
53
54
// if ( L1MuDTTFConfig::Debug(6) ) print();
55
}
56
57
//--------------
58
// Destructor --
59
//--------------
60
61
L1MuBMTEtaPatternLut::~L1MuBMTEtaPatternLut
() { m_lut.clear(); }
62
63
//--------------
64
// Operations --
65
//--------------
66
67
//
68
// reset look-up table
69
//
70
void
L1MuBMTEtaPatternLut::reset
() { m_lut.clear(); }
71
72
//
73
// load pattern look-up table for ETF
74
//
75
int
L1MuBMTEtaPatternLut::load
() {
76
// get directory name
77
string
defaultPath =
"L1Trigger/"
;
78
string
eau_dir =
"L1TMuon/data/bmtf_luts/LUTs_Ass/"
;
79
80
// assemble file name
81
edm::FileInPath
lut_f =
edm::FileInPath
(
string
(defaultPath + eau_dir +
"ETFPatternList.lut"
));
82
string
etf_file = lut_f.
fullPath
();
83
84
// open file
85
L1TriggerLutFile
file
(etf_file);
86
if
(
file
.open() != 0)
87
return
-1;
88
// if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
89
// << file.getName() << endl;
90
91
// ignore comment lines (always at the beginning)
92
int
skip2 = getIgnoredLines(
file
);
93
file
.ignoreLines(skip2);
94
95
// read patterns
96
while
(
file
.good()) {
97
int
id
=
file
.readInteger();
98
if
(!
file
.good())
99
break
;
100
string
pat
=
file
.readString();
101
if
(!
file
.good())
102
break
;
103
int
qual =
file
.readInteger();
104
if
(!
file
.good())
105
break
;
106
int
eta
=
file
.readInteger();
107
if
(!
file
.good())
108
break
;
109
L1MuDTEtaPattern
pattern
(
id
,
pat
,
eta
, qual);
110
111
m_lut[
pattern
.id()] =
pattern
;
112
113
if
(!
file
.good()) {
114
file
.close();
115
break
;
116
}
117
}
118
119
file
.close();
120
121
return
0;
122
}
123
124
//
125
// print pattern look-up table for ETF
126
//
127
void
L1MuBMTEtaPatternLut::print
()
const
{
128
cout
<< endl;
129
cout
<<
"L1 barrel Track Finder ETA Pattern look-up table :"
<< endl;
130
cout
<<
"=================================================="
<< endl;
131
cout
<< endl;
132
133
cout
<<
"ETF Patterns : "
<< m_lut.size() << endl;
134
cout
<<
"======================"
<< endl;
135
cout
<< endl;
136
137
LUT::const_iterator iter = m_lut.begin();
138
while
(iter != m_lut.end()) {
139
cout
<< (*iter).second << endl;
140
iter++;
141
}
142
143
cout
<< endl;
144
}
145
146
//
147
// get pattern with a given ID
148
//
149
L1MuDTEtaPattern
L1MuBMTEtaPatternLut::getPattern
(
int
id
)
const
{
150
LUT::const_iterator it = m_lut.find(
id
);
151
if
(it == m_lut.end()) {
152
edm::LogError
(
"L1MuBMTEtaPatternLut: fine eta not found"
)
153
<<
"Error: L1MuBMTEtaPatternLut: pattern not found : "
<<
id
<< endl;
154
}
155
return
(*it).second;
156
}
157
158
int
L1MuBMTEtaPatternLut::getIgnoredLines
(
L1TriggerLutFile
file
)
const
{
159
if
(
file
.open() != 0)
160
return
-1;
161
int
skip
= 0;
162
while
(
file
.good()) {
163
string
str
=
file
.readString();
164
if
(
str
.find(
'#'
) == 0)
165
skip
+= 1;
166
//cout<<"here "<<str<<" found "<<str.find("#")<<endl;
167
if
(!
file
.good()) {
168
file
.close();
169
break
;
170
}
171
}
172
file
.close();
173
return
skip
;
174
}
L1MuDTEtaPattern
Definition:
L1MuDTEtaPattern.h:46
MessageLogger.h
L1MuBMTEtaPatternLut::print
void print() const
print pattern look-up table
Definition:
L1MuBMTEtaPatternLut.cc:127
L1MuBMTEtaPatternLut::~L1MuBMTEtaPatternLut
virtual ~L1MuBMTEtaPatternLut()
destructor
Definition:
L1MuBMTEtaPatternLut.cc:61
L1TriggerLutFile
Definition:
L1TriggerLutFile.h:37
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
edm::FileInPath
Definition:
FileInPath.h:61
optionsL1T.skip
skip
Definition:
optionsL1T.py:30
L1MuBMTEtaPatternLut::L1MuBMTEtaPatternLut
L1MuBMTEtaPatternLut()
constructor
Definition:
L1MuBMTEtaPatternLut.cc:49
PVValHelper::eta
Definition:
PVValidationHelpers.h:70
str
#define str(s)
Definition:
TestProcessor.cc:53
L1MuBMTEtaPatternLut::reset
void reset()
reset pattern look-up table
Definition:
L1MuBMTEtaPatternLut.cc:70
FileInPath.h
geometryDiff.file
file
Definition:
geometryDiff.py:13
L1MuBMTEtaPatternLut::getIgnoredLines
int getIgnoredLines(L1TriggerLutFile file) const
Definition:
L1MuBMTEtaPatternLut.cc:158
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition:
topSingleLeptonDQM_PU_cfi.py:39
pat
Definition:
HeavyIon.h:7
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:123
L1MuBMTEtaPatternLut::getPattern
L1MuDTEtaPattern getPattern(int id) const
get pattern with a given ID
Definition:
L1MuBMTEtaPatternLut.cc:149
std
Definition:
JetResolutionObject.h:76
L1MuBMTEtaPatternLut.h
L1MuBMTEtaPatternLut::load
int load()
load pattern look-up table
Definition:
L1MuBMTEtaPatternLut.cc:75
L1TriggerLutFile.h
edm::FileInPath::fullPath
std::string fullPath() const
Definition:
FileInPath.cc:161
Generated for CMSSW Reference Manual by
1.8.16