Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunecore
dunecore
DuneCommon
Tool
FclIndexRangeTool_tool.cc
Go to the documentation of this file.
1
// FclIndexRangeTool_tool.cc
2
3
#include "
FclIndexRangeTool.h
"
4
#include "
fhiclcpp/intermediate_table.h
"
5
#include "
fhiclcpp/make_ParameterSet.h
"
6
#include <iostream>
7
#include <iomanip>
8
9
using
std::cout;
10
using
std::endl
;
11
using
std::string
;
12
using
std::setw
;
13
using
NameVector
=
IndexRange::NameVector
;
14
15
//**********************************************************************
16
17
FclIndexRangeTool::FclIndexRangeTool
(
fhicl::ParameterSet
const
&
ps
)
18
: m_LogLevel(ps.
get
<
Index
>(
"LogLevel"
)) {
19
const
Name
myname =
"FclIndexRangeTool::ctor: "
;
20
Index
namSize = 0;
21
Index
labSize = 0;
22
for
(
string
rnam : ps.
get_pset_names
() ) {
23
if
( rnam ==
"LogLevel"
)
continue
;
24
cout << myname <<
" "
<< rnam <<
endl
;
25
fhicl::ParameterSet
psr = ps.
get
<
fhicl::ParameterSet
>(rnam);
26
if
(
m_Ranges
.find(rnam) !=
m_Ranges
.end() ) {
27
cout << myname <<
"Overwriting duplicate range: "
<< rnam <<
endl
;
28
}
29
IndexRange
& ran =
m_Ranges
[rnam];
30
ran.
name
= rnam;
31
ran.
labels
= psr.
get
<
NameVector
>(
"labels"
);
32
ran.
begin
= psr.
get
<
Index
>(
"begin"
);
33
ran.
end
= psr.
get
<
Index
>(
"end"
);
34
if
( ran.
name
.size() > namSize ) namSize = ran.
name
.size();
35
if
( ran.
label
().size() > labSize ) labSize = ran.
label
().size();
36
}
37
if
(
m_LogLevel
>= 1 ) {
38
cout << myname <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
39
cout << myname <<
" Range count: "
<<
m_Ranges
.size() <<
endl
;
40
if
(
m_LogLevel
>= 2 ) {
41
for
( IndexRangeMap::value_type iran :
m_Ranges
) {
42
const
IndexRange
& ran = iran.second;
43
cout << myname <<
setw
(namSize+2) << ran.
name
44
<<
setw
(6) << ran.
begin
45
<<
setw
(6) << ran.
end
46
<<
setw
(labSize+1) << ran.
label
() <<
endl
;
47
}
48
}
49
}
50
}
51
52
//**********************************************************************
53
54
IndexRange
FclIndexRangeTool::get
(
Name
nam)
const
{
55
const
Name
myname =
"FclIndexRangeTool::runData: "
;
56
IndexRangeMap::const_iterator
iran =
m_Ranges
.find(nam);
57
if
( iran ==
m_Ranges
.end() )
return
IndexRange
();
58
return
iran->second;
59
}
60
61
//**********************************************************************
62
63
DEFINE_ART_CLASS_TOOL
(
FclIndexRangeTool
)
FclIndexRangeTool::get
IndexRange get(Name nam) const override
Definition:
FclIndexRangeTool_tool.cc:54
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
FclIndexRangeTool
Definition:
FclIndexRangeTool.h:24
intermediate_table.h
IndexRange::labels
NameVector labels
Definition:
IndexRange.h:33
string
std::string string
Definition:
nybbler.cc:12
IndexRange::begin
Index begin
Definition:
IndexRange.h:34
make_ParameterSet.h
const_iterator
intermediate_table::const_iterator const_iterator
Definition:
intermediate_table.cc:28
IndexRange::end
Index end
Definition:
IndexRange.h:35
IndexRange::name
Name name
Definition:
IndexRange.h:32
FclIndexRangeTool.h
IndexRange::NameVector
std::vector< Name > NameVector
Definition:
IndexRange.h:29
fhicl::ParameterSet::get_pset_names
std::vector< std::string > get_pset_names() const
Definition:
ParameterSet.cc:189
FclIndexRangeTool::FclIndexRangeTool
FclIndexRangeTool(fhicl::ParameterSet const &ps)
Definition:
FclIndexRangeTool_tool.cc:17
FclIndexRangeTool::m_LogLevel
Index m_LogLevel
Definition:
FclIndexRangeTool.h:43
fhicl::ParameterSet::get
T get(std::string const &key) const
Definition:
ParameterSet.h:271
IndexRangeTool::Name
IndexRange::Name Name
Definition:
IndexRangeTool.h:17
genie::units::ps
static constexpr double ps
Definition:
Units.h:99
IndexRange::label
Name label(Index ilab=0) const
Definition:
IndexRange.h:106
FclIndexRangeTool::m_Ranges
IndexRangeMap m_Ranges
Definition:
FclIndexRangeTool.h:44
setw
Q_EXPORT QTSManip setw(int w)
Definition:
qtextstream.h:331
IndexRange
Definition:
IndexRange.h:23
NameVector
std::vector< string > NameVector
Definition:
DuneToolManager.cxx:18
FclIndexRangeTool::Index
IndexRange::Index Index
Definition:
FclIndexRangeTool.h:28
art::get
auto const & get(AssnsNode< L, R, D > const &r)
Definition:
AssnsNode.h:115
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11