Message: Magnetic field nan values | Not Logged In (login) |
Hello, I am using geant4.9.5.p02. I have an external magnetic field map which I feed into geant4 via a G4ElectroMagneticField inherited class. Following the examples I implement the function void Field::GetFieldValue( const G4double Point[3],G4double* Bfield ) const which I checked that it can provide the true magnetic field values I need. However, when I start running Geant4, after a couple of events I noticed that it gets stuck at an event forever. When I G4cout the position of the particle which gets into this infinite time loop via void Field::GetFieldValue( const G4double Point[3],G4double* Bfield ) const { G4cout << "x,y,z: " << Point[0]/m << ", " << Point[1]/m << ", " << Point[2]/m << " m" << G4endl; I see such nan or unreasonable values: x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: 6.2145628640319e-315, 2.4004425734447e-314, -0.15 m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: 1.2429125728064e-314, 4.8008851463953e-314, -0.15 m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: 6.2145628788539e-316, 2.4004425744328e-315, -0.15 m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: -nan, -nan, -nan m x,y,z: 1.2429125708301e-315, 4.8008851488656e-315, -0.15 m These nan values are the values Geant4 is asking me for the field vector values. So, I guess for some reason the FieldPropagator/ChordFinder/ClassicalRK4 gets into some numerical instability and stays there forever? Here are the parameters I used for the field stepping. fieldMgr: deltaOneStep = 0.01*mm; fieldPropagator: epsMin = 5.0e-05; epsMax = 1.0e-03; MaxLoopCount = 1000; fChordFinder: minStep = 1*mm; I also have a step limiter, with a step size of 1 mm to the whole logicWorld in the DetectorConstruction, because I noticed that sometimes Geant4 adapts the step size and therefore I don't have curved tracks anymore in vacuum. I also ask the fieldPropagator if she thinks it is looping via fieldPropagator->IsParticleLoop() but she always tell me she is NOT looping. Maybe I am doing something wrong here? Or how can I make it to avoid such infinite cases? For the physical events the rest of the tracks are fine, but when it gets to this kind of problem Geant4 stays there forever... thanks for any help, Balint |
Inline Depth: | Outline Depth: | Add message: |
to: |