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

#include <AdcUnderflowFlagger.h>

Inheritance diagram for AdcUnderflowFlagger:
TpcDataTool AdcChannelTool

Public Types

using IntVector = std::vector< short >
 
- Public Types inherited from AdcChannelTool
using Index = unsigned int
 

Public Member Functions

 AdcUnderflowFlagger (fhicl::ParameterSet const &ps)
 
DataMap view (const AdcChannelData &acd) const override
 
DataMap update (AdcChannelData &acd) const override
 
AdcCountVectoradcThreshold ()
 
const AdcCountVectoradcThreshold () const
 
int & defaultThreshold ()
 
AdcCount defaultThreshold () const
 
- 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
 
IntVector m_AdcThresholds
 
int m_DefaultThreshold
 
AdcIndex m_modifyCount
 

Additional Inherited Members

- Static Public Member Functions inherited from AdcChannelTool
static int interfaceNotImplemented ()
 

Detailed Description

Definition at line 36 of file AdcUnderflowFlagger.h.

Member Typedef Documentation

Definition at line 41 of file AdcUnderflowFlagger.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file AdcUnderflowFlagger_tool.cc.

27 : m_LogLevel(ps.get<int>("LogLevel")),
28  m_AdcThresholds(ps.get<AdcCountVector>("AdcThresholds")),
29  m_DefaultThreshold(ps.get<int>("DefaultThreshold")),
30  m_modifyCount(0) {
31  const string myname = "AdcUnderflowFlagger::ctor: ";
32  if ( m_LogLevel >= 1 ) {
33  cout << myname << "Configuration parameters:" << endl;
34  cout << myname << " LogLevel: " << m_LogLevel << endl;
35  cout << myname << " AdcThresholds: [";
36  Index maxcha = 10;
37  Index ncha = m_AdcThresholds.size();
38  bool haveMore = ncha > maxcha;
39  if ( ! haveMore ) maxcha = ncha;
40  for ( Index icha=0; icha<maxcha; ++icha ) {
41  if ( icha ) cout << ",";
42  cout << " " << m_AdcThresholds[icha];
43  }
44  if ( haveMore ) cout << ",...";
45  cout << "]" << endl;
46  }
47 }
std::vector< AdcCount > AdcCountVector
Definition: AdcTypes.h:19
unsigned int Index
static constexpr double ps
Definition: Units.h:99
QTextStream & endl(QTextStream &s)

Member Function Documentation

AdcCountVector& AdcUnderflowFlagger::adcThreshold ( )
inline

Definition at line 50 of file AdcUnderflowFlagger.h.

const AdcCountVector& AdcUnderflowFlagger::adcThreshold ( ) const
inline

Definition at line 51 of file AdcUnderflowFlagger.h.

51 { return m_AdcThresholds; }
int& AdcUnderflowFlagger::defaultThreshold ( )
inline

Definition at line 52 of file AdcUnderflowFlagger.h.

AdcCount AdcUnderflowFlagger::defaultThreshold ( ) const
inline

Definition at line 53 of file AdcUnderflowFlagger.h.

DataMap AdcUnderflowFlagger::update ( AdcChannelData acd) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 61 of file AdcUnderflowFlagger_tool.cc.

61  {
62  const string myname = "AdcUnderflowFlagger::update: ";
63  if ( m_LogLevel >= 3 ) cout << myname << "Calling " << endl;
64  DataMap res(0);
65  AdcChannel icha = acd.channel();
66  res.setInt("channel", icha);
67  res.setInt("nModify", m_modifyCount);
68  if ( icha == AdcChannelData::badChannel() ) {
69  if ( m_LogLevel >= 2 ) cout << myname << "Data does not have an assigned channel." << endl;
70  return res.setStatus(1);
71  }
72  IntVector::value_type sthr = -1;
73  Index ncha = m_AdcThresholds.size();
74  if ( icha < ncha ) sthr = m_AdcThresholds[icha];
75  else sthr = m_DefaultThreshold;
76  if ( sthr < 0 ) {
77  if ( m_LogLevel >= 2 ) cout << myname << "No threshold set for channel " << icha << endl;
78  return res.setStatus(2 + icha >= ncha);
79  }
80  AdcCount thr = sthr;
81  Index nraw = acd.raw.size();
82  Index nflg = acd.flags.size();
83  if ( nflg < nraw ) acd.flags.resize(nraw, AdcGood);
84  Index nunder = 0;
85  for ( Index isam=0; isam<nraw; ++isam ) {
86  if ( acd.raw[isam] <= thr ) {
87  ++nunder;
88  acd.flags[isam] = AdcUnderflow;
89  }
90  }
91  res.setInt("nUnderflow", nunder);
92  return res;
93 }
G4double thr[100]
Definition: G4S2Light.cc:59
const AdcFlag AdcUnderflow
Definition: AdcTypes.h:33
unsigned int Index
const AdcFlag AdcGood
Definition: AdcTypes.h:32
AdcCountVector raw
Channel channel() const
unsigned int AdcChannel
Definition: AdcTypes.h:50
static Index badChannel()
short AdcCount
Definition: AdcTypes.h:18
QTextStream & endl(QTextStream &s)
AdcFlagVector flags
DataMap AdcUnderflowFlagger::view ( const AdcChannelData acd) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 51 of file AdcUnderflowFlagger_tool.cc.

51  {
52  const string myname = "AdcUnderflowFlagger::view: ";
53  AdcChannelData acdtmp;
54  acdtmp.setChannelInfo(acd.channel());
55  acdtmp.raw = acd.raw;
56  return update(acdtmp);
57 }
DataMap update(AdcChannelData &acd) const override
void setChannelInfo(ChannelInfoPtr pchi)
AdcCountVector raw
Channel channel() const

Member Data Documentation

IntVector AdcUnderflowFlagger::m_AdcThresholds
private

Definition at line 59 of file AdcUnderflowFlagger.h.

int AdcUnderflowFlagger::m_DefaultThreshold
private

Definition at line 60 of file AdcUnderflowFlagger.h.

int AdcUnderflowFlagger::m_LogLevel
private

Definition at line 58 of file AdcUnderflowFlagger.h.

AdcIndex AdcUnderflowFlagger::m_modifyCount
private

Definition at line 63 of file AdcUnderflowFlagger.h.


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