CMS 3D CMS Logo

EDLooper.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     <package>
00004 // Module:      EDLooper
00005 // 
00006 // Author:      Valentin Kuznetsov
00007 // Created:     Wed Jul  5 11:44:26 EDT 2006
00008 // $Id: EDLooper.cc,v 1.11 2008/03/19 22:02:36 wdd Exp $
00009 
00010 #include "FWCore/Framework/interface/EDLooper.h"
00011 #include "FWCore/Framework/interface/Event.h"
00012 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00013 #include "FWCore/Framework/interface/EventSetupProvider.h"
00014 #include "FWCore/Utilities/interface/Algorithms.h"
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016 #include "FWCore/Framework/interface/Actions.h"
00017 #include "FWCore/Utilities/interface/Exception.h"
00018 
00019 #include "boost/bind.hpp"
00020 
00021 
00022 namespace edm {
00023 
00024   EDLooper::EDLooper() : iCounter_(0) { }
00025   EDLooper::~EDLooper() { }
00026 
00027   void
00028   EDLooper::doStartingNewLoop() {
00029     startingNewLoop(iCounter_);
00030   }
00031 
00032   EDLooper::Status
00033   EDLooper::doDuringLoop(edm::EventPrincipal& eventPrincipal, const edm::EventSetup& es) {
00034     edm::ModuleDescription modDesc;
00035     modDesc.moduleName_="EDLooper";
00036     modDesc.moduleLabel_="";
00037     Event event(eventPrincipal, modDesc);
00038 
00039     Status status = kContinue;
00040     try {
00041       status = duringLoop(event, es);
00042     }
00043     catch(cms::Exception& e) {
00044       actions::ActionCodes action = (act_table_->find(e.rootCause()));
00045       if (action != actions::Rethrow) {
00046         LogWarning(e.category())
00047           << "An exception occurred in the looper, continuing with the next event\n"
00048           << e.what();
00049       }
00050       else {
00051         throw;
00052       }
00053     }
00054     return status;
00055   }
00056 
00057   EDLooper::Status
00058   EDLooper::doEndOfLoop(const edm::EventSetup& es) {
00059     return endOfLoop(es, iCounter_);
00060   }
00061 
00062   void
00063   EDLooper::prepareForNextLoop(eventsetup::EventSetupProvider* esp) {
00064     ++iCounter_;
00065 
00066     const std::set<edm::eventsetup::EventSetupRecordKey>& keys = modifyingRecords();
00067     for_all(keys,
00068       boost::bind(&eventsetup::EventSetupProvider::resetRecordPlusDependentRecords,
00069                   esp, _1));
00070   }
00071 
00072   void EDLooper::beginOfJob(const edm::EventSetup&) { }
00073 
00074   void EDLooper::endOfJob() { }
00075 
00076   std::set<eventsetup::EventSetupRecordKey> 
00077   EDLooper::modifyingRecords() const
00078   {
00079     return std::set<eventsetup::EventSetupRecordKey> ();
00080   }
00081 }

Generated on Tue Jun 9 17:35:53 2009 for CMSSW by  doxygen 1.5.4