Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunecore
dunecore
DuneCommon
Tool
FclIndexVectorMapTool_tool.cc
Go to the documentation of this file.
1
// FclIndexVectorMapTool_tool.cc
2
3
#include "
FclIndexVectorMapTool.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
Name
=
std::string
;
14
15
//**********************************************************************
16
17
FclIndexVectorMapTool::FclIndexVectorMapTool
(
fhicl::ParameterSet
const
&
ps
)
18
: m_LogLevel(ps.
get
<
Index
>(
"LogLevel"
)),
19
m_Entries(ps.
get
<
IndexVectorVector
>(
"Entries"
)) {
20
const
Name
myname =
"FclIndexVectorMapTool::ctor: "
;
21
for
(
const
IndexVector
ent :
m_Entries
) {
22
if
( ent.size() == 0 )
continue
;
23
Index
ient = ent.front();
24
IndexVector
& vals =
m_entryMap
[ient];
25
vals.insert(vals.end(), ++ent.begin(), ent.end());
26
}
27
Index
vecCount =
m_entryMap
.size();
28
Index
valCount = 0;
29
for
(
const
IndexVectorMap::value_type& ent :
m_entryMap
) valCount += ent.second.size();
30
if
(
m_LogLevel
>= 1 ) {
31
cout << myname <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
32
cout << myname <<
" Entries: "
<< vecCount <<
" vectors with "
33
<< valCount <<
" values"
;
34
if
(
m_LogLevel
> 1 ) {
35
cout <<
":"
<<
endl
;
36
for
(
const
IndexVectorMap::value_type& ent : m_entryMap ) {
37
cout << myname <<
" "
<< ent.first <<
": ["
;
38
bool
first =
true
;
39
for
(
Index
val
: ent.second ) {
40
if
( first ) first =
false
;
41
else
cout <<
", "
;
42
cout <<
val
;
43
}
44
cout <<
"]"
<<
endl
;
45
}
46
}
else
{
47
cout <<
"."
<<
endl
;
48
}
49
}
50
}
51
52
//**********************************************************************
53
54
IndexVectorMapTool::IndexVector
FclIndexVectorMapTool::get
(
Index
idx)
const
{
55
const
Name
myname =
"FclIndexVectorMapTool::get: "
;
56
IndexVectorMap::const_iterator
ient =
m_entryMap
.find(idx);
57
static
const
IndexVector
empty
;
58
if
( ient ==
m_entryMap
.end() )
return
empty;
59
return
ient->second;
60
}
61
62
//**********************************************************************
63
64
DEFINE_ART_CLASS_TOOL
(
FclIndexVectorMapTool
)
IndexVectorMapTool::IndexVector
std::vector< Index > IndexVector
Definition:
IndexVectorMapTool.h:20
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
intermediate_table.h
val
Definition:
registry_via_id_test_2.cc:15
string
std::string string
Definition:
nybbler.cc:12
FclIndexVectorMapTool
Definition:
FclIndexVectorMapTool.h:24
FclIndexVectorMapTool::FclIndexVectorMapTool
FclIndexVectorMapTool(fhicl::ParameterSet const &ps)
Definition:
FclIndexVectorMapTool_tool.cc:17
make_ParameterSet.h
Name
ChannelGroupService::Name Name
Definition:
FixedChannelGroupService_service.cc:19
const_iterator
intermediate_table::const_iterator const_iterator
Definition:
intermediate_table.cc:28
FclIndexVectorMapTool.h
FclIndexVectorMapTool::Index
IndexVectorMapTool::Index Index
Definition:
FclIndexVectorMapTool.h:28
FclIndexVectorMapTool::m_entryMap
IndexVectorMap m_entryMap
Definition:
FclIndexVectorMapTool.h:47
FclIndexVectorMapTool::IndexVector
std::vector< Index > IndexVector
Definition:
FclIndexVectorMapTool.h:29
testsqlite3.val
list val
Definition:
testsqlite3.py:13
genie::units::ps
static constexpr double ps
Definition:
Units.h:99
FclIndexVectorMapTool::get
IndexVector get(Index ient) const override
Definition:
FclIndexVectorMapTool_tool.cc:54
FclIndexVectorMapTool::m_LogLevel
Index m_LogLevel
Definition:
FclIndexVectorMapTool.h:45
setw
Q_EXPORT QTSManip setw(int w)
Definition:
qtextstream.h:331
FclIndexVectorMapTool::m_Entries
IndexVectorVector m_Entries
Definition:
FclIndexVectorMapTool.h:46
FclIndexVectorMapTool::IndexVectorVector
std::vector< IndexVector > IndexVectorVector
Definition:
FclIndexVectorMapTool.h:30
art::get
auto const & get(AssnsNode< L, R, D > const &r)
Definition:
AssnsNode.h:115
util::empty
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition:
StdUtils.h:97
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11