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 | Static 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 &)
 
void setEarlyDeleteHelpers (std::map< const Worker *, EarlyDeleteHelper * > 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

void handleEarlyFinish (EventPrincipal &)
 
void handleEarlyFinish (RunPrincipal &)
 
void handleEarlyFinish (LuminosityBlockPrincipal &)
 
bool handleWorkerFailure (cms::Exception &e, int nwrwue, bool isEvent, bool begin, BranchType branchType, CurrentProcessingContext const &cpc, std::string const &id)
 
void recordStatus (int nwrwue, bool isEvent)
 
void updateCounters (bool succeed, bool isEvent)
 

Static Private Member Functions

static void exceptionContext (cms::Exception &ex, bool isEvent, bool begin, BranchType branchType, CurrentProcessingContext const &cpc, std::string const &id)
 

Private Attributes

ActionTable const * act_table_
 
boost::shared_ptr
< ActivityRegistry
actReg_
 
int bitpos_
 
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
 
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 39 of file Path.h.

Member Typedef Documentation

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

Definition at line 44 of file Path.h.

Definition at line 41 of file Path.h.

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

Definition at line 45 of file Path.h.

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

Definition at line 43 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 13 of file Path.cc.

18  :
19  stopwatch_(),
20  timesRun_(),
21  timesPassed_(),
22  timesFailed_(),
23  timesExcept_(),
25  bitpos_(bitpos),
27  trptr_(trptr),
28  actReg_(areg),
30  workers_(workers),
31  isEndPath_(isEndPath) {
32  }
not [yet] run
Definition: HLTenums.h:21
roAction_t actions[nactions]
Definition: GenABIO.cc:200
int timesFailed_
Definition: Path.h:94
ActionTable const * act_table_
Definition: Path.h:103
int timesExcept_
Definition: Path.h:95
std::string name_
Definition: Path.h:100
bool isEndPath_
Definition: Path.h:108
TrigResPtr trptr_
Definition: Path.h:101
int bitpos_
Definition: Path.h:99
boost::shared_ptr< ActivityRegistry > actReg_
Definition: Path.h:102
WorkersInPath workers_
Definition: Path.h:105
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:91
State state_
Definition: Path.h:97
int timesPassed_
Definition: Path.h:93
int timesRun_
Definition: Path.h:92

Member Function Documentation

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

Definition at line 57 of file Path.h.

References bitpos_.

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

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

Definition at line 143 of file Path.cc.

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

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

143  {
145  for_all(workers_, boost::bind(&WorkerInPath::clearCounters, _1));
146  }
int timesFailed_
Definition: Path.h:94
int timesExcept_
Definition: Path.h:95
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
WorkersInPath workers_
Definition: Path.h:105
int timesPassed_
Definition: Path.h:93
int timesRun_
Definition: Path.h:92
void edm::Path::exceptionContext ( cms::Exception ex,
bool  isEvent,
bool  begin,
BranchType  branchType,
CurrentProcessingContext const &  cpc,
std::string const &  id 
)
staticprivate

Definition at line 79 of file Path.cc.

References cms::Exception::addContext(), errorMatrix2Lands_multiChannel::id, edm::InLumi, edm::InRun, edm::CurrentProcessingContext::moduleDescription(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), and edm::CurrentProcessingContext::pathName().

Referenced by handleWorkerFailure().

84  {
85  std::ostringstream ost;
86  if (isEvent) {
87  ost << "Calling event method";
88  }
89  else if (begin && branchType == InRun) {
90  ost << "Calling beginRun";
91  }
92  else if (begin && branchType == InLumi) {
93  ost << "Calling beginLuminosityBlock";
94  }
95  else if (!begin && branchType == InLumi) {
96  ost << "Calling endLuminosityBlock";
97  }
98  else if (!begin && branchType == InRun) {
99  ost << "Calling endRun";
100  }
101  else {
102  // It should be impossible to get here ...
103  ost << "Calling unknown function";
104  }
105  if (cpc.moduleDescription()) {
106  ost << " for module " << cpc.moduleDescription()->moduleName() << "/'" << cpc.moduleDescription()->moduleLabel() << "'";
107  }
108  ex.addContext(ost.str());
109  ost.str("");
110  ost << "Running path '";
111  if (cpc.pathName()) {
112  ost << *cpc.pathName() << "'";
113  }
114  else {
115  ost << "unknown'";
116  }
117  ex.addContext(ost.str());
118  ost.str("");
119  ost << "Processing ";
120  ost << id;
121  ex.addContext(ost.str());
122  }
void addContext(std::string const &context)
Definition: Exception.cc:227
#define begin
Definition: vmac.h:31
Worker const* edm::Path::getWorker ( size_type  i) const
inline

Definition at line 85 of file Path.h.

References workers_.

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

85 { return workers_.at(i).getWorker(); }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:105
void edm::Path::handleEarlyFinish ( EventPrincipal iEvent)
private

Definition at line 176 of file Path.cc.

References earlyDeleteHelpers_.

Referenced by processOneOccurrence().

176  {
177  for(auto helper: earlyDeleteHelpers_) {
178  helper->pathFinished(iEvent);
179  }
180  }
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
Definition: Path.h:106
int iEvent
Definition: GenABIO.cc:243
void edm::Path::handleEarlyFinish ( RunPrincipal )
inlineprivate

Definition at line 129 of file Path.h.

129 {}
void edm::Path::handleEarlyFinish ( LuminosityBlockPrincipal )
inlineprivate

Definition at line 130 of file Path.h.

130 {}
bool edm::Path::handleWorkerFailure ( cms::Exception e,
int  nwrwue,
bool  isEvent,
bool  begin,
BranchType  branchType,
CurrentProcessingContext const &  cpc,
std::string const &  id 
)
private

Definition at line 35 of file Path.cc.

References act_table_, alignCSCRings::action, cms::Exception::addAdditionalInfo(), cms::Exception::category(), edm::Exception::codeToString(), edm::hlt::Exception, exceptionContext(), edm::actions::FailPath, edm::ActionTable::find(), edm::printCmsExceptionWarning(), edm::errors::ProductNotFound, recordStatus(), edm::actions::Rethrow, state_, and timesExcept_.

Referenced by processOneOccurrence().

41  {
42 
43  exceptionContext(e, isEvent, begin, branchType, cpc, id);
44 
45  bool should_continue = true;
46 
47  // there is no support as of yet for specific paths having
48  // different exception behavior
49 
50  // If not processing an event, always rethrow.
52  switch(action) {
53  case actions::FailPath: {
54  should_continue = false;
55  edm::printCmsExceptionWarning("FailPath", e);
56  break;
57  }
58  default: {
59  if (isEvent) ++timesExcept_;
61  recordStatus(nwrwue, isEvent);
62  if (action == actions::Rethrow) {
64  if (e.category() == pNF) {
65  std::ostringstream ost;
66  ost << "If you wish to continue processing events after a " << pNF << " exception,\n" <<
67  "add \"SkipEvent = cms.untracked.vstring('ProductNotFound')\" to the \"options\" PSet in the configuration.\n";
68  e.addAdditionalInfo(ost.str());
69  }
70  }
71  throw;
72  }
73  }
74 
75  return should_continue;
76  }
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:125
ActionTable const * act_table_
Definition: Path.h:103
std::string const & category() const
Definition: Exception.cc:183
int timesExcept_
Definition: Path.h:95
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e, edm::JobReport *jobRep=0, int rc=-1)
void addAdditionalInfo(std::string const &info)
Definition: Exception.cc:235
static std::string codeToString(Code)
-----------— implementation details ---------------—
Definition: EDMException.cc:55
static void exceptionContext(cms::Exception &ex, bool isEvent, bool begin, BranchType branchType, CurrentProcessingContext const &cpc, std::string const &id)
Definition: Path.cc:79
State state_
Definition: Path.h:97
#define begin
Definition: vmac.h:31
actions::ActionCodes find(const std::string &category) const
Definition: Actions.cc:93
std::string const& edm::Path::name ( void  ) const
inline
template<typename T >
void edm::Path::processOneOccurrence ( typename T::MyPrincipal &  ep,
EventSetup const &  es 
)

Definition at line 157 of file Path.h.

References edm::CurrentProcessingContext::activate(), actReg_, edm::convertException::badAllocToEDM(), bitPosition(), trackerHits::c, edm::convertException::charPtrToEDM(), alignCSCRings::e, end, cppFunctionSkipper::exception, handleEarlyFinish(), handleWorkerFailure(), i, isEndPath_, name_, edm::hlt::Ready, recordStatus(), alignCSCRings::s, state_, edm::convertException::stdToEDM(), stopwatch_, edm::convertException::stringToEDM(), timesRun_, edm::convertException::unknownToEDM(), updateCounters(), and workers_.

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

157  {
158 
159  //Create the PathSignalSentry before the RunStopwatch so that
160  // we only record the time spent in the path not from the signal
161  int nwrwue = -1;
162  PathSignalSentry<T> signaler(actReg_.get(), name_, nwrwue, state_);
163 
164  // A RunStopwatch, but only if we are processing an event.
165  RunStopwatch stopwatch(T::isEvent_ ? stopwatch_ : RunStopwatch::StopwatchPointer());
166 
167  if (T::isEvent_) {
168  ++timesRun_;
169  }
170  state_ = hlt::Ready;
171 
172  // nwrue = numWorkersRunWithoutUnhandledException
173  bool should_continue = true;
174  CurrentProcessingContext cpc(&name_, bitPosition(), isEndPath_);
175 
176  WorkersInPath::size_type idx = 0;
177  // It seems likely that 'nwrwue' and 'idx' can never differ ---
178  // if so, we should remove one of them!.
179  for (WorkersInPath::iterator i = workers_.begin(), end = workers_.end();
180  i != end && should_continue;
181  ++i, ++idx) {
182  ++nwrwue;
183  assert (static_cast<int>(idx) == nwrwue);
184  try {
185  try {
186  cpc.activate(idx, i->getWorker()->descPtr());
187  should_continue = i->runWorker<T>(ep, es, &cpc);
188  }
189  catch (cms::Exception& e) { throw; }
190  catch(std::bad_alloc& bda) { convertException::badAllocToEDM(); }
191  catch (std::exception& e) { convertException::stdToEDM(e); }
192  catch(std::string& s) { convertException::stringToEDM(s); }
193  catch(char const* c) { convertException::charPtrToEDM(c); }
194  catch (...) { convertException::unknownToEDM(); }
195  }
196  catch(cms::Exception& ex) {
197  // handleWorkerFailure may throw a new exception.
198  std::ostringstream ost;
199  ost << ep.id();
200  should_continue = handleWorkerFailure(ex, nwrwue, T::isEvent_, T::begin_, T::branchType_, cpc, ost.str());
201  }
202  }
203  if (not should_continue) {
204  handleEarlyFinish(ep);
205  }
206  updateCounters(should_continue, T::isEvent_);
207  recordStatus(nwrwue, T::isEvent_);
208  }
int i
Definition: DBlmapReader.cc:9
int bitPosition() const
Definition: Path.h:57
void recordStatus(int nwrwue, bool isEvent)
Definition: Path.cc:125
void handleEarlyFinish(EventPrincipal &)
Definition: Path.cc:176
not [yet] run
Definition: HLTenums.h:21
bool handleWorkerFailure(cms::Exception &e, int nwrwue, bool isEvent, bool begin, BranchType branchType, CurrentProcessingContext const &cpc, std::string const &id)
Definition: Path.cc:35
uint16_t size_type
std::string name_
Definition: Path.h:100
bool isEndPath_
Definition: Path.h:108
boost::shared_ptr< CPUTimer > StopwatchPointer
Definition: RunStopwatch.h:23
void stdToEDM(std::exception const &e)
#define end
Definition: vmac.h:38
boost::shared_ptr< ActivityRegistry > actReg_
Definition: Path.h:102
WorkersInPath workers_
Definition: Path.h:105
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
void updateCounters(bool succeed, bool isEvent)
Definition: Path.cc:132
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:91
State state_
Definition: Path.h:97
long double T
int timesRun_
Definition: Path.h:92
void edm::Path::recordStatus ( int  nwrwue,
bool  isEvent 
)
private

Definition at line 125 of file Path.cc.

References bitpos_, and state_.

Referenced by handleWorkerFailure(), and processOneOccurrence().

125  {
126  if(isEvent) {
127  (*trptr_)[bitpos_]=HLTPathStatus(state_, nwrwue);
128  }
129  }
int bitpos_
Definition: Path.h:99
State state_
Definition: Path.h:97
void edm::Path::setEarlyDeleteHelpers ( std::map< const Worker *, EarlyDeleteHelper * > const &  iWorkerToDeleter)

Definition at line 159 of file Path.cc.

References earlyDeleteHelpers_, newFWLiteAna::found, getWorker(), getHLTprescales::index, size(), and groupFilesInBlocks::temp.

159  {
160  //we use a temp so we can overset the size but then when moving to earlyDeleteHelpers we only
161  // have to use the space necessary
162  std::vector<EarlyDeleteHelper*> temp;
163  temp.reserve(iWorkerToDeleter.size());
164  for(unsigned int index=0; index !=size();++index) {
165  auto found = iWorkerToDeleter.find(getWorker(index));
166  if(found != iWorkerToDeleter.end()) {
167  temp.push_back(found->second);
168  found->second->addedToPath();
169  }
170  }
171  std::vector<EarlyDeleteHelper*> tempCorrectSize(temp.begin(),temp.end());
172  earlyDeleteHelpers_.swap(tempCorrectSize);
173  }
std::vector< EarlyDeleteHelper * > earlyDeleteHelpers_
Definition: Path.h:106
size_type size() const
Definition: Path.h:80
Worker const * getWorker(size_type i) const
Definition: Path.h:85
size_type edm::Path::size ( void  ) const
inline

Definition at line 80 of file Path.h.

References workers_.

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

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

Definition at line 78 of file Path.h.

References state_.

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

Definition at line 60 of file Path.h.

References stopwatch_.

60  {
61  if(stopwatch_) {
62  return std::pair<double, double>(stopwatch_->cpuTime(), stopwatch_->realTime());
63  }
64  return std::pair<double, double>(0., 0.);
65  }
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:91
std::pair<double, double> edm::Path::timeCpuReal ( unsigned int const  i) const
inline

Definition at line 67 of file Path.h.

References workers_.

67  {
68  return workers_.at(i).timeCpuReal();
69  }
int i
Definition: DBlmapReader.cc:9
WorkersInPath workers_
Definition: Path.h:105
int edm::Path::timesExcept ( ) const
inline

Definition at line 76 of file Path.h.

References timesExcept_.

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

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

Definition at line 84 of file Path.h.

References workers_.

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

Definition at line 75 of file Path.h.

References timesFailed_.

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

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

Definition at line 83 of file Path.h.

References workers_.

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

Definition at line 74 of file Path.h.

References timesPassed_.

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

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

Definition at line 82 of file Path.h.

References workers_.

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

Definition at line 73 of file Path.h.

References timesRun_.

Referenced by edm::fillPathSummary().

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

Definition at line 81 of file Path.h.

References workers_.

Referenced by edm::fillModuleInPathSummary().

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

Definition at line 132 of file Path.cc.

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

Referenced by processOneOccurrence().

132  {
133  if (success) {
134  if (isEvent) ++timesPassed_;
135  state_ = hlt::Pass;
136  } else {
137  if(isEvent) ++timesFailed_;
138  state_ = hlt::Fail;
139  }
140  }
int timesFailed_
Definition: Path.h:94
reject
Definition: HLTenums.h:23
accept
Definition: HLTenums.h:22
State state_
Definition: Path.h:97
int timesPassed_
Definition: Path.h:93
void edm::Path::useStopwatch ( )

Definition at line 149 of file Path.cc.

References stopwatch_, and workers_.

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

149  {
150  stopwatch_.reset(new RunStopwatch::StopwatchPointer::element_type);
151  for(WorkersInPath::iterator it=workers_.begin(), itEnd = workers_.end();
152  it != itEnd;
153  ++it) {
154  it->useStopwatch();
155  }
156  }
WorkersInPath workers_
Definition: Path.h:105
RunStopwatch::StopwatchPointer stopwatch_
Definition: Path.h:91

Member Data Documentation

ActionTable const* edm::Path::act_table_
private

Definition at line 103 of file Path.h.

Referenced by handleWorkerFailure().

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

Definition at line 102 of file Path.h.

Referenced by processOneOccurrence().

int edm::Path::bitpos_
private

Definition at line 99 of file Path.h.

Referenced by bitPosition(), and recordStatus().

std::vector<EarlyDeleteHelper*> edm::Path::earlyDeleteHelpers_
private

Definition at line 106 of file Path.h.

Referenced by handleEarlyFinish(), and setEarlyDeleteHelpers().

bool edm::Path::isEndPath_
private

Definition at line 108 of file Path.h.

Referenced by processOneOccurrence().

std::string edm::Path::name_
private

Definition at line 100 of file Path.h.

Referenced by name(), and processOneOccurrence().

State edm::Path::state_
private

Definition at line 97 of file Path.h.

Referenced by handleWorkerFailure(), processOneOccurrence(), recordStatus(), state(), and updateCounters().

RunStopwatch::StopwatchPointer edm::Path::stopwatch_
private

Definition at line 91 of file Path.h.

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

int edm::Path::timesExcept_
private

Definition at line 95 of file Path.h.

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

int edm::Path::timesFailed_
private

Definition at line 94 of file Path.h.

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

int edm::Path::timesPassed_
private

Definition at line 93 of file Path.h.

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

int edm::Path::timesRun_
private

Definition at line 92 of file Path.h.

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

TrigResPtr edm::Path::trptr_
private

Definition at line 101 of file Path.h.

WorkersInPath edm::Path::workers_
private