Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VtxNtuple.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4VtxNtuple.cc
1 #include "G4VtxNtuple.h"
2 
4 #include <g4main/PHG4VtxPoint.h>
5 
7 #include <fun4all/SubsysReco.h> // for SubsysReco
8 
9 #include <phool/getClass.h>
10 
11 #include <TNtuple.h>
12 
13 #include <sstream>
14 
15 using namespace std;
16 
18  : SubsysReco(name)
19  , m_FileName(filename)
20 {
21 }
22 
24 {
25  delete hm;
26 }
27 
29 {
30  hm = new Fun4AllHistoManager(Name());
31  ntup = new TNtuple("vtxntup", "G4Vtxs", "vx:vy:vz");
33  return 0;
34 }
35 
37 {
38  PHG4TruthInfoContainer *truthinfo = findNode::getClass<PHG4TruthInfoContainer>(topNode, "G4TruthInfo");
39  if (truthinfo)
40  {
41  PHG4VtxPoint *gvertex = truthinfo->GetPrimaryVtx(truthinfo->GetPrimaryVertexIndex());
42  ntup->Fill(gvertex->get_x(), gvertex->get_y(), gvertex->get_z());
43  }
44  return 0;
45 }
46 
48 {
49  hm->dumpHistos(m_FileName, "RECREATE");
50  return 0;
51 }