CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/FWCore/Framework/src/EDLooperBase.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     <package>
00004 // Module:      EDLooperBase
00005 // 
00006 // Author:      Valentin Kuznetsov
00007 // Created:     Wed Jul  5 11:44:26 EDT 2006
00008 // $Id: EDLooperBase.cc,v 1.2 2010/09/01 18:26:27 chrjones Exp $
00009 
00010 #include "FWCore/Framework/interface/EDLooperBase.h"
00011 #include "FWCore/Framework/interface/Event.h"
00012 #include "FWCore/Framework/interface/Run.h"
00013 #include "FWCore/Framework/interface/LuminosityBlock.h"
00014 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00015 #include "FWCore/Framework/interface/EventSetupProvider.h"
00016 #include "FWCore/Utilities/interface/Algorithms.h"
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018 #include "FWCore/Framework/interface/Actions.h"
00019 #include "FWCore/Utilities/interface/Exception.h"
00020 #include "FWCore/Framework/interface/ScheduleInfo.h"
00021 
00022 #include "boost/bind.hpp"
00023 
00024 
00025 namespace edm {
00026 
00027   EDLooperBase::EDLooperBase() : iCounter_(0), act_table_(0), moduleChanger_(0) { }
00028   EDLooperBase::~EDLooperBase() { }
00029 
00030   void
00031   EDLooperBase::doStartingNewLoop() {
00032     startingNewLoop(iCounter_);
00033   }
00034 
00035   EDLooperBase::Status
00036   EDLooperBase::doDuringLoop(edm::EventPrincipal& eventPrincipal, const edm::EventSetup& es, edm::ProcessingController& ioController) {
00037     edm::ModuleDescription modDesc("EDLooperBase", "");
00038     Event event(eventPrincipal, modDesc);
00039 
00040     Status status = kContinue;
00041     try {
00042       status = duringLoop(event, es, ioController);
00043     }
00044     catch(cms::Exception& e) {
00045       actions::ActionCodes action = (act_table_->find(e.rootCause()));
00046       if (action != actions::Rethrow) {
00047         LogWarning(e.category())
00048           << "An exception occurred in the looper, continuing with the next event\n"
00049           << e.what();
00050       }
00051       else {
00052         throw;
00053       }
00054     }
00055     return status;
00056   }
00057 
00058   EDLooperBase::Status
00059   EDLooperBase::doEndOfLoop(const edm::EventSetup& es) {
00060     return endOfLoop(es, iCounter_);
00061   }
00062 
00063   void
00064   EDLooperBase::prepareForNextLoop(eventsetup::EventSetupProvider* esp) {
00065     ++iCounter_;
00066 
00067     const std::set<edm::eventsetup::EventSetupRecordKey>& keys = modifyingRecords();
00068     for_all(keys,
00069       boost::bind(&eventsetup::EventSetupProvider::resetRecordPlusDependentRecords,
00070                   esp, _1));
00071   }
00072 
00073   void EDLooperBase::beginOfJob(const edm::EventSetup&) { beginOfJob();}
00074   void EDLooperBase::beginOfJob() { }
00075 
00076   void EDLooperBase::endOfJob() { }
00077 
00078   void EDLooperBase::doBeginRun(RunPrincipal& iRP, EventSetup const& iES){
00079         edm::ModuleDescription modDesc("EDLooperBase", "");
00080         Run run(iRP, modDesc);
00081         beginRun(run,iES);
00082   }
00083 
00084   void EDLooperBase::doEndRun(RunPrincipal& iRP, EventSetup const& iES){
00085         edm::ModuleDescription modDesc("EDLooperBase", "");
00086         Run run(iRP, modDesc);
00087         endRun(run,iES);
00088   }
00089   void EDLooperBase::doBeginLuminosityBlock(LuminosityBlockPrincipal& iLB, EventSetup const& iES){
00090     edm::ModuleDescription modDesc("EDLooperBase", "");
00091     LuminosityBlock luminosityBlock(iLB, modDesc);
00092     beginLuminosityBlock(luminosityBlock,iES);
00093   }
00094   void EDLooperBase::doEndLuminosityBlock(LuminosityBlockPrincipal& iLB, EventSetup const& iES){
00095     edm::ModuleDescription modDesc("EDLooperBase", "");
00096     LuminosityBlock luminosityBlock(iLB, modDesc);
00097     endLuminosityBlock(luminosityBlock,iES);
00098   }
00099 
00100   void EDLooperBase::beginRun(Run const&, EventSetup const&){}
00101   void EDLooperBase::endRun(Run const&, EventSetup const&){}
00102   void EDLooperBase::beginLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
00103   void EDLooperBase::endLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
00104 
00105   void EDLooperBase::attachTo(ActivityRegistry&){}
00106    
00107 
00108   std::set<eventsetup::EventSetupRecordKey> 
00109   EDLooperBase::modifyingRecords() const
00110   {
00111     return std::set<eventsetup::EventSetupRecordKey> ();
00112   }
00113    
00114   void 
00115   EDLooperBase::copyInfo(const ScheduleInfo& iInfo){
00116     scheduleInfo_ = std::auto_ptr<ScheduleInfo>(new ScheduleInfo(iInfo));
00117   }
00118   void 
00119   EDLooperBase::setModuleChanger(const ModuleChanger* iChanger) {
00120     moduleChanger_ = iChanger;
00121   }
00122 
00123   const ModuleChanger* EDLooperBase::moduleChanger() const {
00124     return moduleChanger_;
00125   }
00126   const ScheduleInfo* EDLooperBase::scheduleInfo() const {
00127     return scheduleInfo_.get();
00128   }
00129   
00130 }