CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

edm::UnscheduledCallProducer Class Reference

#include <Schedule.h>

Inheritance diagram for edm::UnscheduledCallProducer:
edm::UnscheduledHandler

List of all members.

Public Member Functions

void addWorker (Worker *aWorker)
template<typename T >
void runNow (typename T::MyPrincipal &p, EventSetup const &es)
 UnscheduledCallProducer ()

Private Member Functions

virtual bool tryToFillImpl (std::string const &moduleLabel, EventPrincipal &event, EventSetup const &eventSetup, CurrentProcessingContext const *iContext)

Private Attributes

std::map< std::string, Worker * > labelToWorkers_

Detailed Description

Definition at line 351 of file Schedule.h.


Constructor & Destructor Documentation

edm::UnscheduledCallProducer::UnscheduledCallProducer ( ) [inline]

Definition at line 353 of file Schedule.h.


Member Function Documentation

void edm::UnscheduledCallProducer::addWorker ( Worker aWorker) [inline]

Definition at line 354 of file Schedule.h.

References edm::Worker::description(), labelToWorkers_, and edm::ModuleDescription::moduleLabel().

                                    {
      assert(0 != aWorker);
      labelToWorkers_[aWorker->description().moduleLabel()] = aWorker;
    }
template<typename T >
void edm::UnscheduledCallProducer::runNow ( typename T::MyPrincipal &  p,
EventSetup const &  es 
) [inline]

Definition at line 360 of file Schedule.h.

References cms::Exception::addContext(), edm::InLumi, edm::InRun, labelToWorkers_, and AlCaHLTBitMon_ParallelJobs::p.

                                                                {
      //do nothing for event since we will run when requested
      if(!T::isEvent_) {
        for(std::map<std::string, Worker*>::iterator it = labelToWorkers_.begin(), itEnd=labelToWorkers_.end();
            it != itEnd;
            ++it) {
          CPUTimer timer;
          try {
            it->second->doWork<T>(p, es, 0, &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;
          }
        }
      }
    }
virtual bool edm::UnscheduledCallProducer::tryToFillImpl ( std::string const &  moduleLabel,
EventPrincipal event,
EventSetup const &  eventSetup,
CurrentProcessingContext const *  iContext 
) [inline, private, virtual]

Implements edm::UnscheduledHandler.

Definition at line 404 of file Schedule.h.

References cms::Exception::addContext(), event(), and labelToWorkers_.

                                                                         {
      std::map<std::string, Worker*>::const_iterator itFound =
        labelToWorkers_.find(moduleLabel);
      if(itFound != labelToWorkers_.end()) {
        CPUTimer timer;
        try {
          itFound->second->doWork<OccurrenceTraits<EventPrincipal, BranchActionBegin> >(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;
    }

Member Data Documentation

std::map<std::string, Worker*> edm::UnscheduledCallProducer::labelToWorkers_ [private]

Definition at line 427 of file Schedule.h.

Referenced by addWorker(), runNow(), and tryToFillImpl().