Skip to content

Commit

Permalink
Remove some very old unused code which is complicating new developmen…
Browse files Browse the repository at this point in the history
…t for the threaded Framework
  • Loading branch information
wddgit committed Jul 10, 2013
1 parent 6b547ee commit d83beca
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 118 deletions.
14 changes: 0 additions & 14 deletions FWCore/Framework/interface/EventProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();
Expand All @@ -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<ActivityRegistry> actReg_;
boost::shared_ptr<ProductRegistry const> preg_;
boost::shared_ptr<BranchIDListHelper> branchIDListHelper_;
Expand Down
18 changes: 0 additions & 18 deletions FWCore/Framework/src/EventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,6 @@ namespace edm {
serviceregistry::ServiceLegacy iLegacy,
std::vector<std::string> const& defaultServices,
std::vector<std::string> const& forcedServices) :
preProcessEventSignal_(),
postProcessEventSignal_(),
actReg_(),
preg_(),
branchIDListHelper_(),
Expand Down Expand Up @@ -426,8 +424,6 @@ namespace edm {
EventProcessor::EventProcessor(std::string const& config,
std::vector<std::string> const& defaultServices,
std::vector<std::string> const& forcedServices) :
preProcessEventSignal_(),
postProcessEventSignal_(),
actReg_(),
preg_(),
branchIDListHelper_(),
Expand Down Expand Up @@ -479,8 +475,6 @@ namespace edm {
EventProcessor::EventProcessor(boost::shared_ptr<ProcessDesc>& processDesc,
ServiceToken const& token,
serviceregistry::ServiceLegacy legacy) :
preProcessEventSignal_(),
postProcessEventSignal_(),
actReg_(),
preg_(),
branchIDListHelper_(),
Expand Down Expand Up @@ -528,8 +522,6 @@ namespace edm {


EventProcessor::EventProcessor(std::string const& config, bool isPython):
preProcessEventSignal_(),
postProcessEventSignal_(),
actReg_(),
preg_(),
branchIDListHelper_(),
Expand Down Expand Up @@ -656,7 +648,6 @@ namespace edm {
processConfiguration_ = items.processConfiguration_;

FDEBUG(2) << parameterSet << std::endl;
connectSigs(this);

// Reusable event principal
boost::shared_ptr<EventPrincipal> ep(new EventPrincipal(preg_,
Expand Down Expand Up @@ -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<ModuleDescription const*>
EventProcessor::getAllModuleDescriptions() const {
return schedule_->getAllModuleDescriptions();
Expand Down
124 changes: 38 additions & 86 deletions FWCore/Framework/test/eventprocessor_t.cppunit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -58,7 +57,6 @@ class testeventprocessor: public CppUnit::TestFixture {

void tearDown() { m_handler.reset();}
void parseTest();
void prepostTest();
void beginEndTest();
void cleanupJobTest();
void activityRegistryTest();
Expand Down Expand Up @@ -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<edm::ModuleDescription const*> 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"
Expand Down Expand Up @@ -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);

Expand All @@ -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_;
};
}

Expand Down Expand Up @@ -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<edm::ModuleDescription const*> 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
Expand Down

0 comments on commit d83beca

Please sign in to comment.