VMC Examples Version 6.6
Loading...
Searching...
No Matches
A01LocalMagField.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Virtual Monte Carlo examples
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
10/// \file A01LocalMagField.cxx
11/// \brief Implementation of the A01LocalMagField class
12///
13/// Geant4 example A01 adapted to Virtual Monte Carlo \n
14///
15/// \author I. Hrivnacova; IPN, Orsay
16
17#include <TMath.h>
18
19#include "A01LocalMagField.h"
20
21/// \cond CLASSIMP
22ClassImp(A01LocalMagField)
23 /// \endcond
24
25 //______________________________________________________________________________
26 A01LocalMagField::A01LocalMagField(Double_t Bx, Double_t By, Double_t Bz)
27 : TVirtualMagField("A01 magnetic field")
28{
29 /// Standard constructor
30 /// \param Bx The x component of the field value (in kiloGauss)
31 /// \param By The y component of the field value (in kiloGauss)
32 /// \param Bz The z component of the field value (in kiloGauss)
33
34 fB[0] = Bx;
35 fB[1] = By;
36 fB[2] = Bz;
37}
38
39//______________________________________________________________________________
41{
42 /// Default constructor
43 fB[0] = 0.;
44 fB[1] = 0.;
45 fB[2] = 0.;
46}
47
48//______________________________________________________________________________
50{
51 /// Destructor
52}
53
54//______________________________________________________________________________
55void A01LocalMagField::Field(const Double_t* /*x*/, Double_t* B)
56{
57 /// Fill in the field value B in the given position at x.
58 /// The local field is uniform in the associated volume.
59 /// \param B The field value (in kiloGauss)
60
61 B[0] = fB[0];
62 B[1] = fB[1];
63 B[2] = fB[2];
64}
Definition of the A01LocalMagField class.
Definition of a uniform magnetic field within a given region.
virtual void Field(const Double_t *, Double_t *B)
Double_t fB[3]
Magnetic field vector.