LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
Path.cc
Go to the documentation of this file.
2 
4 #include "cetlib/container_algorithms.h"
6 
7 #include <algorithm>
8 
9 using namespace cet;
10 using namespace fhicl;
11 using namespace std;
12 
13 namespace art {
14 
15  Path::Path(int const bitpos,
16  string const& path_name,
17  WorkersInPath&& workers,
18  TrigResPtr pathResults,
19  ActionTable const& actions,
20  ActivityRegistry& areg,
21  bool const isEndPath)
22  : bitpos_{bitpos}
23  , name_{path_name}
24  , trptr_{pathResults}
25  , actReg_{areg}
26  , act_table_{actions}
27  , workers_{std::move(workers)}
28  , isEndPath_{isEndPath}
29  {}
30 
31  bool
33  int const nwrwue,
34  bool const isEvent)
35  {
36  bool should_continue{true};
37 
38  // there is no support as of yet for specific paths having
39  // different exception behavior
40 
41  // If not processing an event, always rethrow.
42  actions::ActionCodes action =
43  (isEvent ? act_table_.find(e.root_cause()) : actions::Rethrow);
44  assert(action != actions::FailModule);
45  switch (action) {
46  case actions::FailPath: {
47  should_continue = false;
48  mf::LogWarning(e.category())
49  << "Failing path " << name_ << ", due to exception, message:\n"
50  << e.what() << "\n";
51  break;
52  }
53  default: {
54  if (isEvent)
55  ++timesExcept_;
57  recordStatus(nwrwue, isEvent);
58  throw art::Exception{
59  errors::ScheduleExecutionFailure, "Path: ProcessingStopped.", e}
60  << "Exception going through path " << name_ << "\n";
61  }
62  }
63 
64  return should_continue;
65  }
66 
67  void
68  Path::recordUnknownException(int const nwrwue, bool const isEvent)
69  {
70  mf::LogError("PassingThrough")
71  << "Exception passing through path " << name_ << "\n";
72  if (isEvent)
73  ++timesExcept_;
75  recordStatus(nwrwue, isEvent);
76  }
77 
78  void
79  Path::recordStatus(int const nwrwue, bool const isEvent)
80  {
81  if (isEvent && trptr_) {
82  (*trptr_)[bitpos_] = HLTPathStatus(state_, nwrwue);
83  }
84  }
85 
86  void
87  Path::updateCounters(bool const success, bool const isEvent)
88  {
89  if (success) {
90  if (isEvent)
91  ++timesPassed_;
93  } else {
94  if (isEvent)
95  ++timesFailed_;
97  }
98  }
99 
100  void
102  {
104  for_all(workers_, [](auto& w) { w.clearCounters(); });
105  }
106 
107  void
108  Path::findEventModifiers(std::vector<std::string>& foundLabels) const
109  {
110  findByModifiesEvent(true, foundLabels);
111  }
112 
113  void
114  Path::findEventObservers(std::vector<std::string>& foundLabels) const
115  {
116  findByModifiesEvent(false, foundLabels);
117  }
118 
119  void
120  Path::findByModifiesEvent(bool const modifies,
121  std::vector<std::string>& foundLabels) const
122  {
123  for (auto const& w : workers_) {
124  if (w.modifiesEvent() == modifies) {
125  foundLabels.push_back(w.label());
126  }
127  }
128  }
129 }
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:79
void recordUnknownException(int nwrwue, bool isEvent)
Definition: Path.cc:68
int bitpos_
Definition: Path.h:109
void findByModifiesEvent(bool modifies, std::vector< std::string > &foundLabels) const
Definition: Path.cc:120
cet::exempt_ptr< HLTGlobalStatus > TrigResPtr
Definition: Path.h:38
actions::ActionCodes find(std::string const &category) const
Definition: Actions.cc:87
ActionTable const & act_table_
Definition: Path.h:113
std::vector< WorkerInPath > WorkersInPath
Definition: Path.h:36
void findEventObservers(std::vector< std::string > &foundLabels) const
Definition: Path.cc:114
STL namespace.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
void updateCounters(bool succeed, bool isEvent)
Definition: Path.cc:87
ActivityRegistry & actReg_
Definition: Path.h:112
std::size_t timesExcept_
Definition: Path.h:106
std::size_t timesFailed_
Definition: Path.h:105
parameter set interface
void clearCounters()
Definition: Path.cc:101
std::string name_
Definition: Path.h:110
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool handleWorkerFailure(cet::exception const &e, int nwrwue, bool isEvent)
Definition: Path.cc:32
std::size_t timesRun_
Definition: Path.h:103
TrigResPtr trptr_
Definition: Path.h:111
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
HLT enums.
std::size_t timesPassed_
Definition: Path.h:104
accept
Definition: HLTenums.h:16
WorkersInPath workers_
Definition: Path.h:115
reject
Definition: HLTenums.h:17
bool isEndPath_
Definition: Path.h:117
void findEventModifiers(std::vector< std::string > &foundLabels) const
Definition: Path.cc:108
Float_t e
Definition: plot.C:34
Float_t w
Definition: plot.C:23
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
State state_
Definition: Path.h:107