Main Page
Namespaces
Classes
Package Documentation
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 <errno.h>
6
7
void
L1MuCSCPtLut::readFromDBS
(
std::string
& ptLUT )
8
{
9
10
//edm::LogInfo( "L1-O2O: L1MuCSCPtLut" ) <<" Reading from DBS";
11
12
// the ptLUT returned by the OMDS query will have a structure like number"\n"number"\n"
13
// e.g., 32896\n32896\n32896\n32896\n and so on
14
// remove the \n separator to write the pt_lut[1<<21] line-by-line
15
for
(
size_t
pos
=ptLUT.find(
"\\n"
);
pos
!=std::string::npos;
pos
=ptLUT.find(
"\\n"
,
pos
)){
16
ptLUT[
pos
]=
' '
;
17
ptLUT[
pos
+1]=
'\n'
;
18
}
19
20
unsigned
long
length = 1<<21;
//length of the ptLUT file
21
22
std::stringstream
file
(ptLUT);
23
if
( file.fail() )
24
throw
cms::Exception
(
"Cannot open the ptLUT"
)<<
"L1MuCSCPtLut cannot open "
25
<<
"ptLUT from DBS (errno="
26
<<errno<<
")"
<<std::endl;
27
28
// filling the ptLUT
29
unsigned
int
address=0;
30
for
(address=0; !file.eof() && address<length; address++) {
31
char
buff[1024];
32
file.getline(buff,1024);
33
int
ptOutput = atoi(buff);
34
35
// uncomment if you want to see line-by-line
36
//edm::LogInfo( "L1-O2O: L1MuCSCPtLut" ) << "writing line "
37
// << ptOutput;
38
39
// Warning: this may throw non-cms like exception
40
pt_lut
[address] = ptOutput;
41
}
42
43
if
( address!=length )
44
throw
cms::Exception
(
"Incorrect LUT size"
)<<
"L1MuCSCPtLut read "
<<address
45
<<
" words from DBS instead of expected "
46
<<length <<std::endl;
47
}
MessageLogger.h
Exception
Definition:
hltDiff.cc:291
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
L1MuCSCPtLut::readFromDBS
void readFromDBS(std::string &ptLUT)
Definition:
L1MuCSCPtLut.cc:7
L1MuCSCPtLut::pt_lut
unsigned short pt_lut[1<< 21]
Definition:
L1MuCSCPtLut.h:13
FrontierConditions_GlobalTag_cff.file
file
Definition:
FrontierConditions_GlobalTag_cff.py:13
pos
Definition:
PixelAliasList.h:14
cms::Exception
Definition:
Exception.h:68
L1MuCSCPtLut.h
Generated for CMSSW Reference Manual by
1.8.11