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
0040e0f4
Commit
0040e0f4
authored
10 years ago
by
Markus Frank
Browse files
Options
Downloads
Patches
Plain Diff
Fix vertex position change for particle generation
parent
bebb227f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
DDG4/include/DDG4/Geant4IsotropeGenerator.h
+5
-2
5 additions, 2 deletions
DDG4/include/DDG4/Geant4IsotropeGenerator.h
DDG4/src/Geant4IsotropeGenerator.cpp
+11
-1
11 additions, 1 deletion
DDG4/src/Geant4IsotropeGenerator.cpp
with
16 additions
and
3 deletions
DDG4/include/DDG4/Geant4IsotropeGenerator.h
+
5
−
2
View file @
0040e0f4
...
...
@@ -11,6 +11,7 @@
// Framework include files
#include
"DDG4/Geant4GeneratorAction.h"
#include
"Math/Vector3D.h"
// Forward declarations
class
G4ParticleDefinition
;
...
...
@@ -28,12 +29,14 @@ namespace DD4hep {
*/
class
Geant4IsotropeGenerator
:
public
Geant4GeneratorAction
{
protected:
/// Property: Position and shooting direction of the gun
ROOT
::
Math
::
XYZVector
m_position
;
/// Property: Particle name
std
::
string
m_particleName
;
/// Pointer to geant4 particle definition
G4ParticleDefinition
*
m_particle
;
/// Property: Particle energy
double
m_energy
;
/// Property: Particle name
std
::
string
m_particleName
;
/// Property: Desired multiplicity of the particles to be shot
int
m_multiplicity
;
/// Property: User mask passed to all particles in the generated interaction
...
...
This diff is collapsed.
Click to expand it.
DDG4/src/Geant4IsotropeGenerator.cpp
+
11
−
1
View file @
0040e0f4
...
...
@@ -28,7 +28,7 @@ using namespace DD4hep::Simulation;
/// Standard constructor
Geant4IsotropeGenerator
::
Geant4IsotropeGenerator
(
Geant4Context
*
context
,
const
string
&
name
)
:
Geant4GeneratorAction
(
context
,
name
),
m_particle
(
0
)
:
Geant4GeneratorAction
(
context
,
name
),
m_position
(
0
,
0
,
0
),
m_particle
(
0
)
{
InstanceCount
::
increment
(
this
);
m_needsControl
=
true
;
...
...
@@ -36,6 +36,7 @@ Geant4IsotropeGenerator::Geant4IsotropeGenerator(Geant4Context* context, const s
declareProperty
(
"Energy"
,
m_energy
=
50
*
MeV
);
declareProperty
(
"Multiplicity"
,
m_multiplicity
=
1
);
declareProperty
(
"Mask"
,
m_mask
=
0
);
declareProperty
(
"Position"
,
m_position
);
}
/// Default destructor
...
...
@@ -62,6 +63,9 @@ void Geant4IsotropeGenerator::operator()(G4Event*) {
Geant4Vertex
*
vtx
=
new
Geant4Vertex
();
vtx
->
mask
=
m_mask
;
vtx
->
x
=
m_position
.
X
();
vtx
->
y
=
m_position
.
Y
();
vtx
->
z
=
m_position
.
Z
();
inter
->
vertices
.
insert
(
make_pair
(
inter
->
vertices
.
size
(),
vtx
));
for
(
int
i
=
0
;
i
<
m_multiplicity
;
++
i
)
{
double
phi
=
2
*
M_PI
*
rnd
.
rndm
();
...
...
@@ -81,6 +85,12 @@ void Geant4IsotropeGenerator::operator()(G4Event*) {
p
->
psy
=
x2
*
momentum
;
p
->
psz
=
x3
*
momentum
;
p
->
mass
=
m_particle
->
GetPDGMass
();
p
->
vsx
=
vtx
->
x
;
p
->
vsy
=
vtx
->
y
;
p
->
vsz
=
vtx
->
z
;
p
->
vex
=
vtx
->
x
;
p
->
vey
=
vtx
->
y
;
p
->
vez
=
vtx
->
z
;
inter
->
particles
.
insert
(
make_pair
(
p
->
id
,
p
));
vtx
->
out
.
insert
(
p
->
id
);
printout
(
INFO
,
name
(),
"Particle [%d] %s %.3f GeV direction:(%6.3f %6.3f %6.3f)"
,
...
...
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