Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:22:08

0001 #ifndef MACRO_MYHITTTREE_C
0002 #define MACRO_MYHITTTREE_C
0003 
0004 #include <fun4all/SubsysReco.h>
0005 #include <fun4all/Fun4AllServer.h>
0006 #include <fun4all/Fun4AllInputManager.h>
0007 #include <fun4all/Fun4AllDstInputManager.h>
0008 #include <fun4all/Fun4AllOutputManager.h>
0009 #include <fun4all/Fun4AllDstOutputManager.h>
0010 #include <g4histos/G4HitTTree.h>
0011 
0012 R__LOAD_LIBRARY(libg4histos.so)
0013 
0014 void MyHitTTree(const char *fname, const int nevnt = 0, const char *outfile="hits.root")
0015 {
0016   gSystem->Load("libg4dst.so");
0017   Fun4AllServer *se = Fun4AllServer::instance();
0018   char detector[100];
0019   char outnode[100];
0020   sprintf(detector,"%s","SVTX");
0021   sprintf(outnode,"G4RootHit_%s",detector);
0022   //  se->Verbosity(10);
0023   G4HitTTree *tt = new G4HitTTree();
0024   tt->Detector(detector);
0025   se->registerSubsystem(tt);
0026 
0027   Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin");
0028   in->fileopen(fname);
0029   se->registerInputManager(in);
0030   Fun4AllOutputManager *out = new Fun4AllDstOutputManager("DSTout",outfile);
0031   out->AddNode(outnode);
0032   se->registerOutputManager(out);
0033 
0034   se->run(nevnt);
0035   se->End();
0036   delete se;
0037 }
0038 
0039 #endif