Back to home page

sPhenix code displayed by LXR

 
 

    


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

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