From d83becaab80b68138f477810badb7df4ffc1aa8f Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Wed, 10 Jul 2013 14:48:31 -0500 Subject: [PATCH] Remove some very old unused code which is complicating new development for the threaded Framework --- FWCore/Framework/interface/EventProcessor.h | 14 -- FWCore/Framework/src/EventProcessor.cc | 18 --- .../test/eventprocessor_t.cppunit.cc | 124 ++++++------------ 3 files changed, 38 insertions(+), 118 deletions(-) diff --git a/FWCore/Framework/interface/EventProcessor.h b/FWCore/Framework/interface/EventProcessor.h index 75bcd6401bf08..6fc3f1f8c572a 100644 --- a/FWCore/Framework/interface/EventProcessor.h +++ b/FWCore/Framework/interface/EventProcessor.h @@ -197,16 +197,6 @@ namespace edm { // but the EventFilter needs it for now. ServiceToken getToken(); - /// signal is emitted after the Event has been created by the - /// InputSource but before any modules have seen the Event - ActivityRegistry::PreProcessEvent& - preProcessEventSignal() {return preProcessEventSignal_;} - - /// signal is emitted after all modules have finished processing - /// the Event - ActivityRegistry::PostProcessEvent& - postProcessEventSignal() {return postProcessEventSignal_;} - //------------------------------------------------------------------ // // Nested classes and structs below. @@ -302,8 +292,6 @@ namespace edm { StatusCode waitForAsyncCompletion(unsigned int timeout_seconds); - void connectSigs(EventProcessor* ep); - void changeState(event_processor::Msg); void errorState(); void setupSignal(); @@ -322,8 +310,6 @@ namespace edm { // only during construction, and never again. If they aren't // really needed, we should remove them. - ActivityRegistry::PreProcessEvent preProcessEventSignal_; - ActivityRegistry::PostProcessEvent postProcessEventSignal_; boost::shared_ptr actReg_; boost::shared_ptr preg_; boost::shared_ptr branchIDListHelper_; diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index da20cf43189b4..28e867ba12d24 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -373,8 +373,6 @@ namespace edm { serviceregistry::ServiceLegacy iLegacy, std::vector const& defaultServices, std::vector const& forcedServices) : - preProcessEventSignal_(), - postProcessEventSignal_(), actReg_(), preg_(), branchIDListHelper_(), @@ -426,8 +424,6 @@ namespace edm { EventProcessor::EventProcessor(std::string const& config, std::vector const& defaultServices, std::vector const& forcedServices) : - preProcessEventSignal_(), - postProcessEventSignal_(), actReg_(), preg_(), branchIDListHelper_(), @@ -479,8 +475,6 @@ namespace edm { EventProcessor::EventProcessor(boost::shared_ptr& processDesc, ServiceToken const& token, serviceregistry::ServiceLegacy legacy) : - preProcessEventSignal_(), - postProcessEventSignal_(), actReg_(), preg_(), branchIDListHelper_(), @@ -528,8 +522,6 @@ namespace edm { EventProcessor::EventProcessor(std::string const& config, bool isPython): - preProcessEventSignal_(), - postProcessEventSignal_(), actReg_(), preg_(), branchIDListHelper_(), @@ -656,7 +648,6 @@ namespace edm { processConfiguration_ = items.processConfiguration_; FDEBUG(2) << parameterSet << std::endl; - connectSigs(this); // Reusable event principal boost::shared_ptr ep(new EventPrincipal(preg_, @@ -1305,15 +1296,6 @@ namespace edm { return false; } - void - EventProcessor::connectSigs(EventProcessor* ep) { - // When the FwkImpl signals are given, pass them to the - // appropriate EventProcessor signals so that the outside world - // can see the signal. - actReg_->preProcessEventSignal_.connect(std::cref(ep->preProcessEventSignal_)); - actReg_->postProcessEventSignal_.connect(std::cref(ep->postProcessEventSignal_)); - } - std::vector EventProcessor::getAllModuleDescriptions() const { return schedule_->getAllModuleDescriptions(); diff --git a/FWCore/Framework/test/eventprocessor_t.cppunit.cc b/FWCore/Framework/test/eventprocessor_t.cppunit.cc index 1659b4566f8a1..822b7ae276e78 100644 --- a/FWCore/Framework/test/eventprocessor_t.cppunit.cc +++ b/FWCore/Framework/test/eventprocessor_t.cppunit.cc @@ -37,7 +37,6 @@ void doInit(); class testeventprocessor: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(testeventprocessor); CPPUNIT_TEST(parseTest); - CPPUNIT_TEST(prepostTest); CPPUNIT_TEST(beginEndTest); CPPUNIT_TEST(cleanupJobTest); CPPUNIT_TEST(activityRegistryTest); @@ -58,7 +57,6 @@ class testeventprocessor: public CppUnit::TestFixture { void tearDown() { m_handler.reset();} void parseTest(); - void prepostTest(); void beginEndTest(); void cleanupJobTest(); void activityRegistryTest(); @@ -278,59 +276,6 @@ void testeventprocessor::parseTest() { } } -static int g_pre = 0; -static int g_post = 0; - -static -void doPre(edm::EventID const&, edm::Timestamp const&) { - ++g_pre; -} - -static -void doPost(edm::Event const&, edm::EventSetup const&) { - CPPUNIT_ASSERT(g_pre == ++g_post); -} - -void testeventprocessor::prepostTest() { - std::string configuration( - "import FWCore.ParameterSet.Config as cms\n" - "process = cms.Process('p')\n" - "process.maxEvents = cms.untracked.PSet(\n" - " input = cms.untracked.int32(5))\n" - "process.source = cms.Source('EmptySource')\n" - "process.m1 = cms.EDProducer('TestMod',\n" - " ivalue = cms.int32(-3))\n" - "process.p1 = cms.Path(process.m1)\n"); - - edm::EventProcessor proc(configuration, true); - - proc.preProcessEventSignal().connect(&doPre); - proc.postProcessEventSignal().connect(&doPost); - proc.beginJob(); - proc.run(); - proc.endJob(); - CPPUNIT_ASSERT(5 == g_pre); - CPPUNIT_ASSERT(5 == g_post); - { - edm::EventProcessor const& crProc(proc); - typedef std::vector ModuleDescs; - ModuleDescs allModules = crProc.getAllModuleDescriptions(); - CPPUNIT_ASSERT(2 == allModules.size()); // TestMod and TriggerResultsInserter - std::cout << "\nModuleDescriptions in testeventprocessor::prepostTest()---\n"; - for (ModuleDescs::const_iterator i = allModules.begin(), - e = allModules.end() ; - i != e ; - ++i) { - CPPUNIT_ASSERT(*i != 0); - std::cout << **i << '\n'; - } - std::cout << "--- end of ModuleDescriptions\n"; - - CPPUNIT_ASSERT(5 == crProc.totalEvents()); - CPPUNIT_ASSERT(5 == crProc.totalEventsPassed()); - } -} - void testeventprocessor::beginEndTest() { std::string configuration( "import FWCore.ParameterSet.Config as cms\n" @@ -583,12 +528,12 @@ void testeventprocessor::cleanupJobTest() namespace { struct Listener{ Listener(edm::ActivityRegistry& iAR) : - postBeginJob_(false), - postEndJob_(false), - preEventProcessing_(false), - postEventProcessing_(false), - preModule_(false), - postModule_(false) { + postBeginJob_(0), + postEndJob_(0), + preEventProcessing_(0), + postEventProcessing_(0), + preModule_(0), + postModule_(0) { iAR.watchPostBeginJob(this, &Listener::postBeginJob); iAR.watchPostEndJob(this, &Listener::postEndJob); @@ -599,33 +544,27 @@ namespace { iAR.watchPostModule(this, &Listener::postModule); } - void postBeginJob() {postBeginJob_ = true;} - void postEndJob() {postEndJob_ = true;} + void postBeginJob() {++postBeginJob_;} + void postEndJob() {++postEndJob_;} void preEventProcessing(edm::EventID const&, edm::Timestamp const&) { - preEventProcessing_ = true;} + ++preEventProcessing_;} void postEventProcessing(edm::Event const&, edm::EventSetup const&) { - postEventProcessing_ = true;} + ++postEventProcessing_;} void preModule(edm::ModuleDescription const&) { - preModule_ = true; + ++preModule_; } void postModule(edm::ModuleDescription const&) { - postModule_ = true; + ++postModule_; } - bool allCalled() const { - return postBeginJob_&&postEndJob_ - &&preEventProcessing_&&postEventProcessing_ - &&preModule_&&postModule_; - } - - bool postBeginJob_; - bool postEndJob_; - bool preEventProcessing_; - bool postEventProcessing_; - bool preModule_; - bool postModule_; + unsigned int postBeginJob_; + unsigned int postEndJob_; + unsigned int preEventProcessing_; + unsigned int postEventProcessing_; + unsigned int preModule_; + unsigned int postModule_; }; } @@ -660,14 +599,27 @@ testeventprocessor::activityRegistryTest() { proc.run(); proc.endJob(); - CPPUNIT_ASSERT(listener.postBeginJob_); - CPPUNIT_ASSERT(listener.postEndJob_); - CPPUNIT_ASSERT(listener.preEventProcessing_); - CPPUNIT_ASSERT(listener.postEventProcessing_); - CPPUNIT_ASSERT(listener.preModule_); - CPPUNIT_ASSERT(listener.postModule_); + CPPUNIT_ASSERT(listener.postBeginJob_ == 1); + CPPUNIT_ASSERT(listener.postEndJob_ == 1); + CPPUNIT_ASSERT(listener.preEventProcessing_ == 5); + CPPUNIT_ASSERT(listener.postEventProcessing_ == 5); + CPPUNIT_ASSERT(listener.preModule_ == 10); + CPPUNIT_ASSERT(listener.postModule_ == 10); + + typedef std::vector ModuleDescs; + ModuleDescs allModules = proc.getAllModuleDescriptions(); + CPPUNIT_ASSERT(2 == allModules.size()); // TestMod and TriggerResultsInserter + std::cout << "\nModuleDescriptions in testeventprocessor::activityRegistryTest()---\n"; + for (ModuleDescs::const_iterator i = allModules.begin(), e = allModules.end(); + i != e ; + ++i) { + CPPUNIT_ASSERT(*i != 0); + std::cout << **i << '\n'; + } + std::cout << "--- end of ModuleDescriptions\n"; - CPPUNIT_ASSERT(listener.allCalled()); + CPPUNIT_ASSERT(5 == proc.totalEvents()); + CPPUNIT_ASSERT(5 == proc.totalEventsPassed()); } static