10 #include <Geant4/G4Event.hh>
11 #include <Geant4/G4IonTable.hh>
12 #include <Geant4/G4ParticleDefinition.hh>
13 #include <Geant4/G4ParticleTable.hh>
14 #include <Geant4/G4PrimaryParticle.hh>
15 #include <Geant4/G4PrimaryVertex.hh>
16 #include <Geant4/G4String.hh>
17 #include <Geant4/G4SystemOfUnits.hh>
18 #include <Geant4/G4ThreeVector.hh>
19 #include <Geant4/G4Types.hh>
36 map<int, PHG4VtxPoint*>::const_iterator vtxiter;
37 multimap<int, PHG4Particle*>::const_iterator particle_iter;
38 std::pair<std::map<int, PHG4VtxPoint*>::const_iterator, std::map<int, PHG4VtxPoint*>::const_iterator> vtxbegin_end = inEvent->GetVertices();
40 for (vtxiter = vtxbegin_end.first; vtxiter != vtxbegin_end.second; ++vtxiter)
47 pair<multimap<int, PHG4Particle*>::const_iterator, multimap<int, PHG4Particle*>::const_iterator> particlebegin_end = inEvent->GetParticles(vtxiter->first);
48 for (particle_iter = particlebegin_end.first; particle_iter != particlebegin_end.second; ++particle_iter)
61 if (!(*particle_iter->second).get_pid())
63 G4String particleName = (*particle_iter->second).get_name();
72 cout <<
PHWHERE <<
"Cannot get PDG value for particle " << particleName
73 <<
", dropping it" << endl;
78 if (!(*particle_iter->second).get_pid())
82 if (particle_definition)
86 double ekin = sqrt((*particle_iter->second).get_px() * (*particle_iter->second).get_px() +
87 (*particle_iter->second).get_py() * (*particle_iter->second).get_py() +
88 (*particle_iter->second).get_pz() * (*particle_iter->second).get_pz());
93 G4ThreeVector v((*particle_iter->second).get_px(), (*particle_iter->second).get_py(), (*particle_iter->second).get_pz());
99 particle_polarization.
y(),
100 particle_polarization.
z());
104 cout <<
PHWHERE <<
" cannot get G4 particle definition" << endl;
105 cout <<
"you should have never gotten here, please check this in detail" << endl;
106 cout <<
"exiting now" << endl;
113 if ((*particle_iter->second).isIon())
117 g4part->
SetCharge((*particle_iter->second).get_IonCharge());
119 (*particle_iter->second).get_py() *
GeV,
120 (*particle_iter->second).get_pz() *
GeV);
122 else if ((*particle_iter->second).get_pid() > 1000000000)
132 (*particle_iter->second).get_py() *
GeV,
133 (*particle_iter->second).get_pz() *
GeV);
137 cout << __PRETTY_FUNCTION__ <<
": WARNING : PDG ID of " << (*particle_iter->second).get_pid() <<
" is not a valid ion! Therefore, this particle is ignored in processing :";
138 (*particle_iter->second).identify();
144 (*particle_iter->second).get_px() *
GeV,
145 (*particle_iter->second).get_py() *
GeV,
146 (*particle_iter->second).get_pz() *
GeV);
159 vertex->SetPrimary(g4part);