ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MyHitTTree.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MyHitTTree.C
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 #include <fun4all/SubsysReco.h>
9 #include <g4histos/G4HitTTree.h>
10 R__LOAD_LIBRARY(libg4histos.so)
11 #endif
12 
13 void MyHitTTree(const char *fname, const int nevnt = 0, const char *outfile="hits.root")
14 {
15  gSystem->Load("libg4histos");
17  char detector[100];
18  char outnode[100];
19  sprintf(detector,"%s","box_0");
20  sprintf(outnode,"G4RootHit_%s",detector);
21  // se->Verbosity(10);
22  G4HitTTree *tt = new G4HitTTree();
23  tt->Detector(detector);
24  se->registerSubsystem(tt);
25 
27  in->fileopen(fname);
28  se->registerInputManager(in);
29  Fun4AllOutputManager *out = new Fun4AllDstOutputManager("DSTout",outfile);
30  out->AddNode(outnode);
31  se->registerOutputManager(out);
32 
33  se->run(nevnt);
34  se->End();
35  delete se;
36 }