00001 00002 #include "EventFilter/StorageManager/interface/EPRunner.h" 00003 #include "FWCore/Utilities/interface/DebugMacros.h" 00004 #include "FWCore/ServiceRegistry/interface/Service.h" 00005 00006 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" 00007 #include "FWCore/Framework/interface/ConstProductRegistry.h" 00008 00009 #include "boost/bind.hpp" 00010 00011 #include <exception> 00012 #include <iostream> 00013 00014 using namespace std; 00015 using namespace edm; 00016 00017 namespace stor 00018 { 00019 EPRunner::EPRunner(const std::string& config_string, 00020 std::auto_ptr<HLTInfo> info): 00021 info_(info.get()), 00022 tok_(edm::ServiceRegistry::createContaining(info)), 00023 ah_(), 00024 ep_(config_string,tok_,edm::serviceregistry::kOverlapIsError) 00025 { 00026 FDEBUG(4) << "EPRunner ctor body" << endl; 00027 } 00028 00029 EPRunner::~EPRunner() 00030 { 00031 } 00032 00033 const edm::ProductRegistry& EPRunner::getRegistry() 00034 { 00035 Service<ConstProductRegistry> reg; 00036 return reg->productRegistry(); 00037 } 00038 00039 void EPRunner::start() 00040 { 00041 me_.reset( new boost::thread(boost::bind(EPRunner::run,this))); 00042 } 00043 00044 void EPRunner::join() 00045 { 00046 me_->join(); 00047 } 00048 00049 void EPRunner::run(EPRunner* t) 00050 { 00051 t->dowork(); 00052 } 00053 00054 void EPRunner::dowork() 00055 { 00056 try 00057 { 00058 { 00059 boost::mutex::scoped_lock sl(info_->getExtraLock()); 00060 ep_.beginJob(); 00061 } 00062 ep_.run(); 00063 { 00064 boost::mutex::scoped_lock sl(info_->getExtraLock()); 00065 ep_.endJob(); 00066 } 00067 } 00068 catch (std::exception& e) 00069 { 00070 std::cerr << "Standard library exception caught EventProcessor" << "\n" 00071 << e.what() 00072 << std::endl; 00073 } 00074 catch (...) 00075 { 00076 std::cerr << "Unknown exception caught EventProcessor" 00077 << std::endl; 00078 } 00079 00080 } 00081 00082 }