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

#include <AdcSampleScaler.h>

Inheritance diagram for AdcSampleScaler:
TpcDataTool

Public Member Functions

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

Private Attributes

int m_LogLevel
 
float m_ScaleFactor
 
std::string m_OutputUnit
 
std::string m_InputUnit
 

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 19 of file AdcSampleScaler.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file AdcSampleScaler_tool.cc.

17 : m_LogLevel(ps.get<int>("LogLevel")),
18  m_ScaleFactor(ps.get<float>("ScaleFactor")),
19  m_OutputUnit(ps.get<string>("OutputUnit")),
20  m_InputUnit(ps.get<string>("InputUnit")) {
21  const string myname = "AdcSampleScaler::ctor: ";
22  if ( m_LogLevel >= 1 ) {
23  cout << myname << "Parameters:" << endl;
24  cout << myname << " LogLevel: " << m_LogLevel << endl;
25  cout << myname << " ScaleFactor: " << m_ScaleFactor << endl;
26  cout << myname << " OutputUnit: " << m_OutputUnit << endl;
27  cout << myname << " InputUnit: " << m_InputUnit << endl;
28  }
29 }
static constexpr double ps
Definition: Units.h:99
std::string m_OutputUnit
std::string m_InputUnit
QTextStream & endl(QTextStream &s)
AdcSampleScaler::~AdcSampleScaler ( )
overridedefault

Member Function Documentation

DataMap AdcSampleScaler::update ( AdcChannelData acd) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 33 of file AdcSampleScaler_tool.cc.

33  {
34  const string myname = "AdcSampleScaler::update: ";
35  if ( m_LogLevel >= 2 ) cout << "Processing run " << acd.run() << " event " << acd.event()
36  << " channel " << acd.channel() << endl;
37  DataMap ret;
38 
39  // Check input data unit.
40  int unitCheck = 0;
41  if ( m_InputUnit.size() ) {
42  if ( acd.sampleUnit.size() == 0 ) {
43  cout << myname << "WARNING: Input data does not have a sample unit." << endl;
44  unitCheck = 1;
45  } else if ( acd.sampleUnit != m_InputUnit ) {
46  cout << myname << "WARNING: Unexpected input data unit: " << acd.sampleUnit
47  << " != " << m_InputUnit << endl;
48  unitCheck = 2;
49  }
50  }
51 
52  // Scale samples.
53  for ( float& sam : acd.samples ) sam *= m_ScaleFactor;
54  if ( m_OutputUnit.size() ) acd.sampleUnit = m_OutputUnit;
55 
56  ret.setInt("acsUnitCheck", unitCheck);
57  ret.setInt("acsSampleCount", acd.samples.size());
58 
59  return ret;
60 }
AdcIndex run() const
void setInt(Name name, int val)
Definition: DataMap.h:131
AdcIndex event() const
Channel channel() const
std::string m_OutputUnit
std::string m_InputUnit
AdcSignalVector samples
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::string AdcSampleScaler::m_InputUnit
private

Definition at line 35 of file AdcSampleScaler.h.

int AdcSampleScaler::m_LogLevel
private

Definition at line 32 of file AdcSampleScaler.h.

std::string AdcSampleScaler::m_OutputUnit
private

Definition at line 34 of file AdcSampleScaler.h.

float AdcSampleScaler::m_ScaleFactor
private

Definition at line 33 of file AdcSampleScaler.h.


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