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 
0010 #include <g4histos/G4HitTTree.h>
0011 #include <g4histos/G4RawTowerTTree.h>
0012 R__LOAD_LIBRARY(libfun4all.so)
0013 R__LOAD_LIBRARY(libg4histos.so)
0014 #endif
0015 
0016 void G4TTree(
0017   const char *fname = "/sphenix/sim/sim01/tutorials/clusters/G4sPHENIX_Pythia8.root",
0018   const int nevnt = 0,
0019   const char *outfile="towers.root")
0020 {
0021   gSystem->Load("libg4histos");
0022   gSystem->Load("libg4dst.so");
0023   Fun4AllServer *se = Fun4AllServer::instance();
0024   char detector[100];
0025   char outnode[100];
0026   sprintf(detector,"%s","CEMC"); 
0027  //  se->Verbosity(10);
0028   G4HitTTree *tt = new G4HitTTree();
0029   tt->Detector(detector);
0030   se->registerSubsystem(tt);
0031 
0032   G4RawTowerTTree *rt = new G4RawTowerTTree();
0033   rt->Detector(detector);
0034   se->registerSubsystem(rt);
0035   Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin");
0036   in->fileopen(fname);
0037   se->registerInputManager(in);
0038   Fun4AllOutputManager *out = new Fun4AllDstOutputManager("DSTout",outfile);
0039   sprintf(outnode,"G4RootHit_%s",detector);
0040   out->AddNode(outnode);
0041   sprintf(outnode,"G4RootRawTower_%s",detector);
0042   out->AddNode(outnode);
0043   se->registerOutputManager(out);
0044 
0045   se->run(nevnt);
0046   se->End();
0047   delete se;
0048 }