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

Definition of a uniform magnetic field. More...

#include <Ex02MagField.h>

Inheritance diagram for Ex02MagField:

Public Member Functions

 Ex02MagField (Double_t Bx, Double_t By, Double_t Bz)
 
 Ex02MagField ()
 
virtual ~Ex02MagField ()
 
virtual void Field (const Double_t *x, Double_t *B)
 

Private Member Functions

 Ex02MagField (const Ex02MagField &)
 
Ex02MagFieldoperator= (const Ex02MagField &)
 

Private Attributes

Double_t fB [3]
 Magnetic field vector.
 

Detailed Description

Definition of a uniform magnetic field.

This class demonstrates definition of a user magnetic field via the TVirtualMagField interface. In case of a uniform magnetic field, it is also possible to use directly the TGeoUniformMagField class in the VMC application.

Date
Author
I. Hrivnacova; IPN, Orsay

Definition at line 34 of file Ex02MagField.h.

Constructor & Destructor Documentation

◆ Ex02MagField() [1/3]

Ex02MagField::Ex02MagField ( Double_t Bx,
Double_t By,
Double_t Bz )

Standard constructor

Parameters
BxThe x component of the field value (in kiloGauss)
ByThe y component of the field value (in kiloGauss)
BzThe z component of the field value (in kiloGauss)

Definition at line 24 of file Ex02MagField.cxx.

25 : TVirtualMagField("Ex02 magnetic field")
26{
27 /// Standard constructor
28 /// \param Bx The x component of the field value (in kiloGauss)
29 /// \param By The y component of the field value (in kiloGauss)
30 /// \param Bz The z component of the field value (in kiloGauss)
31
32 fB[0] = Bx;
33 fB[1] = By;
34 fB[2] = Bz;
35}
Double_t fB[3]
Magnetic field vector.

◆ Ex02MagField() [2/3]

Ex02MagField::Ex02MagField ( )

Default constructor

Definition at line 38 of file Ex02MagField.cxx.

39{
40 /// Default constructor
41 fB[0] = 0.;
42 fB[1] = 0.;
43 fB[2] = 0.;
44}

◆ ~Ex02MagField()

Ex02MagField::~Ex02MagField ( )
virtual

Destructor

Definition at line 47 of file Ex02MagField.cxx.

48{
49 /// Destructor
50}

◆ Ex02MagField() [3/3]

Ex02MagField::Ex02MagField ( const Ex02MagField & )
private

Member Function Documentation

◆ Field()

void Ex02MagField::Field ( const Double_t * x,
Double_t * B )
virtual

Fill in the field value B in the given position at x. (In case of a uniform magnetic field the value B does not depend on the position x )

Parameters
xThe position
Bhe field value (in kiloGauss)

Definition at line 53 of file Ex02MagField.cxx.

54{
55 /// Fill in the field value B in the given position at x.
56 /// (In case of a uniform magnetic field the value B does not depend on
57 /// the position x )
58 /// \param x The position
59 /// \param B he field value (in kiloGauss)
60
61 // cout << "+++ Getting field in "
62 // << gMC->CurrentVolName() << " " << gMC->CurrentMedium() << endl;
63
64 B[0] = fB[0];
65 B[1] = fB[1];
66 B[2] = fB[2];
67}

◆ operator=()

Ex02MagField & Ex02MagField::operator= ( const Ex02MagField & )
private

Member Data Documentation

◆ fB

Double_t Ex02MagField::fB[3]
private

Magnetic field vector.

Definition at line 47 of file Ex02MagField.h.


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