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

#include <AdcSampleFiller.h>

Inheritance diagram for AdcSampleFiller:
TpcDataTool AdcChannelTool

Public Member Functions

 AdcSampleFiller (fhicl::ParameterSet const &ps)
 
DataMap view (const AdcChannelData &acd) const override
 
DataMap update (AdcChannelData &acd) const override
 
- Public Member Functions inherited from TpcDataTool
virtual DataMap updateTpcData (TpcData &) const
 
virtual DataMap viewTpcData (const TpcData &) const
 
virtual int forwardTpcData () const
 
- Public Member Functions inherited from AdcChannelTool
virtual ~AdcChannelTool ()=default
 
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)
 

Private Attributes

int m_LogLevel
 
AdcIndex m_AdcUnderflow
 
AdcIndex m_AdcOverflow
 

Additional Inherited Members

- Public Types inherited from AdcChannelTool
using Index = unsigned int
 
- Static Public Member Functions inherited from AdcChannelTool
static int interfaceNotImplemented ()
 

Detailed Description

Definition at line 39 of file AdcSampleFiller.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file AdcSampleFiller_tool.cc.

15 : m_LogLevel(ps.get<int>("LogLevel")),
16  m_AdcUnderflow(ps.get<unsigned int>("AdcUnderflow")),
17  m_AdcOverflow(ps.get<unsigned int>("AdcOverflow")) {
18  const string myname = "AdcSampleFiller::ctor: ";
19  if ( m_LogLevel >= 1 ) {
20  cout << myname << "Configuration parameters:" << endl;
21  cout << myname << " LogLevel: " << m_LogLevel << endl;
22  cout << myname << " AdcUnderflow: " << m_AdcUnderflow << endl;
23  cout << myname << " AdcOverflow: " << m_AdcOverflow << endl;
24  }
25 }
AdcIndex m_AdcOverflow
AdcIndex m_AdcUnderflow
static constexpr double ps
Definition: Units.h:99
QTextStream & endl(QTextStream &s)

Member Function Documentation

DataMap AdcSampleFiller::update ( AdcChannelData acd) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 29 of file AdcSampleFiller_tool.cc.

29  {
30  const string myname = "AdcSampleFiller::update: ";
31  AdcIndex nsam = acd.raw.size();
32  acd.samples.resize(nsam, AdcChannelData::badSignal());
33  acd.flags.resize(nsam, AdcGood);
34  AdcPedestal ped = acd.pedestal;
35  if ( m_LogLevel >= 2 ) {
36  cout << myname << "# samples: " << nsam << endl;
37  cout << myname << " Pedestal: " << ped << endl;
38  }
39  if ( ped == AdcChannelData::badSignal() ) {
40  cout << myname << "Pedestal is not set." << endl;
41  return DataMap(1);
42  }
43  AdcIndex nlo = 0;
44  AdcIndex nhi = 0;
45  AdcIndex nbad = 0;
46  for ( AdcIndex isam=0; isam<nsam; ++isam ) {
47  AdcIndex adc = acd.raw[isam];
48  acd.samples[isam] = adc - ped;
49  if ( adc <= m_AdcUnderflow ) {
50  acd.flags[isam] = AdcUnderflow;
51  ++nlo;
52  } else if ( adc >= m_AdcOverflow ) {
53  acd.flags[isam] = AdcOverflow;
54  ++nhi;
55  }
56  if ( adc < m_AdcUnderflow || adc > m_AdcOverflow ) ++nbad;
57  }
58  acd.sampleUnit = "ADC count";
59  DataMap res(0);
60  res.setInt("nSample", nsam);
61  res.setInt("nUnderflow", nlo);
62  res.setInt("nOverflow", nhi);
63  res.setInt("nOutOfRange", nbad);
64  return res;
65 }
int16_t adc
Definition: CRTFragment.hh:202
const AdcFlag AdcUnderflow
Definition: AdcTypes.h:33
AdcIndex m_AdcOverflow
const AdcFlag AdcGood
Definition: AdcTypes.h:32
static Index badSignal()
const AdcFlag AdcOverflow
Definition: AdcTypes.h:34
AdcIndex m_AdcUnderflow
AdcCountVector raw
unsigned int AdcIndex
Definition: AdcTypes.h:15
AdcSignal pedestal
float AdcPedestal
Definition: AdcTypes.h:25
AdcSignalVector samples
QTextStream & endl(QTextStream &s)
AdcFlagVector flags
DataMap AdcSampleFiller::view ( const AdcChannelData acd) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 69 of file AdcSampleFiller_tool.cc.

69  {
70  AdcChannelData acdtmp;
71  acdtmp.samples = acd.samples;
72  return update(acdtmp);
73 }
DataMap update(AdcChannelData &acd) const override
AdcSignalVector samples

Member Data Documentation

AdcIndex AdcSampleFiller::m_AdcOverflow
private

Definition at line 55 of file AdcSampleFiller.h.

AdcIndex AdcSampleFiller::m_AdcUnderflow
private

Definition at line 54 of file AdcSampleFiller.h.

int AdcSampleFiller::m_LogLevel
private

Definition at line 53 of file AdcSampleFiller.h.


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