Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed SIM exception actions #14289

Merged
merged 2 commits into from
May 1, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions SimG4Core/Application/plugins/OscarMTProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,14 @@ void OscarMTProducer::produce(edm::Event & e, const edm::EventSetup & es)
}
} catch ( const SimG4Exception& simg4ex ) {

edm::LogInfo("SimG4CoreApplication") << " SimG4Exception caght !"
edm::LogInfo("SimG4CoreApplication") << "SimG4Exception caght! "
<< simg4ex.what();

m_runManagerWorker->abortEvent();
throw edm::Exception( edm::errors::EventCorruption );
throw edm::Exception( edm::errors::EventCorruption )
<< "SimG4CoreApplication exception in generation of event "
<< e.id() << " in stream " << e.streamID() << " \n"
<< simg4ex.what();
}

}

StaticRandomEngineSetUnset::StaticRandomEngineSetUnset(
Expand Down
8 changes: 5 additions & 3 deletions SimG4Core/Application/plugins/OscarProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,13 @@ void OscarProducer::produce(edm::Event & e, const edm::EventSetup & es)

} catch ( const SimG4Exception& simg4ex ) {

edm::LogInfo("SimG4CoreApplication") << " SimG4Exception caght !"
edm::LogInfo("SimG4CoreApplication") << "SimG4Exception caght! "
<< simg4ex.what();

m_runManager->abortEvent();
throw edm::Exception( edm::errors::EventCorruption );
throw edm::Exception( edm::errors::EventCorruption )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be needed to properly clear Geant's internals in the case of a failure.
Also, for the original problem from the issue, produce is never called since the job is ending before entering the event loop.

<< "SimG4CoreApplication exception in generation of event "
<< e.id() << " in stream " << e.streamID() << " \n"
<< simg4ex.what();
}
}

Expand Down
10 changes: 10 additions & 0 deletions SimG4Core/Application/src/RunManagerMTWorker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ void RunManagerMTWorker::initializeThread(RunManagerMT& runManagerMaster, const

int thisID = getThreadIndex();

edm::LogInfo("SimG4CoreApplication")
<< "RunManagerMTWorker::initializeThread " << thisID;

// Initialize per-thread output
G4Threading::G4SetThreadId( thisID );
G4UImanager::GetUIpointer()->SetUpForAThread( thisID );
Expand Down Expand Up @@ -274,6 +277,10 @@ void RunManagerMTWorker::initializeThread(RunManagerMT& runManagerMaster, const
m_tls->registry.beginOfJobSignal_(&aBeginOfJob);

initializeUserActions();

edm::LogInfo("SimG4CoreApplication")
<< "RunManagerMTWorker::initializeThread done for the thread " << thisID;

/*
for(const std::string& command: runManagerMaster.G4Commands()) {
edm::LogInfo("SimG4CoreApplication") << "RunManagerMTWorker:: Requests UI: "
Expand Down Expand Up @@ -361,6 +368,7 @@ void RunManagerMTWorker::initializeRun() {
}

void RunManagerMTWorker::terminateRun() {
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

if(m_tls && m_tls->userRunAction) {
m_tls->userRunAction->EndOfRunAction(m_tls->currentRun.get());
m_tls->userRunAction.reset();
Expand All @@ -373,6 +381,7 @@ void RunManagerMTWorker::terminateRun() {
kernel->RunTermination();
m_tls->runTerminated = true;
}
*/
}

void RunManagerMTWorker::produce(const edm::Event& inpevt, const edm::EventSetup& es,
Expand All @@ -386,6 +395,7 @@ void RunManagerMTWorker::produce(const edm::Event& inpevt, const edm::EventSetup
//
// We have to do the per-thread initialization, and per-thread
// per-run initialization here by ourselves.

if(!(m_tls && m_tls->threadInitialized)) {
LogDebug("SimG4CoreApplication") << "RunManagerMTWorker::produce(): stream " << inpevt.streamID() << " thread " << getThreadIndex() << " initializing";
initializeThread(runManagerMaster, es);
Expand Down