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; });
66 stream <<
"#<header> V1 " << nrBitsAddress_ <<
" " << nrBitsData_ <<
" </header> " << std::endl;
67 for (
unsigned int address = 0; address < data_.size(); address++) {
68 stream << (address & addressMask_) <<
" " <<
data(address) << std::endl;
73 int startPos = stream.tellg();
75 while (std::getline(stream, line)) {
76 if (line.find(
"#<header>") == 0) {
77 std::istringstream lineStream(line);
81 if (lineStream >> headerField >> version >> nrBitsAddress_ >> nrBitsData_) {
82 addressMask_ = nrBitsAddress_ != 32 ? (0x1 << nrBitsAddress_) - 1 : ~0x0;
83 dataMask_ = (0x1 << nrBitsData_) - 1;
84 stream.seekg(startPos);
92 addressMask_ = (0x1 << nrBitsAddress_) - 1;
93 dataMask_ = (0x1 << nrBitsData_) - 1;
95 stream.seekg(startPos);
void write(std::ostream &stream) const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
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 &)
char data[epos_bytes_allocation]