16 return readHeaderCode;
18 std::vector<std::pair<unsigned int, int> > entries;
22 while (std::getline(stream, line)) {
23 line.erase(
std::find(line.begin(), line.end(),
'#'), line.end());
24 std::istringstream lineStream(line);
25 std::pair<unsigned int, int>
entry;
26 while (lineStream >> entry.first >> entry.second) {
29 entries.push_back(entry);
30 if (entry.first > maxAddress || maxAddress ==
addressMask_)
31 maxAddress = entry.first;
34 std::sort(entries.begin(), entries.end());
35 if (entries.empty()) {
40 if (std::adjacent_find(entries.begin(), entries.end(), [](
auto const&
a,
auto const&
b) {
41 return a.first ==
b.first;
42 }) != entries.end()) {
46 if (entries.front().first != 0 ||
47 std::adjacent_find(entries.begin(), entries.end(), [](
auto const&
a,
auto const&
b) {
48 return a.first + 1 !=
b.first;
49 }) != entries.end()) {
55 data_.resize(maxAddress + 1, 0);
61 std::transform(entries.begin(), entries.end(),
data_.begin(), [](
auto const& x) {
return x.second; });
67 for (
unsigned int address = 0; address <
data_.size(); address++) {
73 int startPos = stream.tellg();
75 while (std::getline(stream, line)) {
76 if (line.find(
"#<header>") == 0) {
77 std::istringstream lineStream(line);
84 stream.seekg(startPos);
95 stream.seekg(startPos);
void write(std::ostream &stream) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int read(std::istream &stream)
unsigned int addressMask_
int readHeader_(std::istream &)
int data(unsigned int address) const
unsigned int nrBitsAddress_