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

#include <FclFileFloatArray.h>

Inheritance diagram for FclFileFloatArray:
FloatArrayTool

Public Types

using Name = std::string
 
using NameVector = std::vector< Name >
 
- Public Types inherited from FloatArrayTool
using Index = unsigned int
 
using FloatVector = std::vector< float >
 

Public Member Functions

 FclFileFloatArray (fhicl::ParameterSet const &ps)
 
 ~FclFileFloatArray () override=default
 
Index size () const override
 
const FloatVectorvalues () const override
 
float defaultValue () const override
 
Name unit () const override
 
- Public Member Functions inherited from FloatArrayTool
virtual ~FloatArrayTool ()=default
 
virtual Index offset () const
 
virtual std::string label () const
 
virtual bool inRange (Index ival) const
 
virtual float value (Index ival) const
 
virtual float value (Index ival, float defval) const
 
virtual int fill (FloatVector &vals, float valdef) const
 

Private Member Functions

void init ()
 

Private Attributes

Index m_LogLevel
 
NameVector m_FileNames
 
float m_DefaultValue
 
Name m_unit
 
FloatVector m_vals
 

Detailed Description

Definition at line 22 of file FclFileFloatArray.h.

Member Typedef Documentation

Definition at line 26 of file FclFileFloatArray.h.

Definition at line 27 of file FclFileFloatArray.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file FclFileFloatArray_tool.cc.

16 : m_LogLevel(ps.get<Index>("LogLevel")),
17  m_FileNames(ps.get<NameVector>("FileNames")),
18  m_DefaultValue(ps.get<float>("DefaultValue")) {
19  const Name myname = "FclFileFloatArray::ctor: ";
20  if ( m_LogLevel ) {
21  cout << "Configuration:" << endl;
22  cout << " LogLevel: " << m_LogLevel << endl;
23  cout << " FileNames: ";
24  if ( m_FileNames.size() == 0 ) {
25  cout << "<empty>";
26  }
27  for ( Name fname : m_FileNames ) {
28  cout << "\n " << fname;
29  }
30  cout << endl;
31  cout << " DefaultValue: " << m_DefaultValue << endl;
32  }
33  init();
34 }
ChannelGroupService::Name Name
unsigned int Index
static constexpr double ps
Definition: Units.h:99
std::vector< string > NameVector
QTextStream & endl(QTextStream &s)
FclFileFloatArray::~FclFileFloatArray ( )
overridedefault

Member Function Documentation

float FclFileFloatArray::defaultValue ( ) const
inlineoverridevirtual

Reimplemented from FloatArrayTool.

Definition at line 42 of file FclFileFloatArray.h.

42 { return m_DefaultValue; }
void FclFileFloatArray::init ( )
private

Definition at line 38 of file FclFileFloatArray_tool.cc.

38  {
39  const Name myname = "FclFileFloatArray::init: ";
40  bool first = true;
41  Name fclPath = gSystem->Getenv("FHICL_FILE_PATH");
42  for ( Name fname : m_FileNames ) {
43  TString ts(fname.c_str());
44  gSystem->FindFile(fclPath.c_str(), ts);
45  Name pfname = ts.Data();
46  if ( pfname.size() == 0 ) {
47  cout << myname << "WARNING: Unable to find file " << fname << endl;
48  continue;
49  }
50  cet::filepath_maker policy;
51  auto ps = fhicl::ParameterSet::make(fhicl::parse_document(pfname, policy));
52  auto pfat = art::make_tool<FloatArrayTool>(ps);
53  if ( m_LogLevel >= 2 ) cout << myname << "Reading tool " << pfat->label() << endl;
54  if ( first ) {
55  m_unit = pfat->unit();
56  first = false;
57  } else {
58  if ( pfat->unit() != unit() ) {
59  cout << myname << "WARNING: Inconsistent units: " << pfat->unit() << " != " << m_unit << endl;
60  cout << myname << "Skipping tool at " << fname << endl;
61  continue;
62  }
63  }
64  pfat->fill(m_vals, defaultValue());
65  }
66 }
Name unit() const override
static ParameterSet make(intermediate_table const &tbl)
Definition: ParameterSet.cc:68
ChannelGroupService::Name Name
int fill() const
Definition: qtextstream.h:253
static constexpr double ps
Definition: Units.h:99
intermediate_table parse_document(std::string const &filename, cet::filepath_maker &maker)
Definition: parse.cc:720
float defaultValue() const override
QTextStream & endl(QTextStream &s)
Index FclFileFloatArray::size ( ) const
inlineoverridevirtual

Reimplemented from FloatArrayTool.

Definition at line 36 of file FclFileFloatArray.h.

36 { return m_vals.size(); }
Name FclFileFloatArray::unit ( ) const
inlineoverridevirtual

Reimplemented from FloatArrayTool.

Definition at line 45 of file FclFileFloatArray.h.

45 { return m_unit; }
const FloatVector& FclFileFloatArray::values ( ) const
inlineoverridevirtual

Implements FloatArrayTool.

Definition at line 39 of file FclFileFloatArray.h.

39 { return m_vals; }

Member Data Documentation

float FclFileFloatArray::m_DefaultValue
private

Definition at line 52 of file FclFileFloatArray.h.

NameVector FclFileFloatArray::m_FileNames
private

Definition at line 51 of file FclFileFloatArray.h.

Index FclFileFloatArray::m_LogLevel
private

Definition at line 50 of file FclFileFloatArray.h.

Name FclFileFloatArray::m_unit
private

Definition at line 54 of file FclFileFloatArray.h.

FloatVector FclFileFloatArray::m_vals
private

Definition at line 55 of file FclFileFloatArray.h.


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