Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:20:28

0001 // $Id: $                                                                                             
0002 
0003 /*!
0004  * \file Fun4All_ImportGeom.C
0005  * \brief Example Fun4All macro part to import an external Geometry to DST node
0006  * \author Jin Huang <jhuang@bnl.gov>
0007  * \version $Revision:   $
0008  * \date $Date: $
0009  */
0010 
0011 #include <phgeom/PHGeomUtility.h>
0012 #include <phgeom/PHGeomFileImport.h>
0013 
0014 #include <fun4all/Fun4AllDummyInputManager.h>
0015 #include <fun4all/Fun4AllDstOutputManager.h>
0016 #include <fun4all/Fun4AllInputManager.h>
0017 #include <fun4all/Fun4AllServer.h>
0018 
0019 #include <TSystem.h>
0020 
0021 #include <string>
0022 
0023 //! Read in a Geometry file, and output DST and ROOT TGeo files
0024 void
0025 Fun4All_ImportGeom(const std::string & geom_file = "./sPHENIX.root")
0026 {
0027   gSystem->Load("libphgeom.so");
0028 
0029   Fun4AllServer *se = Fun4AllServer::instance();
0030   se->Verbosity(1);
0031 
0032   PHGeomFileImport * import = new PHGeomFileImport(geom_file);
0033   se->registerSubsystem(import);
0034 
0035   // dummy input
0036   Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE");
0037   se->registerInputManager(in);
0038 
0039   // output in DST
0040   Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT",
0041       geom_file + "_DST.root");
0042   se->registerOutputManager(out);
0043 
0044   // run one event as example
0045   se->run(1);
0046 
0047   PHGeomUtility::ExportGeomtry(se->topNode(),geom_file + "_export.root");
0048 
0049   se->End();
0050   std::cout << "All done" << std::endl;
0051   delete se;
0052   gSystem->Exit(0);
0053 
0054 }
0055