Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!
_Geant4 Version:_v11.2.1
_Operating System:_Ubuntu
Hello there, im currently working on the basics of using electricic fields in Geant. Im reading in an electric field from Comsol using the PurgeMagnetExample and the Field02Example like some others on here. Visualizing the field works perfectly fine.
Now to my Problem:
The electron behaviour inside the field is not correct.
This is the path my Electron uses for the first event (the photon in green is shown so one can see the direction of the gun)
And this track is shown for all Events after that.
Whats baffling to me, that the visualisation of the field works fine, as well as tests with a uniform field and the same code. As said, like some other people on here ive taken the F02 code and added the PurgingMagnetCode:
F02ElectricFieldSetup::F02ElectricFieldSetup()
: fMinStep(10*um),
fFieldManager(0),
fChordFinder(0),
fEquation(0),
fEMfield(0),
fElFieldValue(),
fStepper(0),
fIntgrDriver(0),
fStepperType(4), // ClassicalRK4 – the default stepper
fFieldMessenger(nullptr)
{
//fEMfield = new G4UniformElectricField(G4ThreeVector(0.0,-1.0*kilovolt/cm,0.0));
G4double zOffset = 0.0 * mm;
fEMfield = new ElTabulatedField("Test2.TABLE", zOffset);
fEquation = new G4EqMagElectricField(fEMfield);
fFieldManager = GetGlobalFieldManager();
UpdateIntegrator();
fFieldMessenger = new F02FieldMessenger(this);
}
this is the snippet from my construction:
...
return physWorld;}
void construction::ConstructSDandField()
{
auto fieldSetup = new F02ElectricFieldSetup();
G4AutoDelete::Register(fieldSetup); //Kernel will delete the messenger
fEmFieldSetup.Put(fieldSetup);
}
For the physicslist im just using the PurgMagPhysicsList from the example. Since the code works for a uniform field i assume the Physics are correct.
I would appreciate any help or ideas where to look for answers.
Tim