src
CondFormats
L1TObjects
src
L1MuCSCPtLut.cc
Go to the documentation of this file.
1
#include "
CondFormats/L1TObjects/interface/L1MuCSCPtLut.h
"
2
#include <
FWCore/MessageLogger/interface/MessageLogger.h
>
3
#include <sstream>
4
#include <iostream>
5
#include <cerrno>
6
7
void
L1MuCSCPtLut::readFromDBS
(
std::string
&
ptLUT
) {
8
//edm::LogInfo( "L1-O2O: L1MuCSCPtLut" ) <<" Reading from DBS";
9
10
// the ptLUT returned by the OMDS query will have a structure like number"\n"number"\n"
11
// e.g., 32896\n32896\n32896\n32896\n and so on
12
// remove the \n separator to write the pt_lut[1<<21] line-by-line
13
for
(
size_t
pos
=
ptLUT
.find(
"\\n"
);
pos
!= std::string::npos;
pos
=
ptLUT
.find(
"\\n"
,
pos
)) {
14
ptLUT
[
pos
] =
' '
;
15
ptLUT
[
pos
+ 1] =
'\n'
;
16
}
17
18
unsigned
long
length = 1 << 21;
//length of the ptLUT file
19
20
std::stringstream
file
(
ptLUT
);
21
if
(
file
.fail())
22
throw
cms::Exception
(
"Cannot open the ptLUT"
) <<
"L1MuCSCPtLut cannot open "
23
<<
"ptLUT from DBS (errno="
<< errno <<
")"
<< std::endl;
24
25
// filling the ptLUT
26
unsigned
int
address = 0;
27
for
(address = 0; !
file
.eof() && address < length; address++) {
28
char
buff[1024];
29
file
.getline(buff, 1024);
30
int
ptOutput = atoi(buff);
31
32
// uncomment if you want to see line-by-line
33
//edm::LogInfo( "L1-O2O: L1MuCSCPtLut" ) << "writing line "
34
// << ptOutput;
35
36
// Warning: this may throw non-cms like exception
37
pt_lut
[address] = ptOutput;
38
}
39
40
if
(address != length)
41
throw
cms::Exception
(
"Incorrect LUT size"
)
42
<<
"L1MuCSCPtLut read "
<< address <<
" words from DBS instead of expected "
<< length << std::endl;
43
}
Phase2L1GMT::ptLUT
const ap_uint< BITSPT > ptLUT[2251]
Definition:
TPSLUTs.h:18
Exception
Definition:
hltDiff.cc:245
MessageLogger.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
L1MuCSCPtLut::readFromDBS
void readFromDBS(std::string &ptLUT)
Definition:
L1MuCSCPtLut.cc:7
L1MuCSCPtLut::pt_lut
unsigned short pt_lut[1<< 21]
Definition:
L1MuCSCPtLut.h:13
pos
Definition:
PixelCalibBase.h:13
geometryDiff.file
file
Definition:
geometryDiff.py:13
cms::Exception
Definition:
Exception.h:59
L1MuCSCPtLut.h
Generated for CMSSW Reference Manual by
1.8.14