Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
art
art
Framework
Principal
Actions.cc
Go to the documentation of this file.
1
#include "
art/Framework/Principal/Actions.h
"
2
// vim: set sw=2 expandtab :
3
4
#include "
art/Framework/Principal/ActionCodes.h
"
5
#include "
canvas/Utilities/DebugMacros.h
"
6
#include "
cetlib/container_algorithms.h
"
7
8
using namespace
cet
;
9
using namespace
std
;
10
11
namespace
art
{
12
13
namespace
actions
{
14
15
char
const
*
16
actionName
(
ActionCodes
code
)
17
{
18
vector<const char*>
names
{
19
"IgnoreCompletely"
,
"Rethrow"
,
"SkipEvent"
,
"FailModule"
,
"FailPath"
};
20
return
(static_cast<size_t>(code) <
names
.size()) ?
names
[code] :
21
"UnknownAction"
;
22
}
23
24
}
// namespace actions
25
26
ActionTable::~ActionTable() =
default
;
27
28
ActionTable::ActionTable() { addDefaults_(); }
29
30
ActionTable::ActionTable(
Config
const
&
c
)
31
{
32
if
(c.
defaultExceptions
()) {
33
addDefaults_();
34
}
35
install_(
actions::IgnoreCompletely
, c.
ignoreCompletely
());
36
install_(
actions::Rethrow
, c.
rethrow
());
37
install_(
actions::SkipEvent
, c.
skipEvent
());
38
install_(
actions::FailModule
, c.
failModule
());
39
install_(
actions::FailPath
, c.
failPath
());
40
}
41
42
void
43
ActionTable::addDefaults_()
44
{
45
// This is where defaults that are not 'Rethrow' would be populated.
46
if
(2 >
debugit
())
47
return
;
48
49
for
(
auto
const
& pr : map_) {
50
cerr << pr.first <<
','
<< pr.second <<
'\n'
;
51
}
52
cerr <<
endl
;
53
}
54
55
void
56
ActionTable::install_(
actions::ActionCodes
code
,
57
vector<string>
const
& action_names)
58
{
59
for_all
(action_names, [
this
, code](
auto
const
& action_name) {
60
this->
add
(action_name, code);
61
});
62
}
63
64
void
65
ActionTable::add
(
const
string
&
category
,
actions::ActionCodes
code
)
66
{
67
map_[
category
] =
code
;
68
}
69
70
actions::ActionCodes
71
ActionTable::find(
string
const
&
category
)
const
72
{
73
auto
I
= map_.find(category);
74
return
(
I
!= map_.end()) ?
I
->second :
actions::Rethrow
;
75
}
76
77
}
// namespace art
art::actions::FailModule
Definition:
ActionCodes.h:12
art::ActionTable::Config::ignoreCompletely
fhicl::Sequence< std::string > ignoreCompletely
Definition:
Actions.h:26
container_algorithms.h
art::actions::IgnoreCompletely
Definition:
ActionCodes.h:9
art::debugit
DebugValue debugit
Definition:
DebugMacros.cc:14
add
Coord add(Coord c1, Coord c2)
Definition:
restypedef.cpp:23
std
STL namespace.
art::actions::actionName
char const * actionName(ActionCodes code)
Definition:
Actions.cc:16
pionana::I
double I
Definition:
TruthAnalyzer_module.cc:40
art::actions::Rethrow
Definition:
ActionCodes.h:10
art::actions::FailPath
Definition:
ActionCodes.h:13
art::ActionTable::Config::skipEvent
fhicl::Sequence< std::string > skipEvent
Definition:
Actions.h:29
cet
Definition:
PluginSymbolResolvers.h:8
art::ActionTable::Config::defaultExceptions
fhicl::Atom< bool > defaultExceptions
Definition:
Actions.h:25
ActionCodes.h
ValidateOpDetSimulation.c
dictionary c
Definition:
ValidateOpDetSimulation.py:57
python.root_metadata.category
category
Definition:
root_metadata.py:29
code
CodeOutputInterface * code
Definition:
tclscanner.cpp:1114
art::actions::ActionCodes
ActionCodes
Definition:
ActionCodes.h:8
art::actions::SkipEvent
Definition:
ActionCodes.h:11
cet::for_all
auto for_all(FwdCont &, Func)
Definition:
container_algorithms.h:90
art
Definition:
BasicOptionsHandler.h:9
art::ActionTable::Config::rethrow
fhicl::Sequence< std::string > rethrow
Definition:
Actions.h:28
art::ActionTable::Config::failModule
fhicl::Sequence< std::string > failModule
Definition:
Actions.h:30
art::ActionTable::Config::failPath
fhicl::Sequence< std::string > failPath
Definition:
Actions.h:31
actions
Namespace containing all the test actions.
Definition:
sparse_vector_test.cc:73
dune::names
static std::vector< std::string > const names
Definition:
FragmentType.hh:8
DebugMacros.h
art::ActionTable::Config
Definition:
Actions.h:23
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Actions.h
Generated by
1.8.11