System : Linux
REST version : v2.2.X
Hi,
I have a problem when I want to add the magnetic field into restG4.
After I overloaded the virtual function G4VUserDetectorConstruction::ConstructSDandField
and constructed a simple global uniform magetic field, I met no errors in compiling but a crash in running.
void DetectorConstruction::ConstructSDandField()
{
G4MagneticField* magField =
new G4UniformMagField(G4ThreeVector(1.*tesla,0.,0.));G4FieldManager* globalFieldMgr = G4TransportationManager:: GetTransportationManager()-> GetFieldManager();
globalFieldMgr->SetDetectorField(magField);
}
Is it because the sensitive volume is not defined in DetectorConstruction
?
It seems that the EventAction
class will check the user-specified sensitive volume in the GDML file to set the volume to store energy.
Or does REST provide any APIs related to magnetic field definition?
Looking forward to your help, thanks.