Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:18:53

0001 #ifndef MACRO_FUN4ALLREADDST_C
0002 #define MACRO_FUN4ALLREADDST_C
0003 
0004 #include <g4histos/G4HitNtuple.h>
0005 
0006 #include <fun4all/Fun4AllDstInputManager.h>
0007 #include <fun4all/Fun4AllDstOutputManager.h>
0008 #include <fun4all/Fun4AllDummyInputManager.h>
0009 #include <fun4all/Fun4AllInputManager.h>
0010 #include <fun4all/Fun4AllOutputManager.h>
0011 #include <fun4all/Fun4AllServer.h>
0012 #include <fun4all/SubsysReco.h>
0013 
0014 #include <phool/recoConsts.h>
0015 
0016 R__LOAD_LIBRARY(libfun4all.so)
0017 R__LOAD_LIBRARY(libg4testbench.so)
0018 R__LOAD_LIBRARY(libg4histos.so)
0019 
0020 void Fun4All_Read_Dst(int nEvents = 1)
0021 {
0022   ///////////////////////////////////////////
0023   // Make the Server
0024   //////////////////////////////////////////
0025   Fun4AllServer *se = Fun4AllServer::instance();
0026   recoConsts *rc = recoConsts::instance();
0027   // if you want to fix the random seed to reproduce results
0028   // set this flag
0029   // rc->set_IntFlag("RANDOMSEED",12345);
0030 
0031   G4HitNtuple *hits = new G4HitNtuple("Hits", "HitsFromDst.root");
0032   hits->AddNode("HoleInBox", 0);
0033   se->registerSubsystem(hits);
0034 
0035   ///////////////////////////////////////////
0036   // IOManagers...
0037   ///////////////////////////////////////////
0038 
0039   // Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT","G4Example01.root");
0040   // out->Verbosity(10);
0041   // se->registerOutputManager(out);
0042 
0043   // this (dummy) input manager just drives the event loop
0044   Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin");
0045   in->fileopen("G4Example01.root");
0046   se->registerInputManager(in);
0047   // events = 0 => run till end of input file
0048   if (nEvents < 0)
0049   {
0050     return 0;
0051   }
0052   se->run(nEvents);
0053   se->End();
0054   std::cout << "All done" << std::endl;
0055   delete se;
0056   gSystem->Exit(0);
0057 }
0058 
0059 #endif