LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
art::Path Class Reference

#include "Path.h"

Public Types

using State = hlt::HLTState
 
using WorkersInPath = std::vector< WorkerInPath >
 
using size_type = WorkersInPath::size_type
 
using TrigResPtr = cet::exempt_ptr< HLTGlobalStatus >
 

Public Member Functions

 Path (int bitpos, std::string const &path_name, WorkersInPath &&workers, TrigResPtr pathResults, ActionTable const &actions, ActivityRegistry &reg, bool isEndPath)
 
template<typename T >
void process (typename T::MyPrincipal &)
 
int bitPosition () const
 
std::string const & name () const
 
void clearCounters ()
 
std::size_t timesRun () const
 
std::size_t timesPassed () const
 
std::size_t timesFailed () const
 
std::size_t timesExcept () const
 
State state () const
 
auto const & workersInPath () const
 
void findEventModifiers (std::vector< std::string > &foundLabels) const
 
void findEventObservers (std::vector< std::string > &foundLabels) const
 

Private Member Functions

void findByModifiesEvent (bool modifies, std::vector< std::string > &foundLabels) const
 
bool handleWorkerFailure (cet::exception const &e, int nwrwue, bool isEvent)
 
void recordUnknownException (int nwrwue, bool isEvent)
 
void recordStatus (int nwrwue, bool isEvent)
 
void updateCounters (bool succeed, bool isEvent)
 

Private Attributes

std::size_t timesRun_ {}
 
std::size_t timesPassed_ {}
 
std::size_t timesFailed_ {}
 
std::size_t timesExcept_ {}
 
State state_ {hlt::Ready}
 
int bitpos_
 
std::string name_
 
TrigResPtr trptr_
 
ActivityRegistryactReg_
 
ActionTable const & act_table_
 
WorkersInPath workers_
 
bool isEndPath_
 

Detailed Description

Definition at line 32 of file Path.h.

Member Typedef Documentation

using art::Path::size_type = WorkersInPath::size_type

Definition at line 37 of file Path.h.

Definition at line 34 of file Path.h.

using art::Path::TrigResPtr = cet::exempt_ptr<HLTGlobalStatus>

Definition at line 38 of file Path.h.

using art::Path::WorkersInPath = std::vector<WorkerInPath>

Definition at line 36 of file Path.h.

Constructor & Destructor Documentation

art::Path::Path ( int  bitpos,
std::string const &  path_name,
WorkersInPath &&  workers,
TrigResPtr  pathResults,
ActionTable const &  actions,
ActivityRegistry reg,
bool  isEndPath 
)

Definition at line 15 of file Path.cc.

References act_table_, actReg_, isEndPath_, name_, trptr_, and workers_.

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  {}
int bitpos_
Definition: Path.h:109
ActionTable const & act_table_
Definition: Path.h:113
ActivityRegistry & actReg_
Definition: Path.h:112
std::string name_
Definition: Path.h:110
TrigResPtr trptr_
Definition: Path.h:111
WorkersInPath workers_
Definition: Path.h:115
bool isEndPath_
Definition: Path.h:117

Member Function Documentation

int art::Path::bitPosition ( ) const
inline

Definition at line 52 of file Path.h.

References bitpos_.

Referenced by process().

53  {
54  return bitpos_;
55  }
int bitpos_
Definition: Path.h:109
void art::Path::clearCounters ( )

Definition at line 101 of file Path.cc.

References timesExcept_, timesFailed_, timesPassed_, timesRun_, w, and workers_.

Referenced by name().

102  {
104  for_all(workers_, [](auto& w) { w.clearCounters(); });
105  }
std::size_t timesExcept_
Definition: Path.h:106
std::size_t timesFailed_
Definition: Path.h:105
std::size_t timesRun_
Definition: Path.h:103
std::size_t timesPassed_
Definition: Path.h:104
WorkersInPath workers_
Definition: Path.h:115
Float_t w
Definition: plot.C:23
void art::Path::findByModifiesEvent ( bool  modifies,
std::vector< std::string > &  foundLabels 
) const
private

Definition at line 120 of file Path.cc.

References w, and workers_.

Referenced by findEventModifiers(), findEventObservers(), and workersInPath().

122  {
123  for (auto const& w : workers_) {
124  if (w.modifiesEvent() == modifies) {
125  foundLabels.push_back(w.label());
126  }
127  }
128  }
WorkersInPath workers_
Definition: Path.h:115
Float_t w
Definition: plot.C:23
void art::Path::findEventModifiers ( std::vector< std::string > &  foundLabels) const

Definition at line 108 of file Path.cc.

References findByModifiesEvent().

Referenced by workersInPath().

109  {
110  findByModifiesEvent(true, foundLabels);
111  }
void findByModifiesEvent(bool modifies, std::vector< std::string > &foundLabels) const
Definition: Path.cc:120
void art::Path::findEventObservers ( std::vector< std::string > &  foundLabels) const

Definition at line 114 of file Path.cc.

References findByModifiesEvent().

Referenced by workersInPath().

115  {
116  findByModifiesEvent(false, foundLabels);
117  }
void findByModifiesEvent(bool modifies, std::vector< std::string > &foundLabels) const
Definition: Path.cc:120
bool art::Path::handleWorkerFailure ( cet::exception const &  e,
int  nwrwue,
bool  isEvent 
)
private

Definition at line 32 of file Path.cc.

References act_table_, art::hlt::Exception, art::actions::FailModule, art::actions::FailPath, art::ActionTable::find(), name_, recordStatus(), art::actions::Rethrow, art::errors::ScheduleExecutionFailure, state_, and timesExcept_.

Referenced by process().

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  }
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:79
actions::ActionCodes find(std::string const &category) const
Definition: Actions.cc:87
ActionTable const & act_table_
Definition: Path.h:113
std::size_t timesExcept_
Definition: Path.h:106
std::string name_
Definition: Path.h:110
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Float_t e
Definition: plot.C:34
State state_
Definition: Path.h:107
std::string const& art::Path::name ( ) const
inline

Definition at line 57 of file Path.h.

References clearCounters(), and name_.

58  {
59  return name_;
60  }
std::string name_
Definition: Path.h:110
template<typename T >
void art::Path::process ( typename T::MyPrincipal &  ep)

Definition at line 129 of file Path.h.

References actReg_, bitPosition(), e, evd::details::end(), art::Event, handleWorkerFailure(), isEndPath_, name_, art::hlt::Ready, recordStatus(), recordUnknownException(), state_, timesRun_, updateCounters(), and workers_.

130 {
131  int nwrwue{-1}; // numWorkersRunWithoutUnhandledException
132  T::prePathSignal(actReg_, name_);
133 
134  if (T::level == Level::Event) {
135  ++timesRun_;
136  }
137  state_ = hlt::Ready;
138 
139  bool should_continue{true};
140  CurrentProcessingContext cpc{&name_, bitPosition(), isEndPath_};
141 
142  for (auto it = workers_.begin(), end = workers_.end();
143  it != end && should_continue;
144  ++it) {
145  ++nwrwue;
146  try {
147  cpc.activate(nwrwue, it->getWorker()->descPtr());
148  should_continue = it->runWorker<T>(ep, &cpc);
149  }
150  catch (cet::exception& e) {
151  // handleWorkerFailure may throw a new exception.
152  should_continue =
153  handleWorkerFailure(e, nwrwue, T::level == Level::Event);
154  }
155  catch (...) {
156  recordUnknownException(nwrwue, T::level == Level::Event);
157  throw;
158  }
159  }
160  updateCounters(should_continue, T::level == Level::Event);
161  recordStatus(nwrwue, T::level == Level::Event);
162  HLTPathStatus const status(state_, nwrwue);
163  T::postPathSignal(actReg_, name_, status);
164 }
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:79
void recordUnknownException(int nwrwue, bool isEvent)
Definition: Path.cc:68
void updateCounters(bool succeed, bool isEvent)
Definition: Path.cc:87
ActivityRegistry & actReg_
Definition: Path.h:112
not [yet] run
Definition: HLTenums.h:15
std::string name_
Definition: Path.h:110
bool handleWorkerFailure(cet::exception const &e, int nwrwue, bool isEvent)
Definition: Path.cc:32
std::size_t timesRun_
Definition: Path.h:103
int bitPosition() const
Definition: Path.h:52
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
WorkersInPath workers_
Definition: Path.h:115
bool isEndPath_
Definition: Path.h:117
Float_t e
Definition: plot.C:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
State state_
Definition: Path.h:107
void art::Path::recordStatus ( int  nwrwue,
bool  isEvent 
)
private

Definition at line 79 of file Path.cc.

References bitpos_, state_, and trptr_.

Referenced by handleWorkerFailure(), process(), and recordUnknownException().

80  {
81  if (isEvent && trptr_) {
82  (*trptr_)[bitpos_] = HLTPathStatus(state_, nwrwue);
83  }
84  }
int bitpos_
Definition: Path.h:109
TrigResPtr trptr_
Definition: Path.h:111
State state_
Definition: Path.h:107
void art::Path::recordUnknownException ( int  nwrwue,
bool  isEvent 
)
private

Definition at line 68 of file Path.cc.

References art::hlt::Exception, name_, recordStatus(), state_, and timesExcept_.

Referenced by process().

69  {
70  mf::LogError("PassingThrough")
71  << "Exception passing through path " << name_ << "\n";
72  if (isEvent)
73  ++timesExcept_;
75  recordStatus(nwrwue, isEvent);
76  }
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:79
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::size_t timesExcept_
Definition: Path.h:106
std::string name_
Definition: Path.h:110
State state_
Definition: Path.h:107
State art::Path::state ( ) const
inline

Definition at line 85 of file Path.h.

References state_.

86  {
87  return state_;
88  }
State state_
Definition: Path.h:107
std::size_t art::Path::timesExcept ( ) const
inline

Definition at line 80 of file Path.h.

References timesExcept_.

81  {
82  return timesExcept_;
83  }
std::size_t timesExcept_
Definition: Path.h:106
std::size_t art::Path::timesFailed ( ) const
inline

Definition at line 75 of file Path.h.

References timesFailed_.

76  {
77  return timesFailed_;
78  }
std::size_t timesFailed_
Definition: Path.h:105
std::size_t art::Path::timesPassed ( ) const
inline

Definition at line 70 of file Path.h.

References timesPassed_.

71  {
72  return timesPassed_;
73  }
std::size_t timesPassed_
Definition: Path.h:104
std::size_t art::Path::timesRun ( ) const
inline

Definition at line 65 of file Path.h.

References timesRun_.

66  {
67  return timesRun_;
68  }
std::size_t timesRun_
Definition: Path.h:103
void art::Path::updateCounters ( bool  succeed,
bool  isEvent 
)
private

Definition at line 87 of file Path.cc.

References art::hlt::Fail, art::hlt::Pass, state_, timesFailed_, and timesPassed_.

Referenced by process().

88  {
89  if (success) {
90  if (isEvent)
91  ++timesPassed_;
93  } else {
94  if (isEvent)
95  ++timesFailed_;
97  }
98  }
std::size_t timesFailed_
Definition: Path.h:105
std::size_t timesPassed_
Definition: Path.h:104
accept
Definition: HLTenums.h:16
reject
Definition: HLTenums.h:17
State state_
Definition: Path.h:107
auto const& art::Path::workersInPath ( ) const
inline

Definition at line 91 of file Path.h.

References findByModifiesEvent(), findEventModifiers(), findEventObservers(), and workers_.

92  {
93  return workers_;
94  }
WorkersInPath workers_
Definition: Path.h:115

Member Data Documentation

ActionTable const& art::Path::act_table_
private

Definition at line 113 of file Path.h.

Referenced by handleWorkerFailure(), and Path().

ActivityRegistry& art::Path::actReg_
private

Definition at line 112 of file Path.h.

Referenced by Path(), and process().

int art::Path::bitpos_
private

Definition at line 109 of file Path.h.

Referenced by bitPosition(), and recordStatus().

bool art::Path::isEndPath_
private

Definition at line 117 of file Path.h.

Referenced by Path(), and process().

std::string art::Path::name_
private

Definition at line 110 of file Path.h.

Referenced by handleWorkerFailure(), name(), Path(), process(), and recordUnknownException().

State art::Path::state_ {hlt::Ready}
private
std::size_t art::Path::timesExcept_ {}
private

Definition at line 106 of file Path.h.

Referenced by clearCounters(), handleWorkerFailure(), recordUnknownException(), and timesExcept().

std::size_t art::Path::timesFailed_ {}
private

Definition at line 105 of file Path.h.

Referenced by clearCounters(), timesFailed(), and updateCounters().

std::size_t art::Path::timesPassed_ {}
private

Definition at line 104 of file Path.h.

Referenced by clearCounters(), timesPassed(), and updateCounters().

std::size_t art::Path::timesRun_ {}
private

Definition at line 103 of file Path.h.

Referenced by clearCounters(), process(), and timesRun().

TrigResPtr art::Path::trptr_
private

Definition at line 111 of file Path.h.

Referenced by Path(), and recordStatus().

WorkersInPath art::Path::workers_
private

Definition at line 115 of file Path.h.

Referenced by clearCounters(), findByModifiesEvent(), Path(), process(), and workersInPath().


The documentation for this class was generated from the following files: