Geant4-11
Public Member Functions | Static Public Attributes | Protected Attributes | Private Attributes
G4TCachedMagneticField< T_Field > Class Template Reference

#include <G4TCachedMagneticField.hh>

Inheritance diagram for G4TCachedMagneticField< T_Field >:
G4MagneticField G4Field

Public Member Functions

void ClearCounts ()
 
G4TCachedMagneticFieldClone () const
 
G4bool DoesFieldChangeEnergy () const
 
 G4TCachedMagneticField (const G4TCachedMagneticField< T_Field > &rightCMF)
 
 G4TCachedMagneticField (T_Field *pTField, G4double distance)
 
G4double GetConstDistance () const
 
G4int GetCountCalls () const
 
G4int GetCountEvaluations () const
 
virtual void GetFieldValue (const G4double Point[4], G4double *Bfield) const
 
G4bool IsGravityActive () const
 
G4TCachedMagneticFieldoperator= (const G4TCachedMagneticField &right)
 
void ReportStatistics ()
 
void SetConstDistance (G4double dist)
 
void SetGravityActive (G4bool OnOffFlag)
 
virtual ~G4TCachedMagneticField ()
 

Static Public Attributes

static constexpr G4int MAX_NUMBER_OF_COMPONENTS = 24
 

Protected Attributes

G4int fCountCalls
 
G4int fCountEvaluations
 

Private Attributes

G4double fDistanceConst
 
G4bool fGravityActive = false
 
G4ThreeVector fLastLocation
 
G4ThreeVector fLastValue
 
T_Field * fpMagneticField
 

Detailed Description

template<class T_Field>
class G4TCachedMagneticField< T_Field >

Definition at line 35 of file G4TCachedMagneticField.hh.

Constructor & Destructor Documentation

◆ G4TCachedMagneticField() [1/2]

template<class T_Field >
G4TCachedMagneticField< T_Field >::G4TCachedMagneticField ( T_Field *  pTField,
G4double  distance 
)
inline

◆ G4TCachedMagneticField() [2/2]

template<class T_Field >
G4TCachedMagneticField< T_Field >::G4TCachedMagneticField ( const G4TCachedMagneticField< T_Field > &  rightCMF)
inline

◆ ~G4TCachedMagneticField()

template<class T_Field >
virtual G4TCachedMagneticField< T_Field >::~G4TCachedMagneticField ( )
inlinevirtual

Definition at line 75 of file G4TCachedMagneticField.hh.

75{ ; }

Member Function Documentation

◆ ClearCounts()

template<class T_Field >
void G4TCachedMagneticField< T_Field >::ClearCounts ( )
inline

◆ Clone()

template<class T_Field >
G4TCachedMagneticField * G4TCachedMagneticField< T_Field >::Clone ( ) const
inlinevirtual

Reimplemented from G4Field.

Definition at line 62 of file G4TCachedMagneticField.hh.

63 {
64 G4cout << "Clone is called" << G4endl;
65 // Cannot use copy constructor: I need to clone the associated magnetif
66 // field
67 T_Field* aF = this->fpMagneticField->T_Field::Clone();
70 cloned->fLastLocation = this->fLastLocation;
71 cloned->fLastValue = this->fLastValue;
72 return cloned;
73 }
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4TCachedMagneticField(T_Field *pTField, G4double distance)

References G4TCachedMagneticField< T_Field >::fDistanceConst, G4TCachedMagneticField< T_Field >::fLastLocation, G4TCachedMagneticField< T_Field >::fLastValue, G4TCachedMagneticField< T_Field >::fpMagneticField, G4cout, G4endl, and G4TCachedMagneticField< T_Field >::G4TCachedMagneticField().

◆ DoesFieldChangeEnergy()

G4bool G4MagneticField::DoesFieldChangeEnergy ( ) const
inlinevirtualinherited

Implements G4Field.

Definition at line 52 of file G4MagneticField.hh.

52{ return false; }

Referenced by export_G4MagneticField().

◆ GetConstDistance()

template<class T_Field >
G4double G4TCachedMagneticField< T_Field >::GetConstDistance ( ) const
inline

◆ GetCountCalls()

template<class T_Field >
G4int G4TCachedMagneticField< T_Field >::GetCountCalls ( ) const
inline

Definition at line 114 of file G4TCachedMagneticField.hh.

114{ return fCountCalls; }

References G4TCachedMagneticField< T_Field >::fCountCalls.

◆ GetCountEvaluations()

template<class T_Field >
G4int G4TCachedMagneticField< T_Field >::GetCountEvaluations ( ) const
inline

◆ GetFieldValue()

template<class T_Field >
virtual void G4TCachedMagneticField< T_Field >::GetFieldValue ( const G4double  Point[4],
G4double Bfield 
) const
inlinevirtual

Implements G4MagneticField.

Definition at line 85 of file G4TCachedMagneticField.hh.

86 {
87 G4ThreeVector newLocation(Point[0], Point[1], Point[2]);
88
89 G4double distSq = (newLocation - fLastLocation).mag2();
91 if(distSq < fDistanceConst * fDistanceConst)
92 {
93 Bfield[0] = fLastValue.x();
94 Bfield[1] = fLastValue.y();
95 Bfield[2] = fLastValue.z();
96 }
97 else
98 {
99 // G4CachedMagneticField* thisNonC=
100 // const_cast<G4CachedMagneticField*>(this);
101 fpMagneticField->T_Field::GetFieldValue(Point, Bfield);
102 // G4cout << " Evaluating. " << G4endl;
104 // thisNonC->
105 fLastLocation = G4ThreeVector(Point[0], Point[1], Point[2]);
106 // thisNonC->
107 fLastValue = G4ThreeVector(Bfield[0], Bfield[1], Bfield[2]);
108 }
109 }
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:83
double z() const
double x() const
double y() const

References G4TCachedMagneticField< T_Field >::fCountCalls, G4TCachedMagneticField< T_Field >::fCountEvaluations, G4TCachedMagneticField< T_Field >::fDistanceConst, G4TCachedMagneticField< T_Field >::fLastLocation, G4TCachedMagneticField< T_Field >::fLastValue, G4TCachedMagneticField< T_Field >::fpMagneticField, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ IsGravityActive()

G4bool G4Field::IsGravityActive ( ) const
inlineinherited

Definition at line 101 of file G4Field.hh.

102{
103 return fGravityActive;
104}
G4bool fGravityActive
Definition: G4Field.hh:96

References G4Field::fGravityActive.

Referenced by G4CoupledTransportation::AlongStepGetPhysicalInteractionLength(), and G4RepleteEofM::G4RepleteEofM().

◆ operator=()

template<class T_Field >
G4TCachedMagneticField & G4TCachedMagneticField< T_Field >::operator= ( const G4TCachedMagneticField< T_Field > &  right)
inline

◆ ReportStatistics()

template<class T_Field >
void G4TCachedMagneticField< T_Field >::ReportStatistics ( )
inline

Definition at line 78 of file G4TCachedMagneticField.hh.

79 {
80 G4cout << " Cached field: " << G4endl
81 << " Number of calls: " << fCountCalls << G4endl
82 << " Number of evaluations : " << fCountEvaluations << G4endl;
83 }

References G4TCachedMagneticField< T_Field >::fCountCalls, G4TCachedMagneticField< T_Field >::fCountEvaluations, G4cout, and G4endl.

◆ SetConstDistance()

template<class T_Field >
void G4TCachedMagneticField< T_Field >::SetConstDistance ( G4double  dist)
inline

◆ SetGravityActive()

void G4Field::SetGravityActive ( G4bool  OnOffFlag)
inlineinherited

Definition at line 106 of file G4Field.hh.

107{
108 fGravityActive = OnOffFlag;
109}

References G4Field::fGravityActive.

Field Documentation

◆ fCountCalls

template<class T_Field >
G4int G4TCachedMagneticField< T_Field >::fCountCalls
mutableprotected

◆ fCountEvaluations

template<class T_Field >
G4int G4TCachedMagneticField< T_Field >::fCountEvaluations
protected

◆ fDistanceConst

template<class T_Field >
G4double G4TCachedMagneticField< T_Field >::fDistanceConst
private

◆ fGravityActive

G4bool G4Field::fGravityActive = false
privateinherited

◆ fLastLocation

template<class T_Field >
G4ThreeVector G4TCachedMagneticField< T_Field >::fLastLocation
mutableprivate

◆ fLastValue

template<class T_Field >
G4ThreeVector G4TCachedMagneticField< T_Field >::fLastValue
mutableprivate

◆ fpMagneticField

template<class T_Field >
T_Field* G4TCachedMagneticField< T_Field >::fpMagneticField
private

◆ MAX_NUMBER_OF_COMPONENTS

constexpr G4int G4Field::MAX_NUMBER_OF_COMPONENTS = 24
staticconstexprinherited

Definition at line 92 of file G4Field.hh.

Referenced by G4BFieldIntegrationDriver::CurvatureRadius().


The documentation for this class was generated from the following file: