4 ///////////////////////////////////////////////////////////////////
6 // WrapMag.hh - Sara Vanini
8 // Wrapper for geometry tracking in magnetic field: returns magnetic
9 // field values in a given position.
12 // modified 18/XI/1999
13 // modified 24.10.01: by I. Hrivnacova
14 // functions declarations separated from implementation
15 // (moved to Wrappers.hh);
17 /////////////////////////////////////////////////////////////////
20 #include "Wrappers.hh"
21 #include "FGeometryInit.hh"
24 void magfld(const G4double& pX, const G4double& pY, const G4double& pZ,
25 G4double& cosBx, G4double& cosBy, G4double& cosBz,
26 G4double& Bmag, G4int& reg, G4int& idiscflag)
30 #ifdef G4GEOMETRY_DEBUG
31 G4cout<<"================== MAGFLD ================="<<G4endl;
35 FGeometryInit * ptrGeoInit=FGeometryInit::GetInstance();
37 //get FieldManager, Field pointers for magnetic field handling
38 G4FieldManager * pFieldMgr = ptrGeoInit->getFieldManager();
39 const G4Field * ptrField = pFieldMgr->GetDetectorField();
47 ptrField->GetFieldValue(point,B);
48 G4double Bnor = sqrt(sqr(B[0])+sqr(B[1])+sqr(B[2]));