diff --git a/[refs] b/[refs] index 0b9a2bc4ac674..a66c31f053e45 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/vhbbHeppy74X: 2622d68bf0f0c58cacf0e195c4dc5005c04e459f +refs/heads/vhbbHeppy74X: 93f895fddf946c4ee7aae23815a1b6b95f6a2099 diff --git a/trunk/FWCore/Framework/interface/Schedule.h b/trunk/FWCore/Framework/interface/Schedule.h index 22c34e45bcefb..c867e43cf1b44 100644 --- a/trunk/FWCore/Framework/interface/Schedule.h +++ b/trunk/FWCore/Framework/interface/Schedule.h @@ -64,7 +64,7 @@ #include "FWCore/Framework/interface/ExceptionHelpers.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" -#include "FWCore/Framework/interface/UnscheduledHandler.h" +#include "FWCore/Framework/interface/UnscheduledCallProducer.h" #include "FWCore/Framework/src/Path.h" #include "FWCore/Framework/src/RunStopwatch.h" #include "FWCore/Framework/src/Worker.h" @@ -350,85 +350,6 @@ namespace edm { EventSetup const& es; }; - class UnscheduledCallProducer : public UnscheduledHandler { - public: - UnscheduledCallProducer() : UnscheduledHandler(), labelToWorkers_() {} - void addWorker(Worker* aWorker) { - assert(0 != aWorker); - labelToWorkers_[aWorker->description().moduleLabel()] = aWorker; - } - - template - void runNow(typename T::MyPrincipal& p, EventSetup const& es) { - //do nothing for event since we will run when requested - if(!T::isEvent_) { - for(std::map::iterator it = labelToWorkers_.begin(), itEnd=labelToWorkers_.end(); - it != itEnd; - ++it) { - CPUTimer timer; - try { - it->second->doWork(p, es, nullptr, &timer); - } - catch (cms::Exception & ex) { - std::ostringstream ost; - if (T::isEvent_) { - ost << "Calling event method"; - } - else if (T::begin_ && T::branchType_ == InRun) { - ost << "Calling beginRun"; - } - else if (T::begin_ && T::branchType_ == InLumi) { - ost << "Calling beginLuminosityBlock"; - } - else if (!T::begin_ && T::branchType_ == InLumi) { - ost << "Calling endLuminosityBlock"; - } - else if (!T::begin_ && T::branchType_ == InRun) { - ost << "Calling endRun"; - } - else { - // It should be impossible to get here ... - ost << "Calling unknown function"; - } - ost << " for unscheduled module " << it->second->description().moduleName() - << "/'" << it->second->description().moduleLabel() << "'"; - ex.addContext(ost.str()); - ost.str(""); - ost << "Processing " << p.id(); - ex.addContext(ost.str()); - throw; - } - } - } - } - - private: - virtual bool tryToFillImpl(std::string const& moduleLabel, - EventPrincipal& event, - EventSetup const& eventSetup, - CurrentProcessingContext const* iContext) { - std::map::const_iterator itFound = - labelToWorkers_.find(moduleLabel); - if(itFound != labelToWorkers_.end()) { - CPUTimer timer; - try { - itFound->second->doWork >(event, eventSetup, iContext, &timer); - } - catch (cms::Exception & ex) { - std::ostringstream ost; - ost << "Calling produce method for unscheduled module " - << itFound->second->description().moduleName() << "/'" - << itFound->second->description().moduleLabel() << "'"; - ex.addContext(ost.str()); - throw; - } - return true; - } - return false; - } - std::map labelToWorkers_; - }; - void inline Schedule::reportSkipped(EventPrincipal const& ep) const { diff --git a/trunk/FWCore/Framework/interface/UnscheduledCallProducer.h b/trunk/FWCore/Framework/interface/UnscheduledCallProducer.h new file mode 100644 index 0000000000000..11835700cbe93 --- /dev/null +++ b/trunk/FWCore/Framework/interface/UnscheduledCallProducer.h @@ -0,0 +1,97 @@ +#ifndef FWCore_Framework_UnscheduledCallProducer_h +#define FWCore_Framework_UnscheduledCallProducer_h + +#include "FWCore/Framework/interface/UnscheduledHandler.h" + +#include "FWCore/Framework/interface/BranchActionType.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/src/Worker.h" + +#include +#include +#include + +namespace edm { + class UnscheduledCallProducer : public UnscheduledHandler { + public: + UnscheduledCallProducer() : UnscheduledHandler(), labelToWorkers_() {} + void addWorker(Worker* aWorker) { + assert(0 != aWorker); + labelToWorkers_[aWorker->description().moduleLabel()] = aWorker; + } + + template + void runNow(typename T::MyPrincipal& p, EventSetup const& es) { + //do nothing for event since we will run when requested + if(!T::isEvent_) { + for(std::map::iterator it = labelToWorkers_.begin(), itEnd=labelToWorkers_.end(); + it != itEnd; + ++it) { + CPUTimer timer; + try { + it->second->doWork(p, es, nullptr, &timer); + } + catch (cms::Exception & ex) { + std::ostringstream ost; + if (T::isEvent_) { + ost << "Calling event method"; + } + else if (T::begin_ && T::branchType_ == InRun) { + ost << "Calling beginRun"; + } + else if (T::begin_ && T::branchType_ == InLumi) { + ost << "Calling beginLuminosityBlock"; + } + else if (!T::begin_ && T::branchType_ == InLumi) { + ost << "Calling endLuminosityBlock"; + } + else if (!T::begin_ && T::branchType_ == InRun) { + ost << "Calling endRun"; + } + else { + // It should be impossible to get here ... + ost << "Calling unknown function"; + } + ost << " for unscheduled module " << it->second->description().moduleName() + << "/'" << it->second->description().moduleLabel() << "'"; + ex.addContext(ost.str()); + ost.str(""); + ost << "Processing " << p.id(); + ex.addContext(ost.str()); + throw; + } + } + } + } + + private: + virtual bool tryToFillImpl(std::string const& moduleLabel, + EventPrincipal& event, + EventSetup const& eventSetup, + CurrentProcessingContext const* iContext) { + std::map::const_iterator itFound = + labelToWorkers_.find(moduleLabel); + if(itFound != labelToWorkers_.end()) { + CPUTimer timer; + try { + itFound->second->doWork >(event, eventSetup, iContext, &timer); + } + catch (cms::Exception & ex) { + std::ostringstream ost; + ost << "Calling produce method for unscheduled module " + << itFound->second->description().moduleName() << "/'" + << itFound->second->description().moduleLabel() << "'"; + ex.addContext(ost.str()); + throw; + } + return true; + } + return false; + } + std::map labelToWorkers_; + }; + +} + +#endif