Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
Removed unused members and functions.
Converted a member with only two allowed values to be a bool.
  • Loading branch information
Dr15Jones committed Jul 2, 2017
1 parent cda1923 commit 08e0826
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 34 deletions.
11 changes: 3 additions & 8 deletions FWCore/Framework/interface/EventProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ namespace edm {
//
StatusCode runToCompletion();

// The following functions are used by the code implementing our
// boost statemachine
// The following functions are used by the code implementing
// transition handling.

InputSource::ItemType nextTransitionType();
std::pair<edm::ProcessHistoryID, edm::RunNumber_t> nextRunID();
Expand Down Expand Up @@ -218,15 +218,12 @@ namespace edm {
void writeLumi(ProcessHistoryID const& phid, RunNumber_t run, LuminosityBlockNumber_t lumi);
void deleteLumiFromCache(ProcessHistoryID const& phid, RunNumber_t run, LuminosityBlockNumber_t lumi);

void readAndProcessEvent();
bool shouldWeStop() const;

void setExceptionMessageFiles(std::string& message);
void setExceptionMessageRuns(std::string& message);
void setExceptionMessageLumis(std::string& message);

bool alreadyHandlingException() const;

bool setDeferredException(std::exception_ptr);

InputSource::ItemType readAndProcessEvents();
Expand Down Expand Up @@ -303,12 +300,10 @@ namespace edm {
PrincipalCache principalCache_;
bool beginJobCalled_;
bool shouldWeStop_;
std::string fileMode_;
std::string emptyRunLumiMode_;
bool fileModeNoMerge_;
std::string exceptionMessageFiles_;
std::string exceptionMessageRuns_;
std::string exceptionMessageLumis_;
bool alreadyHandlingException_;
bool forceLooperToEnd_;
bool looperBeginJobRun_;
bool forceESCacheClearOnNewRun_;
Expand Down
35 changes: 13 additions & 22 deletions FWCore/Framework/src/EventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,10 @@ namespace edm {
principalCache_(),
beginJobCalled_(false),
shouldWeStop_(false),
fileMode_(),
emptyRunLumiMode_(),
fileModeNoMerge_(false),
exceptionMessageFiles_(),
exceptionMessageRuns_(),
exceptionMessageLumis_(),
alreadyHandlingException_(false),
forceLooperToEnd_(false),
looperBeginJobRun_(false),
forceESCacheClearOnNewRun_(false),
Expand Down Expand Up @@ -277,12 +275,10 @@ namespace edm {
principalCache_(),
beginJobCalled_(false),
shouldWeStop_(false),
fileMode_(),
emptyRunLumiMode_(),
fileModeNoMerge_(false),
exceptionMessageFiles_(),
exceptionMessageRuns_(),
exceptionMessageLumis_(),
alreadyHandlingException_(false),
forceLooperToEnd_(false),
looperBeginJobRun_(false),
forceESCacheClearOnNewRun_(false),
Expand Down Expand Up @@ -319,12 +315,10 @@ namespace edm {
principalCache_(),
beginJobCalled_(false),
shouldWeStop_(false),
fileMode_(),
emptyRunLumiMode_(),
fileModeNoMerge_(false),
exceptionMessageFiles_(),
exceptionMessageRuns_(),
exceptionMessageLumis_(),
alreadyHandlingException_(false),
forceLooperToEnd_(false),
looperBeginJobRun_(false),
forceESCacheClearOnNewRun_(false),
Expand Down Expand Up @@ -357,12 +351,10 @@ namespace edm {
principalCache_(),
beginJobCalled_(false),
shouldWeStop_(false),
fileMode_(),
emptyRunLumiMode_(),
fileModeNoMerge_(false),
exceptionMessageFiles_(),
exceptionMessageRuns_(),
exceptionMessageLumis_(),
alreadyHandlingException_(false),
forceLooperToEnd_(false),
looperBeginJobRun_(false),
forceESCacheClearOnNewRun_(false),
Expand Down Expand Up @@ -402,8 +394,14 @@ namespace edm {

// Now set some parameters specific to the main process.
ParameterSet const& optionsPset(parameterSet->getUntrackedParameterSet("options", ParameterSet()));
fileMode_ = optionsPset.getUntrackedParameter<std::string>("fileMode", "");
emptyRunLumiMode_ = optionsPset.getUntrackedParameter<std::string>("emptyRunLumiMode", "");
auto const& fileMode = optionsPset.getUntrackedParameter<std::string>("fileMode", "FULLMERGE");
if(fileMode != "NOMERGE" and fileMode != "FULLMERGE") {
throw Exception(errors::Configuration, "Illegal fileMode parameter value: ")
<< fileMode << ".\n"
<< "Legal values are 'NOMERGE' and 'FULLMERGE'.\n";
} else {
fileModeNoMerge_ = (fileMode == "NOMERGE");
}
forceESCacheClearOnNewRun_ = optionsPset.getUntrackedParameter<bool>("forceEventSetupCacheClearOnNewRun", false);
//threading
unsigned int nThreads=1;
Expand Down Expand Up @@ -758,7 +756,7 @@ namespace edm {
nextItemTypeFromProcessingEvents_=InputSource::IsEvent;
asyncStopRequestedWhileProcessingEvents_=false;
try {
FilesProcessor fp(fileMode_ == std::string("NOMERGE"));
FilesProcessor fp(fileModeNoMerge_);

convertException::wrap([&]() {
bool firstTime = true;
Expand Down Expand Up @@ -1377,9 +1375,6 @@ namespace edm {
});
}

void EventProcessor::readAndProcessEvent() {
readAndProcessEvents();
}
InputSource::ItemType EventProcessor::readAndProcessEvents() {
nextItemTypeFromProcessingEvents_ = InputSource::IsEvent; //needed for looper
asyncStopRequestedWhileProcessingEvents_ = false;
Expand Down Expand Up @@ -1545,10 +1540,6 @@ namespace edm {
exceptionMessageLumis_ = message;
}

bool EventProcessor::alreadyHandlingException() const {
return alreadyHandlingException_;
}

bool EventProcessor::setDeferredException(std::exception_ptr iException) {
bool expected =false;
if(deferredExceptionPtrIsSet_.compare_exchange_strong(expected,true)) {
Expand Down
1 change: 0 additions & 1 deletion FWCore/Framework/test/MockEventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ namespace edm {
void MockEventProcessor::setExceptionMessageRuns(std::string&) {}
void MockEventProcessor::setExceptionMessageLumis(std::string&) {}

bool MockEventProcessor::alreadyHandlingException() const { return false; }
bool MockEventProcessor::setDeferredException(std::exception_ptr) { return true;}

}
5 changes: 2 additions & 3 deletions FWCore/Framework/test/MockEventProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,19 @@ namespace edm {
void writeLumi(ProcessHistoryID const& phid, RunNumber_t run, LuminosityBlockNumber_t lumi);
void deleteLumiFromCache(ProcessHistoryID const& phid, RunNumber_t run, LuminosityBlockNumber_t lumi);

void readAndProcessEvent();
bool shouldWeStop() const;

void setExceptionMessageFiles(std::string& message);
void setExceptionMessageRuns(std::string& message);
void setExceptionMessageLumis(std::string& message);

bool alreadyHandlingException() const;

InputSource::ItemType readAndProcessEvents();

bool setDeferredException(std::exception_ptr);

private:
void readAndProcessEvent();

std::string mockData_;
std::ostream & output_;
std::istringstream input_;
Expand Down

0 comments on commit 08e0826

Please sign in to comment.