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 destruction at exit of Geant4 components #28789

Merged
merged 2 commits into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SimG4Core/Application/interface/RunManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class RunManager {
edm::EDGetTokenT<edm::LHCTransportLinkContainer> m_LHCtr;

bool m_nonBeam;
std::unique_ptr<CustomUIsession> m_UIsession;
CustomUIsession* m_UIsession;
std::unique_ptr<PhysicsList> m_physicsList;
PrimaryTransformer* m_primaryTransformer;

Expand Down
2 changes: 1 addition & 1 deletion SimG4Core/Application/interface/RunManagerMT.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class RunManagerMT {

G4MTRunManagerKernel* m_kernel;

std::unique_ptr<CustomUIsession> m_UIsession;
CustomUIsession* m_UIsession;
std::unique_ptr<PhysicsList> m_physicsList;
bool m_managerInitialized;
bool m_runTerminated;
Expand Down
4 changes: 2 additions & 2 deletions SimG4Core/Application/src/RunManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ RunManager::RunManager(edm::ParameterSet const& p, edm::ConsumesCollector&& iC)
m_g4overlap(p.getUntrackedParameter<edm::ParameterSet>("G4CheckOverlap")),
m_G4Commands(p.getParameter<std::vector<std::string> >("G4Commands")),
m_p(p) {
m_UIsession.reset(new CustomUIsession());
m_UIsession = new CustomUIsession();
m_kernel = new G4RunManagerKernel();
G4StateManager::GetStateManager()->SetExceptionHandler(new ExceptionHandler());

Expand Down Expand Up @@ -369,7 +369,7 @@ void RunManager::initG4(const edm::EventSetup& es) {

// Geometry checks
if (m_check || !regionFile.empty()) {
CMSG4CheckOverlap check(m_g4overlap, regionFile, m_UIsession.get(), pworld);
CMSG4CheckOverlap check(m_g4overlap, regionFile, m_UIsession, pworld);
}

// If the Geant4 particle table is needed, decomment the lines below
Expand Down
4 changes: 2 additions & 2 deletions SimG4Core/Application/src/RunManagerMT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ RunManagerMT::RunManagerMT(edm::ParameterSet const& p)
m_G4Commands(p.getParameter<std::vector<std::string> >("G4Commands")),
m_p(p) {
m_currentRun = nullptr;
m_UIsession.reset(new CustomUIsession());
m_UIsession = new CustomUIsession();
m_physicsList.reset(nullptr);
m_world.reset(nullptr);

Expand Down Expand Up @@ -227,7 +227,7 @@ void RunManagerMT::initG4(const DDCompactView* pDD,

// Geometry checks
if (m_check || !regionFile.empty()) {
CMSG4CheckOverlap check(m_g4overlap, regionFile, m_UIsession.get(), world);
CMSG4CheckOverlap check(m_g4overlap, regionFile, m_UIsession, world);
}

// If the Geant4 particle table is needed, decomment the lines below
Expand Down
9 changes: 3 additions & 6 deletions SimG4Core/Application/src/RunManagerMTWorker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ namespace {

struct RunManagerMTWorker::TLSData {
std::unique_ptr<G4RunManagerKernel> kernel; //must be deleted last
std::unique_ptr<CustomUIsession> UIsession;
std::unique_ptr<RunAction> userRunAction;
std::unique_ptr<SimRunInterface> runInterface;
std::unique_ptr<SimActivityRegistry> registry;
Expand Down Expand Up @@ -252,13 +251,11 @@ void RunManagerMTWorker::initializeThread(RunManagerMT& runManagerMaster, const
G4UImanager::GetUIpointer()->SetUpForAThread(thisID);
const std::string& uitype = m_pCustomUIsession.getUntrackedParameter<std::string>("Type", "MessageLogger");
if (uitype == "MessageLogger") {
m_tls->UIsession.reset(new CustomUIsession());
new CustomUIsession();
} else if (uitype == "MessageLoggerThreadPrefix") {
m_tls->UIsession.reset(new CustomUIsessionThreadPrefix(
m_pCustomUIsession.getUntrackedParameter<std::string>("ThreadPrefix", ""), thisID));
new CustomUIsessionThreadPrefix(m_pCustomUIsession.getUntrackedParameter<std::string>("ThreadPrefix", ""), thisID);
} else if (uitype == "FilePerThread") {
m_tls->UIsession.reset(
new CustomUIsessionToFile(m_pCustomUIsession.getUntrackedParameter<std::string>("ThreadFile", ""), thisID));
new CustomUIsessionToFile(m_pCustomUIsession.getUntrackedParameter<std::string>("ThreadFile", ""), thisID);
} else {
throw edm::Exception(edm::errors::Configuration)
<< "Invalid value of CustomUIsession.Type '" << uitype
Expand Down