Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DD4hep
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cepc
externals
mirroring
DD4hep
Commits
e5411f48
Commit
e5411f48
authored
11 years ago
by
Markus Frank
Browse files
Options
Downloads
Patches
Plain Diff
Re-add code, which got lost on last commit.
parent
5ea6e843
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DDG4/src/Geant4FieldSetup.cpp
+96
-0
96 additions, 0 deletions
DDG4/src/Geant4FieldSetup.cpp
with
96 additions
and
0 deletions
DDG4/src/Geant4FieldSetup.cpp
0 → 100644
+
96
−
0
View file @
e5411f48
// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $
//====================================================================
// AIDA Detector description implementation for LCD
//--------------------------------------------------------------------
//
// Author : M.Frank
//
//====================================================================
// Framework include files
#include
"DD4hep/Handle.h"
#include
"DD4hep/Fields.h"
#include
"DDG4/Factories.h"
#include
"DDG4/Geant4Field.h"
#include
"DDG4/Geant4Converter.h"
#include
"G4TransportationManager.hh"
#include
"G4MagIntegratorStepper.hh"
#include
"G4Mag_EqRhs.hh"
#include
"G4ChordFinder.hh"
#include
"G4PropagatorInField.hh"
using
namespace
std
;
using
namespace
DD4hep
;
using
namespace
DD4hep
::
Simulation
;
typedef
DD4hep
::
Geometry
::
LCDD
lcdd_t
;
namespace
{
struct
Geant4FieldSetup
;
struct
Geant4SetupPropertyMap
{
const
map
<
string
,
string
>&
vals
;
Geant4SetupPropertyMap
(
const
map
<
string
,
string
>&
v
)
:
vals
(
v
)
{}
string
value
(
const
string
&
key
)
const
;
double
toDouble
(
const
string
&
key
)
const
;
bool
operator
[](
const
string
&
key
)
const
{
return
vals
.
find
(
key
)
!=
vals
.
end
();
}
};
string
Geant4SetupPropertyMap
::
value
(
const
string
&
key
)
const
{
lcdd_t
::
PropertyValues
::
const_iterator
iV
=
vals
.
find
(
key
);
return
iV
==
vals
.
end
()
?
""
:
(
*
iV
).
second
;
}
double
Geant4SetupPropertyMap
::
toDouble
(
const
string
&
key
)
const
{
return
Geometry
::
_toDouble
(
this
->
value
(
key
));
}
}
static
long
setup_fields
(
lcdd_t
&
lcdd
,
const
Simulation
::
Geant4Converter
&
/* cnv */
,
const
map
<
string
,
string
>&
vals
)
{
Geant4SetupPropertyMap
pm
(
vals
);
DD4hep
::
Geometry
::
OverlayedField
fld
=
lcdd
.
field
();
G4MagIntegratorStepper
*
stepper
=
0
;
G4MagneticField
*
field
=
0
;
G4FieldManager
*
fieldMgr
=
0
;
G4TransportationManager
*
tr
=
0
;
G4PropagatorInField
*
propagator
=
0
;
G4ChordFinder
*
chordFinder
=
0
;
lcdd_t
::
PropertyValues
::
const_iterator
iV
;
string
eq_typ
=
pm
.
value
(
"equation"
);
string
stepper_typ
=
pm
.
value
(
"stepper"
);
double
value
;
field
=
new
Simulation
::
Geant4Field
(
fld
);
tr
=
G4TransportationManager
::
GetTransportationManager
();
fieldMgr
=
tr
->
GetFieldManager
();
fieldMgr
->
SetFieldChangesEnergy
(
fld
.
changesEnergy
());
fieldMgr
->
SetDetectorField
(
field
);
G4Mag_EqRhs
*
equation
=
ROOT
::
Reflex
::
PluginService
::
Create
<
G4Mag_EqRhs
*>
(
eq_typ
,
field
);
stepper
=
ROOT
::
Reflex
::
PluginService
::
Create
<
G4MagIntegratorStepper
*>
(
stepper_typ
,
equation
);
iV
=
vals
.
find
(
"min_chord_step"
);
value
=
Geometry
::
_toDouble
((
iV
==
vals
.
end
())
?
string
(
"1.0e-2 * mm"
)
:
(
*
iV
).
second
);
chordFinder
=
new
G4ChordFinder
(
field
,
value
,
stepper
);
propagator
=
tr
->
GetPropagatorInField
();
fieldMgr
->
SetChordFinder
(
chordFinder
);
if
(
pm
[
"delta_chord"
]
)
{
chordFinder
->
SetDeltaChord
(
pm
.
toDouble
(
"delta_chord"
));
}
if
(
pm
[
"delta_one_step"
]
)
{
fieldMgr
->
SetAccuraciesWithDeltaOneStep
(
pm
.
toDouble
(
"delta_one_step"
));
}
if
(
pm
[
"delta_intersection"
]
)
{
fieldMgr
->
SetDeltaIntersection
(
pm
.
toDouble
(
"delta_intersection"
));
}
if
(
pm
[
"eps_min"
]
)
{
propagator
->
SetMinimumEpsilonStep
(
pm
.
toDouble
(
"eps_min"
));
}
if
(
pm
[
"eps_max"
]
)
{
propagator
->
SetMaximumEpsilonStep
(
pm
.
toDouble
(
"eps_max"
));
}
return
1
;
}
DECLARE_GEANT4_SETUP
(
Geant4FieldSetup
,
setup_fields
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment