AdcKeepAllSignalFinder_tool.cc
Go to the documentation of this file.
1 // AdcKeepAllSignalFinder_tool.cc
2 
4 #include <iostream>
5 
6 using std::string;
7 using std::cout;
8 using std::endl;
9 
10 //**********************************************************************
11 // Class methods.
12 //**********************************************************************
13 
15 : m_LogLevel(ps.get<int>("LogLevel")),
16  m_DataPath(ps.get<Name>("DataPath")) {
17  const string myname = "AdcKeepAllSignalFinder::ctor: ";
18  if ( m_LogLevel >= 1 ) {
19  cout << myname << "Configuration parameters:" << endl;
20  cout << myname << " LogLevel: " << m_LogLevel << endl;
21  cout << myname << " DataPath: " << m_DataPath << endl;
22  }
23 }
24 
25 //**********************************************************************
26 
28  const string myname = "AdcKeepAllSignalFinder::update: ";
29  DataMap ret;
30  Index nvie = acdtop.viewSize(m_DataPath);
31  Index nroi = 0;
32  for ( Index ivie=0; ivie<nvie; ++ivie ) {
33  AdcChannelData* pacd = acdtop.mutableViewEntry(m_DataPath, ivie);
34  if ( pacd == nullptr ) {
35  cout << myname << "WARNING: Skipping null data." << endl;
36  continue;
37  }
38  AdcChannelData& acd = *pacd;
39  AdcIndex nsam = acd.samples.size();
40  acd.signal.clear();
41  acd.rois.clear();
42  if ( nsam == 0 ) {
43  cout << myname << "ERROR: No samples found in channel " << acd.channel()
44  << " view " << ivie << endl;
45  return ret.setStatus(1);
46  }
47  if ( m_LogLevel >= 2 ) {
48  cout << myname << "Building ROI for channel " << acd.channel()
49  << " view " << ivie << "/" << nvie << "." << endl;
50  }
51  acd.signal.resize(nsam, true);
52  acd.roisFromSignal();
53  nroi += acd.rois.size();
54  }
55  ret.setInt("nroi", nroi);
56  return ret;
57 }
58 
59 //**********************************************************************
60 
62  AdcChannelData acdtmp;
63  acdtmp.samples = acd.samples;
64  return update(acdtmp);
65 }
66 
67 //**********************************************************************
68 
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
unsigned int Index
DataMap & setStatus(int stat)
Definition: DataMap.h:130
std::string string
Definition: nybbler.cc:12
AdcRoiVector rois
void setInt(Name name, int val)
Definition: DataMap.h:131
static constexpr double ps
Definition: Units.h:99
unsigned int AdcIndex
Definition: AdcTypes.h:15
Channel channel() const
DataMap update(AdcChannelData &acd) const override
AdcFilterVector signal
AdcChannelData * mutableViewEntry(Name vpnam, AdcIndex ient)
AdcKeepAllSignalFinder(fhicl::ParameterSet const &ps)
size_t viewSize() const
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
DataMap view(const AdcChannelData &acd) const override
AdcSignalVector samples
QTextStream & endl(QTextStream &s)