ToyFragment.cc
Go to the documentation of this file.
2 
3 #include "cetlib_except/exception.h"
4 
5 namespace {
6 
7  // JCF, 9/29/14
8  // pop_count() is currently unused; under the new compiler (gcc // 4.9.1 as opposed to 4.8.2) this registers as an error // (-Werror=unused-function) so I've commented it out for now
9 
10  // unsigned int pop_count (unsigned int n) {
11  // unsigned int c;
12  // for (c = 0; n; c++) n &= n - 1;
13  // return c;
14  // }
15 }
16 
17 void dune::ToyFragment::checkADCData(int daq_adc_bits) const {
18  dune::ToyFragment::adc_t const * adcPtr(findBadADC(daq_adc_bits));
19  if (adcPtr != dataEnd()) {
20  throw cet::exception("IllegalADCVal")
21  << "Illegal value of ADC word #"
22  << (adcPtr - dataBegin())
23  << ": 0x"
24  << std::hex
25  << *adcPtr
26  << ".";
27  }
28 }
29 
30 std::ostream & dune::operator << (std::ostream & os, ToyFragment const & f) {
31  os << "ToyFragment event size: "
32  << f.hdr_event_size()
33  << ", run number: "
34  << f.hdr_run_number()
35  << "\n";
36 
37  return os;
38 }
39 
std::ostream & operator<<(std::ostream &out, CTBFragment const &f)
Definition: CTBFragment.cc:6
adc_t const * findBadADC(int daq_adc_bits) const
Definition: ToyFragment.hh:118
QTextStream & hex(QTextStream &s)
adc_t const * dataEnd() const
Definition: ToyFragment.hh:107
Header::event_size_t hdr_event_size() const
Definition: ToyFragment.hh:92
adc_t const * dataBegin() const
Definition: ToyFragment.hh:102
void checkADCData(int daq_adc_bits) const
Definition: ToyFragment.cc:17
Header::run_number_t hdr_run_number() const
Definition: ToyFragment.hh:93
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33