CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/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 
00009 #include "FWCore/Framework/interface/EDLooperBase.h"
00010 #include "FWCore/Framework/interface/Event.h"
00011 #include "FWCore/Framework/interface/Run.h"
00012 #include "FWCore/Framework/interface/LuminosityBlock.h"
00013 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00014 #include "FWCore/Framework/interface/EventSetupProvider.h"
00015 #include "FWCore/Utilities/interface/Algorithms.h"
00016 #include "FWCore/MessageLogger/interface/ExceptionMessages.h"
00017 #include "FWCore/Framework/interface/Actions.h"
00018 #include "FWCore/Utilities/interface/Exception.h"
00019 #include "FWCore/Framework/interface/ScheduleInfo.h"
00020 
00021 #include "boost/bind.hpp"
00022 
00023 
00024 namespace edm {
00025 
00026   EDLooperBase::EDLooperBase() : iCounter_(0), act_table_(0), moduleChanger_(0) { }
00027   EDLooperBase::~EDLooperBase() { }
00028 
00029   void
00030   EDLooperBase::doStartingNewLoop() {
00031     startingNewLoop(iCounter_);
00032   }
00033 
00034   EDLooperBase::Status
00035   EDLooperBase::doDuringLoop(edm::EventPrincipal& eventPrincipal, const edm::EventSetup& es, edm::ProcessingController& ioController) {
00036     edm::ModuleDescription modDesc("EDLooperBase", "");
00037     Event event(eventPrincipal, modDesc);
00038 
00039     Status status = kContinue;
00040     try {
00041       status = duringLoop(event, es, ioController);
00042     }
00043     catch(cms::Exception& e) {
00044       e.addContext("Calling the 'duringLoop' method of a looper");
00045       actions::ActionCodes action = (act_table_->find(e.category()));
00046       if (action != actions::Rethrow) {
00047         edm::printCmsExceptionWarning("SkipEvent", e);
00048       }
00049       else {
00050         throw;
00051       }
00052     }
00053     return status;
00054   }
00055 
00056   EDLooperBase::Status
00057   EDLooperBase::doEndOfLoop(const edm::EventSetup& es) {
00058     return endOfLoop(es, iCounter_);
00059   }
00060 
00061   void
00062   EDLooperBase::prepareForNextLoop(eventsetup::EventSetupProvider* esp) {
00063     ++iCounter_;
00064 
00065     std::set<edm::eventsetup::EventSetupRecordKey> const& keys = modifyingRecords();
00066     for_all(keys,
00067       boost::bind(&eventsetup::EventSetupProvider::resetRecordPlusDependentRecords,
00068                   esp, _1));
00069   }
00070 
00071   void EDLooperBase::beginOfJob(const edm::EventSetup&) { beginOfJob();}
00072   void EDLooperBase::beginOfJob() { }
00073 
00074   void EDLooperBase::endOfJob() { }
00075 
00076   void EDLooperBase::doBeginRun(RunPrincipal& iRP, EventSetup const& iES){
00077         edm::ModuleDescription modDesc("EDLooperBase", "");
00078         Run run(iRP, modDesc);
00079         beginRun(run,iES);
00080   }
00081 
00082   void EDLooperBase::doEndRun(RunPrincipal& iRP, EventSetup const& iES){
00083         edm::ModuleDescription modDesc("EDLooperBase", "");
00084         Run run(iRP, modDesc);
00085         endRun(run,iES);
00086   }
00087   void EDLooperBase::doBeginLuminosityBlock(LuminosityBlockPrincipal& iLB, EventSetup const& iES){
00088     edm::ModuleDescription modDesc("EDLooperBase", "");
00089     LuminosityBlock luminosityBlock(iLB, modDesc);
00090     beginLuminosityBlock(luminosityBlock,iES);
00091   }
00092   void EDLooperBase::doEndLuminosityBlock(LuminosityBlockPrincipal& iLB, EventSetup const& iES){
00093     edm::ModuleDescription modDesc("EDLooperBase", "");
00094     LuminosityBlock luminosityBlock(iLB, modDesc);
00095     endLuminosityBlock(luminosityBlock,iES);
00096   }
00097 
00098   void EDLooperBase::beginRun(Run const&, EventSetup const&){}
00099   void EDLooperBase::endRun(Run const&, EventSetup const&){}
00100   void EDLooperBase::beginLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
00101   void EDLooperBase::endLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
00102 
00103   void EDLooperBase::attachTo(ActivityRegistry&){}
00104    
00105 
00106   std::set<eventsetup::EventSetupRecordKey> 
00107   EDLooperBase::modifyingRecords() const
00108   {
00109     return std::set<eventsetup::EventSetupRecordKey> ();
00110   }
00111    
00112   void 
00113   EDLooperBase::copyInfo(const ScheduleInfo& iInfo){
00114     scheduleInfo_ = std::auto_ptr<ScheduleInfo>(new ScheduleInfo(iInfo));
00115   }
00116   void 
00117   EDLooperBase::setModuleChanger(const ModuleChanger* iChanger) {
00118     moduleChanger_ = iChanger;
00119   }
00120 
00121   const ModuleChanger* EDLooperBase::moduleChanger() const {
00122     return moduleChanger_;
00123   }
00124   const ScheduleInfo* EDLooperBase::scheduleInfo() const {
00125     return scheduleInfo_.get();
00126   }
00127   
00128 }