Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunecore
dunecore
DuneCommon
Tool
FclFileFloatArray_tool.cc
Go to the documentation of this file.
1
// FclFileFloatArray_tool.cc
2
3
#include "
FclFileFloatArray.h
"
4
#include "
fhiclcpp/intermediate_table.h
"
5
#include "
fhiclcpp/make_ParameterSet.h
"
6
#include "
art/Utilities/make_tool.h
"
7
#include <iostream>
8
#include "TSystem.h"
9
10
using
std::cout;
11
using
std::endl
;
12
13
//**********************************************************************
14
15
FclFileFloatArray::FclFileFloatArray
(
fhicl::ParameterSet
const
&
ps
)
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
}
35
36
//**********************************************************************
37
38
void
FclFileFloatArray::init
() {
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
}
67
68
//**********************************************************************
69
70
DEFINE_ART_CLASS_TOOL
(
FclFileFloatArray
)
FclFileFloatArray::Name
std::string Name
Definition:
FclFileFloatArray.h:26
FclFileFloatArray
Definition:
FclFileFloatArray.h:22
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
intermediate_table.h
FclFileFloatArray::unit
Name unit() const override
Definition:
FclFileFloatArray.h:45
reco_momentum_tuples.float
float
Definition:
reco_momentum_tuples.py:12
fhicl::ParameterSet::make
static ParameterSet make(intermediate_table const &tbl)
Definition:
ParameterSet.cc:68
make_ParameterSet.h
FclFileFloatArray::m_DefaultValue
float m_DefaultValue
Definition:
FclFileFloatArray.h:52
wirecell.sigproc.paper.noise.fname
fname
Definition:
noise.py:68
QTextStream::fill
int fill() const
Definition:
qtextstream.h:253
FclFileFloatArray::m_LogLevel
Index m_LogLevel
Definition:
FclFileFloatArray.h:50
cet::filepath_maker
Definition:
filepath_maker.h:42
FclFileFloatArray::m_unit
Name m_unit
Definition:
FclFileFloatArray.h:54
genie::units::ps
static constexpr double ps
Definition:
Units.h:99
FclFileFloatArray::init
void init()
Definition:
FclFileFloatArray_tool.cc:38
FclFileFloatArray::FclFileFloatArray
FclFileFloatArray(fhicl::ParameterSet const &ps)
Definition:
FclFileFloatArray_tool.cc:15
make_tool.h
FclFileFloatArray::m_vals
FloatVector m_vals
Definition:
FclFileFloatArray.h:55
FclFileFloatArray::m_FileNames
NameVector m_FileNames
Definition:
FclFileFloatArray.h:51
fhicl::parse_document
intermediate_table parse_document(std::string const &filename, cet::filepath_maker &maker)
Definition:
parse.cc:720
FclFileFloatArray::defaultValue
float defaultValue() const override
Definition:
FclFileFloatArray.h:42
art::get
auto const & get(AssnsNode< L, R, D > const &r)
Definition:
AssnsNode.h:115
FclFileFloatArray::NameVector
std::vector< Name > NameVector
Definition:
FclFileFloatArray.h:27
FloatArrayTool::Index
unsigned int Index
Definition:
FloatArrayTool.h:19
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
FclFileFloatArray.h
Generated by
1.8.11