Message: Update Geometry Before Run/BeamOn leads to Segfault Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Update Geometry Before Run/BeamOn leads to Segfault 

Forum: Geometry
Date: 19 Jul, 2013
From: Yugeng He <Yugeng He>

Hi all,

I'm working on the liquid xenon particle detector project and I'm trying to experiment with various parameters in my detector geometry to find the optimal setup. I've followed a series of posts on this forum and am able to update the geometry in between runs in the same UImanager terminal, but soon I discover that if I update my detector geometry before making the first run it will have a segmentation error and quit immediately, but if I make a run before updating, even if it's only one run, it will update beautifully. This is clearly very bad because I will always have my first run wasted and affect the data gathering. Here is the code I'm using to achieve geometry updating:

in DetectorConstruction.cc:
--------------------------------------------------------------
void
MpandaxDetectorConstruction::SetRFRHeight(G4double TpcRfrZ)
{
	m_pRFRHeight = TpcRfrZ;
}
void
MpandaxDetectorConstruction::UpdateGeometry()
{
	G4GeometryManager::GetInstance()->OpenGeometry();
	G4PhysicalVolumeStore::GetInstance()->Clean();
	G4LogicalVolumeStore::GetInstance()->Clean();
	G4SolidStore::GetInstance()->Clean();

	G4RunManager::GetRunManager()->DefineWorldVolume(Construct());
	//G4RunManager::GetRunManager()->GeometryHasBeenModified();

	G4cout << "wasup" << G4endl;
}

for redefining sensitive detector I have:
-------------------------------------------------------------
G4SDManager *pSDManager = G4SDManager::GetSDMpointer();
if (!pPmtSD) {
	pPmtSD = new MpandaxPmtSensitiveDetector("Mpandax/PmtSD");
	pSDManager->AddNewDetector(pPmtSD);
} else {
	delete pPmtSD;
	pPmtSD = new MpandaxPmtSensitiveDetector("Mpandax/PmtSD");
	pSDManager->AddNewDetector(pPmtSD);
}
m_pPmtPhotoCathodeLogicalVolume->SetSensitiveDetector(pPmtSD);
m_pR3PmtCathodeLogicalVolume->SetSensitiveDetector(pPmtSD);

in detectorMessenger.cc:
--------------------------------------------------------------------------
m_pUpdateCmd = new G4UIcmdWithoutParameter("/Xe/detector/update",this);
	m_pUpdateCmd->SetGuidance("Update mpanda geometry.");
	m_pUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
	m_pUpdateCmd->SetGuidance("if you changed geometrical value(s).");
	m_pUpdateCmd->AvailableForStates(G4State_PreInit, G4State_Idle);

if(pUIcommand == m_pRFRHeightCmd)
    	m_pXeDetector->SetRFRHeight(m_pRFRHeightCmd->GetNewDoubleValue(hNewValue));

	if(pUIcommand == m_pUpdateCmd)
		m_pXeDetector->UpdateGeometry();

When I try to update before run, this will appear:
-------------------------------------------------------------------------
 *** Break *** segmentation violation

=========================================================== There was a crash. This is the entire stack trace of all threads: ===========================================================

#0  0x00007f214373244e in __libc_waitpid (pid=<optimized out>, stat_loc=0x7fffbf90fb70, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:32
#1  0x00007f21436b829e in do_system (line=0x14f65e50 "/home/daranday/Downloads/root/etc/gdb-backtrace.sh 17011 1>&2") at ../sysdeps/posix/system.c:149
#2  0x00007f214b225a6d in TUnixSystem::StackTrace() () from /home/daranday/Downloads/root/lib/libCore.so
#3  0x00007f214b228373 in TUnixSystem::DispatchSignals(ESignals) () from /home/daranday/Downloads/root/lib/libCore.so
#4  <signal handler called>
#5  0x00007f2146751c8b in G4NeutronHPData::DoPhysicsVector(G4NeutronHPVector*) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4processes.so
#6  0x00007f2146758aff in G4NeutronHPElasticData::BuildPhysicsTable(G4ParticleDefinition const&) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4processes.so
#7  0x00007f2146503d09 in G4CrossSectionDataStore::BuildPhysicsTable(G4ParticleDefinition const&) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4processes.so
#8  0x00007f214652bdf0 in G4HadronicProcess::BuildPhysicsTable(G4ParticleDefinition const&) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4processes.so
#9  0x00007f2147ab9a84 in G4VUserPhysicsList::BuildPhysicsTable(G4ParticleDefinition*) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#10 0x00007f2147abbb9d in G4VUserPhysicsList::BuildPhysicsTable() () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#11 0x00007f2147aaed25 in G4RunManagerKernel::BuildPhysicsTables() () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#12 0x00007f2147aaf110 in G4RunManagerKernel::RunInitialization() () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#13 0x00007f2147aab65d in G4RunManager::RunInitialization() () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#14 0x00007f2147aa89c7 in G4RunManager::BeamOn(int, char const*, int) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#15 0x00007f2147aaf99c in G4RunMessenger::SetNewValue(G4UIcommand*, G4String) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#16 0x00007f2144bc364b in G4UIcommand::DoIt(G4String) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4intercoms.so
#17 0x00007f2144bd6730 in G4UImanager::ApplyCommand(char const*) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4intercoms.so
#18 0x00007f2147ce3235 in G4UIterminal::ExecuteCommand(G4String) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4interfaces.so
#19 0x00007f2147ce4690 in G4UIterminal::SessionStart() () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4interfaces.so
#20 0x00000000004051de in main (argc=6, argv=0x7fffbf9133d8) at BG_MPandaX.cc:160
===========================================================

The lines below might hint at the cause of the crash. If they do not help you then please submit a bug report at http://root.cern.ch/bugs. Please post the ENTIRE stack trace from above as an attachment in addition to anything else that might help us fixing this issue. ===========================================================

#5  0x00007f2146751c8b in G4NeutronHPData::DoPhysicsVector(G4NeutronHPVector*) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4processes.so
#6  0x00007f2146758aff in G4NeutronHPElasticData::BuildPhysicsTable(G4ParticleDefinition const&) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4processes.so
#7  0x00007f2146503d09 in G4CrossSectionDataStore::BuildPhysicsTable(G4ParticleDefinition const&) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4processes.so
#8  0x00007f214652bdf0 in G4HadronicProcess::BuildPhysicsTable(G4ParticleDefinition const&) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4processes.so
#9  0x00007f2147ab9a84 in G4VUserPhysicsList::BuildPhysicsTable(G4ParticleDefinition*) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#10 0x00007f2147abbb9d in G4VUserPhysicsList::BuildPhysicsTable() () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#11 0x00007f2147aaed25 in G4RunManagerKernel::BuildPhysicsTables() () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#12 0x00007f2147aaf110 in G4RunManagerKernel::RunInitialization() () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#13 0x00007f2147aab65d in G4RunManager::RunInitialization() () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#14 0x00007f2147aa89c7 in G4RunManager::BeamOn(int, char const*, int) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#15 0x00007f2147aaf99c in G4RunMessenger::SetNewValue(G4UIcommand*, G4String) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4run.so
#16 0x00007f2144bc364b in G4UIcommand::DoIt(G4String) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4intercoms.so
#17 0x00007f2144bd6730 in G4UImanager::ApplyCommand(char const*) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4intercoms.so
#18 0x00007f2147ce3235 in G4UIterminal::ExecuteCommand(G4String) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4interfaces.so
#19 0x00007f2147ce4690 in G4UIterminal::SessionStart() () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/libG4interfaces.so
#20 0x00000000004051de in main (argc=6, argv=0x7fffbf9133d8) at BG_MPandaX.cc:160
===========================================================

Please tell me what's going on, thank you! Sorry about the broken english.

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Warning: Re: Update Geometry Before Run/BeamOn leads to Segfault   (Michael H. Kelsey - 19 Jul, 2013)
2 None: Re: Update Geometry Before Run/BeamOn leads to Segfault   (Yugeng He - 22 Jul, 2013)
 Add Message Add Message
to: "Update Geometry Before Run/BeamOn leads to Segfault"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]