16 if(readHeaderCode!=
SUCCESS)
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_) maxAddress=entry.first;
33 std::sort(entries.begin(),entries.end());
39 if(std::adjacent_find(entries.begin(),entries.end(),
40 [](
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(),
48 [](
auto const&
a,
auto const&
b) {
49 return a.first + 1 !=
b.first;
62 std::transform(entries.begin(),entries.end(),
data_.begin(), [](
auto const& x){
return x.second; });
70 for(
unsigned int address=0;address<
data_.size();address++){
78 int startPos=stream.tellg();
80 while(std::getline(stream,line)){
81 if(line.find(
"#<header>")==0){
82 std::istringstream lineStream(line);
89 stream.seekg(startPos);
100 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_