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::Schedule Class Reference

#include <Schedule.h>

Public Types

typedef std::vector
< OutputWorker * > 
AllOutputWorkers
 
typedef std::vector< Worker * > AllWorkers
 
typedef std::vector< PathNonTrigPaths
 
typedef std::vector< WorkerInPathPathWorkers
 
enum  State { Ready = 0, Running, Latched }
 
typedef std::vector< PathTrigPaths
 
typedef boost::shared_ptr
< HLTGlobalStatus
TrigResPtr
 
typedef std::vector< std::string > vstring
 
typedef boost::shared_ptr< WorkerWorkerPtr
 
typedef std::vector< Worker * > Workers
 

Public Member Functions

void availablePaths (std::vector< std::string > &oLabelsToFill) const
 adds to oLabelsToFill the labels for all paths in the process More...
 
void beginJob ()
 
bool changeModule (std::string const &iLabel, ParameterSet const &iPSet)
 
void clearCounters ()
 Clear all the counters in the trigger report. More...
 
void closeOutputFiles ()
 
void enableEndPaths (bool active)
 
void endJob (ExceptionCollector &collector)
 
bool endPathsEnabled () const
 
std::vector< ModuleDescription
const * > 
getAllModuleDescriptions () const
 
void getTriggerReport (TriggerReport &rep) const
 
void modulesInPath (std::string const &iPathLabel, std::vector< std::string > &oLabelsToFill) const
 adds to oLabelsToFill in execution order the labels of all modules in path iPathLabel More...
 
void openNewOutputFilesIfNeeded ()
 
void openOutputFiles (FileBlock &fb)
 
void postForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren)
 
void preForkReleaseResources ()
 
template<typename T >
void processOneOccurrence (typename T::MyPrincipal &principal, EventSetup const &eventSetup, bool cleaningUpAfterException=false)
 
void respondToCloseInputFile (FileBlock const &fb)
 
void respondToCloseOutputFiles (FileBlock const &fb)
 
void respondToOpenInputFile (FileBlock const &fb)
 
void respondToOpenOutputFiles (FileBlock const &fb)
 
 Schedule (ParameterSet &proc_pset, service::TriggerNamesService &tns, ProductRegistry &pregistry, ActionTable const &actions, boost::shared_ptr< ActivityRegistry > areg, boost::shared_ptr< ProcessConfiguration > processConfiguration, const ParameterSet *subProcPSet)
 
bool shouldWeCloseOutput () const
 
bool terminate () const
 Return whether each output module has reached its maximum count. More...
 
std::pair< double, double > timeCpuReal () const
 
int totalEvents () const
 
int totalEventsFailed () const
 
int totalEventsPassed () const
 
void writeLumi (LuminosityBlockPrincipal const &lbp)
 
void writeRun (RunPrincipal const &rp)
 

Private Member Functions

void addToAllWorkers (Worker *w)
 
void fillEndPath (ParameterSet &proc_pset, ProductRegistry &preg, boost::shared_ptr< ProcessConfiguration const > processConfiguration, int bitpos, std::string const &name)
 
void fillTrigPath (ParameterSet &proc_pset, ProductRegistry &preg, boost::shared_ptr< ProcessConfiguration const > processConfiguration, int bitpos, std::string const &name, TrigResPtr, vstring *labelsOnTriggerPaths)
 
void fillWorkers (ParameterSet &proc_pset, ProductRegistry &preg, boost::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &name, bool ignoreFilters, PathWorkers &out, vstring *labelsOnPaths)
 
void initializeEarlyDelete (edm::ParameterSet const &opts, edm::ProductRegistry const &preg, edm::ParameterSet const *subProcPSet)
 
void limitOutput (ParameterSet const &proc_pset)
 
void reduceParameterSet (ParameterSet &proc_pset, vstring &modulesInConfig, std::set< std::string > const &modulesInConfigSet, vstring &labelsOnTriggerPaths, vstring &shouldBeUsedLabels, std::map< std::string, std::vector< std::pair< std::string, int > > > &outputModulePathPositions)
 
void reportSkipped (EventPrincipal const &ep) const
 
void reportSkipped (LuminosityBlockPrincipal const &) const
 
void reportSkipped (RunPrincipal const &) const
 
void resetAll ()
 
void resetEarlyDelete ()
 
template<typename T >
void runEndPaths (typename T::MyPrincipal &, EventSetup const &)
 
template<typename T >
bool runTriggerPaths (typename T::MyPrincipal &, EventSetup const &)
 
void setupOnDemandSystem (EventPrincipal &principal, EventSetup const &es)
 
AllWorkers::const_iterator workersBegin () const
 
AllWorkers::iterator workersBegin ()
 
AllWorkers::const_iterator workersEnd () const
 
AllWorkers::iterator workersEnd ()
 

Private Attributes

ActionTable const * act_table_
 
boost::shared_ptr
< ActivityRegistry
actReg_
 
AllOutputWorkers all_output_workers_
 
AllWorkers all_workers_
 
std::vector< std::pair
< BranchID, unsigned int > > 
earlyDeleteBranchToCount_
 
std::vector< EarlyDeleteHelperearlyDeleteHelpers_
 
std::vector< unsigned int > earlyDeleteHelperToBranchIndicies_
 
vstring end_path_name_list_
 
TrigPaths end_paths_
 
TrigResPtr endpath_results_
 
volatile bool endpathsAreActive_
 
TrigResPtr results_
 
WorkerPtr results_inserter_
 
State state_
 
RunStopwatch::StopwatchPointer stopwatch_
 
int total_events_
 
int total_passed_
 
vstring trig_name_list_
 
TrigPaths trig_paths_
 
boost::shared_ptr
< UnscheduledCallProducer
unscheduled_
 
bool wantSummary_
 
WorkerRegistry worker_reg_
 

Detailed Description

Definition at line 102 of file Schedule.h.

Member Typedef Documentation

Definition at line 110 of file Schedule.h.

typedef std::vector<Worker*> edm::Schedule::AllWorkers

Definition at line 109 of file Schedule.h.

typedef std::vector<Path> edm::Schedule::NonTrigPaths

Definition at line 106 of file Schedule.h.

Definition at line 114 of file Schedule.h.

typedef std::vector<Path> edm::Schedule::TrigPaths

Definition at line 105 of file Schedule.h.

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

Definition at line 107 of file Schedule.h.

typedef std::vector<std::string> edm::Schedule::vstring

Definition at line 104 of file Schedule.h.

typedef boost::shared_ptr<Worker> edm::Schedule::WorkerPtr

Definition at line 108 of file Schedule.h.

typedef std::vector<Worker*> edm::Schedule::Workers

Definition at line 112 of file Schedule.h.

Member Enumeration Documentation

Enumerator
Ready 
Running 
Latched 

Definition at line 124 of file Schedule.h.

Constructor & Destructor Documentation

edm::Schedule::Schedule ( ParameterSet proc_pset,
service::TriggerNamesService tns,
ProductRegistry pregistry,
ActionTable const &  actions,
boost::shared_ptr< ActivityRegistry areg,
boost::shared_ptr< ProcessConfiguration processConfiguration,
const ParameterSet subProcPSet 
)

Definition at line 151 of file Schedule.cc.

References act_table_, actReg_, addToAllWorkers(), all_output_workers_, all_workers_, edm::ProductRegistry::anyProductProduced(), alignCSCRings::e, end_path_name_list_, endpath_results_, edm::detail::ThreadSafeRegistry< KEY, T, E >::extra(), fillEndPath(), edm::fillProductRegistryTransients(), fillTrigPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getPSetForUpdate(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), edm::WorkerRegistry::getWorker(), i, edm::ParameterSet::id(), edm::InEvent, initializeEarlyDelete(), edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), limitOutput(), edm::loadMissingDictionaries(), geometryDiff::opts, edm::ProductRegistry::productList(), reduceParameterSet(), edm::ParameterSet::registerIt(), results_, results_inserter_, edm::ProductRegistry::setFrozen(), trig_name_list_, unscheduled_, edm::BranchIDListHelper::updateRegistries(), worker_reg_, workersBegin(), and workersEnd().

157  :
158  worker_reg_(areg),
160  actReg_(areg),
161  state_(Ready),
162  trig_name_list_(tns.getTrigPaths()),
163  end_path_name_list_(tns.getEndPaths()),
164  results_(new HLTGlobalStatus(trig_name_list_.size())),
165  endpath_results_(), // delay!
167  all_workers_(),
169  trig_paths_(),
170  end_paths_(),
171  wantSummary_(tns.wantSummary()),
172  total_events_(),
173  total_passed_(),
174  stopwatch_(wantSummary_? new RunStopwatch::StopwatchPointer::element_type : static_cast<RunStopwatch::StopwatchPointer::element_type*> (0)),
175  unscheduled_(new UnscheduledCallProducer),
176  endpathsAreActive_(true) {
177 
178  ParameterSet const& opts = proc_pset.getUntrackedParameterSet("options", ParameterSet());
179  bool hasPath = false;
180 
181  int trig_bitpos = 0;
182  vstring labelsOnTriggerPaths;
183  for (vstring::const_iterator i = trig_name_list_.begin(),
184  e = trig_name_list_.end();
185  i != e;
186  ++i) {
187  fillTrigPath(proc_pset, preg, processConfiguration, trig_bitpos, *i, results_, &labelsOnTriggerPaths);
188  ++trig_bitpos;
189  hasPath = true;
190  }
191 
192  if (hasPath) {
193  // the results inserter stands alone
194  results_inserter_ = makeInserter(proc_pset,
195  preg,
196  actions, actReg_, processConfiguration, results_);
198  }
199 
200  TrigResPtr epptr(new HLTGlobalStatus(end_path_name_list_.size()));
201  endpath_results_ = epptr;
202 
203  // fill normal endpaths
204  vstring::iterator eib(end_path_name_list_.begin()), eie(end_path_name_list_.end());
205  for (int bitpos = 0; eib != eie; ++eib, ++bitpos) {
206  fillEndPath(proc_pset, preg, processConfiguration, bitpos, *eib);
207  }
208 
209  //See if all modules were used
210  std::set<std::string> usedWorkerLabels;
211  for (AllWorkers::iterator itWorker = workersBegin();
212  itWorker != workersEnd();
213  ++itWorker) {
214  usedWorkerLabels.insert((*itWorker)->description().moduleLabel());
215  }
216  std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string> >("@all_modules"));
217  std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
218  std::vector<std::string> unusedLabels;
219  set_difference(modulesInConfigSet.begin(), modulesInConfigSet.end(),
220  usedWorkerLabels.begin(), usedWorkerLabels.end(),
221  back_inserter(unusedLabels));
222  //does the configuration say we should allow on demand?
223  bool allowUnscheduled = opts.getUntrackedParameter<bool>("allowUnscheduled", false);
224  std::set<std::string> unscheduledLabels;
225  std::vector<std::string> shouldBeUsedLabels;
226  if (!unusedLabels.empty()) {
227  //Need to
228  // 1) create worker
229  // 2) if it is a WorkerT<EDProducer>, add it to our list
230  // 3) hand list to our delayed reader
231 
232  for (std::vector<std::string>::iterator itLabel = unusedLabels.begin(), itLabelEnd = unusedLabels.end();
233  itLabel != itLabelEnd;
234  ++itLabel) {
235  if (allowUnscheduled) {
236  bool isTracked;
237  ParameterSet* modulePSet(proc_pset.getPSetForUpdate(*itLabel, isTracked));
238  assert(isTracked);
239  assert(modulePSet != 0);
240  WorkerParams params(proc_pset, modulePSet, preg,
241  processConfiguration, *act_table_);
242  Worker* newWorker(worker_reg_.getWorker(params, *itLabel));
243  if (dynamic_cast<WorkerT<EDProducer>*>(newWorker) ||
244  dynamic_cast<WorkerT<EDFilter>*>(newWorker)) {
245  unscheduledLabels.insert(*itLabel);
246  unscheduled_->addWorker(newWorker);
247  //add to list so it gets reset each new event
248  addToAllWorkers(newWorker);
249  } else {
250  //not a producer so should be marked as not used
251  shouldBeUsedLabels.push_back(*itLabel);
252  }
253  } else {
254  //everthing is marked are unused so no 'on demand' allowed
255  shouldBeUsedLabels.push_back(*itLabel);
256  }
257  }
258  if (!shouldBeUsedLabels.empty()) {
259  std::ostringstream unusedStream;
260  unusedStream << "'" << shouldBeUsedLabels.front() << "'";
261  for (std::vector<std::string>::iterator itLabel = shouldBeUsedLabels.begin() + 1,
262  itLabelEnd = shouldBeUsedLabels.end();
263  itLabel != itLabelEnd;
264  ++itLabel) {
265  unusedStream << ",'" << *itLabel << "'";
266  }
267  LogInfo("path")
268  << "The following module labels are not assigned to any path:\n"
269  << unusedStream.str()
270  << "\n";
271  }
272  }
273  if (!unscheduledLabels.empty()) {
274  for (ProductRegistry::ProductList::const_iterator it = preg.productList().begin(),
275  itEnd = preg.productList().end();
276  it != itEnd;
277  ++it) {
278  if (it->second.produced() &&
279  it->second.branchType() == InEvent &&
280  unscheduledLabels.end() != unscheduledLabels.find(it->second.moduleLabel())) {
281  it->second.setOnDemand();
282  }
283  }
284  }
285 
286  std::map<std::string, std::vector<std::pair<std::string, int> > > outputModulePathPositions;
287  reduceParameterSet(proc_pset, modulesInConfig, modulesInConfigSet, labelsOnTriggerPaths, shouldBeUsedLabels, outputModulePathPositions);
288 
289  proc_pset.registerIt();
290  pset::Registry::instance()->extra().setID(proc_pset.id());
291  processConfiguration->setParameterSetID(proc_pset.id());
292 
293  initializeEarlyDelete(opts,preg,subProcPSet);
294 
295  // This is used for a little sanity-check to make sure no code
296  // modifications alter the number of workers at a later date.
297  size_t all_workers_count = all_workers_.size();
298 
299  for (AllWorkers::iterator i = all_workers_.begin(), e = all_workers_.end();
300  i != e;
301  ++i) {
302 
303  // All the workers should be in all_workers_ by this point. Thus
304  // we can now fill all_output_workers_.
305  OutputWorker* ow = dynamic_cast<OutputWorker*>(*i);
306  if (ow) {
307  all_output_workers_.push_back(ow);
308  }
309  }
310  // Now that the output workers are filled in, set any output limits.
311  limitOutput(proc_pset);
312 
314  preg.setFrozen();
315 
316  for (AllOutputWorkers::iterator i = all_output_workers_.begin(), e = all_output_workers_.end();
317  i != e; ++i) {
318  (*i)->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
319  }
320 
321  // Sanity check: make sure nobody has added a worker after we've
322  // already relied on all_workers_ being full.
323  assert (all_workers_count == all_workers_.size());
324 
325  ProcessConfigurationRegistry::instance()->insertMapped(*processConfiguration);
327  fillProductRegistryTransients(*processConfiguration, preg);
328  } // Schedule::Schedule
State state_
Definition: Schedule.h:294
void initializeEarlyDelete(edm::ParameterSet const &opts, edm::ProductRegistry const &preg, edm::ParameterSet const *subProcPSet)
Definition: Schedule.cc:331
int i
Definition: DBlmapReader.cc:9
roAction_t actions[nactions]
Definition: GenABIO.cc:200
void limitOutput(ParameterSet const &proc_pset)
Definition: Schedule.cc:599
AllOutputWorkers all_output_workers_
Definition: Schedule.h:303
WorkerPtr results_inserter_
Definition: Schedule.h:301
WorkerRegistry worker_reg_
Definition: Schedule.h:290
static ThreadSafeRegistry * instance()
TrigPaths trig_paths_
Definition: Schedule.h:304
TrigResPtr endpath_results_
Definition: Schedule.h:299
int total_passed_
Definition: Schedule.h:324
bool insertMapped(value_type const &v)
boost::shared_ptr< HLTGlobalStatus > TrigResPtr
Definition: Schedule.h:107
void fillProductRegistryTransients(std::vector< ProcessConfiguration > const &pcVec, ProductRegistry const &preg, bool okToRegister=false)
void fillEndPath(ParameterSet &proc_pset, ProductRegistry &preg, boost::shared_ptr< ProcessConfiguration const > processConfiguration, int bitpos, std::string const &name)
Definition: Schedule.cc:745
RunStopwatch::StopwatchPointer stopwatch_
Definition: Schedule.h:325
void reduceParameterSet(ParameterSet &proc_pset, vstring &modulesInConfig, std::set< std::string > const &modulesInConfigSet, vstring &labelsOnTriggerPaths, vstring &shouldBeUsedLabels, std::map< std::string, std::vector< std::pair< std::string, int > > > &outputModulePathPositions)
Definition: Schedule.cc:481
vstring trig_name_list_
Definition: Schedule.h:295
ActionTable const * act_table_
Definition: Schedule.h:291
AllWorkers::const_iterator workersBegin() const
Definition: Schedule.h:229
volatile bool endpathsAreActive_
Definition: Schedule.h:329
TrigResPtr results_
Definition: Schedule.h:298
int total_events_
Definition: Schedule.h:323
void loadMissingDictionaries()
Definition: ReflexTools.cc:231
TrigPaths end_paths_
Definition: Schedule.h:305
std::vector< std::string > vstring
bool wantSummary_
Definition: Schedule.h:322
static void updateRegistries(ProductRegistry const &reg)
void fillTrigPath(ParameterSet &proc_pset, ProductRegistry &preg, boost::shared_ptr< ProcessConfiguration const > processConfiguration, int bitpos, std::string const &name, TrigResPtr, vstring *labelsOnTriggerPaths)
Definition: Schedule.cc:720
Worker * getWorker(WorkerParams const &p, std::string const &moduleLabel)
Retrieve the particular instance of the worker.
vstring end_path_name_list_
Definition: Schedule.h:296
AllWorkers::const_iterator workersEnd() const
Definition: Schedule.h:233
void addToAllWorkers(Worker *w)
Definition: Schedule.cc:1318
boost::shared_ptr< ActivityRegistry > actReg_
Definition: Schedule.h:292
AllWorkers all_workers_
Definition: Schedule.h:302
boost::shared_ptr< UnscheduledCallProducer > unscheduled_
Definition: Schedule.h:327

Member Function Documentation

void edm::Schedule::addToAllWorkers ( Worker w)
private

Definition at line 1318 of file Schedule.cc.

References all_workers_, edm::search_all(), edm::Worker::useStopwatch(), and wantSummary_.

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

1318  {
1319  if (!search_all(all_workers_, w)) {
1320  if (wantSummary_) {
1321  w->useStopwatch();
1322  }
1323  all_workers_.push_back(w);
1324  }
1325  }
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:46
bool wantSummary_
Definition: Schedule.h:322
T w() const
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::availablePaths ( std::vector< std::string > &  oLabelsToFill) const

adds to oLabelsToFill the labels for all paths in the process

Definition at line 1209 of file Schedule.cc.

References edm::Path::name(), create_public_pileup_plots::transform, and trig_paths_.

Referenced by edm::ScheduleInfo::availablePaths().

1209  {
1210  oLabelsToFill.reserve(trig_paths_.size());
1211  std::transform(trig_paths_.begin(),
1212  trig_paths_.end(),
1213  std::back_inserter(oLabelsToFill),
1214  boost::bind(&Path::name, _1));
1215  }
TrigPaths trig_paths_
Definition: Schedule.h:304
std::string const & name() const
Definition: Path.h:58
void edm::Schedule::beginJob ( void  )

Definition at line 1161 of file Schedule.cc.

References all_workers_, edm::Worker::beginJob(), edm::for_all(), and edm::loadMissingDictionaries().

1161  {
1162  for_all(all_workers_, boost::bind(&Worker::beginJob, _1));
1164  }
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void loadMissingDictionaries()
Definition: ReflexTools.cc:231
void beginJob()
Definition: Worker.cc:72
AllWorkers all_workers_
Definition: Schedule.h:302
bool edm::Schedule::changeModule ( std::string const &  iLabel,
ParameterSet const &  iPSet 
)

clone the type of module with label iLabel but configure with iPSet. Returns true if successful.

Definition at line 1173 of file Schedule.cc.

References all_workers_, edm::Worker::beginJob(), SurfaceDeformationFactory::create(), edm::Worker::description(), newFWLiteAna::found, reco::get(), and edm::ModuleDescription::moduleName().

Referenced by edm::ModuleChanger::changeModule().

1174  {
1175  Worker* found = 0;
1176  for (AllWorkers::const_iterator it=all_workers_.begin(), itEnd=all_workers_.end();
1177  it != itEnd; ++it) {
1178  if ((*it)->description().moduleLabel() == iLabel) {
1179  found = *it;
1180  break;
1181  }
1182  }
1183  if (0 == found) {
1184  return false;
1185  }
1186 
1187  std::auto_ptr<Maker> wm(MakerPluginFactory::get()->create(found->description().moduleName()));
1188  wm->swapModule(found, iPSet);
1189  found->beginJob();
1190  return true;
1191  }
SurfaceDeformation * create(int type, const std::vector< double > &params)
T get(const Candidate &c)
Definition: component.h:56
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::clearCounters ( )

Clear all the counters in the trigger report.

Definition at line 1303 of file Schedule.cc.

References all_workers_, edm::Path::clearCounters(), edm::Worker::clearCounters(), end_paths_, edm::for_all(), total_events_, total_passed_, and trig_paths_.

1303  {
1305  for_all(trig_paths_, boost::bind(&Path::clearCounters, _1));
1306  for_all(end_paths_, boost::bind(&Path::clearCounters, _1));
1307  for_all(all_workers_, boost::bind(&Worker::clearCounters, _1));
1308  }
TrigPaths trig_paths_
Definition: Schedule.h:304
void clearCounters()
Definition: Worker.h:85
int total_passed_
Definition: Schedule.h:324
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
int total_events_
Definition: Schedule.h:323
TrigPaths end_paths_
Definition: Schedule.h:305
void clearCounters()
Definition: Path.cc:143
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::closeOutputFiles ( )

Definition at line 1118 of file Schedule.cc.

References all_output_workers_, edm::OutputWorker::closeFile(), and edm::for_all().

1118  {
1120  }
AllOutputWorkers all_output_workers_
Definition: Schedule.h:303
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void edm::Schedule::enableEndPaths ( bool  active)

Turn end_paths "off" if "active" is false; turn end_paths "on" if "active" is true.

Definition at line 1235 of file Schedule.cc.

References endpathsAreActive_.

1235  {
1236  endpathsAreActive_ = active;
1237  }
volatile bool endpathsAreActive_
Definition: Schedule.h:329
void edm::Schedule::endJob ( ExceptionCollector collector)

Definition at line 767 of file Schedule.cc.

References edm::ExceptionCollector::addException(), edm::convertException::badAllocToEDM(), trackerHits::c, edm::convertException::charPtrToEDM(), alignCSCRings::e, end_paths_, cppFunctionSkipper::exception, i, max(), pi, edm::convertException::stdToEDM(), edm::convertException::stringToEDM(), timeCpuReal(), totalEvents(), totalEventsFailed(), totalEventsPassed(), trig_paths_, edm::convertException::unknownToEDM(), wantSummary_, workersBegin(), and workersEnd().

767  {
768  bool failure = false;
769  AllWorkers::iterator ai(workersBegin()), ae(workersEnd());
770  for (; ai != ae; ++ai) {
771  try {
772  try {
773  (*ai)->endJob();
774  }
775  catch (cms::Exception& e) { throw; }
776  catch (std::bad_alloc& bda) { convertException::badAllocToEDM(); }
777  catch (std::exception& e) { convertException::stdToEDM(e); }
778  catch (std::string& s) { convertException::stringToEDM(s); }
779  catch (char const* c) { convertException::charPtrToEDM(c); }
780  catch (...) { convertException::unknownToEDM(); }
781  }
782  catch (cms::Exception const& ex) {
783  collector.addException(ex);
784  failure = true;
785  }
786  }
787  if (failure) {
788  return;
789  }
790 
791  if (wantSummary_ == false) return;
792 
793  TrigPaths::const_iterator pi, pe;
794 
795  // The trigger report (pass/fail etc.):
796 
797  LogVerbatim("FwkSummary") << "";
798  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Event Summary ------------";
799  LogVerbatim("FwkSummary") << "TrigReport"
800  << " Events total = " << totalEvents()
801  << " passed = " << totalEventsPassed()
802  << " failed = " << (totalEventsFailed())
803  << "";
804 
805  LogVerbatim("FwkSummary") << "";
806  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Path Summary ------------";
807  LogVerbatim("FwkSummary") << "TrigReport "
808  << std::right << std::setw(10) << "Trig Bit#" << " "
809  << std::right << std::setw(10) << "Run" << " "
810  << std::right << std::setw(10) << "Passed" << " "
811  << std::right << std::setw(10) << "Failed" << " "
812  << std::right << std::setw(10) << "Error" << " "
813  << "Name" << "";
814  pi = trig_paths_.begin();
815  pe = trig_paths_.end();
816  for (; pi != pe; ++pi) {
817  LogVerbatim("FwkSummary") << "TrigReport "
818  << std::right << std::setw(5) << 1
819  << std::right << std::setw(5) << pi->bitPosition() << " "
820  << std::right << std::setw(10) << pi->timesRun() << " "
821  << std::right << std::setw(10) << pi->timesPassed() << " "
822  << std::right << std::setw(10) << pi->timesFailed() << " "
823  << std::right << std::setw(10) << pi->timesExcept() << " "
824  << pi->name() << "";
825  }
826 
827  LogVerbatim("FwkSummary") << "";
828  LogVerbatim("FwkSummary") << "TrigReport " << "-------End-Path Summary ------------";
829  LogVerbatim("FwkSummary") << "TrigReport "
830  << std::right << std::setw(10) << "Trig Bit#" << " "
831  << std::right << std::setw(10) << "Run" << " "
832  << std::right << std::setw(10) << "Passed" << " "
833  << std::right << std::setw(10) << "Failed" << " "
834  << std::right << std::setw(10) << "Error" << " "
835  << "Name" << "";
836  pi = end_paths_.begin();
837  pe = end_paths_.end();
838  for (; pi != pe; ++pi) {
839  LogVerbatim("FwkSummary") << "TrigReport "
840  << std::right << std::setw(5) << 0
841  << std::right << std::setw(5) << pi->bitPosition() << " "
842  << std::right << std::setw(10) << pi->timesRun() << " "
843  << std::right << std::setw(10) << pi->timesPassed() << " "
844  << std::right << std::setw(10) << pi->timesFailed() << " "
845  << std::right << std::setw(10) << pi->timesExcept() << " "
846  << pi->name() << "";
847  }
848 
849  pi = trig_paths_.begin();
850  pe = trig_paths_.end();
851  for (; pi != pe; ++pi) {
852  LogVerbatim("FwkSummary") << "";
853  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Modules in Path: " << pi->name() << " ------------";
854  LogVerbatim("FwkSummary") << "TrigReport "
855  << std::right << std::setw(10) << "Trig Bit#" << " "
856  << std::right << std::setw(10) << "Visited" << " "
857  << std::right << std::setw(10) << "Passed" << " "
858  << std::right << std::setw(10) << "Failed" << " "
859  << std::right << std::setw(10) << "Error" << " "
860  << "Name" << "";
861 
862  for (unsigned int i = 0; i < pi->size(); ++i) {
863  LogVerbatim("FwkSummary") << "TrigReport "
864  << std::right << std::setw(5) << 1
865  << std::right << std::setw(5) << pi->bitPosition() << " "
866  << std::right << std::setw(10) << pi->timesVisited(i) << " "
867  << std::right << std::setw(10) << pi->timesPassed(i) << " "
868  << std::right << std::setw(10) << pi->timesFailed(i) << " "
869  << std::right << std::setw(10) << pi->timesExcept(i) << " "
870  << pi->getWorker(i)->description().moduleLabel() << "";
871  }
872  }
873 
874  pi = end_paths_.begin();
875  pe = end_paths_.end();
876  for (; pi != pe; ++pi) {
877  LogVerbatim("FwkSummary") << "";
878  LogVerbatim("FwkSummary") << "TrigReport " << "------ Modules in End-Path: " << pi->name() << " ------------";
879  LogVerbatim("FwkSummary") << "TrigReport "
880  << std::right << std::setw(10) << "Trig Bit#" << " "
881  << std::right << std::setw(10) << "Visited" << " "
882  << std::right << std::setw(10) << "Passed" << " "
883  << std::right << std::setw(10) << "Failed" << " "
884  << std::right << std::setw(10) << "Error" << " "
885  << "Name" << "";
886 
887  for (unsigned int i = 0; i < pi->size(); ++i) {
888  LogVerbatim("FwkSummary") << "TrigReport "
889  << std::right << std::setw(5) << 0
890  << std::right << std::setw(5) << pi->bitPosition() << " "
891  << std::right << std::setw(10) << pi->timesVisited(i) << " "
892  << std::right << std::setw(10) << pi->timesPassed(i) << " "
893  << std::right << std::setw(10) << pi->timesFailed(i) << " "
894  << std::right << std::setw(10) << pi->timesExcept(i) << " "
895  << pi->getWorker(i)->description().moduleLabel() << "";
896  }
897  }
898 
899  LogVerbatim("FwkSummary") << "";
900  LogVerbatim("FwkSummary") << "TrigReport " << "---------- Module Summary ------------";
901  LogVerbatim("FwkSummary") << "TrigReport "
902  << std::right << std::setw(10) << "Visited" << " "
903  << std::right << std::setw(10) << "Run" << " "
904  << std::right << std::setw(10) << "Passed" << " "
905  << std::right << std::setw(10) << "Failed" << " "
906  << std::right << std::setw(10) << "Error" << " "
907  << "Name" << "";
908  ai = workersBegin();
909  ae = workersEnd();
910  for (; ai != ae; ++ai) {
911  LogVerbatim("FwkSummary") << "TrigReport "
912  << std::right << std::setw(10) << (*ai)->timesVisited() << " "
913  << std::right << std::setw(10) << (*ai)->timesRun() << " "
914  << std::right << std::setw(10) << (*ai)->timesPassed() << " "
915  << std::right << std::setw(10) << (*ai)->timesFailed() << " "
916  << std::right << std::setw(10) << (*ai)->timesExcept() << " "
917  << (*ai)->description().moduleLabel() << "";
918 
919  }
920  LogVerbatim("FwkSummary") << "";
921 
922  // The timing report (CPU and Real Time):
923 
924  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Event Summary ---[sec]----";
925  LogVerbatim("FwkSummary") << "TimeReport"
926  << std::setprecision(6) << std::fixed
927  << " CPU/event = " << timeCpuReal().first/std::max(1, totalEvents())
928  << " Real/event = " << timeCpuReal().second/std::max(1, totalEvents())
929  << "";
930 
931  LogVerbatim("FwkSummary") << "";
932  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Path Summary ---[sec]----";
933  LogVerbatim("FwkSummary") << "TimeReport "
934  << std::right << std::setw(22) << "per event "
935  << std::right << std::setw(22) << "per path-run "
936  << "";
937  LogVerbatim("FwkSummary") << "TimeReport "
938  << std::right << std::setw(10) << "CPU" << " "
939  << std::right << std::setw(10) << "Real" << " "
940  << std::right << std::setw(10) << "CPU" << " "
941  << std::right << std::setw(10) << "Real" << " "
942  << "Name" << "";
943  pi = trig_paths_.begin();
944  pe = trig_paths_.end();
945  for (; pi != pe; ++pi) {
946  LogVerbatim("FwkSummary") << "TimeReport "
947  << std::setprecision(6) << std::fixed
948  << std::right << std::setw(10) << pi->timeCpuReal().first/std::max(1, totalEvents()) << " "
949  << std::right << std::setw(10) << pi->timeCpuReal().second/std::max(1, totalEvents()) << " "
950  << std::right << std::setw(10) << pi->timeCpuReal().first/std::max(1, pi->timesRun()) << " "
951  << std::right << std::setw(10) << pi->timeCpuReal().second/std::max(1, pi->timesRun()) << " "
952  << pi->name() << "";
953  }
954  LogVerbatim("FwkSummary") << "TimeReport "
955  << std::right << std::setw(10) << "CPU" << " "
956  << std::right << std::setw(10) << "Real" << " "
957  << std::right << std::setw(10) << "CPU" << " "
958  << std::right << std::setw(10) << "Real" << " "
959  << "Name" << "";
960  LogVerbatim("FwkSummary") << "TimeReport "
961  << std::right << std::setw(22) << "per event "
962  << std::right << std::setw(22) << "per path-run "
963  << "";
964 
965  LogVerbatim("FwkSummary") << "";
966  LogVerbatim("FwkSummary") << "TimeReport " << "-------End-Path Summary ---[sec]----";
967  LogVerbatim("FwkSummary") << "TimeReport "
968  << std::right << std::setw(22) << "per event "
969  << std::right << std::setw(22) << "per endpath-run "
970  << "";
971  LogVerbatim("FwkSummary") << "TimeReport "
972  << std::right << std::setw(10) << "CPU" << " "
973  << std::right << std::setw(10) << "Real" << " "
974  << std::right << std::setw(10) << "CPU" << " "
975  << std::right << std::setw(10) << "Real" << " "
976  << "Name" << "";
977  pi = end_paths_.begin();
978  pe = end_paths_.end();
979  for (; pi != pe; ++pi) {
980  LogVerbatim("FwkSummary") << "TimeReport "
981  << std::setprecision(6) << std::fixed
982  << std::right << std::setw(10) << pi->timeCpuReal().first/std::max(1, totalEvents()) << " "
983  << std::right << std::setw(10) << pi->timeCpuReal().second/std::max(1, totalEvents()) << " "
984  << std::right << std::setw(10) << pi->timeCpuReal().first/std::max(1, pi->timesRun()) << " "
985  << std::right << std::setw(10) << pi->timeCpuReal().second/std::max(1, pi->timesRun()) << " "
986  << pi->name() << "";
987  }
988  LogVerbatim("FwkSummary") << "TimeReport "
989  << std::right << std::setw(10) << "CPU" << " "
990  << std::right << std::setw(10) << "Real" << " "
991  << std::right << std::setw(10) << "CPU" << " "
992  << std::right << std::setw(10) << "Real" << " "
993  << "Name" << "";
994  LogVerbatim("FwkSummary") << "TimeReport "
995  << std::right << std::setw(22) << "per event "
996  << std::right << std::setw(22) << "per endpath-run "
997  << "";
998 
999  pi = trig_paths_.begin();
1000  pe = trig_paths_.end();
1001  for (; pi != pe; ++pi) {
1002  LogVerbatim("FwkSummary") << "";
1003  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Modules in Path: " << pi->name() << " ---[sec]----";
1004  LogVerbatim("FwkSummary") << "TimeReport "
1005  << std::right << std::setw(22) << "per event "
1006  << std::right << std::setw(22) << "per module-visit "
1007  << "";
1008  LogVerbatim("FwkSummary") << "TimeReport "
1009  << std::right << std::setw(10) << "CPU" << " "
1010  << std::right << std::setw(10) << "Real" << " "
1011  << std::right << std::setw(10) << "CPU" << " "
1012  << std::right << std::setw(10) << "Real" << " "
1013  << "Name" << "";
1014  for (unsigned int i = 0; i < pi->size(); ++i) {
1015  LogVerbatim("FwkSummary") << "TimeReport "
1016  << std::setprecision(6) << std::fixed
1017  << std::right << std::setw(10) << pi->timeCpuReal(i).first/std::max(1, totalEvents()) << " "
1018  << std::right << std::setw(10) << pi->timeCpuReal(i).second/std::max(1, totalEvents()) << " "
1019  << std::right << std::setw(10) << pi->timeCpuReal(i).first/std::max(1, pi->timesVisited(i)) << " "
1020  << std::right << std::setw(10) << pi->timeCpuReal(i).second/std::max(1, pi->timesVisited(i)) << " "
1021  << pi->getWorker(i)->description().moduleLabel() << "";
1022  }
1023  }
1024  LogVerbatim("FwkSummary") << "TimeReport "
1025  << std::right << std::setw(10) << "CPU" << " "
1026  << std::right << std::setw(10) << "Real" << " "
1027  << std::right << std::setw(10) << "CPU" << " "
1028  << std::right << std::setw(10) << "Real" << " "
1029  << "Name" << "";
1030  LogVerbatim("FwkSummary") << "TimeReport "
1031  << std::right << std::setw(22) << "per event "
1032  << std::right << std::setw(22) << "per module-visit "
1033  << "";
1034 
1035  pi = end_paths_.begin();
1036  pe = end_paths_.end();
1037  for (; pi != pe; ++pi) {
1038  LogVerbatim("FwkSummary") << "";
1039  LogVerbatim("FwkSummary") << "TimeReport " << "------ Modules in End-Path: " << pi->name() << " ---[sec]----";
1040  LogVerbatim("FwkSummary") << "TimeReport "
1041  << std::right << std::setw(22) << "per event "
1042  << std::right << std::setw(22) << "per module-visit "
1043  << "";
1044  LogVerbatim("FwkSummary") << "TimeReport "
1045  << std::right << std::setw(10) << "CPU" << " "
1046  << std::right << std::setw(10) << "Real" << " "
1047  << std::right << std::setw(10) << "CPU" << " "
1048  << std::right << std::setw(10) << "Real" << " "
1049  << "Name" << "";
1050  for (unsigned int i = 0; i < pi->size(); ++i) {
1051  LogVerbatim("FwkSummary") << "TimeReport "
1052  << std::setprecision(6) << std::fixed
1053  << std::right << std::setw(10) << pi->timeCpuReal(i).first/std::max(1, totalEvents()) << " "
1054  << std::right << std::setw(10) << pi->timeCpuReal(i).second/std::max(1, totalEvents()) << " "
1055  << std::right << std::setw(10) << pi->timeCpuReal(i).first/std::max(1, pi->timesVisited(i)) << " "
1056  << std::right << std::setw(10) << pi->timeCpuReal(i).second/std::max(1, pi->timesVisited(i)) << " "
1057  << pi->getWorker(i)->description().moduleLabel() << "";
1058  }
1059  }
1060  LogVerbatim("FwkSummary") << "TimeReport "
1061  << std::right << std::setw(10) << "CPU" << " "
1062  << std::right << std::setw(10) << "Real" << " "
1063  << std::right << std::setw(10) << "CPU" << " "
1064  << std::right << std::setw(10) << "Real" << " "
1065  << "Name" << "";
1066  LogVerbatim("FwkSummary") << "TimeReport "
1067  << std::right << std::setw(22) << "per event "
1068  << std::right << std::setw(22) << "per module-visit "
1069  << "";
1070 
1071  LogVerbatim("FwkSummary") << "";
1072  LogVerbatim("FwkSummary") << "TimeReport " << "---------- Module Summary ---[sec]----";
1073  LogVerbatim("FwkSummary") << "TimeReport "
1074  << std::right << std::setw(22) << "per event "
1075  << std::right << std::setw(22) << "per module-run "
1076  << std::right << std::setw(22) << "per module-visit "
1077  << "";
1078  LogVerbatim("FwkSummary") << "TimeReport "
1079  << std::right << std::setw(10) << "CPU" << " "
1080  << std::right << std::setw(10) << "Real" << " "
1081  << std::right << std::setw(10) << "CPU" << " "
1082  << std::right << std::setw(10) << "Real" << " "
1083  << std::right << std::setw(10) << "CPU" << " "
1084  << std::right << std::setw(10) << "Real" << " "
1085  << "Name" << "";
1086  ai = workersBegin();
1087  ae = workersEnd();
1088  for (; ai != ae; ++ai) {
1089  LogVerbatim("FwkSummary") << "TimeReport "
1090  << std::setprecision(6) << std::fixed
1091  << std::right << std::setw(10) << (*ai)->timeCpuReal().first/std::max(1, totalEvents()) << " "
1092  << std::right << std::setw(10) << (*ai)->timeCpuReal().second/std::max(1, totalEvents()) << " "
1093  << std::right << std::setw(10) << (*ai)->timeCpuReal().first/std::max(1, (*ai)->timesRun()) << " "
1094  << std::right << std::setw(10) << (*ai)->timeCpuReal().second/std::max(1, (*ai)->timesRun()) << " "
1095  << std::right << std::setw(10) << (*ai)->timeCpuReal().first/std::max(1, (*ai)->timesVisited()) << " "
1096  << std::right << std::setw(10) << (*ai)->timeCpuReal().second/std::max(1, (*ai)->timesVisited()) << " "
1097  << (*ai)->description().moduleLabel() << "";
1098  }
1099  LogVerbatim("FwkSummary") << "TimeReport "
1100  << std::right << std::setw(10) << "CPU" << " "
1101  << std::right << std::setw(10) << "Real" << " "
1102  << std::right << std::setw(10) << "CPU" << " "
1103  << std::right << std::setw(10) << "Real" << " "
1104  << std::right << std::setw(10) << "CPU" << " "
1105  << std::right << std::setw(10) << "Real" << " "
1106  << "Name" << "";
1107  LogVerbatim("FwkSummary") << "TimeReport "
1108  << std::right << std::setw(22) << "per event "
1109  << std::right << std::setw(22) << "per module-run "
1110  << std::right << std::setw(22) << "per module-visit "
1111  << "";
1112 
1113  LogVerbatim("FwkSummary") << "";
1114  LogVerbatim("FwkSummary") << "T---Report end!" << "";
1115  LogVerbatim("FwkSummary") << "";
1116  }
int i
Definition: DBlmapReader.cc:9
std::pair< double, double > timeCpuReal() const
Definition: Schedule.h:167
TrigPaths trig_paths_
Definition: Schedule.h:304
int totalEventsFailed() const
Definition: Schedule.h:201
int totalEventsPassed() const
Definition: Schedule.h:195
const T & max(const T &a, const T &b)
int totalEvents() const
Definition: Schedule.h:189
void stdToEDM(std::exception const &e)
AllWorkers::const_iterator workersBegin() const
Definition: Schedule.h:229
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
TrigPaths end_paths_
Definition: Schedule.h:305
bool wantSummary_
Definition: Schedule.h:322
double pi
AllWorkers::const_iterator workersEnd() const
Definition: Schedule.h:233
bool edm::Schedule::endPathsEnabled ( ) const

Return true if end_paths are active, and false if they are inactive.

Definition at line 1240 of file Schedule.cc.

References endpathsAreActive_.

1240  {
1241  return endpathsAreActive_;
1242  }
volatile bool endpathsAreActive_
Definition: Schedule.h:329
void edm::Schedule::fillEndPath ( ParameterSet proc_pset,
ProductRegistry preg,
boost::shared_ptr< ProcessConfiguration const >  processConfiguration,
int  bitpos,
std::string const &  name 
)
private

Definition at line 745 of file Schedule.cc.

References act_table_, actReg_, addToAllWorkers(), end_paths_, endpath_results_, fillWorkers(), edm::for_all(), AlCaHLTBitMon_ParallelJobs::p, edm::Path::useStopwatch(), and wantSummary_.

Referenced by Schedule().

748  {
749  PathWorkers tmpworkers;
750  fillWorkers(proc_pset, preg, processConfiguration, name, true, tmpworkers, 0);
751  Workers holder;
752 
753  for (PathWorkers::iterator wi(tmpworkers.begin()), we(tmpworkers.end()); wi != we; ++wi) {
754  holder.push_back(wi->getWorker());
755  }
756 
757  if (!tmpworkers.empty()) {
758  Path p(bitpos, name, tmpworkers, endpath_results_, *act_table_, actReg_, true);
759  if (wantSummary_) {
760  p.useStopwatch();
761  }
762  end_paths_.push_back(p);
763  }
764  for_all(holder, boost::bind(&Schedule::addToAllWorkers, this, _1));
765  }
std::vector< WorkerInPath > PathWorkers
Definition: Schedule.h:114
TrigResPtr endpath_results_
Definition: Schedule.h:299
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
ActionTable const * act_table_
Definition: Schedule.h:291
std::vector< Worker * > Workers
Definition: Schedule.h:112
TrigPaths end_paths_
Definition: Schedule.h:305
bool wantSummary_
Definition: Schedule.h:322
void fillWorkers(ParameterSet &proc_pset, ProductRegistry &preg, boost::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &name, bool ignoreFilters, PathWorkers &out, vstring *labelsOnPaths)
Definition: Schedule.cc:661
void addToAllWorkers(Worker *w)
Definition: Schedule.cc:1318
boost::shared_ptr< ActivityRegistry > actReg_
Definition: Schedule.h:292
void edm::Schedule::fillTrigPath ( ParameterSet proc_pset,
ProductRegistry preg,
boost::shared_ptr< ProcessConfiguration const >  processConfiguration,
int  bitpos,
std::string const &  name,
TrigResPtr  trptr,
vstring labelsOnTriggerPaths 
)
private

Definition at line 720 of file Schedule.cc.

References act_table_, actReg_, addToAllWorkers(), fillWorkers(), edm::for_all(), AlCaHLTBitMon_ParallelJobs::p, trig_paths_, edm::Path::useStopwatch(), and wantSummary_.

Referenced by Schedule().

724  {
725  PathWorkers tmpworkers;
726  Workers holder;
727  fillWorkers(proc_pset, preg, processConfiguration, name, false, tmpworkers, labelsOnTriggerPaths);
728 
729  for (PathWorkers::iterator wi(tmpworkers.begin()),
730  we(tmpworkers.end()); wi != we; ++wi) {
731  holder.push_back(wi->getWorker());
732  }
733 
734  // an empty path will cause an extra bit that is not used
735  if (!tmpworkers.empty()) {
736  Path p(bitpos, name, tmpworkers, trptr, *act_table_, actReg_, false);
737  if (wantSummary_) {
738  p.useStopwatch();
739  }
740  trig_paths_.push_back(p);
741  }
742  for_all(holder, boost::bind(&Schedule::addToAllWorkers, this, _1));
743  }
std::vector< WorkerInPath > PathWorkers
Definition: Schedule.h:114
TrigPaths trig_paths_
Definition: Schedule.h:304
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
ActionTable const * act_table_
Definition: Schedule.h:291
std::vector< Worker * > Workers
Definition: Schedule.h:112
bool wantSummary_
Definition: Schedule.h:322
void fillWorkers(ParameterSet &proc_pset, ProductRegistry &preg, boost::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &name, bool ignoreFilters, PathWorkers &out, vstring *labelsOnPaths)
Definition: Schedule.cc:661
void addToAllWorkers(Worker *w)
Definition: Schedule.cc:1318
boost::shared_ptr< ActivityRegistry > actReg_
Definition: Schedule.h:292
void edm::Schedule::fillWorkers ( ParameterSet proc_pset,
ProductRegistry preg,
boost::shared_ptr< ProcessConfiguration const >  processConfiguration,
std::string const &  name,
bool  ignoreFilters,
PathWorkers out,
vstring labelsOnPaths 
)
private

Definition at line 661 of file Schedule.cc.

References act_table_, edm::errors::Configuration, edm::Worker::description(), end_path_name_list_, edm::hlt::Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getPSetForUpdate(), edm::ParameterSet::getUntrackedParameter(), edm::WorkerRegistry::getWorker(), edm::WorkerInPath::Ignore, edm::ModuleDescription::moduleName(), mergeVDriftHistosByStation::name, edm::WorkerInPath::Normal, edm::search_all(), edm::WorkerInPath::Veto, w(), and worker_reg_.

Referenced by fillEndPath(), and fillTrigPath().

667  {
668  vstring modnames = proc_pset.getParameter<vstring>(name);
669  vstring::iterator it(modnames.begin()), ie(modnames.end());
670  PathWorkers tmpworkers;
671 
672  for (; it != ie; ++it) {
673 
674  if (labelsOnPaths) labelsOnPaths->push_back(*it);
675 
677  if ((*it)[0] == '!') filterAction = WorkerInPath::Veto;
678  else if ((*it)[0] == '-') filterAction = WorkerInPath::Ignore;
679 
680  std::string moduleLabel = *it;
681  if (filterAction != WorkerInPath::Normal) moduleLabel.erase(0, 1);
682 
683  bool isTracked;
684  ParameterSet* modpset = proc_pset.getPSetForUpdate(moduleLabel, isTracked);
685  if (modpset == 0) {
686  std::string pathType("endpath");
688  pathType = std::string("path");
689  }
691  "The unknown module label \"" << moduleLabel <<
692  "\" appears in " << pathType << " \"" << name <<
693  "\"\n please check spelling or remove that label from the path.";
694  }
695  assert(isTracked);
696 
697  WorkerParams params(proc_pset, modpset, preg, processConfiguration, *act_table_);
698  Worker* worker = worker_reg_.getWorker(params, moduleLabel);
699  if (ignoreFilters && filterAction != WorkerInPath::Ignore && dynamic_cast<WorkerT<EDFilter>*>(worker)) {
700  // We have a filter on an end path, and the filter is not explicitly ignored.
701  // See if the filter is allowed.
702  std::vector<std::string> allowed_filters = proc_pset.getUntrackedParameter<vstring>("@filters_on_endpaths");
703  if (!search_all(allowed_filters, worker->description().moduleName())) {
704  // Filter is not allowed. Ignore the result, and issue a warning.
705  filterAction = WorkerInPath::Ignore;
706  LogWarning("FilterOnEndPath")
707  << "The EDFilter '" << worker->description().moduleName() << "' with module label '" << moduleLabel << "' appears on EndPath '" << name << "'.\n"
708  << "The return value of the filter will be ignored.\n"
709  << "To suppress this warning, either remove the filter from the endpath,\n"
710  << "or explicitly ignore it in the configuration by using cms.ignore().\n";
711  }
712  }
713  WorkerInPath w(worker, filterAction);
714  tmpworkers.push_back(w);
715  }
716 
717  out.swap(tmpworkers);
718  }
WorkerRegistry worker_reg_
Definition: Schedule.h:290
std::vector< WorkerInPath > PathWorkers
Definition: Schedule.h:114
ActionTable const * act_table_
Definition: Schedule.h:291
tuple out
Definition: dbtoconf.py:99
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:46
std::vector< std::string > vstring
Worker * getWorker(WorkerParams const &p, std::string const &moduleLabel)
Retrieve the particular instance of the worker.
vstring end_path_name_list_
Definition: Schedule.h:296
T w() const
std::vector< ModuleDescription const * > edm::Schedule::getAllModuleDescriptions ( ) const

Return a vector allowing const access to all the ModuleDescriptions for this Schedule. *** N.B. *** Ownership of the ModuleDescriptions is not *** passed to the caller. Do not call delete on these *** pointers!

Definition at line 1194 of file Schedule.cc.

References all_workers_, alignCSCRings::e, i, AlCaHLTBitMon_ParallelJobs::p, query::result, workersBegin(), and workersEnd().

Referenced by edm::ScheduleInfo::availableModuleLabels(), and edm::ScheduleInfo::parametersForModule().

1194  {
1195  AllWorkers::const_iterator i(workersBegin());
1196  AllWorkers::const_iterator e(workersEnd());
1197 
1198  std::vector<ModuleDescription const*> result;
1199  result.reserve(all_workers_.size());
1200 
1201  for (; i != e; ++i) {
1202  ModuleDescription const* p = (*i)->descPtr();
1203  result.push_back(p);
1204  }
1205  return result;
1206  }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
AllWorkers::const_iterator workersBegin() const
Definition: Schedule.h:229
AllWorkers::const_iterator workersEnd() const
Definition: Schedule.h:233
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::getTriggerReport ( TriggerReport rep) const

Return the trigger report information on paths, modules-in-path, modules-in-endpath, and modules.

Definition at line 1292 of file Schedule.cc.

References all_workers_, end_paths_, edm::TriggerReport::endPathSummaries, edm::TriggerReport::eventSummary, edm::fillPathSummary(), edm::fillWorkerSummary(), edm::EventSummary::totalEvents, totalEvents(), edm::EventSummary::totalEventsFailed, totalEventsFailed(), edm::EventSummary::totalEventsPassed, totalEventsPassed(), trig_paths_, edm::TriggerReport::trigPathSummaries, and edm::TriggerReport::workerSummaries.

1292  {
1293  rep.eventSummary.totalEvents = totalEvents();
1294  rep.eventSummary.totalEventsPassed = totalEventsPassed();
1295  rep.eventSummary.totalEventsFailed = totalEventsFailed();
1296 
1297  fill_summary(trig_paths_, rep.trigPathSummaries, &fillPathSummary);
1298  fill_summary(end_paths_, rep.endPathSummaries, &fillPathSummary);
1299  fill_summary(all_workers_, rep.workerSummaries, &fillWorkerSummary);
1300  }
void fillWorkerSummary(Worker const *pw, WorkerSummary &sum)
Definition: Schedule.cc:1287
TrigPaths trig_paths_
Definition: Schedule.h:304
int totalEventsFailed() const
Definition: Schedule.h:201
int totalEventsPassed() const
Definition: Schedule.h:195
int totalEvents() const
Definition: Schedule.h:189
TrigPaths end_paths_
Definition: Schedule.h:305
void fillPathSummary(Path const &path, PathSummary &sum)
Definition: Schedule.cc:1260
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::initializeEarlyDelete ( edm::ParameterSet const &  opts,
edm::ProductRegistry const &  preg,
edm::ParameterSet const *  subProcPSet 
)
private

Definition at line 331 of file Schedule.cc.

References all_workers_, delta, alignCSCRings::e, earlyDeleteBranchToCount_, earlyDeleteHelpers_, earlyDeleteHelperToBranchIndicies_, end_paths_, newFWLiteAna::found, edm::detail::ThreadSafeRegistry< KEY, T, E >::getMapped(), i, getHLTprescales::index, edm::InEvent, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::OutputWorker::keptProducts(), prof2calltree::l, n, AlCaHLTBitMon_ParallelJobs::p, resetEarlyDelete(), and trig_paths_.

Referenced by Schedule().

332  {
333  //for now, if have a subProcess, don't allow early delete
334  // In the future we should use the SubProcess's 'keep list' to decide what can be kept
335  if(subProcPSet) return;
336 
337  //see if 'canDeleteEarly' was set and if so setup the list with those products actually
338  // registered for this job
339  std::multimap<std::string,Worker*> branchToReadingWorker;
340  initializeBranchToReadingWorker(opts,preg,branchToReadingWorker);
341 
342  //If no delete early items have been specified we don't have to do anything
343  if(branchToReadingWorker.size()==0) {
344  return;
345  }
346  const std::vector<std::string> kEmpty;
347  std::map<Worker*,unsigned int> reserveSizeForWorker;
348  unsigned int upperLimitOnReadingWorker =0;
349  unsigned int upperLimitOnIndicies = 0;
350  unsigned int nUniqueBranchesToDelete=branchToReadingWorker.size();
351  for (AllWorkers::iterator i = all_workers_.begin(), e = all_workers_.end();
352  i != e;
353  ++i) {
354  OutputWorker* ow = dynamic_cast<OutputWorker*>(*i);
355  if (ow) {
356  if(branchToReadingWorker.size()>0) {
357  //If an OutputModule needs a product, we can't delete it early
358  // so we should remove it from our list
359  SelectionsArray const&kept = ow->keptProducts();
360  for( auto const& item: kept[InEvent]) {
361  auto found = branchToReadingWorker.equal_range(item->branchName());
362  if(found.first !=found.second) {
363  --nUniqueBranchesToDelete;
364  branchToReadingWorker.erase(found.first,found.second);
365  }
366  }
367  }
368  } else {
369  if(branchToReadingWorker.size()>0) {
370  //determine if this module could read a branch we want to delete early
371  auto pset = pset::Registry::instance()->getMapped((*i)->description().parameterSetID());
372  if(0!=pset) {
373  auto branches = pset->getUntrackedParameter<std::vector<std::string>>("mightGet",kEmpty);
374  if(not branches.empty()) {
375  ++upperLimitOnReadingWorker;
376  }
377  for(auto const& branch:branches){
378  auto found = branchToReadingWorker.equal_range(branch);
379  if(found.first != found.second) {
380  ++upperLimitOnIndicies;
381  ++reserveSizeForWorker[*i];
382  if(nullptr == found.first->second) {
383  found.first->second = *i;
384  } else {
385  branchToReadingWorker.insert(make_pair(found.first->first,*i));
386  }
387  }
388  }
389  }
390  }
391  }
392  }
393  {
394  auto it = branchToReadingWorker.begin();
395  std::vector<std::string> unusedBranches;
396  while(it !=branchToReadingWorker.end()) {
397  if(it->second == nullptr) {
398  unusedBranches.push_back(it->first);
399  //erasing the object invalidates the iterator so must advance it first
400  auto temp = it;
401  ++it;
402  branchToReadingWorker.erase(temp);
403  } else {
404  ++it;
405  }
406  }
407  if(not unusedBranches.empty()) {
408  LogWarning l("UnusedProductsForCanDeleteEarly");
409  l<<"The following products in the 'canDeleteEarly' list are not used in this job and will be ignored.\n"
410  " If possible, remove the producer from the job or add the product to the producer's own 'mightGet' list.";
411  for(auto const& n:unusedBranches){
412  l<<"\n "<<n;
413  }
414  }
415  }
416  if(0!=branchToReadingWorker.size()) {
417  earlyDeleteHelpers_.reserve(upperLimitOnReadingWorker);
418  earlyDeleteHelperToBranchIndicies_.resize(upperLimitOnIndicies,0);
419  earlyDeleteBranchToCount_.reserve(nUniqueBranchesToDelete);
420  std::map<const Worker*,EarlyDeleteHelper*> alreadySeenWorkers;
421  std::string lastBranchName;
422  size_t nextOpenIndex = 0;
423  unsigned int* beginAddress = &(earlyDeleteHelperToBranchIndicies_.front());
424  for(auto& branchAndWorker:branchToReadingWorker) {
425  if(lastBranchName != branchAndWorker.first) {
426  //have to put back the period we removed earlier in order to get the proper name
427  BranchID bid(branchAndWorker.first+".");
428  earlyDeleteBranchToCount_.emplace_back(std::make_pair(bid,0U));
429  lastBranchName = branchAndWorker.first;
430  }
431  auto found = alreadySeenWorkers.find(branchAndWorker.second);
432  if(alreadySeenWorkers.end() == found) {
433  //NOTE: we will set aside enough space in earlyDeleteHelperToBranchIndicies_ to accommodate
434  // all the branches that might be read by this worker. However, initially we will only tell the
435  // EarlyDeleteHelper about the first one. As additional branches are added via 'appendIndex' the
436  // EarlyDeleteHelper will automatically advance its internal end pointer.
437  size_t index = nextOpenIndex;
438  size_t nIndices = reserveSizeForWorker[branchAndWorker.second];
440  earlyDeleteHelpers_.emplace_back(EarlyDeleteHelper(beginAddress+index,
441  beginAddress+index+1,
443  branchAndWorker.second->setEarlyDeleteHelper(&(earlyDeleteHelpers_.back()));
444  alreadySeenWorkers.insert(std::make_pair(branchAndWorker.second,&(earlyDeleteHelpers_.back())));
445  nextOpenIndex +=nIndices;
446  } else {
447  found->second->appendIndex(earlyDeleteBranchToCount_.size()-1);
448  }
449  }
450 
451  //Now we can compactify the earlyDeleteHelperToBranchIndicies_ since we may have over estimated the
452  // space needed for each module
453  auto itLast = earlyDeleteHelpers_.begin();
454  for(auto it = earlyDeleteHelpers_.begin()+1;it != earlyDeleteHelpers_.end();++it) {
455  if(itLast->end() != it->begin()) {
456  //figure the offset for next Worker since it hasn't been moved yet so it has the original address
457  unsigned int delta = it->begin()- itLast->end();
458  it->shiftIndexPointers(delta);
459 
461  (itLast->end()-beginAddress),
463  (it->begin()-beginAddress));
464  }
465  itLast = it;
466  }
467  earlyDeleteHelperToBranchIndicies_.erase(earlyDeleteHelperToBranchIndicies_.begin()+(itLast->end()-beginAddress),
469 
470  //now tell the paths about the deleters
471  for(auto& p : trig_paths_) {
472  p.setEarlyDeleteHelpers(alreadySeenWorkers);
473  }
474  for(auto& p : end_paths_) {
475  p.setEarlyDeleteHelpers(alreadySeenWorkers);
476  }
478  }
479  }
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
void resetEarlyDelete()
Definition: Schedule.cc:1335
std::vector< EarlyDeleteHelper > earlyDeleteHelpers_
Definition: Schedule.h:320
static ThreadSafeRegistry * instance()
TrigPaths trig_paths_
Definition: Schedule.h:304
bool getMapped(key_type const &k, value_type &result) const
boost::array< Selections, NumBranchTypes > SelectionsArray
Definition: Selections.h:12
TrigPaths end_paths_
Definition: Schedule.h:305
std::vector< unsigned int > earlyDeleteHelperToBranchIndicies_
Definition: Schedule.h:317
std::vector< std::pair< BranchID, unsigned int > > earlyDeleteBranchToCount_
Definition: Schedule.h:310
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::limitOutput ( ParameterSet const &  proc_pset)
private

Definition at line 599 of file Schedule.cc.

References all_output_workers_, edm::errors::Configuration, edm::ParameterSet::empty(), edm::hlt::Exception, edm::ParameterSet::getParameterNamesForType(), edm::ParameterSet::getParameterSetNames(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), edm::OutputModuleDescription::maxEvents_, convertSQLitetoXML_cfg::output, and edm::search_all().

Referenced by Schedule().

599  {
600  std::string const output("output");
601 
602  ParameterSet const& maxEventsPSet = proc_pset.getUntrackedParameterSet("maxEvents", ParameterSet());
603  int maxEventSpecs = 0;
604  int maxEventsOut = -1;
605  ParameterSet const* vMaxEventsOut = 0;
606  std::vector<std::string> intNamesE = maxEventsPSet.getParameterNamesForType<int>(false);
607  if (search_all(intNamesE, output)) {
608  maxEventsOut = maxEventsPSet.getUntrackedParameter<int>(output);
609  ++maxEventSpecs;
610  }
611  std::vector<std::string> psetNamesE;
612  maxEventsPSet.getParameterSetNames(psetNamesE, false);
613  if (search_all(psetNamesE, output)) {
614  vMaxEventsOut = &maxEventsPSet.getUntrackedParameterSet(output);
615  ++maxEventSpecs;
616  }
617 
618  if (maxEventSpecs > 1) {
620  "\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
621  }
622 
623  if (maxEventSpecs == 0) {
624  return;
625  }
626 
627  for (AllOutputWorkers::const_iterator it = all_output_workers_.begin(), itEnd = all_output_workers_.end();
628  it != itEnd; ++it) {
629  OutputModuleDescription desc(maxEventsOut);
630  if (vMaxEventsOut != 0 && !vMaxEventsOut->empty()) {
631  std::string moduleLabel = (*it)->description().moduleLabel();
632  try {
633  desc.maxEvents_ = vMaxEventsOut->getUntrackedParameter<int>(moduleLabel);
634  } catch (Exception const&) {
636  "\nNo entry in 'maxEvents' for output module label '" << moduleLabel << "'.\n";
637  }
638  }
639  (*it)->configure(desc);
640  }
641  }
AllOutputWorkers all_output_workers_
Definition: Schedule.h:303
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:46
void edm::Schedule::modulesInPath ( std::string const &  iPathLabel,
std::vector< std::string > &  oLabelsToFill 
) const

adds to oLabelsToFill in execution order the labels of all modules in path iPathLabel

Definition at line 1218 of file Schedule.cc.

References i, edm::Path::name(), and trig_paths_.

Referenced by edm::ScheduleInfo::modulesInPath().

1219  {
1220  TrigPaths::const_iterator itFound =
1221  std::find_if (trig_paths_.begin(),
1222  trig_paths_.end(),
1223  boost::bind(std::equal_to<std::string>(),
1224  iPathLabel,
1225  boost::bind(&Path::name, _1)));
1226  if (itFound!=trig_paths_.end()) {
1227  oLabelsToFill.reserve(itFound->size());
1228  for (size_t i = 0; i < itFound->size(); ++i) {
1229  oLabelsToFill.push_back(itFound->getWorker(i)->description().moduleLabel());
1230  }
1231  }
1232  }
int i
Definition: DBlmapReader.cc:9
TrigPaths trig_paths_
Definition: Schedule.h:304
std::string const & name() const
Definition: Path.h:58
void edm::Schedule::openNewOutputFilesIfNeeded ( )

Definition at line 1122 of file Schedule.cc.

References all_output_workers_, edm::for_all(), and edm::OutputWorker::openNewFileIfNeeded().

1122  {
1124  }
AllOutputWorkers all_output_workers_
Definition: Schedule.h:303
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void openNewFileIfNeeded()
Definition: OutputWorker.cc:32
void edm::Schedule::openOutputFiles ( FileBlock fb)

Definition at line 1126 of file Schedule.cc.

References all_output_workers_, edm::for_all(), and edm::OutputWorker::openFile().

1126  {
1127  for_all(all_output_workers_, boost::bind(&OutputWorker::openFile, _1, boost::cref(fb)));
1128  }
AllOutputWorkers all_output_workers_
Definition: Schedule.h:303
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void openFile(FileBlock const &fb)
Definition: OutputWorker.cc:37
void edm::Schedule::postForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)

Definition at line 1169 of file Schedule.cc.

References all_workers_, edm::for_all(), and edm::Worker::postForkReacquireResources().

1169  {
1170  for_all(all_workers_, boost::bind(&Worker::postForkReacquireResources, _1, iChildIndex, iNumberOfChildren));
1171  }
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
Definition: Worker.h:66
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::preForkReleaseResources ( )

Definition at line 1166 of file Schedule.cc.

References all_workers_, edm::for_all(), and edm::Worker::preForkReleaseResources().

1166  {
1168  }
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void preForkReleaseResources()
Definition: Worker.h:65
AllWorkers all_workers_
Definition: Schedule.h:302
template<typename T >
void edm::Schedule::processOneOccurrence ( typename T::MyPrincipal &  principal,
EventSetup const &  eventSetup,
bool  cleaningUpAfterException = false 
)

Definition at line 439 of file Schedule.h.

References act_table_, alignCSCRings::action, cms::Exception::addContext(), edm::addContextAndPrintException(), edm::convertException::badAllocToEDM(), trackerHits::c, cms::Exception::category(), edm::convertException::charPtrToEDM(), cms::Exception::context(), alignCSCRings::e, endpathsAreActive_, cppFunctionSkipper::exception, edm::actions::FailPath, edm::ActionTable::find(), edm::actions::IgnoreCompletely, Latched, edm::printCmsExceptionWarning(), Ready, resetAll(), resetEarlyDelete(), results_inserter_, edm::actions::Rethrow, Running, alignCSCRings::s, setupOnDemandSystem(), edm::actions::SkipEvent, state_, edm::convertException::stdToEDM(), stopwatch_, edm::convertException::stringToEDM(), total_events_, total_passed_, edm::convertException::unknownToEDM(), and unscheduled_.

441  {
442  this->resetAll();
443  state_ = Running;
444 
445  // A RunStopwatch, but only if we are processing an event.
446  RunStopwatch stopwatch(T::isEvent_ ? stopwatch_ : RunStopwatch::StopwatchPointer());
447 
448  if (T::isEvent_) {
449  ++total_events_;
450  setupOnDemandSystem(dynamic_cast<EventPrincipal&>(ep), es);
451  }
452  try {
453  try {
454  try {
455  //make sure the unscheduled items see this transition [Event will be a no-op]
456  unscheduled_->runNow<T>(ep, es);
457  if (runTriggerPaths<T>(ep, es)) {
458  if (T::isEvent_) ++total_passed_;
459  }
460  state_ = Latched;
461  }
462  catch(cms::Exception& e) {
464  assert (action != actions::IgnoreCompletely);
465  assert (action != actions::FailPath);
466  if (action == actions::SkipEvent) {
467  edm::printCmsExceptionWarning("SkipEvent", e);
468  } else {
469  throw;
470  }
471  }
472 
473  try {
474  CPUTimer timer;
475  if (results_inserter_.get()) results_inserter_->doWork<T>(ep, es, 0, &timer);
476  }
477  catch (cms::Exception & ex) {
478  if (T::isEvent_) {
479  ex.addContext("Calling produce method for module TriggerResultInserter");
480  }
481  std::ostringstream ost;
482  ost << "Processing " << ep.id();
483  ex.addContext(ost.str());
484  throw;
485  }
486 
487  if (endpathsAreActive_) runEndPaths<T>(ep, es);
488  if(T::isEvent_) resetEarlyDelete();
489  }
490  catch (cms::Exception& e) { throw; }
491  catch(std::bad_alloc& bda) { convertException::badAllocToEDM(); }
492  catch (std::exception& e) { convertException::stdToEDM(e); }
493  catch(std::string& s) { convertException::stringToEDM(s); }
494  catch(char const* c) { convertException::charPtrToEDM(c); }
495  catch (...) { convertException::unknownToEDM(); }
496  }
497  catch(cms::Exception& ex) {
498  if (ex.context().empty()) {
499  addContextAndPrintException("Calling function Schedule::processOneOccurrence", ex, cleaningUpAfterException);
500  } else {
501  addContextAndPrintException("", ex, cleaningUpAfterException);
502  }
503  state_ = Ready;
504  throw;
505  }
506  // next thing probably is not needed, the product insertion code clears it
507  state_ = Ready;
508  }
State state_
Definition: Schedule.h:294
WorkerPtr results_inserter_
Definition: Schedule.h:301
void resetEarlyDelete()
Definition: Schedule.cc:1335
void addContextAndPrintException(char const *context, cms::Exception &ex, bool disablePrint)
std::string const & category() const
Definition: Exception.cc:183
int total_passed_
Definition: Schedule.h:324
void resetAll()
Definition: Schedule.cc:1311
RunStopwatch::StopwatchPointer stopwatch_
Definition: Schedule.h:325
boost::shared_ptr< CPUTimer > StopwatchPointer
Definition: RunStopwatch.h:23
void stdToEDM(std::exception const &e)
std::list< std::string > const & context() const
Definition: Exception.cc:191
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e, edm::JobReport *jobRep=0, int rc=-1)
ActionTable const * act_table_
Definition: Schedule.h:291
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
volatile bool endpathsAreActive_
Definition: Schedule.h:329
void addContext(std::string const &context)
Definition: Exception.cc:227
int total_events_
Definition: Schedule.h:323
actions::ActionCodes find(const std::string &category) const
Definition: Actions.cc:93
long double T
void setupOnDemandSystem(EventPrincipal &principal, EventSetup const &es)
Definition: Schedule.cc:1328
boost::shared_ptr< UnscheduledCallProducer > unscheduled_
Definition: Schedule.h:327
void edm::Schedule::reduceParameterSet ( ParameterSet proc_pset,
vstring modulesInConfig,
std::set< std::string > const &  modulesInConfigSet,
vstring labelsOnTriggerPaths,
vstring shouldBeUsedLabels,
std::map< std::string, std::vector< std::pair< std::string, int > > > &  outputModulePathPositions 
)
private

Definition at line 481 of file Schedule.cc.

References edm::ParameterSet::addParameter(), alignCSCRings::e, end_path_name_list_, edm::ParameterSet::eraseOrSetUntrackedParameterSet(), edm::ParameterSet::eraseSimpleParameter(), edm::for_all(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), i, reco_calib_source_client_cfg::labels, and edm::sort_all().

Referenced by Schedule().

486  {
487 
488  // Before calculating the ParameterSetID of the top level ParameterSet or
489  // saving it in the registry drop from the top level ParameterSet all
490  // OutputModules and EDAnalyzers not on trigger paths. If unscheduled
491  // production is not enabled also drop all the EDFilters and EDProducers
492  // that are not scheduled. Drop the ParameterSet used to configure the module
493  // itself. Also drop the other traces of these labels in the top level
494  // ParameterSet: Remove that labels from @all_modules and from all the
495  // end paths. If this makes any end paths empty, then remove the end path
496  // name from @end_paths, and @paths.
497 
498  // First make a list of labels to drop
499  vstring labelsToBeDropped;
500  vstring outputModuleLabels;
501  std::string edmType;
502  std::string const moduleEdmType("@module_edm_type");
503  std::string const outputModule("OutputModule");
504  std::string const edAnalyzer("EDAnalyzer");
505  std::string const edFilter("EDFilter");
506  std::string const edProducer("EDProducer");
507  sort_all(labelsOnTriggerPaths);
508  vstring::const_iterator iLabelsOnTriggerPaths = labelsOnTriggerPaths.begin();
509  vstring::const_iterator endLabelsOnTriggerPaths = labelsOnTriggerPaths.end();
510  sort_all(shouldBeUsedLabels);
511  vstring::const_iterator iShouldBeUsedLabels = shouldBeUsedLabels.begin();
512  vstring::const_iterator endShouldBeUsedLabels = shouldBeUsedLabels.end();
513 
514  for (std::set<std::string>::const_iterator i = modulesInConfigSet.begin(),
515  e = modulesInConfigSet.end(); i != e; ++i) {
516  edmType = proc_pset.getParameterSet(*i).getParameter<std::string>(moduleEdmType);
517  if (edmType == outputModule) {
518  labelsToBeDropped.push_back(*i);
519  outputModuleLabels.push_back(*i);
520  }
521  else if (edmType == edAnalyzer) {
522  while (iLabelsOnTriggerPaths != endLabelsOnTriggerPaths &&
523  *iLabelsOnTriggerPaths < *i) {
524  ++iLabelsOnTriggerPaths;
525  }
526  if (iLabelsOnTriggerPaths == endLabelsOnTriggerPaths ||
527  *iLabelsOnTriggerPaths != *i) {
528  labelsToBeDropped.push_back(*i);
529  }
530  }
531  else if (edmType == edFilter || edmType == edProducer) {
532  while (iShouldBeUsedLabels != endShouldBeUsedLabels &&
533  *iShouldBeUsedLabels < *i) {
534  ++iShouldBeUsedLabels;
535  }
536  if (iShouldBeUsedLabels != endShouldBeUsedLabels &&
537  *iShouldBeUsedLabels == *i) {
538  labelsToBeDropped.push_back(*i);
539  }
540  }
541  }
542 
543  // drop the parameter sets used to configure the modules
544  for_all(labelsToBeDropped, boost::bind(&ParameterSet::eraseOrSetUntrackedParameterSet, boost::ref(proc_pset), _1));
545 
546  // drop the labels from @all_modules
547  vstring::iterator endAfterRemove = std::remove_if(modulesInConfig.begin(), modulesInConfig.end(), boost::bind(binary_search_string, boost::ref(labelsToBeDropped), _1));
548  modulesInConfig.erase(endAfterRemove, modulesInConfig.end());
549  proc_pset.addParameter<vstring>(std::string("@all_modules"), modulesInConfig);
550 
551  // drop the labels from all end paths
552  vstring endPathsToBeDropped;
553  vstring labels;
554  for (vstring::iterator iEndPath = end_path_name_list_.begin(), endEndPath = end_path_name_list_.end();
555  iEndPath != endEndPath;
556  ++iEndPath) {
557  labels = proc_pset.getParameter<vstring>(*iEndPath);
558  vstring::iterator iSave = labels.begin();
559  vstring::iterator iBegin = labels.begin();
560 
561  for (vstring::iterator iLabel = labels.begin(), iEnd = labels.end();
562  iLabel != iEnd; ++iLabel) {
563  if (binary_search_string(labelsToBeDropped, *iLabel)) {
564  if (binary_search_string(outputModuleLabels, *iLabel)) {
565  outputModulePathPositions[*iLabel].push_back(std::pair<std::string, int>(*iEndPath, iSave - iBegin));
566  }
567  } else {
568  if (iSave != iLabel) {
569  iSave->swap(*iLabel);
570  }
571  ++iSave;
572  }
573  }
574  labels.erase(iSave, labels.end());
575  if (labels.empty()) {
576  // remove empty end paths and save their names
577  proc_pset.eraseSimpleParameter(*iEndPath);
578  endPathsToBeDropped.push_back(*iEndPath);
579  } else {
580  proc_pset.addParameter<vstring>(*iEndPath, labels);
581  }
582  }
583  sort_all(endPathsToBeDropped);
584 
585  // remove empty end paths from @paths
586  vstring scheduledPaths = proc_pset.getParameter<vstring>("@paths");
587  endAfterRemove = std::remove_if(scheduledPaths.begin(), scheduledPaths.end(), boost::bind(binary_search_string, boost::ref(endPathsToBeDropped), _1));
588  scheduledPaths.erase(endAfterRemove, scheduledPaths.end());
589  proc_pset.addParameter<vstring>(std::string("@paths"), scheduledPaths);
590 
591  // remove empty end paths from @end_paths
592  vstring scheduledEndPaths = proc_pset.getParameter<vstring>("@end_paths");
593  endAfterRemove = std::remove_if(scheduledEndPaths.begin(), scheduledEndPaths.end(), boost::bind(binary_search_string, boost::ref(endPathsToBeDropped), _1));
594  scheduledEndPaths.erase(endAfterRemove, scheduledEndPaths.end());
595  proc_pset.addParameter<vstring>(std::string("@end_paths"), scheduledEndPaths);
596  }
int i
Definition: DBlmapReader.cc:9
void eraseOrSetUntrackedParameterSet(std::string const &name)
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
std::vector< std::string > vstring
vstring end_path_name_list_
Definition: Schedule.h:296
void edm::Schedule::reportSkipped ( EventPrincipal const &  ep) const
inlineprivate

Definition at line 432 of file Schedule.h.

References edm::EventID::event(), edm::EventPrincipal::id(), and edm::EventID::run().

432  {
433  Service<JobReport> reportSvc;
434  reportSvc->reportSkippedEvent(ep.id().run(), ep.id().event());
435  }
void edm::Schedule::reportSkipped ( LuminosityBlockPrincipal const &  ) const
inlineprivate

Definition at line 256 of file Schedule.h.

256 {}
void edm::Schedule::reportSkipped ( RunPrincipal const &  ) const
inlineprivate

Definition at line 257 of file Schedule.h.

257 {}
void edm::Schedule::resetAll ( )
private

Definition at line 1311 of file Schedule.cc.

References all_workers_, endpath_results_, edm::for_all(), edm::Worker::reset(), and results_.

Referenced by processOneOccurrence().

1311  {
1312  for_all(all_workers_, boost::bind(&Worker::reset, _1));
1313  results_->reset();
1314  endpath_results_->reset();
1315  }
TrigResPtr endpath_results_
Definition: Schedule.h:299
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void reset()
Definition: Worker.h:68
TrigResPtr results_
Definition: Schedule.h:298
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::resetEarlyDelete ( )
private

Definition at line 1335 of file Schedule.cc.

References prof2calltree::count, earlyDeleteBranchToCount_, earlyDeleteHelpers_, earlyDeleteHelperToBranchIndicies_, and getHLTprescales::index.

Referenced by initializeEarlyDelete(), and processOneOccurrence().

1335  {
1336  //must be sure we have cleared the count first
1337  for(auto& count:earlyDeleteBranchToCount_) {
1338  count.second = 0;
1339  }
1340  //now reset based on how many helpers use that branch
1342  ++(earlyDeleteBranchToCount_[index].second);
1343  }
1344  for(auto& helper: earlyDeleteHelpers_) {
1345  helper.reset();
1346  }
1347  }
std::vector< EarlyDeleteHelper > earlyDeleteHelpers_
Definition: Schedule.h:320
std::vector< unsigned int > earlyDeleteHelperToBranchIndicies_
Definition: Schedule.h:317
std::vector< std::pair< BranchID, unsigned int > > earlyDeleteBranchToCount_
Definition: Schedule.h:310
void edm::Schedule::respondToCloseInputFile ( FileBlock const &  fb)

Definition at line 1149 of file Schedule.cc.

References all_workers_, edm::for_all(), and edm::Worker::respondToCloseInputFile().

1149  {
1150  for_all(all_workers_, boost::bind(&Worker::respondToCloseInputFile, _1, boost::cref(fb)));
1151  }
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void respondToCloseInputFile(FileBlock const &fb)
Definition: Worker.h:61
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::respondToCloseOutputFiles ( FileBlock const &  fb)

Definition at line 1157 of file Schedule.cc.

References all_workers_, edm::for_all(), and edm::Worker::respondToCloseOutputFiles().

1157  {
1158  for_all(all_workers_, boost::bind(&Worker::respondToCloseOutputFiles, _1, boost::cref(fb)));
1159  }
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void respondToCloseOutputFiles(FileBlock const &fb)
Definition: Worker.h:63
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::respondToOpenInputFile ( FileBlock const &  fb)

Definition at line 1145 of file Schedule.cc.

References all_workers_, edm::for_all(), and edm::Worker::respondToOpenInputFile().

1145  {
1146  for_all(all_workers_, boost::bind(&Worker::respondToOpenInputFile, _1, boost::cref(fb)));
1147  }
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void respondToOpenInputFile(FileBlock const &fb)
Definition: Worker.h:60
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::respondToOpenOutputFiles ( FileBlock const &  fb)

Definition at line 1153 of file Schedule.cc.

References all_workers_, edm::for_all(), and edm::Worker::respondToOpenOutputFiles().

1153  {
1154  for_all(all_workers_, boost::bind(&Worker::respondToOpenOutputFiles, _1, boost::cref(fb)));
1155  }
void respondToOpenOutputFiles(FileBlock const &fb)
Definition: Worker.h:62
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
AllWorkers all_workers_
Definition: Schedule.h:302
template<typename T >
void edm::Schedule::runEndPaths ( typename T::MyPrincipal &  ep,
EventSetup const &  es 
)
private

Definition at line 519 of file Schedule.h.

References end_paths_, and edm::for_all().

519  {
520  // Note there is no state-checking safety controlling the
521  // activation/deactivation of endpaths.
522  for_all(end_paths_, ProcessOneOccurrence<T>(ep, es));
523 
524  // We could get rid of the functor ProcessOneOccurrence if we used
525  // boost::lambda, but the use of lambda with member functions
526  // which take multiple arguments, by both non-const and const
527  // reference, seems much more obscure...
528  //
529  // using namespace boost::lambda;
530  // for_all(end_paths_,
531  // bind(&Path::processOneOccurrence,
532  // boost::lambda::_1, // qualification to avoid ambiguity
533  // var(ep), // pass by reference (not copy)
534  // constant_ref(es))); // pass by const-reference (not copy)
535  }
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
TrigPaths end_paths_
Definition: Schedule.h:305
template<typename T >
bool edm::Schedule::runTriggerPaths ( typename T::MyPrincipal &  ep,
EventSetup const &  es 
)
private

Definition at line 512 of file Schedule.h.

References edm::for_all(), results_, and trig_paths_.

512  {
513  for_all(trig_paths_, ProcessOneOccurrence<T>(ep, es));
514  return results_->accept();
515  }
TrigPaths trig_paths_
Definition: Schedule.h:304
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
TrigResPtr results_
Definition: Schedule.h:298
void edm::Schedule::setupOnDemandSystem ( EventPrincipal principal,
EventSetup const &  es 
)
private

Definition at line 1328 of file Schedule.cc.

References edm::EventPrincipal::setUnscheduledHandler(), and unscheduled_.

Referenced by processOneOccurrence().

1328  {
1329  // NOTE: who owns the productdescrption? Just copied by value
1330  unscheduled_->setEventSetup(es);
1331  ep.setUnscheduledHandler(unscheduled_);
1332  }
boost::shared_ptr< UnscheduledCallProducer > unscheduled_
Definition: Schedule.h:327
bool edm::Schedule::shouldWeCloseOutput ( ) const

Definition at line 1138 of file Schedule.cc.

References all_output_workers_, and edm::OutputWorker::shouldWeCloseFile().

1138  {
1139  // Return true iff at least one output module returns true.
1140  return (std::find_if (all_output_workers_.begin(), all_output_workers_.end(),
1141  boost::bind(&OutputWorker::shouldWeCloseFile, _1))
1142  != all_output_workers_.end());
1143  }
AllOutputWorkers all_output_workers_
Definition: Schedule.h:303
bool shouldWeCloseFile() const
Definition: OutputWorker.cc:27
bool edm::Schedule::terminate ( void  ) const

Return whether each output module has reached its maximum count.

Definition at line 643 of file Schedule.cc.

References all_output_workers_.

643  {
644  if (all_output_workers_.empty()) {
645  return false;
646  }
647  for (AllOutputWorkers::const_iterator it = all_output_workers_.begin(),
648  itEnd = all_output_workers_.end();
649  it != itEnd; ++it) {
650  if (!(*it)->limitReached()) {
651  // Found an output module that has not reached output event count.
652  return false;
653  }
654  }
655  LogInfo("SuccessfulTermination")
656  << "The job is terminating successfully because each output module\n"
657  << "has reached its configured limit.\n";
658  return true;
659  }
AllOutputWorkers all_output_workers_
Definition: Schedule.h:303
std::pair<double, double> edm::Schedule::timeCpuReal ( ) const
inline

Definition at line 167 of file Schedule.h.

References stopwatch_.

Referenced by endJob().

167  {
168  return std::pair<double, double>(stopwatch_->cpuTime(), stopwatch_->realTime());
169  }
RunStopwatch::StopwatchPointer stopwatch_
Definition: Schedule.h:325
int edm::Schedule::totalEvents ( ) const
inline

Return the number of events this Schedule has tried to process (inclues both successes and failures, including failures due to exceptions during processing).

Definition at line 189 of file Schedule.h.

References total_events_.

Referenced by endJob(), getTriggerReport(), and totalEventsFailed().

189  {
190  return total_events_;
191  }
int total_events_
Definition: Schedule.h:323
int edm::Schedule::totalEventsFailed ( ) const
inline

Return the number of events that have not passed any trigger. (N.B. totalEventsFailed() + totalEventsPassed() == totalEvents()

Definition at line 201 of file Schedule.h.

References totalEvents(), and totalEventsPassed().

Referenced by endJob(), and getTriggerReport().

201  {
202  return totalEvents() - totalEventsPassed();
203  }
int totalEventsPassed() const
Definition: Schedule.h:195
int totalEvents() const
Definition: Schedule.h:189
int edm::Schedule::totalEventsPassed ( ) const
inline

Return the number of events which have been passed by one or more trigger paths.

Definition at line 195 of file Schedule.h.

References total_passed_.

Referenced by endJob(), getTriggerReport(), and totalEventsFailed().

195  {
196  return total_passed_;
197  }
int total_passed_
Definition: Schedule.h:324
AllWorkers::const_iterator edm::Schedule::workersBegin ( ) const
inlineprivate

Definition at line 229 of file Schedule.h.

References all_workers_.

Referenced by endJob(), getAllModuleDescriptions(), and Schedule().

229  {
230  return all_workers_.begin();
231  }
AllWorkers all_workers_
Definition: Schedule.h:302
AllWorkers::iterator edm::Schedule::workersBegin ( )
inlineprivate

Definition at line 237 of file Schedule.h.

References all_workers_.

237  {
238  return all_workers_.begin();
239  }
AllWorkers all_workers_
Definition: Schedule.h:302
AllWorkers::const_iterator edm::Schedule::workersEnd ( ) const
inlineprivate

Definition at line 233 of file Schedule.h.

References all_workers_.

Referenced by endJob(), getAllModuleDescriptions(), and Schedule().

233  {
234  return all_workers_.end();
235  }
AllWorkers all_workers_
Definition: Schedule.h:302
AllWorkers::iterator edm::Schedule::workersEnd ( )
inlineprivate

Definition at line 241 of file Schedule.h.

References all_workers_.

241  {
242  return all_workers_.end();
243  }
AllWorkers all_workers_
Definition: Schedule.h:302
void edm::Schedule::writeLumi ( LuminosityBlockPrincipal const &  lbp)

Definition at line 1134 of file Schedule.cc.

References all_output_workers_, edm::for_all(), and edm::OutputWorker::writeLumi().

1134  {
1135  for_all(all_output_workers_, boost::bind(&OutputWorker::writeLumi, _1, boost::cref(lbp)));
1136  }
AllOutputWorkers all_output_workers_
Definition: Schedule.h:303
void writeLumi(LuminosityBlockPrincipal const &lbp)
Definition: OutputWorker.cc:47
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void edm::Schedule::writeRun ( RunPrincipal const &  rp)

Definition at line 1130 of file Schedule.cc.

References all_output_workers_, edm::for_all(), and edm::OutputWorker::writeRun().

1130  {
1131  for_all(all_output_workers_, boost::bind(&OutputWorker::writeRun, _1, boost::cref(rp)));
1132  }
AllOutputWorkers all_output_workers_
Definition: Schedule.h:303
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
void writeRun(RunPrincipal const &rp)
Definition: OutputWorker.cc:42

Member Data Documentation

ActionTable const* edm::Schedule::act_table_
private

Definition at line 291 of file Schedule.h.

Referenced by fillEndPath(), fillTrigPath(), fillWorkers(), processOneOccurrence(), and Schedule().

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

Definition at line 292 of file Schedule.h.

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

AllOutputWorkers edm::Schedule::all_output_workers_
private
AllWorkers edm::Schedule::all_workers_
private
std::vector<std::pair<BranchID,unsigned int> > edm::Schedule::earlyDeleteBranchToCount_
private

Definition at line 310 of file Schedule.h.

Referenced by initializeEarlyDelete(), and resetEarlyDelete().

std::vector<EarlyDeleteHelper> edm::Schedule::earlyDeleteHelpers_
private

Definition at line 320 of file Schedule.h.

Referenced by initializeEarlyDelete(), and resetEarlyDelete().

std::vector<unsigned int> edm::Schedule::earlyDeleteHelperToBranchIndicies_
private

Definition at line 317 of file Schedule.h.

Referenced by initializeEarlyDelete(), and resetEarlyDelete().

vstring edm::Schedule::end_path_name_list_
private

Definition at line 296 of file Schedule.h.

Referenced by fillWorkers(), reduceParameterSet(), and Schedule().

TrigPaths edm::Schedule::end_paths_
private
TrigResPtr edm::Schedule::endpath_results_
private

Definition at line 299 of file Schedule.h.

Referenced by fillEndPath(), resetAll(), and Schedule().

volatile bool edm::Schedule::endpathsAreActive_
private

Definition at line 329 of file Schedule.h.

Referenced by enableEndPaths(), endPathsEnabled(), and processOneOccurrence().

TrigResPtr edm::Schedule::results_
private

Definition at line 298 of file Schedule.h.

Referenced by resetAll(), runTriggerPaths(), and Schedule().

WorkerPtr edm::Schedule::results_inserter_
private

Definition at line 301 of file Schedule.h.

Referenced by processOneOccurrence(), and Schedule().

State edm::Schedule::state_
private

Definition at line 294 of file Schedule.h.

Referenced by processOneOccurrence().

RunStopwatch::StopwatchPointer edm::Schedule::stopwatch_
private

Definition at line 325 of file Schedule.h.

Referenced by processOneOccurrence(), and timeCpuReal().

int edm::Schedule::total_events_
private

Definition at line 323 of file Schedule.h.

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

int edm::Schedule::total_passed_
private

Definition at line 324 of file Schedule.h.

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

vstring edm::Schedule::trig_name_list_
private

Definition at line 295 of file Schedule.h.

Referenced by Schedule().

TrigPaths edm::Schedule::trig_paths_
private
boost::shared_ptr<UnscheduledCallProducer> edm::Schedule::unscheduled_
private

Definition at line 327 of file Schedule.h.

Referenced by processOneOccurrence(), Schedule(), and setupOnDemandSystem().

bool edm::Schedule::wantSummary_
private

Definition at line 322 of file Schedule.h.

Referenced by addToAllWorkers(), endJob(), fillEndPath(), and fillTrigPath().

WorkerRegistry edm::Schedule::worker_reg_
private

Definition at line 290 of file Schedule.h.

Referenced by fillWorkers(), and Schedule().