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

#include <AdcRegularSignalFinder.h>

Inheritance diagram for AdcRegularSignalFinder:
TpcDataTool AdcChannelTool

Public Member Functions

 AdcRegularSignalFinder (AdcIndex per, AdcIndex len, int lev)
 
 AdcRegularSignalFinder (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 Types

using Name = std::string
 

Private Attributes

int m_LogLevel
 
AdcIndex m_Period
 
AdcIndex m_Length
 

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 40 of file AdcRegularSignalFinder.h.

Member Typedef Documentation

Definition at line 54 of file AdcRegularSignalFinder.h.

Constructor & Destructor Documentation

AdcRegularSignalFinder::AdcRegularSignalFinder ( AdcIndex  per,
AdcIndex  len,
int  lev 
)

Definition at line 17 of file AdcRegularSignalFinder_tool.cc.

18 : m_LogLevel(lev),
19  m_Period(per),
20  m_Length(len) {
21  const string myname = "AdcRegularSignalFinder::ctor: ";
22  if ( m_LogLevel >= 1 ) {
23  cout << myname << "Configuration parameters:" << endl;
24  cout << myname << " LogLevel: " << m_LogLevel << endl;
25  cout << myname << " Period: " << m_Period << endl;
26  cout << myname << " Length: " << m_Length << endl;
27  }
28 }
QTextStream & endl(QTextStream &s)
AdcRegularSignalFinder::AdcRegularSignalFinder ( fhicl::ParameterSet const &  ps)

Definition at line 33 of file AdcRegularSignalFinder_tool.cc.

35  ps.get<unsigned int>("Period"),
36  ps.get<unsigned int>("Length"),
37  ps.get<int>("LogLevel")
38  ) { }
static constexpr double ps
Definition: Units.h:99
AdcRegularSignalFinder(AdcIndex per, AdcIndex len, int lev)

Member Function Documentation

DataMap AdcRegularSignalFinder::update ( AdcChannelData acd) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 42 of file AdcRegularSignalFinder_tool.cc.

42  {
43  const string myname = "AdcRegularSignalFinder::update: ";
44  Index nsam = acd.samples.size();
45  Index nper = m_Period;
46  Index nlen = m_Length == 0 ? m_Period : m_Length;
47  if ( nper == 0 ) {
48  if ( acd.rois.size() > 0 ) {
49  AdcRoi roi = acd.rois[0];
50  AdcIndex itck1 = roi.first;
51  AdcIndex itck2 = roi.second + 1;
52  if ( itck2 > itck1 ) {
53  nper = itck2 - itck1;
54  nlen = nper;
55  if ( acd.rois.size() > 1 ) {
56  roi = acd.rois[1];
57  itck1 = roi.first;
58  itck2 = roi.second + 1;
59  if ( itck2 > itck1 ) nlen = itck2 - itck1;
60  }
61  } else {
62  cout << myname << "WARNING: Input ROI does not specify a valid period." << endl;
63  }
64  } else {
65  cout << myname << "WARNING: Input ROI to specify period is not present." << endl;
66  }
67  }
68  Index nroi = 0;
69  acd.rois.clear();
70  if ( nsam > 0 && nper > 0 ) {
71  acd.signal.resize(nsam, true);
72  Index nrem = nsam % nper;
73  nroi = nsam/nper + (nrem>0);
74  for ( Index iroi=0; iroi<nroi; ++iroi ) {
75  Index isam1 = nper*iroi;
76  Index isam2 = isam1 + nlen;
77  Index isam3 = isam1 + nper;
78  if ( isam2 > nsam ) isam2 = nsam;
79  if ( isam3 > nsam ) isam3 = nsam;
80  for ( Index isam=isam2; isam<isam3; ++isam ) {
81  acd.signal[isam] = false;
82  }
83  acd.rois.emplace_back(isam1, isam2-1);
84  }
85  } else {
86  acd.signal.resize(nsam, false);
87  }
88  DataMap res(0);
89  res.setInt("roiPeriod", nper);
90  res.setInt("roiLength", nlen);
91  res.setInt("roiCount", nroi);
92  return res;
93 }
std::pair< AdcIndex, AdcIndex > AdcRoi
Definition: AdcTypes.h:54
unsigned int Index
AdcRoiVector rois
unsigned int AdcIndex
Definition: AdcTypes.h:15
AdcFilterVector signal
AdcSignalVector samples
QTextStream & endl(QTextStream &s)
DataMap AdcRegularSignalFinder::view ( const AdcChannelData acd) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 97 of file AdcRegularSignalFinder_tool.cc.

97  {
98  AdcChannelData acdtmp;
99  acdtmp.samples = acd.samples;
100  return update(acdtmp);
101 }
DataMap update(AdcChannelData &acd) const override
AdcSignalVector samples

Member Data Documentation

AdcIndex AdcRegularSignalFinder::m_Length
private

Definition at line 59 of file AdcRegularSignalFinder.h.

int AdcRegularSignalFinder::m_LogLevel
private

Definition at line 57 of file AdcRegularSignalFinder.h.

AdcIndex AdcRegularSignalFinder::m_Period
private

Definition at line 58 of file AdcRegularSignalFinder.h.


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