Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4ParticleGun.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4ParticleGun.cc
1 #include "PHG4ParticleGun.h"
2 
3 #include "PHG4InEvent.h"
4 #include "PHG4Particlev1.h"
5 
6 #include <phool/getClass.h>
7 
8 #include <vector> // for vector, vector<>::const_iterator
9 
10 class PHCompositeNode;
11 class PHG4Particle;
12 
15 {
16  return;
17 }
18 
20 {
21  PHG4InEvent *ineve = findNode::getClass<PHG4InEvent>(topNode, "PHG4INEVENT");
22  ReuseExistingVertex(topNode); // checks if we should reuse existing vertex
23  int vtxindex = ineve->AddVtx(get_vtx_x(), get_vtx_y(), get_vtx_z(), get_t0());
24  std::vector<PHG4Particle *>::const_iterator iter;
25  for (iter = particlelist_begin(); iter != particlelist_end(); ++iter)
26  {
27  PHG4Particle *particle = new PHG4Particlev1(*iter);
28  SetParticleId(particle, ineve);
29  ineve->AddParticle(vtxindex, particle);
30  }
31  if (Verbosity() > 0)
32  {
33  ineve->identify();
34  }
35  return 0;
36 }