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

#include <AcdWireReader.h>

Inheritance diagram for AcdWireReader:
TpcDataTool

Public Member Functions

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

Private Attributes

int m_LogLevel
 

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 20 of file AcdWireReader.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file AcdWireReader_tool.cc.

16 : m_LogLevel(ps.get<int>("LogLevel")) {
17  const string myname = "AcdWireReader::ctor: ";
18  if ( m_LogLevel > 0 ) {
19  cout << myname << " LogLevel: " << m_LogLevel << endl;
20  }
21 }
static constexpr double ps
Definition: Units.h:99
QTextStream & endl(QTextStream &s)
AcdWireReader::~AcdWireReader ( )
overridedefault

Member Function Documentation

DataMap AcdWireReader::update ( AdcChannelData acd) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 25 of file AcdWireReader_tool.cc.

25  {
26  const string myname = "AcdWireReader::update: ";
27  // Take the wire from the channel data.
28  const Wire* pwir = acd.wire;
29  if ( pwir == nullptr ) {
30  cout << myname << "ERROR: Wire is null." << endl;
31  return DataMap(1);
32  }
33  const Wire& wir = *pwir;
34  // Check the input data is empty.
35  if ( acd.samples.size() ) {
36  cout << myname << "ERROR: ADC channel has prepared data." << endl;
37  return DataMap(2);
38  }
39  // Check the signal flags record is empty.
40  if ( acd.signal.size() ) {
41  cout << myname << "ERROR: ADC channel has signal flags." << endl;
42  return DataMap(3);
43  }
44  // Check the ROI data is empty.
45  if ( acd.rois.size() ) {
46  cout << myname << "ERROR: ADC channel has ROIs." << endl;
47  return DataMap(4);
48  }
49  // Set or check the wire index.
50  if ( acd.wireIndex != AdcChannelData::badIndex() ) {
51  cout << myname << "ERROR: ADC channel has a wire index." << endl;
52  return DataMap(5);
53  }
54  // Set or check the channel.
55  if ( acd.channel() == AdcChannelData::badChannel() ) {
56  acd.setChannelInfo(wir.Channel());
57  } else {
58  if ( acd.channel() != wir.Channel() ) {
59  cout << myname << "ERROR: Wire has inconsistent channel number." << endl;
60  return DataMap(6);
61  }
62  }
63  // Resize the signal array.
64  unsigned int nsig = pwir->NSignal();
65  // Loop over ROIs and fetch the samples and signals.
66  acd.samples.resize(nsig, 0.0);
67  acd.signal.resize(nsig, false);
68  const lar::sparse_vector<float>& inRois = pwir->SignalROI();
69  for ( const lar::sparse_vector<double>::datarange_t& range : inRois.get_ranges()) {
70  unsigned int isig1 = range.begin_index();
71  unsigned int isig2 = isig1 + range.size();
72  for ( unsigned int isig=isig1; isig<isig2; ++isig ) {
73  acd.samples[isig] = inRois[isig];
74  acd.signal[isig] = true;
75  }
76  }
77  acd.roisFromSignal(); // Fill in the channel data ROIs
78 
79  return DataMap(0);
80 }
size_type size() const
Returns the size of the vector.
const range_list_t & get_ranges() const
Returns the internal list of non-void ranges.
const recob::Wire * wire
void setChannelInfo(ChannelInfoPtr pchi)
AdcRoiVector rois
raw::ChannelID_t Channel() const
Returns the ID of the channel (or InvalidChannelID)
Definition: Wire.h:231
const RegionsOfInterest_t & SignalROI() const
Returns the list of regions of interest.
Definition: Wire.h:228
Channel channel() const
AdcFilterVector signal
Class holding the regions of interest of signal from a channel.
Definition: Wire.h:118
Range class, with range and data.
static Index badChannel()
AdcIndex wireIndex
static Index badIndex()
AdcSignalVector samples
QTextStream & endl(QTextStream &s)
std::size_t NSignal() const
Returns the number of time ticks, or samples, in the channel.
Definition: Wire.h:229

Member Data Documentation

int AcdWireReader::m_LogLevel
private

Definition at line 33 of file AcdWireReader.h.


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