Message: Re: Getting NAN for values of Point in a magnetic field class  Not Logged In (login) 
Aaron,
What happens when you start your track from a random location in a random direction?
> Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName > 0 0 0 0 1 0 0 0 hallPhys initStep Ok, so this is the start position. > previous Bx, By, Bz: 1.38137e314; 6.94803e310; 6.95317e310 I don't know why your 'previous B' is not exactly zero the first time its accessed. > x, y, z: 0; 0; 0 Ok, that's what we want to see
> Br, Btheta, Bphi: 0.0001; 0; 0 > Bx, By, Bz: nan; nan; nan Your Bfield can only be exactly zero on axis. The axis is a singularity and you can't calculate a Bx etc. Everywhere else, for Br>0, Btheta=0, and Bphi=0, Bx=Br*cos(phi), By=Br*sin(phi), Bz=0. > x, y, z: 842.349; 842.349; 842.349 ok, the RungeKutta step attempt is to this location. > One of x, y, or z is NAN: set Bx = By = Bz = 0 I don't see any of the x, y, z is Nan? Anyway, a locatation exactly 0,0,0 and direction exactly 1,1,1 is unphysical. I suggest you start at a random position near zero and random direction near the diagonal. In any event, you must take care to return correct Bfield values for all coordinates. Your simualtion is not even succeeding in doing one single step. This is not a G4 issue but one having to do with your Bfield setup. Your Bfield has to satisfy Maxwells Equations! Peter

Inline Depth:  Outline Depth:  Add message: 
to: 