Hello! I am trying to add hadronic physics to my simulation, but it doesn’t seem to work.
I have added G4EmStandardPhysics and G4OpticalPhysics via adding the header files and RegisterPhysics (new G4OpticalPhysics());
commands.
But when trying to do the same with G4VHadronicPhysics - #include “G4VHadronPhysics.hh”, RegisterPhysics (new G4VHadronPhysics()); and error gets shown -
In constructor ‘MyPhysicsList::MyPhysicsList()’:
/home/ginger/Desktop/sim/physics.cc:6:40: error: invalid new-expression of abstract class type ‘G4VHadronPhysics’
6 | RegisterPhysics (new G4VHadronPhysics());
| ^
In file included from /home/ginger/Desktop/sim/physics.hh:6,
from /home/ginger/Desktop/sim/physics.cc:1:
/home/ginger/Desktop/software/geant4/geant4-v11.1.1-install/include/Geant4/G4VHadronPhysics.hh:49:7: note: because the following virtual functions are pure within ‘G4VHadronPhysics’:
49 | class G4VHadronPhysics : public G4VPhysicsConstructor
| ^~~~~~~~~~~~~~~~
In file included from /home/ginger/Desktop/software/geant4/geant4-v11.1.1-install/include/Geant4/G4VModularPhysicsList.hh:50,
from /home/ginger/Desktop/sim/physics.hh:3,
from /home/ginger/Desktop/sim/physics.cc:1:
/home/ginger/Desktop/software/geant4/geant4-v11.1.1-install/include/Geant4/G4VPhysicsConstructor.hh:120:18: note: ‘virtual void G4VPhysicsConstructor::ConstructProcess()’
120 | virtual void ConstructProcess() = 0;
| ^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/sim.dir/build.make:141: CMakeFiles/sim.dir/physics.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:77: CMakeFiles/sim.dir/all] Error 2
make: *** [Makefile:84: all] Error 2