How to increase number of MultiFunctionalDetector DICOM example

Dear expert,

I try to build two sensitive detector with different name to separate result in RunAction step.
So I modify the ConstructSDandField in DICOM example.

With only one sensitive detector, it has no problem but after increase the sensitive detector number, I got segfault as below… what am I wrong and what should I do? please help me…

Best regards,
Kyounghyoun

CAUGHT SIGNAL: 11 ### address: 0x219, signal = SIGSEGV, value = 11, description = segmentation violation. Address not mapped to object.

MY MODIFIED CODE:
G4MultiFunctionalDetector* MFDet1 = new G4MultiFunctionalDetector(“phantomSD1”);
G4SDManager::GetSDMpointer()->AddNewDetector(MFDet1);
G4VPrimitiveScorer* dosedep1 = new G4PSDoseDeposit3D(“DoseDeposit”, fNoVoxels[1], fNoVoxels[2], fNoVoxels[0]);
MFDet1->RegisterPrimitive(dosedep1);

for(std::set<G4LogicalVolume*>::iterator itr=fScorers1.cbegin(); itr!=fScorers1.cend();++itr)
{
SetSensitiveDetector(*itr, MFDet1);
}

G4MultiFunctionalDetector* MFDet2 = new G4MultiFunctionalDetector(“phantomSD2”);
G4SDManager::GetSDMpointer()->AddNewDetector(MFDet2);
G4VPrimitiveScorer* dosedep2 = new G4PSDoseDeposit3D(“DoseDeposit”, fNoVoxels[1], fNoVoxels[2], fNoVoxels[0]);
MFDet2->RegisterPrimitive(dosedep2);

for(std::set<G4LogicalVolume*>::iterator itr=fScorers2.cbegin(); itr!=fScorers2.cend();++itr)
{
SetSensitiveDetector(*itr, MFDet2);
}

I have still problem on this topic.

I try to build voxel from CT, and I almost success with 146256256 dimension.
But when I try with same thing with 161512512, it makes problem…
There only difference of voxel size and number of registered logical volume as sensitive.

What should I have to try?

please help me

CAUGHT SIGNAL: 11 ### address: 0x219, signal = SIGSEGV, value = 11, description = segmentation violation. Address not mapped to object.

Backtrace:
[PID=132808, TID=-1][ 0/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4geometry.so(_ZN8G4Region14ScanVolumeTreeEP15G4LogicalVolumeb+0x289) [0x7f6c45639559]
[PID=132808, TID=-1][ 1/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4geometry.so(_ZN8G4Region14ScanVolumeTreeEP15G4LogicalVolumeb+0x68b) [0x7f6c4563995b]
[PID=132808, TID=-1][ 2/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4geometry.so(_ZN8G4Region20AddRootLogicalVolumeEP15G4LogicalVolumeb+0x70) [0x7f6c4563a8f0]
[PID=132808, TID=-1][ 3/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4run.so(_ZN18G4RunManagerKernel17DefineWorldVolumeEP17G4VPhysicalVolumeb+0x31c) [0x7f6c460da9bc]
[PID=132808, TID=-1][ 4/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4run.so(_ZN12G4RunManager18InitializeGeometryEv+0xbb) [0x7f6c460c3d9b]
[PID=132808, TID=-1][ 5/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4run.so(_ZN12G4RunManager10InitializeEv+0x64) [0x7f6c460c3b34]
[PID=132808, TID=-1][ 6/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZN16G4TaskRunManager10InitializeEv+0x41) [0x7f6c46176dd1]
[PID=132808, TID=-1][ 7/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4run.so(_ZN14G4RunMessenger11SetNewValueEP11G4UIcommand8G4String+0xced) [0x7f6c460fb86d]
[PID=132808, TID=-1][ 8/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4intercoms.so(_ZN11G4UIcommand4DoItE8G4String+0x4c2) [0x7f6c4537d3e2]
[PID=132808, TID=-1][ 9/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4intercoms.so(_ZN11G4UImanager12ApplyCommandEPKc+0xd22) [0x7f6c4539bf72]
[PID=132808, TID=-1][10/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4intercoms.so(_ZN9G4UIbatch11ExecCommandERK8G4String+0x21) [0x7f6c4536cb21]
[PID=132808, TID=-1][11/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4intercoms.so(_ZN9G4UIbatch12SessionStartEv+0x76) [0x7f6c4536dc56]
[PID=132808, TID=-1][12/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4intercoms.so(_ZN11G4UImanager16ExecuteMacroFileEPKc+0x40) [0x7f6c4539d2d0]
[PID=132808, TID=-1][13/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4intercoms.so(_ZN20G4UIcontrolMessenger11SetNewValueEP11G4UIcommand8G4String+0x26a) [0x7f6c4538a6da]
[PID=132808, TID=-1][14/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4intercoms.so(_ZN11G4UIcommand4DoItE8G4String+0x4c2) [0x7f6c4537d3e2]
[PID=132808, TID=-1][15/19]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4intercoms.so(_ZN11G4UImanager12ApplyCommandEPKc+0xd22) [0x7f6c4539bf72]
[PID=132808, TID=-1][16/19]> ./Dosimetry(+0xbf28) [0x55863c136f28]
[PID=132808, TID=-1][17/19]> /usr/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f6c44bf0083]
[PID=132808, TID=-1][18/19]> ./Dosimetry(+0xc8ae) [0x55863c1378ae]

If it only happens with bigger number of voxels it may be your system memory. Try using “top” to check your memory (or whatever). Else compile Geant4 with debug option to trace the source of the problem

Dear arce,

I think the memory of my desktop is enough to build my all voxels(free 44Gb).
In case of 161x512x512 , my code always print SIGSEGV after “virtual void construct”.

I’m still struggle to solve this error, please help…

Best regards,
Kyounghyoun

I can try to reproduce your problem. You may send me your code privately to pedro.arce@ciemat.es

Dear acre,

Sorry for late answer. I reinstall geant4 with debugging option. Geant4 with debugging option and gdb shows me, my code had material problem. I used too many material maybe, so I change my code.

Now geometry construct is fine but there is new problem on G4NavigationLevel::GetReplicaNo after G4TaskRunManager::CreateAndStartWorkers() like blow:

G4WT1 > ### Run 0 starts on worker thread 1.
G4WT1 > → Event 0 starts with initial seeds (7423922,8824598).
G4WT2 > ### Run 0 starts on worker thread 2.
G4WT3 > ### Run 0 starts on worker thread 3.
G4WT0 > ### Run 0 starts on worker thread 0.

CAUGHT SIGNAL: 11 ### address: 0xed, signal = SIGSEGV, value = 11, description = segmentation violation. Address not mapped to object.

Backtrace:
[PID=235125, TID=1][ 0/51]> /usr/lib/x86_64-linux-gnu/libc.so.6(+0x43090) [0x7fe112fe6090]
[PID=235125, TID=1][ 1/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4geometry.so(_ZNK20G4NavigationLevelRep12GetReplicaNoEv+0x10) [0x7fe113ffad26]
[PID=235125, TID=1][ 2/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4geometry.so(_ZNK17G4NavigationLevel12GetReplicaNoEv+0x1f) [0x7fe113ffad8f]
[PID=235125, TID=1][ 3/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4geometry.so(_ZNK19G4NavigationHistory12GetReplicaNoEi+0x33) [0x7fe113ffafa5]
[PID=235125, TID=1][ 4/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4geometry.so(_ZNK18G4TouchableHistory16GetReplicaNumberEi+0x37) [0x7fe114184d35]
[PID=235125, TID=1][ 5/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4digits_hits.so(_ZN17G4PSDoseDeposit3D8GetIndexEP6G4Step+0x77) [0x7fe114551847]
[PID=235125, TID=1][ 6/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4digits_hits.so(_ZN15G4PSDoseDeposit11ProcessHitsEP6G4StepP18G4TouchableHistory+0x149) [0x7fe114550ce1]
[PID=235125, TID=1][ 7/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4digits_hits.so(_ZN18G4VPrimitiveScorer12HitPrimitiveEP6G4StepP18G4TouchableHistory+0x7c) [0x7fe114530ce6]
[PID=235125, TID=1][ 8/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4digits_hits.so(_ZN25G4MultiFunctionalDetector11ProcessHitsEP6G4StepP18G4TouchableHistory+0xd2) [0x7fe1145300c6]
[PID=235125, TID=1][ 9/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4digits_hits.so(_ZN20G4VSensitiveDetector3HitEP6G4Step+0x104) [0x7fe1145409ee]
[PID=235125, TID=1][10/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tracking.so(_ZN17G4SteppingManager8SteppingEv+0x48e) [0x7fe112e23d24]
[PID=235125, TID=1][11/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tracking.so(_ZN17G4TrackingManager15ProcessOneTrackEP7G4Track+0x2c9) [0x7fe112e3a633]
[PID=235125, TID=1][12/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4event.so(_ZN14G4EventManager12DoProcessingEP7G4Event+0x6c4) [0x7fe1151d1982]
[PID=235125, TID=1][13/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4event.so(_ZN14G4EventManager15ProcessOneEventEP7G4Event+0x32) [0x7fe1151d2350]
[PID=235125, TID=1][14/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZN22G4WorkerTaskRunManager15ProcessOneEventEi+0x6d) [0x7fe11557eaa9]
[PID=235125, TID=1][15/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZN22G4WorkerTaskRunManager11DoEventLoopEiPKci+0xf1) [0x7fe11557e9e3]
[PID=235125, TID=1][16/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZN22G4WorkerTaskRunManager6DoWorkEv+0x224) [0x7fe115580048]
[PID=235125, TID=1][17/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZN22G4TaskRunManagerKernel17ExecuteWorkerTaskEv+0xfe) [0x7fe115579978]
[PID=235125, TID=1][18/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xef5c5) [0x7fe1155655c5]
[PID=235125, TID=1][19/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xf0c36) [0x7fe115566c36]
[PID=235125, TID=1][20/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xf453f) [0x7fe11556a53f]
[PID=235125, TID=1][21/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xf4302) [0x7fe11556a302]
[PID=235125, TID=1][22/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xf405b) [0x7fe11556a05b]
[PID=235125, TID=1][23/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xf494a) [0x7fe11556a94a]
[PID=235125, TID=1][24/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xf45f4) [0x7fe11556a5f4]
[PID=235125, TID=1][25/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZNKSt8functionIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvEEclEv+0x50) [0x7fe11556d67e]
[PID=235125, TID=1][26/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZNSt13__future_base13_State_baseV29_M_do_setEPSt8functionIFSt10unique_ptrINS_12_Result_baseENS3_8_DeleterEEvEEPb+0x3a) [0x7fe11556bb32]
[PID=235125, TID=1][27/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(ZSt13__invoke_implIvMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEEPbEPS1_JS9_SA_EET_St21__invoke_memfun_derefOT0_OT1_DpOT2+0x9c) [0x7fe115572997]
[PID=235125, TID=1][28/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(ZSt8__invokeIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEEPbEJPS1_S9_SA_EENSt15__invoke_resultIT_JDpT0_EE4typeEOSF_DpOSG+0x6b) [0x7fe1155704c9]
[PID=235125, TID=1][29/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZZSt9call_onceIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEEPbEJPS1_S9_SA_EEvRSt9once_flagOT_DpOT0_ENKUlvE_clEv+0x6e) [0x7fe11556d202]
[PID=235125, TID=1][30/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZZSt9call_onceIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEEPbEJPS1_S9_SA_EEvRSt9once_flagOT_DpOT0_ENKUlvE0_clEv+0x2b) [0x7fe11556d239]
[PID=235125, TID=1][31/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZZSt9call_onceIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEEPbEJPS1_S9_SA_EEvRSt9once_flagOT_DpOT0_ENUlvE0_4_FUNEv+0x12) [0x7fe11556d24e]
[PID=235125, TID=1][32/51]> /usr/lib/x86_64-linux-gnu/libpthread.so.0(+0x114df) [0x7fe10f0c84df]
[PID=235125, TID=1][33/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xf4e21) [0x7fe11556ae21]
[PID=235125, TID=1][34/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(ZSt9call_onceIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEEPbEJPS1_S9_SA_EEvRSt9once_flagOT_DpOT0+0xaa) [0x7fe11556d30f]
[PID=235125, TID=1][35/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZNSt13__future_base13_State_baseV213_M_set_resultESt8functionIFSt10unique_ptrINS_12_Result_baseENS3_8_DeleterEEvEEb+0xa8) [0x7fe11556b6e6]
[PID=235125, TID=1][36/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xf40cd) [0x7fe11556a0cd]
[PID=235125, TID=1][37/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZNSt13packaged_taskIFvvEEclEv+0x37) [0x7fe11556ddbf]
[PID=235125, TID=1][38/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xff63a) [0x7fe11557563a]
[PID=235125, TID=1][39/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(+0xfdfe0) [0x7fe115573fe0]
[PID=235125, TID=1][40/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4tasking.so(_ZN3PTL4TaskIvJEEclEv+0x53) [0x7fe1155722a9]
[PID=235125, TID=1][41/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4ptl.so.0(_ZN3PTL10ThreadPool14execute_threadEPNS_14VUserTaskQueueE+0x654) [0x7fe113780470]
[PID=235125, TID=1][42/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4ptl.so.0(_ZN3PTL10ThreadPool12start_threadEPS0_PSt6vectorISt10shared_ptrINS_10ThreadDataEESaIS5_EEl+0x127) [0x7fe11377daf9]
[PID=235125, TID=1][43/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4ptl.so.0(ZSt13__invoke_implIvPFvPN3PTL10ThreadPoolEPSt6vectorISt10shared_ptrINS0_10ThreadDataEESaIS6_EElEJS2_S9_mEET_St14__invoke_otherOT0_DpOT1+0x6c) [0x7fe1137901ea]
[PID=235125, TID=1][44/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4ptl.so.0(ZSt8__invokeIPFvPN3PTL10ThreadPoolEPSt6vectorISt10shared_ptrINS0_10ThreadDataEESaIS6_EElEJS2_S9_mEENSt15__invoke_resultIT_JDpT0_EE4typeEOSD_DpOSE+0x6b) [0x7fe1137900b2]
[PID=235125, TID=1][45/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4ptl.so.0(_ZNSt6thread8_InvokerISt5tupleIJPFvPN3PTL10ThreadPoolEPSt6vectorISt10shared_ptrINS2_10ThreadDataEESaIS8_EElES4_SB_mEEE9_M_invokeIJLm0ELm1ELm2ELm3EEEEvSt12_Index_tupleIJXspT_EEE+0x7f) [0x7fe11378ff91]
[PID=235125, TID=1][46/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4ptl.so.0(_ZNSt6thread8_InvokerISt5tupleIJPFvPN3PTL10ThreadPoolEPSt6vectorISt10shared_ptrINS2_10ThreadDataEESaIS8_EElES4_SB_mEEEclEv+0x1c) [0x7fe11378fde8]
[PID=235125, TID=1][47/51]> /home/snubhnm/SIMULATION/GEANT4/source/install/lib/libG4ptl.so.0(_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFvPN3PTL10ThreadPoolEPSt6vectorISt10shared_ptrINS3_10ThreadDataEESaIS9_EElES5_SC_mEEEEE6_M_runEv+0x20) [0x7fe11378fc18]
[PID=235125, TID=1][48/51]> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xda6b4) [0x7fe1133db6b4]
[PID=235125, TID=1][49/51]> /usr/lib/x86_64-linux-gnu/libpthread.so.0(+0x8609) [0x7fe10f0bf609]
[PID=235125, TID=1][50/51]> /usr/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7fe1130c2133]

What should I do?

Best regards,
Kyounghyoun

I can only help you if you send me your code and I am able to repeat your problem