Consolidate compiler generated dependencies of target last
[ 10%] Building CXX object CMakeFiles/last.dir/src/SensitiveDetector.cc.o
/Users/diegocostasrodriguez/software/geant4/last_try/src/SensitiveDetector.cc:16:15: warning: unused variable 'postStepPoint' [-Wunused-variable]
G4StepPoint *postStepPoint = aStep->GetPostStepPoint();
/Users/diegocostasrodriguez/software/geant4/last_try/src/SensitiveDetector.cc:13:11: warning: unused variable 'track' [-Wunused-variable]
G4Track *track = aStep->GetTrack();
/Users/diegocostasrodriguez/software/geant4/last_try/src/SensitiveDetector.cc:10:74: warning: unused parameter 'ROhist' [-Wunused-parameter]
G4bool SensitiveDetector::ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
3 warnings generated.
[ 20%] Linking CXX executable last
[100%] Built target last
I tried removing the EventAction and SteppingAction and just keep the first Ntuple I created -which records the hits in the BGO sensitive volume- but the same error when running the executable persists.
A quick way to hunt down the error is have your user defined actions (run action, detector construction) print a line when they are constructed, i.e. in the class constructor. You can see what the last class initialized before crashing and try to pin point what the issue is. Because you are crashing on running the executable and not when run beamOn, my guess is it is not a stepping action issue, unless you run a macro that automatically runs on start up
SensitiveDetector *sensDet = new SensitiveDetector("SensitiveDetector");
I think the error comes from this ConstructSDandField(). I do not know if this is something that has changed in G4-v11 but when I write this function in my DetectorConstruction.cc, the program cannot start.
Have you checked that logicDetector is not nullptr when ConstructSDandField is run? That would be an obvious cause of the segfault. Otherwise, all I can recommend in addition is to compile your application in Debug mode and run it through lldb. There’s a discussion on this in this thread: Using gdb debugger in an efficient way, albeit for gdb, but the two are similar (a search for “gdb” in the forums will bring up more on debugging).
I’ve just realized that my issue is just the same as this:
but the solution Lorenzo provides, the
at the end of the G4bool in the SensitiveDetector does not work for me, I already have that. The same line that was giving error to him is the one that is making my program crash with aboves output, do you know what may be the issue here?
Sorry, there’s not enough information here to triage the issue - the best option is to run through the debugger which will provide a full analysis, or to put G4cout statements around the point(s) you think may be triggering the error.