Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
Analysis Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
acts-fatras
analysis
analysis_tpc_prototype
coresoftware
blob
master
calibrations
generators
offline
simulation
g4simulation
g4bbc
g4calo
g4centrality
g4decayer
g4detectors
g4epd
g4eval
g4gdml
g4histos
g4ihcal
g4intt
g4jets
g4main
CosmicSpray.cc
CosmicSpray.h
EcoMug.h
EicEventHeader.cc
EicEventHeader.h
EicEventHeaderLinkDef.h
EicEventHeaderv1.cc
EicEventHeaderv1.h
EicEventHeaderv1LinkDef.h
Fun4AllDstPileupInputManager.cc
Fun4AllDstPileupInputManager.h
Fun4AllDstPileupMerger.cc
Fun4AllDstPileupMerger.h
Fun4AllMessenger.cc
Fun4AllMessenger.h
Fun4AllSingleDstPileupInputManager.cc
Fun4AllSingleDstPileupInputManager.h
G4TBFieldMessenger.cc
G4TBFieldMessenger.hh
G4TBMagneticFieldSetup.cc
G4TBMagneticFieldSetup.hh
HepMCCompress.cc
HepMCCompress.h
HepMCNodeReader.cc
HepMCNodeReader.h
PHBBox.h
PHG4ColorDefs.h
PHG4ConsistencyCheck.cc
PHG4ConsistencyCheck.h
PHG4Detector.cc
PHG4Detector.h
PHG4DisplayAction.cc
PHG4DisplayAction.h
PHG4EtaParameterization.cc
PHG4EtaParameterization.h
PHG4EtaPhiParameterization.cc
PHG4EtaPhiParameterization.h
PHG4EventAction.h
PHG4EventHeader.h
PHG4EventHeaderLinkDef.h
PHG4EventHeaderv1.cc
PHG4EventHeaderv1.h
PHG4EventHeaderv1LinkDef.h
PHG4HeadReco.cc
PHG4HeadReco.h
PHG4Hit.cc
PHG4Hit.h
PHG4HitContainer.cc
PHG4HitContainer.h
PHG4HitContainerLinkDef.h
PHG4HitDefs.cc
PHG4HitDefs.h
PHG4HitEval.cc
PHG4HitEval.h
PHG4HitEvalLinkDef.h
PHG4HitLinkDef.h
PHG4HitReadBack.cc
PHG4HitReadBack.h
PHG4Hitv1.cc
PHG4Hitv1.h
PHG4Hitv1LinkDef.h
PHG4InEvent.cc
PHG4InEvent.h
PHG4InEventCompress.cc
PHG4InEventCompress.h
PHG4InEventLinkDef.h
PHG4InEventReadBack.cc
PHG4InEventReadBack.h
PHG4InputFilter.cc
PHG4InputFilter.h
PHG4IonGun.cc
PHG4IonGun.h
PHG4MagneticField.cc
PHG4MagneticField.h
PHG4Particle.cc
PHG4Particle.h
PHG4ParticleGenerator.cc
PHG4ParticleGenerator.h
PHG4ParticleGeneratorBase.cc
PHG4ParticleGeneratorBase.h
PHG4ParticleGeneratorD0.cc
PHG4ParticleGeneratorD0.h
PHG4ParticleGeneratorVectorMeson.cc
PHG4ParticleGeneratorVectorMeson.h
PHG4ParticleGun.cc
PHG4ParticleGun.h
PHG4ParticleLinkDef.h
PHG4Particlev1.cc
PHG4Particlev1.h
PHG4Particlev1LinkDef.h
PHG4Particlev2.cc
PHG4Particlev2.h
PHG4Particlev2LinkDef.h
PHG4Particlev3.cc
PHG4Particlev3.h
PHG4Particlev3LinkDef.h
PHG4PhenixDetector.cc
PHG4PhenixDetector.h
PHG4PhenixDisplayAction.cc
PHG4PhenixDisplayAction.h
PHG4PhenixEventAction.cc
PHG4PhenixEventAction.h
PHG4PhenixStackingAction.cc
PHG4PhenixStackingAction.h
PHG4PhenixSteppingAction.cc
PHG4PhenixSteppingAction.h
PHG4PhenixTrackingAction.cc
PHG4PhenixTrackingAction.h
PHG4PileupGenerator.cc
PHG4PileupGenerator.h
PHG4PrimaryGeneratorAction.cc
PHG4PrimaryGeneratorAction.h
PHG4Reco.cc
PHG4Reco.h
PHG4RegionInformation.cc
PHG4RegionInformation.h
PHG4ScoringManager.cc
PHG4ScoringManager.h
PHG4Shower.cc
PHG4Shower.h
PHG4ShowerLinkDef.h
PHG4Showerv1.cc
PHG4Showerv1.h
PHG4Showerv1LinkDef.h
PHG4SimpleEventGenerator.cc
PHG4SimpleEventGenerator.h
PHG4StackingAction.cc
PHG4StackingAction.h
PHG4SteppingAction.cc
PHG4SteppingAction.h
PHG4Subsystem.cc
PHG4Subsystem.h
PHG4TrackingAction.h
PHG4TrackUserInfoV1.cc
PHG4TrackUserInfoV1.h
PHG4TruthEventAction.cc
PHG4TruthEventAction.h
PHG4TruthInfoContainer.cc
PHG4TruthInfoContainer.h
PHG4TruthInfoContainerLinkDef.h
PHG4TruthSubsystem.cc
PHG4TruthSubsystem.h
PHG4TruthTrackingAction.cc
PHG4TruthTrackingAction.h
PHG4UIsession.cc
PHG4UIsession.h
PHG4Units.h
PHG4UserPrimaryParticleInformation.h
PHG4Utils.cc
PHG4Utils.h
PHG4VertexSelection.cc
PHG4VertexSelection.h
PHG4VtxPoint.cc
PHG4VtxPoint.h
PHG4VtxPointLinkDef.h
PHG4VtxPointv1.cc
PHG4VtxPointv1.h
PHG4VtxPointv1LinkDef.h
ReadEICFiles.cc
ReadEICFiles.h
g4micromegas
g4mvtx
g4ohcal
g4tpc
g4trackfastsim
g4tracking
g4vertex
g4waveformsim
validation
Doxygen_Assist
g4exampledetector
GenFit
JETSCAPE
KFParticle
macros
online_distribution
OnlMon
prototype
pythia6
rcdaq
RDBC
tutorials
doxygen_mainpage.h
File Members
Examples
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHG4IonGun.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4IonGun.cc
1
#include "
PHG4IonGun.h
"
2
3
#include "
PHG4InEvent.h
"
4
#include "
PHG4Particle.h
"
// for PHG4Particle
5
#include "
PHG4Particlev3.h
"
6
7
#include <
fun4all/Fun4AllReturnCodes.h
>
8
9
#include <
phool/getClass.h
>
10
11
#include <Geant4/G4IonTable.hh>
12
#include <Geant4/G4ParticleDefinition.hh>
// for G4ParticleDefinition
13
#include <Geant4/G4String.hh>
// for G4String
14
#include <Geant4/G4SystemOfUnits.hh>
15
16
#include <algorithm>
// for fill
17
#include <cmath>
// for NAN
18
#include <iostream>
// for operator<<, basic_ostream
19
#include <iterator>
// for begin, end
20
21
using namespace
std;
22
23
PHG4IonGun::PHG4IonGun
(
const
string
&
name
)
24
:
PHG4ParticleGeneratorBase
(name)
25
, ion(new
PHG4Particlev3
())
26
{
27
}
28
29
void
PHG4IonGun::SetCharge
(
const
int
c
)
30
{
31
ioncharge
= c * eplus;
32
}
33
34
void
PHG4IonGun::SetMom
(
const
double
px,
const
double
py,
const
double
pz)
35
{
36
mom
[0] = px;
37
mom
[1] = py;
38
mom
[2] = pz;
39
}
40
41
int
PHG4IonGun::process_event
(
PHCompositeNode
*topNode)
42
{
43
// get pdg code for ions
44
UpdateParticle
();
45
PHG4InEvent
*ineve = findNode::getClass<PHG4InEvent>(topNode,
"PHG4INEVENT"
);
46
ReuseExistingVertex
(topNode);
// checks if we should reuse existing vertex
47
int
vtxindex = ineve->
AddVtx
(
get_vtx_x
(),
get_vtx_y
(),
get_vtx_z
(),
get_t0
());
48
// G4ParticleDefinition* ion = G4IonTable::GetIonTable()->GetIon(Z, A, excitEnergy);
49
//G4PrimaryParticle* g4part = new G4PrimaryParticle(ion);
50
// cout << "name: " << ion->GetParticleName() << ", pdgcode: " << ion->GetPDGEncoding() << endl;
51
PHG4Particle
*
particle
=
new
PHG4Particlev3
(
ion
);
52
SetParticleId
(particle, ineve);
53
ineve->
AddParticle
(vtxindex, particle);
54
return
Fun4AllReturnCodes::EVENT_OK
;
55
}
56
57
void
PHG4IonGun::UpdateParticle
()
58
{
59
ion
->
set_A
(
A
);
60
ion
->
set_Z
(
Z
);
61
ion
->
set_NumCharge
(
ioncharge
);
62
ion
->
set_ExcitEnergy
(
excitEnergy
);
63
ion
->
set_px
(
mom
[0]);
64
ion
->
set_py
(
mom
[1]);
65
ion
->
set_pz
(
mom
[2]);
66
G4ParticleDefinition *iondef = G4IonTable::GetIonTable()->GetIon(
Z
,
A
,
excitEnergy
);
67
ion
->
set_name
(iondef->GetParticleName());
68
ion
->
set_pid
(iondef->GetPDGEncoding());
69
return
;
70
}
71
72
void
PHG4IonGun::Print
(
const
string
&
/*what*/
)
const
73
{
74
cout <<
"PHG4IonGun, using ions of"
<< endl;
75
cout <<
"A: "
<<
A
<<
", Z: "
<<
Z
<<
", charge: "
<<
ioncharge
76
<<
", excitation Energy: "
<<
excitEnergy
<< endl;
77
cout <<
"px: "
<<
mom
[0] /
GeV
<<
" GeV, py: "
<<
mom
[1] /
GeV
<<
" GeV, pz: "
<<
mom
[2] /
GeV
<<
" GeV"
<< endl;
78
}
coresoftware
blob
master
simulation
g4simulation
g4main
PHG4IonGun.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:15
using
1.8.2 with
sPHENIX GitHub integration