VMC Examples Version 6.6
Loading...
Searching...
No Matches
Ex02MagField.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 Ex02MagField.cxx
11/// \brief Implementation of the Ex02MagField class
12///
13/// Geant4 ExampleN02 adapted to Virtual Monte Carlo
14///
15/// \author I. Hrivnacova; IPN, Orsay
16
17#include "Ex02MagField.h"
18
19/// \cond CLASSIMP
20ClassImp(Ex02MagField)
21 /// \endcond
22
23 //______________________________________________________________________________
24 Ex02MagField::Ex02MagField(Double_t Bx, Double_t By, Double_t Bz)
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}
36
37//______________________________________________________________________________
39{
40 /// Default constructor
41 fB[0] = 0.;
42 fB[1] = 0.;
43 fB[2] = 0.;
44}
45
46//______________________________________________________________________________
48{
49 /// Destructor
50}
51
52//______________________________________________________________________________
53void Ex02MagField::Field(const Double_t* /*x*/, Double_t* B)
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}
Definition of the Ex02MagField class.
Definition of a uniform magnetic field.
virtual void Field(const Double_t *x, Double_t *B)
Double_t fB[3]
Magnetic field vector.
virtual ~Ex02MagField()