In general you should get the detector from the event, and the field map from the detector. If you only want the Z field, and you are prepared to assume the field is constant (since we don't have a detailed field map that is probably a good approximation) you can use:
Hep3Vector ip = new BasicHep3Vector(); double zField = event.getDetector().getFieldMap().getField(ip).z();
or more fully
import hep.physics.vec.BasicHep3Vector; import hep.physics.vec.Hep3Vector; import org.lcsim.event.EventHeader; import org.lcsim.util.Driver; public class FieldDriver extends Driver { private static final Hep3Vector ip = new BasicHep3Vector(); public void process(EventHeader event) { double zField = event.getDetector().getFieldMap().getField(ip).z(); } }
For more information see FieldMap