Public Member Functions | Private Attributes | List of all members
AcdDigitReader Class Reference

#include <AcdDigitReader.h>

Inheritance diagram for AcdDigitReader:
TpcDataTool

Public Member Functions

 AcdDigitReader (fhicl::ParameterSet const &ps)
 
 ~AcdDigitReader () override=default
 
DataMap update (AdcChannelData &acd) const override
 

Private Attributes

int m_LogLevel
 

Additional Inherited Members

- Private Types inherited from AdcChannelTool
using Index = unsigned int
 
- Private Member Functions inherited from TpcDataTool
virtual DataMap updateTpcData (TpcData &) const
 
virtual DataMap viewTpcData (const TpcData &) const
 
virtual int forwardTpcData () const
 
- Private Member Functions inherited from AdcChannelTool
virtual ~AdcChannelTool ()=default
 
virtual DataMap view (const AdcChannelData &acd) const
 
virtual DataMap updateMap (AdcChannelDataMap &acds) const
 
virtual DataMap viewMap (const AdcChannelDataMap &acds) const
 
virtual bool updateWithView () const
 
virtual bool viewWithUpdate () const
 
virtual DataMap beginEvent (const DuneEventInfo &) const
 
virtual DataMap endEvent (const DuneEventInfo &) const
 
virtual DataMap close (const DataMap *dmin=nullptr)
 
- Static Private Member Functions inherited from AdcChannelTool
static int interfaceNotImplemented ()
 

Detailed Description

Definition at line 18 of file AcdDigitReader.h.

Constructor & Destructor Documentation

AcdDigitReader::AcdDigitReader ( fhicl::ParameterSet const &  ps)

Definition at line 18 of file AcdDigitReader_tool.cc.

19 : m_LogLevel(ps.get<int>("LogLevel")) {
20  const string myname = "AcdDigitReader::ctor: ";
21  if ( m_LogLevel > 0 ) {
22  cout << myname << " LogLevel: " << m_LogLevel << endl;
23  }
24 }
static constexpr double ps
Definition: Units.h:99
QTextStream & endl(QTextStream &s)
AcdDigitReader::~AcdDigitReader ( )
overridedefault

Member Function Documentation

DataMap AcdDigitReader::update ( AdcChannelData acd) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 28 of file AcdDigitReader_tool.cc.

28  {
29  const string myname = "AcdDigitReader::update: ";
30  // Take the digit from the channel data.
31  const RawDigit* pdig = acd.digit;
32  if ( pdig == nullptr ) {
33  cout << myname << "ERROR: Digit is null." << endl;
34  return DataMap(1);
35  }
36  const RawDigit& dig = *pdig;
37  // Check the input data is empty.
38  if ( acd.raw.size() ) {
39  cout << myname << "ERROR: ADC channel has raw data." << endl;
40  return DataMap(2);
41  }
42  if ( acd.flags.size() ) {
43  cout << myname << "ERROR: ADC channel has flag data." << endl;
44  return DataMap(3);
45  }
46  if ( acd.pedestal != AdcChannelData::badSignal() ) {
47  cout << myname << "ERROR: ADC channel has a pedestal." << endl;
48  return DataMap(4);
49  }
50  // Set or check the channel number.
51  if ( acd.channel() == AdcChannelData::badChannel() ) {
52  acd.setChannelInfo(dig.Channel());
53  } else {
54  if ( acd.channel() != dig.Channel() ) {
55  cout << myname << "ERROR: Raw digit has inconsistent channel number." << endl;
56  return DataMap(5);
57  }
58  }
59  // Copy pedestal.
60  acd.pedestal = dig.GetPedestal();
61  acd.metadata["inputPedestal"] = dig.GetPedestal();
62  // Copy raw data.
63  if ( dig.Compression() == raw::kNone ) {
64  acd.raw = dig.ADCs();
65  } else {
66  unsigned int nsig = dig.Samples();
67  acd.raw.resize(nsig, -999); // See https://cdcvs.fnal.gov/redmine/issues/11572.
68  if ( nsig < dig.ADCs().size() ) {
69  cout << myname << "WARNING: " << "Uncompressed size is smaller than compressed: "
70  << nsig << " < " << dig.ADCs().size() << endl;
71  }
72  raw::Uncompress(dig.ADCs(), acd.raw, dig.GetPedestal(), dig.Compression());
73  }
74  // Initialize flags to good.
75  acd.flags.resize(acd.raw.size(), AdcGood);
76  if ( m_LogLevel >= 4 ) {
77  cout << myname << setw(8) << acd.channel() << ": [";
78  Index mdig = acd.raw.size();
79  bool toomany = mdig > 10 ;
80  if ( toomany ) mdig = 10;
81  for ( Index idig=0; idig<mdig; ++idig ) cout << setw(5) << acd.raw[idig];
82  if ( toomany ) cout << " ...";
83  cout << "]" << endl;
84  } else if ( m_LogLevel >= 3 ) {
85  cout << myname << "Channel " << acd.channel() << " raw count: " << acd.raw.size() << endl;
86  }
87  return DataMap(0);
88 }
float GetPedestal() const
Definition: RawDigit.h:214
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
Definition: RawDigit.h:210
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
Definition: RawDigit.h:213
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:69
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:212
unsigned int Index
const raw::RawDigit * digit
no compression
Definition: RawTypes.h:9
const AdcFlag AdcGood
Definition: AdcTypes.h:32
static Index badSignal()
void setChannelInfo(ChannelInfoPtr pchi)
AdcCountVector raw
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
Definition: RawDigit.h:216
Channel channel() const
AdcSignal pedestal
static Index badChannel()
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:776
QTextStream & endl(QTextStream &s)
AdcFlagVector flags

Member Data Documentation

int AcdDigitReader::m_LogLevel
private

Definition at line 31 of file AcdDigitReader.h.


The documentation for this class was generated from the following files: