CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::Path Class Reference

#include <Path.h>

Public Types

typedef WorkersInPath::size_type size_type
 
typedef hlt::HLTState State
 
typedef boost::shared_ptr
< HLTGlobalStatus
TrigResPtr
 
typedef std::vector< WorkerInPathWorkersInPath
 

Public Member Functions

int bitPosition () const
 
void clearCounters ()
 
Worker const * getWorker (size_type i) const
 
std::string const & name () const
 
 Path (int bitpos, std::string const &path_name, WorkersInPath const &workers, TrigResPtr trptr, ActionTable const &actions, boost::shared_ptr< ActivityRegistry > reg, bool isEndPath)
 
template<typename T >
void processOneOccurrence (typename T::MyPrincipal &, EventSetup const &)
 
size_type size () const
 
State state () const
 
std::pair< double, double > timeCpuReal () const
 
std::pair< double, double > timeCpuReal (unsigned int const i) const
 
int timesExcept () const
 
int timesExcept (size_type i) const
 
int timesFailed () const
 
int timesFailed (size_type i) const
 
int timesPassed () const
 
int timesPassed (size_type i) const
 
int timesRun () const
 
int timesVisited (size_type i) const
 
void useStopwatch ()
 

Private Member Functions

bool handleWorkerFailure (cms::Exception const &e, int nwrwue, bool isEvent)
 
void recordStatus (int nwrwue, bool isEvent)
 
void recordUnknownException (int nwrwue, bool isEvent)
 
void updateCounters (bool succeed, bool isEvent)
 

Private Attributes

ActionTable const * act_table_
 
boost::shared_ptr
< ActivityRegistry
actReg_
 
int bitpos_
 
bool isEndPath_
 
std::string name_
 
State state_
 
RunStopwatch::StopwatchPointer stopwatch_
 
int timesExcept_
 
int timesFailed_
 
int timesPassed_
 
int timesRun_
 
TrigResPtr trptr_
 
WorkersInPath workers_
 

Detailed Description

Definition at line 29 of file Path.h.

Member Typedef Documentation

typedef WorkersInPath::size_type edm::Path::size_type

Definition at line 34 of file Path.h.

Definition at line 31 of file Path.h.

typedef boost::shared_ptr<HLTGlobalStatus> edm::Path::TrigResPtr

Definition at line 35 of file Path.h.

typedef std::vector<WorkerInPath> edm::Path::WorkersInPath

Definition at line 33 of file Path.h.

Constructor & Destructor Documentation

edm::Path::Path ( int  bitpos,
std::string const &  path_name,
WorkersInPath const &  workers,
TrigResPtr  trptr,
ActionTable const &  actions,
boost::shared_ptr< ActivityRegistry reg,
bool  isEndPath 
)

Definition at line 11 of file Path.cc.

16  :
17  stopwatch_(),
18  timesRun_(),
19  timesPassed_(),
20  timesFailed_(),
21  timesExcept_(),
23  bitpos_(bitpos),
24  name_(path_name),
25  trptr_(trptr),
26  actReg_(areg),
28  workers_(workers),
29  isEndPath_(isEndPath) {
30  }
not [yet] run
Definition: HLTenums.h:21
roAction_t actions[nactions]
Definition: GenABIO.cc:200
int timesFailed_
Definition: Path.h:82
ActionTable const * act_table_
Definition: Path.h:91
int timesExcept_
Definition: Path.h:83
std::string name_
Definition: Path.h:88
bool isEndPath_
Definition: Path.h:95
TrigResPtr trptr_
Definition: Path.h:89
int bitpos_
Definition: Path.h:87
boost::shared_ptr< ActivityRegistry > actReg_
Definition: Path.h:90
WorkersInPath workers_
Definition: Path.h:93
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:79
State state_
Definition: Path.h:85
int timesPassed_
Definition: Path.h:81
int timesRun_
Definition: Path.h:80

Member Function Documentation

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

Definition at line 47 of file Path.h.

References bitpos_.

Referenced by edm::fillPathSummary(), and processOneOccurrence().

47 { return bitpos_; }
int bitpos_
Definition: Path.h:87
void edm::Path::clearCounters ( )

Definition at line 100 of file Path.cc.

References edm::WorkerInPath::clearCounters(), edm::for_all(), timesExcept_, timesFailed_, timesPassed_, timesRun_, and workers_.

Referenced by edm::Schedule::clearCounters().

100  {
102  for_all(workers_, boost::bind(&WorkerInPath::clearCounters, _1));
103  }
int timesFailed_
Definition: Path.h:82
int timesExcept_
Definition: Path.h:83
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
WorkersInPath workers_
Definition: Path.h:93
int timesPassed_
Definition: Path.h:81
int timesRun_
Definition: Path.h:80
Worker const* edm::Path::getWorker ( size_type  i) const
inline

Definition at line 75 of file Path.h.

References workers_.

Referenced by edm::fillModuleInPathSummary().

75 { return workers_.at(i).getWorker(); }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:93
bool edm::Path::handleWorkerFailure ( cms::Exception const &  e,
int  nwrwue,
bool  isEvent 
)
private

Definition at line 33 of file Path.cc.

References act_table_, alignmentValidation::action, cms::Exception::category(), edm::Exception::codeToString(), edm::hlt::Exception, edm::actions::FailModule, edm::actions::FailPath, edm::ActionTable::find(), name_, edm::errors::ProductNotFound, recordStatus(), edm::actions::Rethrow, cms::Exception::rootCause(), state_, timesExcept_, and cms::Exception::what().

Referenced by processOneOccurrence().

34  {
35  bool should_continue = true;
36 
37  // there is no support as of yet for specific paths having
38  // different exception behavior
39 
40  // If not processing an event, always rethrow.
41  actions::ActionCodes action = (isEvent ? act_table_->find(e.rootCause()) : actions::Rethrow);
42  assert (action != actions::FailModule);
43  switch(action) {
44  case actions::FailPath: {
45  should_continue = false;
46  LogWarning(e.category())
47  << "Failing path " << name_
48  << ", due to exception, message:\n"
49  << e.what() << "\n";
50  break;
51  }
52  default: {
53  if (isEvent) ++timesExcept_;
55  recordStatus(nwrwue, isEvent);
56  if (action == actions::Rethrow) {
58  if (e.category() == pNF) {
59  e << "If you wish to continue processing events after a " << pNF << " exception,\n" <<
60  "add \"SkipEvent = cms.untracked.vstring('ProductNotFound')\" to the \"options\" PSet in the configuration.\n";
61  }
62  }
63  e << "ProcessingStopped\n";
64  e << "Exception going through path " << name_ << "\n";
65  throw;
66  }
67  }
68 
69  return should_continue;
70  }
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:82
ActionTable const * act_table_
Definition: Path.h:91
int timesExcept_
Definition: Path.h:83
std::string name_
Definition: Path.h:88
static std::string codeToString(Code)
-----------— implementation details ---------------—
Definition: EDMException.cc:48
State state_
Definition: Path.h:85
actions::ActionCodes find(const std::string &category) const
Definition: Actions.cc:95
std::string const& edm::Path::name ( ) const
inline
template<typename T >
void edm::Path::processOneOccurrence ( typename T::MyPrincipal &  ep,
EventSetup const &  es 
)

Definition at line 129 of file Path.h.

References edm::CurrentProcessingContext::activate(), actReg_, bitPosition(), ExpressReco_HICollisions_FallBack::e, end, handleWorkerFailure(), i, isEndPath_, name_, edm::hlt::Ready, recordStatus(), recordUnknownException(), state_, stopwatch_, timesRun_, updateCounters(), and workers_.

Referenced by edm::ProcessOneOccurrence< T >::operator()().

129  {
130 
131  //Create the PathSignalSentry before the RunStopwatch so that
132  // we only record the time spent in the path not from the signal
133  int nwrwue = -1;
134  std::auto_ptr<PathSignalSentry<T> > signaler(new PathSignalSentry<T>(actReg_.get(), name_, nwrwue, state_));
135 
136  // A RunStopwatch, but only if we are processing an event.
137  RunStopwatch stopwatch(T::isEvent_ ? stopwatch_ : RunStopwatch::StopwatchPointer());
138 
139  if (T::isEvent_) {
140  ++timesRun_;
141  }
142  state_ = hlt::Ready;
143 
144  // nwrue = numWorkersRunWithoutUnhandledException
145  bool should_continue = true;
146  CurrentProcessingContext cpc(&name_, bitPosition(), isEndPath_);
147 
148  WorkersInPath::size_type idx = 0;
149  // It seems likely that 'nwrwue' and 'idx' can never differ ---
150  // if so, we should remove one of them!.
151  for (WorkersInPath::iterator i = workers_.begin(), end = workers_.end();
152  i != end && should_continue;
153  ++i, ++idx) {
154  ++nwrwue;
155  assert (static_cast<int>(idx) == nwrwue);
156  try {
157  cpc.activate(idx, i->getWorker()->descPtr());
158  should_continue = i->runWorker<T>(ep, es, &cpc);
159  }
160  catch(cms::Exception& e) {
161  // handleWorkerFailure may throw a new exception.
162  should_continue = handleWorkerFailure(e, nwrwue, T::isEvent_);
163  }
164  catch(...) {
165  recordUnknownException(nwrwue, T::isEvent_);
166  throw;
167  }
168  }
169  updateCounters(should_continue, T::isEvent_);
170  recordStatus(nwrwue, T::isEvent_);
171  }
int i
Definition: DBlmapReader.cc:9
int bitPosition() const
Definition: Path.h:47
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:82
not [yet] run
Definition: HLTenums.h:21
bool handleWorkerFailure(cms::Exception const &e, int nwrwue, bool isEvent)
Definition: Path.cc:33
uint16_t size_type
std::string name_
Definition: Path.h:88
bool isEndPath_
Definition: Path.h:95
boost::shared_ptr< CPUTimer > StopwatchPointer
Definition: RunStopwatch.h:23
#define end
Definition: vmac.h:38
void recordUnknownException(int nwrwue, bool isEvent)
Definition: Path.cc:73
boost::shared_ptr< ActivityRegistry > actReg_
Definition: Path.h:90
WorkersInPath workers_
Definition: Path.h:93
void updateCounters(bool succeed, bool isEvent)
Definition: Path.cc:89
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:79
State state_
Definition: Path.h:85
int timesRun_
Definition: Path.h:80
void edm::Path::recordStatus ( int  nwrwue,
bool  isEvent 
)
private

Definition at line 82 of file Path.cc.

References bitpos_, and state_.

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

82  {
83  if(isEvent) {
84  (*trptr_)[bitpos_]=HLTPathStatus(state_, nwrwue);
85  }
86  }
int bitpos_
Definition: Path.h:87
State state_
Definition: Path.h:85
void edm::Path::recordUnknownException ( int  nwrwue,
bool  isEvent 
)
private

Definition at line 73 of file Path.cc.

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

Referenced by processOneOccurrence().

73  {
74  LogError("PassingThrough")
75  << "Exception passing through path " << name_ << "\n";
76  if (isEvent) ++timesExcept_;
78  recordStatus(nwrwue, isEvent);
79  }
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:82
int timesExcept_
Definition: Path.h:83
std::string name_
Definition: Path.h:88
State state_
Definition: Path.h:85
size_type edm::Path::size ( void  ) const
inline

Definition at line 70 of file Path.h.

References workers_.

Referenced by edm::fillPathSummary().

70 { return workers_.size(); }
WorkersInPath workers_
Definition: Path.h:93
State edm::Path::state ( ) const
inline

Definition at line 68 of file Path.h.

References state_.

68 { return state_; }
State state_
Definition: Path.h:85
std::pair<double, double> edm::Path::timeCpuReal ( ) const
inline

Definition at line 50 of file Path.h.

References stopwatch_.

50  {
51  if(stopwatch_) {
52  return std::pair<double, double>(stopwatch_->cpuTime(), stopwatch_->realTime());
53  }
54  return std::pair<double, double>(0., 0.);
55  }
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:79
std::pair<double, double> edm::Path::timeCpuReal ( unsigned int const  i) const
inline

Definition at line 57 of file Path.h.

References workers_.

57  {
58  return workers_.at(i).timeCpuReal();
59  }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:93
int edm::Path::timesExcept ( ) const
inline

Definition at line 66 of file Path.h.

References timesExcept_.

Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().

66 { return timesExcept_; }
int timesExcept_
Definition: Path.h:83
int edm::Path::timesExcept ( size_type  i) const
inline

Definition at line 74 of file Path.h.

References workers_.

74 { return workers_.at(i).timesExcept() ; }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:93
int edm::Path::timesFailed ( ) const
inline

Definition at line 65 of file Path.h.

References timesFailed_.

Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().

65 { return timesFailed_; }
int timesFailed_
Definition: Path.h:82
int edm::Path::timesFailed ( size_type  i) const
inline

Definition at line 73 of file Path.h.

References workers_.

73 { return workers_.at(i).timesFailed() ; }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:93
int edm::Path::timesPassed ( ) const
inline

Definition at line 64 of file Path.h.

References timesPassed_.

Referenced by edm::fillModuleInPathSummary(), and edm::fillPathSummary().

64 { return timesPassed_; }
int timesPassed_
Definition: Path.h:81
int edm::Path::timesPassed ( size_type  i) const
inline

Definition at line 72 of file Path.h.

References workers_.

72 { return workers_.at(i).timesPassed() ; }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:93
int edm::Path::timesRun ( ) const
inline

Definition at line 63 of file Path.h.

References timesRun_.

Referenced by edm::fillPathSummary().

63 { return timesRun_; }
int timesRun_
Definition: Path.h:80
int edm::Path::timesVisited ( size_type  i) const
inline

Definition at line 71 of file Path.h.

References workers_.

Referenced by edm::fillModuleInPathSummary().

71 { return workers_.at(i).timesVisited(); }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:93
void edm::Path::updateCounters ( bool  succeed,
bool  isEvent 
)
private

Definition at line 89 of file Path.cc.

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

Referenced by processOneOccurrence().

89  {
90  if (success) {
91  if (isEvent) ++timesPassed_;
92  state_ = hlt::Pass;
93  } else {
94  if(isEvent) ++timesFailed_;
95  state_ = hlt::Fail;
96  }
97  }
int timesFailed_
Definition: Path.h:82
reject
Definition: HLTenums.h:23
accept
Definition: HLTenums.h:22
State state_
Definition: Path.h:85
int timesPassed_
Definition: Path.h:81
void edm::Path::useStopwatch ( )

Definition at line 106 of file Path.cc.

References stopwatch_, and workers_.

Referenced by edm::Schedule::fillEndPath(), and edm::Schedule::fillTrigPath().

106  {
107  stopwatch_.reset(new RunStopwatch::StopwatchPointer::element_type);
108  for(WorkersInPath::iterator it=workers_.begin(), itEnd = workers_.end();
109  it != itEnd;
110  ++it) {
111  it->useStopwatch();
112  }
113  }
WorkersInPath workers_
Definition: Path.h:93
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:79

Member Data Documentation

ActionTable const* edm::Path::act_table_
private

Definition at line 91 of file Path.h.

Referenced by handleWorkerFailure().

boost::shared_ptr<ActivityRegistry> edm::Path::actReg_
private

Definition at line 90 of file Path.h.

Referenced by processOneOccurrence().

int edm::Path::bitpos_
private

Definition at line 87 of file Path.h.

Referenced by bitPosition(), and recordStatus().

bool edm::Path::isEndPath_
private

Definition at line 95 of file Path.h.

Referenced by processOneOccurrence().

std::string edm::Path::name_
private
State edm::Path::state_
private
RunStopwatch::StopwatchPointer edm::Path::stopwatch_
private

Definition at line 79 of file Path.h.

Referenced by processOneOccurrence(), timeCpuReal(), and useStopwatch().

int edm::Path::timesExcept_
private

Definition at line 83 of file Path.h.

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

int edm::Path::timesFailed_
private

Definition at line 82 of file Path.h.

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

int edm::Path::timesPassed_
private

Definition at line 81 of file Path.h.

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

int edm::Path::timesRun_
private

Definition at line 80 of file Path.h.

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

TrigResPtr edm::Path::trptr_
private

Definition at line 89 of file Path.h.

WorkersInPath edm::Path::workers_
private