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_ExportGeom.C
0005  * \brief get geometry from DST file and output TGeoManager ROOT files or other formats of geometry files
0006  * \author Jin Huang <jhuang@bnl.gov>
0007  * \version $Revision:   $
0008  * \date $Date: $
0009  */
0010 
0011 //! \brief get geometry from DST file and output TGeoManager ROOT files or other formats of geometry files
0012 
0013 #include <phgeom/PHGeomUtility.h>
0014 #include <phgeom/PHGeomFileImport.h>
0015 
0016 #include <fun4all/Fun4AllDstInputManager.h>
0017 #include <fun4all/Fun4AllInputManager.h>
0018 #include <fun4all/Fun4AllServer.h>
0019 
0020 #include <phool/recoConsts.h>
0021 
0022 #include <TSystem.h>
0023 
0024 #include <string>
0025 
0026 void
0027 Fun4All_ExportGeom(const std::string &DST_file_name = "sPHENIX.root_DST.root")
0028 {
0029 
0030   gSystem->Load("libphgeom.so");
0031 
0032   // in case DST contains sPHENIX stuff
0033   gSystem->Load("libg4dst.so");
0034 
0035   Fun4AllServer *se = Fun4AllServer::instance();
0036   se->Verbosity(1);
0037   recoConsts *rc = recoConsts::instance();
0038   rc->set_IntFlag("RUNNUMBER", 12345);
0039 
0040   Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
0041   hitsin->fileopen(DST_file_name);
0042   se->registerInputManager(hitsin);
0043 
0044   // run one event as example
0045   se->run(1);
0046 
0047   std::string output = DST_file_name + "_export.root";
0048   PHGeomUtility::ExportGeomtry(se->topNode(),DST_file_name + "_export.root");
0049   std::cout << "Done export Geometry to " << output << std::endl;
0050 
0051   se->End();
0052   delete se;
0053   std::cout << "All done" << std::endl;
0054   gSystem->Exit(0);
0055 
0056 }
0057 
0058 
0059