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

#include <AdcTimingMitigator.h>

Inheritance diagram for AdcTimingMitigator:
TpcDataTool AdcChannelTool

Public Types

using Index = unsigned int
 
using IndexVector = std::vector< Index >
 
using IndexSet = std::set< Index >
 
- Public Types inherited from AdcChannelTool
using Index = unsigned int
 

Public Member Functions

 AdcTimingMitigator (fhicl::ParameterSet const &ps)
 
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 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)
 

Private Attributes

int m_LogLevel
 
float m_SamplingRatio
 
float m_SamplingOffset
 
IndexVector m_FEMBs
 
IndexSet m_fembSet
 

Additional Inherited Members

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

Detailed Description

Definition at line 41 of file AdcTimingMitigator.h.

Member Typedef Documentation

using AdcTimingMitigator::Index = unsigned int

Definition at line 46 of file AdcTimingMitigator.h.

Definition at line 48 of file AdcTimingMitigator.h.

Definition at line 47 of file AdcTimingMitigator.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file AdcTimingMitigator_tool.cc.

17 : m_LogLevel(ps.get<int>("LogLevel")),
18  m_SamplingRatio(ps.get<float>("SamplingRatio")),
19  m_SamplingOffset(ps.get<float>("SamplingOffset")),
20  m_FEMBs(ps.get<IndexVector>("FEMBs")) {
21  const string myname = "AdcTimingMitigator::ctor: ";
22  for ( Index ifmb : m_FEMBs ) m_fembSet.insert(ifmb);
23  if ( m_LogLevel >= 1 ) {
24  cout << myname << "Configuration parameters:" << endl;
25  cout << myname << " LogLevel: " << m_LogLevel << endl;
26  cout << myname << " SamplingRatio: " << m_SamplingRatio << endl;
27  cout << myname << " SamplingOffset: " << m_SamplingOffset << endl;
28  cout << myname << " FEMBs: [";
29  bool first = true;
30  for ( Index ifmb : m_fembSet ) {
31  if ( first ) first = false;
32  else cout << ", ";
33  cout << ifmb;
34  }
35  cout << "]" << endl;
36  }
37 }
std::vector< Index > IndexVector
unsigned int Index
static constexpr double ps
Definition: Units.h:99
QTextStream & endl(QTextStream &s)

Member Function Documentation

DataMap AdcTimingMitigator::update ( AdcChannelData acd) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 41 of file AdcTimingMitigator_tool.cc.

41  {
42  const string myname = "AdcTimingMitigator::update: ";
43  DataMap ret;
44  if ( m_fembSet.count(acd.fembID()) == 0 ) {
45  if ( m_LogLevel >= 2 ) {
46  cout << myname << "Skipping channel " << acd.channel() << " in FEMB " << acd.fembID() << endl;
47  }
48  return ret;
49  }
50  Index nsam = acd.samples.size();
51  if ( nsam == 0 ) {
52  if ( m_LogLevel >= 2 ) {
53  cout << myname << "Skipping channel " << acd.channel() << " with no samples." << endl;
54  }
55  return ret;
56  }
57  if ( m_SamplingRatio < 0.01 ) return ret;
58  AdcSignalVector newsams;
59  newsams.reserve(nsam/m_SamplingRatio+1);
60  // Loop over indices for new sample.
61  if ( m_LogLevel >= 3 ) {
62  cout << myname << "Updating samples for channel " << acd.channel() << "." << endl;
63  }
64  for ( Index j=0; ; ++j ) {
65  double xj = j*m_SamplingRatio - m_SamplingOffset;
66  double yj = acd.samples[0];
67  if ( xj > 0.0 ) {
68  Index i1 = xj;
69  Index i2 = i1 + 1;
70  if ( i2 >= acd.samples.size() ) break;
71  double y1 = acd.samples[i1];
72  double y2 = acd.samples[i2];
73  yj = (y2 - y1)*(xj - i1) + y1;
74  if ( m_LogLevel >= 3 ) {
75  cout << myname << " " << j << ": " << y1 << " , " << y2 << " ==> " << yj << endl;
76  }
77  } else {
78  if ( m_LogLevel >= 3 ) {
79  cout << myname << " " << j << ": " << " Keeping first sample: " << yj << endl;
80  }
81  }
82  newsams.push_back(yj);
83  }
84  if ( m_LogLevel >= 2 ) {
85  cout << myname << "Updating samples for channel " << acd.channel() << ": size "
86  << nsam << " --> " << newsams.size() << endl;
87  }
88  acd.samples = newsams;
89  acd.signal.clear();
90  acd.rois.clear();
91  return ret;
92 }
unsigned int Index
Index fembID() const
AdcRoiVector rois
Channel channel() const
AdcFilterVector signal
std::vector< AdcSignal > AdcSignalVector
Definition: AdcTypes.h:22
AdcSignalVector samples
QTextStream & endl(QTextStream &s)

Member Data Documentation

IndexVector AdcTimingMitigator::m_FEMBs
private

Definition at line 60 of file AdcTimingMitigator.h.

IndexSet AdcTimingMitigator::m_fembSet
private

Definition at line 62 of file AdcTimingMitigator.h.

int AdcTimingMitigator::m_LogLevel
private

Definition at line 57 of file AdcTimingMitigator.h.

float AdcTimingMitigator::m_SamplingOffset
private

Definition at line 59 of file AdcTimingMitigator.h.

float AdcTimingMitigator::m_SamplingRatio
private

Definition at line 58 of file AdcTimingMitigator.h.


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