CalibTracker
SiStripCommon
src
SiStripFedIdListReader.cc
Go to the documentation of this file.
1
#include "
CalibTracker/SiStripCommon/interface/SiStripFedIdListReader.h
"
2
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
3
#include <algorithm>
4
#include <sstream>
5
6
// -----------------------------------------------------------------------------
7
//
8
SiStripFedIdListReader::SiStripFedIdListReader
(
std::string
filePath
) {
9
fedIds_
.clear();
10
inputFile_
.open(
filePath
.c_str());
11
12
if
(
inputFile_
.is_open()) {
13
for
(;;) {
14
uint32_t fed_id;
15
inputFile_
>> fed_id;
16
17
if
(!(
inputFile_
.eof() ||
inputFile_
.fail())) {
18
std::vector<uint16_t>::const_iterator it =
find
(
fedIds_
.begin(),
fedIds_
.end(), fed_id);
19
if
(it ==
fedIds_
.end()) {
20
fedIds_
.push_back(fed_id);
21
}
else
{
22
edm::LogWarning
(
"Unknown"
) <<
"[SiStripFedIdListReader::"
<< __func__ <<
"]"
23
<<
" FedId "
<< fed_id <<
" has already been found in file!"
<< std::endl;
24
continue
;
25
}
26
27
}
else
if
(
inputFile_
.eof()) {
28
edm::LogVerbatim
(
"Unknown"
) <<
"[SiStripFedIdListReader::"
<< __func__ <<
"]"
29
<<
" End of file reached! Found "
<<
fedIds_
.size() <<
" valid FedIds!"
30
<< std::endl;
31
break
;
32
}
else
if
(
inputFile_
.fail()) {
33
edm::LogVerbatim
(
"Unknown"
) <<
"[SiStripFedIdListReader::"
<< __func__ <<
"]"
34
<<
" Error while reading file \""
<<
filePath
<<
"\"!"
<< std::endl;
35
break
;
36
}
37
}
38
39
inputFile_
.close();
40
}
else
{
41
edm::LogVerbatim
(
"Unknown"
) <<
"[SiStripFedIdListReader::"
<< __func__ <<
"]"
42
<<
" Unable to open file \""
<<
filePath
<<
"\"!"
<< std::endl;
43
return
;
44
}
45
}
46
47
// -----------------------------------------------------------------------------
48
//
49
SiStripFedIdListReader::SiStripFedIdListReader
(
const
SiStripFedIdListReader
&
copy
) {
50
edm::LogVerbatim
(
"Unknown"
) <<
"[SiStripFedIdListReader::"
<< __func__ <<
"]"
;
51
fedIds_
=
copy
.fedIds_;
52
}
53
54
// -----------------------------------------------------------------------------
55
//
56
SiStripFedIdListReader
&
SiStripFedIdListReader::operator=
(
const
SiStripFedIdListReader
&
copy
) {
57
edm::LogVerbatim
(
"Unknown"
) <<
"[SiStripFedIdListReader::"
<< __func__ <<
"]"
;
58
fedIds_
=
copy
.fedIds_;
59
return
*
this
;
60
}
61
62
// -----------------------------------------------------------------------------
63
//
64
SiStripFedIdListReader::~SiStripFedIdListReader
() {
65
edm::LogVerbatim
(
"Unknown"
) <<
"[SiStripFedIdListReader::"
<< __func__ <<
"]"
;
66
}
67
68
// -----------------------------------------------------------------------------
69
//
70
std::ostream&
operator<<
(std::ostream& os,
const
SiStripFedIdListReader
&
in
) {
71
std::vector<uint16_t> fed_ids =
in
.fedIds();
72
std::stringstream
ss
;
73
ss
<<
"[SiStripFedIdListReader::"
<< __func__ <<
"]"
74
<<
" Found "
<< fed_ids.size() <<
" valid FED ids with values: "
;
75
std::vector<uint16_t>::const_iterator iter = fed_ids.begin();
76
for
(; iter != fed_ids.end(); ++iter) {
77
ss
<< *iter <<
" "
;
78
}
79
os <<
ss
.str();
80
return
os;
81
}
MessageLogger.h
filterCSVwithJSON.copy
copy
Definition:
filterCSVwithJSON.py:36
operator<<
std::ostream & operator<<(std::ostream &os, const SiStripFedIdListReader &in)
Definition:
SiStripFedIdListReader.cc:70
SiStripFedIdListReader::~SiStripFedIdListReader
~SiStripFedIdListReader()
Definition:
SiStripFedIdListReader.cc:64
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition:
FindCaloHit.cc:19
contentValuesCheck.ss
ss
Definition:
contentValuesCheck.py:33
SiStripFedIdListReader
Definition:
SiStripFedIdListReader.h:18
dt4ml_dqm_sourceclient-live_cfg.filePath
filePath
CUSTOMIZE FOR ML.
Definition:
dt4ml_dqm_sourceclient-live_cfg.py:45
SiStripFedIdListReader::SiStripFedIdListReader
SiStripFedIdListReader()
Definition:
SiStripFedIdListReader.h:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition:
MessageLogger.h:141
SiStripFedIdListReader::fedIds_
std::vector< uint16_t > fedIds_
Definition:
SiStripFedIdListReader.h:41
recoMuon::in
Definition:
RecoMuonEnumerators.h:6
edm::LogVerbatim
Definition:
MessageLogger.h:297
SiStripFedIdListReader::operator=
SiStripFedIdListReader & operator=(const SiStripFedIdListReader &)
Definition:
SiStripFedIdListReader.cc:56
SiStripFedIdListReader::inputFile_
std::ifstream inputFile_
Definition:
SiStripFedIdListReader.h:39
SiStripFedIdListReader.h
Generated for CMSSW Reference Manual by
1.8.16