FclFloatArray_tool.cc
Go to the documentation of this file.
1 // FclFloatArray_tool.cc
2 
3 #include "FclFloatArray.h"
4 #include <iostream>
5 #include <iomanip>
6 
7 using std::cout;
8 using std::endl;
9 using std::string;
10 using std::setw;
11 
12 using Name = std::string;
13 
14 //**********************************************************************
15 
17 : m_LogLevel(ps.get<Index>("LogLevel")),
18  m_DefaultValue(ps.get<float>("DefaultValue")),
19  m_Offset(ps.get<Index>("Offset")),
20  m_Label(ps.get<Name>("Label")),
21  m_Unit(ps.get<Name>("Unit")),
22  m_Values(ps.get<FloatVector>("Values")) {
23  const Name myname = "FclFloatArray::ctor: ";
24  if ( m_LogLevel ) {
25  cout << myname << "Configuration:" << endl;
26  cout << myname << " LogLevel: " << m_LogLevel << endl;
27  cout << myname << " Offset: " << m_Offset << endl;
28  cout << myname << " DefaultValue: " << m_DefaultValue << endl;
29  cout << myname << " Label: " << m_Label << endl;
30  cout << myname << " Unit: " << m_Unit << endl;
31  cout << myname << " Size: " << size() << endl;
32  cout << myname << " Values: [";
33  if ( m_LogLevel == 1 || size() <= 10 ) {
34  Index nshow = size() <= 10 ? size() : 5;
35  for ( Index ival=0; ival<nshow; ++ival ) {
36  if ( ival ) cout << ", ";
37  cout << values()[ival];
38  }
39  if ( nshow < size() ) cout << ", ...";
40  cout << "]" << endl;
41  } else {
42  Index iwrd = 0;
43  string sgap = " ";
44  for ( Index ival=0; ival<size(); ++ival ) {
45  if ( ival ) cout << ",";
46  if ( ++iwrd == 10 ) {
47  cout << "\n" << myname << sgap << " ";
48  iwrd = 0;
49  }
50  cout << " " << setw(8) << values()[ival];
51  }
52  cout << "\n" << myname << sgap << "]" << endl;
53  }
54  }
55 }
56 
57 //**********************************************************************
58 
float m_DefaultValue
Definition: FclFloatArray.h:57
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
std::string string
Definition: nybbler.cc:12
ChannelGroupService::Name Name
std::string Name
Definition: FclFloatArray.h:30
std::vector< float > FloatVector
static constexpr double ps
Definition: Units.h:99
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
const FloatVector & values() const override
Definition: FclFloatArray.h:48
virtual Index size() const
FclFloatArray(fhicl::ParameterSet const &ps)
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
unsigned int Index
QTextStream & endl(QTextStream &s)