DD4hep
1.32.0
Detector Description Toolkit for High Energy Physics
Main Page
Related Pages
Modules
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerations
_
a
c
d
e
f
g
h
i
l
m
n
o
p
r
s
u
Enumerator
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Related Functions
b
d
g
o
p
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
x
Functions
_
c
d
g
h
i
l
m
n
o
p
r
s
u
Variables
Typedefs
_
a
c
d
e
f
g
j
l
o
p
r
s
t
u
v
x
Enumerations
Enumerator
Macros
_
a
b
c
d
e
g
h
i
m
n
p
r
s
t
u
x
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
DDG4
src
Geant4Field.cpp
Go to the documentation of this file.
1
//==========================================================================
2
// AIDA Detector description implementation
3
//--------------------------------------------------------------------------
4
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5
// All rights reserved.
6
//
7
// For the licensing terms see $DD4hepINSTALL/LICENSE.
8
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9
//
10
// Author : M.Frank
11
//
12
//==========================================================================
13
14
// Framework include files
15
#include <
DDG4/Geant4Field.h
>
16
#include <
DD4hep/DD4hepUnits.h
>
17
#include <CLHEP/Units/SystemOfUnits.h>
18
namespace
units
=
dd4hep
;
19
20
using namespace
dd4hep::sim
;
21
22
G4bool
Geant4Field::DoesFieldChangeEnergy
()
const
{
23
return
m_field
.
changesEnergy
();
24
}
25
26
void
Geant4Field::GetFieldValue
(
const
double
pos[4],
double
*field)
const
{
27
static
const
double
fac1 = units::mm/CLHEP::mm;
28
static
const
double
fac2 = CLHEP::tesla/units::tesla;
29
double
p[3] = {pos[0]*fac1, pos[1]*fac1, pos[2]*fac1};
// Convert from CLHEP units to tgeo units
30
field[0] = field[1] = field[2] = 0.0;
// Reset field vector
31
m_field
.
magneticField
(p, field);
32
field[0] *= fac2;
// Convert from tgeo units to CLHEP units
33
field[1] *= fac2;
34
field[2] *= fac2;
35
//::printf("Pos: %7.4f %7.4f %7.4f --> %9g %9g %9g\n",p[0],p[1],p[2],field[0],field[1],field[2]);
36
}
Geant4Field.h
dd4hep::sim::Geant4Field::DoesFieldChangeEnergy
virtual G4bool DoesFieldChangeEnergy() const override
Does field change energy ?
Definition:
Geant4Field.cpp:22
dd4hep::sim::Geant4Field::m_field
OverlayedField m_field
Reference to the detector description field.
Definition:
Geant4Field.h:42
dd4hep::sim::Geant4Field::GetFieldValue
virtual void GetFieldValue(const double pos[4], double *arr) const override
Access field values at a given point.
Definition:
Geant4Field.cpp:26
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition:
EDM4hepFileReader.cpp:41
dd4hep
Namespace for the AIDA detector description toolkit.
Definition:
AlignmentsCalib.h:28
dd4hep::OverlayedField::changesEnergy
bool changesEnergy() const
Does the field change the energy of charged particles?
Definition:
Fields.cpp:104
dd4hep::OverlayedField::magneticField
void magneticField(const Position &pos, double *field) const
Returns the 3 magnetic field components (x, y, z).
Definition:
Fields.cpp:140
DD4hepUnits.h
Generated on Tue May 20 2025 21:53:29 for DD4hep by
1.8.18