//
// ********************************************************************
// * DISCLAIMER                                                       *
// *                                                                  *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in:                      *
// *   http://cern.ch/geant4/license                                  *
// *                                                                  *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work  make  any representation or  warranty, express or implied, *
// * regarding  this  software system or assume any liability for its *
// * use.                                                             *
// *                                                                  *
// * This  code  implementation is the  intellectual property  of the *
// * GEANT4 collaboration.                                            *
// * By copying,  distributing  or modifying the Program (or any work *
// * based  on  the Program)  you indicate  your  acceptance of  this *
// * statement, and all its terms.                                    *
// ********************************************************************
//
//
// $Id: G4FieldManager.icc,v 1.9 2003/11/08 03:39:39 japost Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
//
// G4FieldManager inline implementation 
//
// -------------------------------------------------------------------

inline
const G4Field* G4FieldManager::GetDetectorField() const
{ 
   // If pointer is null, should this raise an exception ??
   return fDetectorField;
} 

inline
G4bool G4FieldManager::DoesFieldExist() const
{ 
   return (fDetectorField != 0);
} 

inline  
void G4FieldManager::SetChordFinder(G4ChordFinder *aChordFinder)
{
     fChordFinder= aChordFinder;
}

inline  
G4ChordFinder*  G4FieldManager::GetChordFinder()
{
     return fChordFinder;
}

inline
G4double G4FieldManager::GetDeltaIntersection() const
{
     return fDelta_Intersection_Val;
}

inline
G4double G4FieldManager::GetDeltaOneStep() const
{
     return fDelta_One_Step_Value;
}

inline
void G4FieldManager::SetDeltaOneStep(G4double valDeltaOneStep)
{ 
     fDelta_One_Step_Value= valDeltaOneStep;  
}

inline
void G4FieldManager::SetDeltaIntersection(G4double valDeltaIntersection)
{
      fDelta_Intersection_Val = valDeltaIntersection;
}

inline
void G4FieldManager::SetAccuraciesWithDeltaOneStep(G4double valDeltaOneStep)
{ 
      fDelta_One_Step_Value= valDeltaOneStep;  
      fDelta_Intersection_Val = 0.4 * fDelta_One_Step_Value;
}

inline G4bool   G4FieldManager::DoesFieldChangeEnergy() const
{ return fFieldChangesEnergy;}

inline void     G4FieldManager::SetFieldChangesEnergy(G4bool value)
{ fFieldChangesEnergy = value; }

inline G4bool G4FieldManager:: FieldHasMagComponent() const
{ return fMagComponent; }	

inline void    G4FieldManager::SetFieldMagComponent(G4bool value)
{ fMagComponent = value;}


// Minimum for Relative accuracy of any Step 
inline 
G4double  G4FieldManager::GetMinimumEpsilonStep() const
{
  return fEpsilonMin; 
}

inline 
void      G4FieldManager::SetMinimumEpsilonStep( G4double newEpsMin )
{
  if( (newEpsMin > 0.0) && (fabs(1.0+newEpsMin) > 1.0) )
  {
    fEpsilonMin = newEpsMin;
  }
}

// Maximum for Relative accuracy of any Step 
inline 
G4double  G4FieldManager::GetMaximumEpsilonStep() const
{
  return fEpsilonMax; 
}

inline 
void      G4FieldManager::SetMaximumEpsilonStep( G4double newEpsMax )
{
  if(    (newEpsMax > 0.0) 
      && (newEpsMax >= fEpsilonMin ) 
      && (fabs(1.0+newEpsMax)>1.0) )
  {
    fEpsilonMax = newEpsMax;
  }
}
