Geant4 VMC
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
source
geometry
src
TG4Field.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Geant4 Virtual Monte Carlo package
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
14
15
#include "
TG4Field.h
"
16
#include "
TG4MagneticField.h
"
17
#include "
TG4Globals.h
"
18
19
#include <TVirtualMagField.h>
20
21
#include <G4FieldBuilder.hh>
22
23
//_____________________________________________________________________________
24
TG4Field::TG4Field
(
const
G4FieldParameters& parameters,
25
TVirtualMagField* magField, G4LogicalVolume* lv)
26
:
fVirtualMagField
(magField),
27
fLogicalVolume
(lv)
28
{
30
31
// Consistency check
32
if
(magField ==
nullptr
) {
33
TG4Globals::Exception
(
34
"TG4Field"
,
"TG4Field:"
,
"No TVirtualMagField is defined."
);
35
}
36
37
// Create field
38
fG4Field
=
new
TG4MagneticField
(magField);
39
// field will be deleted by Geant4 kernel
40
41
// Set field to G4 field builder
42
auto
fieldBuilder = G4FieldBuilder::Instance();
43
if
(lv ==
nullptr
) {
44
fieldBuilder->SetGlobalField(
fG4Field
);
45
}
46
else
{
47
fieldBuilder->SetLocalField(
fG4Field
, lv);
48
}
49
}
50
51
//_____________________________________________________________________________
52
TG4Field::~TG4Field
()
53
{
55
}
TG4Field.h
Definition of the TG4Field class.
TG4Globals.h
Definition of the TG4Globals class and basic container types.
TG4MagneticField.h
Definition of the TG4MagneticField class.
TG4Field::~TG4Field
~TG4Field()
Definition
TG4Field.cxx:52
TG4Field::fLogicalVolume
G4LogicalVolume * fLogicalVolume
The associated volume (if local field).
Definition
TG4Field.h:52
TG4Field::fVirtualMagField
TVirtualMagField * fVirtualMagField
The associated TGeo magnetic field.
Definition
TG4Field.h:50
TG4Field::TG4Field
TG4Field(const G4FieldParameters ¶meters, TVirtualMagField *magField, G4LogicalVolume *lv=nullptr)
Definition
TG4Field.cxx:24
TG4Field::fG4Field
G4Field * fG4Field
Geant4 field.
Definition
TG4Field.h:48
TG4Globals::Exception
static void Exception(const TString &className, const TString &methodName, const TString &text)
Definition
TG4Globals.cxx:33
TG4MagneticField
The magnetic field defined via TVirtualMagField.
Definition
TG4MagneticField.h:29
Generated on
for Geant4 VMC by
1.17.0