Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4TTree.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4TTree.C
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 #include <fun4all/SubsysReco.h>
9 
10 #include <g4histos/G4HitTTree.h>
12 R__LOAD_LIBRARY(libfun4all.so)
13 R__LOAD_LIBRARY(libg4histos.so)
14 #endif
15 
16 void G4TTree(
17  const char *fname = "/sphenix/sim/sim01/tutorials/clusters/G4sPHENIX_Pythia8.root",
18  const int nevnt = 0,
19  const char *outfile="towers.root")
20 {
21  gSystem->Load("libg4histos");
22  gSystem->Load("libg4dst.so");
24  char detector[100];
25  char outnode[100];
26  sprintf(detector,"%s","CEMC");
27  // se->Verbosity(10);
28  G4HitTTree *tt = new G4HitTTree();
29  tt->Detector(detector);
30  se->registerSubsystem(tt);
31 
32  G4RawTowerTTree *rt = new G4RawTowerTTree();
33  rt->Detector(detector);
34  se->registerSubsystem(rt);
36  in->fileopen(fname);
37  se->registerInputManager(in);
39  sprintf(outnode,"G4RootHit_%s",detector);
40  out->AddNode(outnode);
41  sprintf(outnode,"G4RootRawTower_%s",detector);
42  out->AddNode(outnode);
43  se->registerOutputManager(out);
44 
45  se->run(nevnt);
46  se->End();
47  delete se;
48 }