VMC Examples Version 6.6
Loading...
Searching...
No Matches
B5MagneticField Class Reference

Magnetic field. More...

#include <B5MagneticField.hh>

Inheritance diagram for B5MagneticField:

Public Member Functions

 B5MagneticField ()
 
virtual ~B5MagneticField ()
 
virtual void GetFieldValue (const G4double point[4], double *bField) const
 
void SetField (G4double val)
 
G4double GetField () const
 

Private Member Functions

void DefineCommands ()
 

Private Attributes

G4GenericMessenger * fMessenger
 
G4double fBy
 

Detailed Description

Magnetic field.

Definition at line 41 of file B5MagneticField.hh.

Constructor & Destructor Documentation

◆ B5MagneticField()

B5MagneticField::B5MagneticField ( )

Definition at line 39 of file B5MagneticField.cxx.

40 : G4MagneticField(), fMessenger(0), fBy(1.0 * tesla)
41{
42 // define commands for this class
44}
G4GenericMessenger * fMessenger

◆ ~B5MagneticField()

B5MagneticField::~B5MagneticField ( )
virtual

Definition at line 48 of file B5MagneticField.cxx.

48{ delete fMessenger; }

Member Function Documentation

◆ GetFieldValue()

void B5MagneticField::GetFieldValue ( const G4double point[4],
double * bField ) const
virtual

Definition at line 50 of file B5MagneticField.cxx.

51{
52 bField[0] = 0.;
53 bField[1] = fBy;
54 bField[2] = 0.;
55}

◆ SetField()

void B5MagneticField::SetField ( G4double val)
inline

Definition at line 49 of file B5MagneticField.hh.

49{ fBy = val; }

◆ GetField()

G4double B5MagneticField::GetField ( ) const
inline

Definition at line 50 of file B5MagneticField.hh.

50{ return fBy; }

◆ DefineCommands()

void B5MagneticField::DefineCommands ( )
private

Definition at line 59 of file B5MagneticField.cxx.

60{
61 // Define /B5/field command directory using generic messenger class
62 fMessenger = new G4GenericMessenger(this, "/B5/field/", "Field control");
63
64 // fieldValue command
65 G4GenericMessenger::Command& valueCmd = fMessenger->DeclareMethodWithUnit(
66 "value", "tesla", &B5MagneticField::SetField, "Set field strength.");
67 valueCmd.SetParameterName("field", true);
68 valueCmd.SetDefaultValue("1.");
69}
void SetField(G4double val)

Member Data Documentation

◆ fMessenger

G4GenericMessenger* B5MagneticField::fMessenger
private

Definition at line 55 of file B5MagneticField.hh.

◆ fBy

G4double B5MagneticField::fBy
private

Definition at line 56 of file B5MagneticField.hh.


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