Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:41

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : F.Gaede
0011 //
0012 //==========================================================================
0013 #include "DD4hep/Detector.h"
0014 #include "DD4hep/DD4hepUnits.h"
0015 #include "DD4hep/Fields.h"
0016 
0017 #include "TGeoManager.h"
0018 
0019 //---- GEAR ----
0020 #include "gear/GEAR.h"
0021 #include "gearxml/GearXML.h"
0022 
0023 #include "gearimpl/Util.h"
0024 #include "gearimpl/ConstantBField.h"
0025 #include "gearimpl/GearMgrImpl.h"
0026 
0027 #include "geartgeo/TGeoGearPointProperties.h"
0028 #include "geartgeo/TGeoGearDistanceProperties.h"
0029 
0030 #include "DDRec/DDGear.h"
0031 
0032 using namespace std ;
0033 using namespace dd4hep ;
0034 using namespace dd4hep::detail;
0035 using namespace dd4hep::rec ;
0036 
0037 //=============================================================================
0038 
0039 int main(int argc, char** argv ){
0040     
0041   if( argc < 3 ) {
0042     std::cout << " usage: convertToGear plugin compact.xml [gear_file.xml]" << std::endl 
0043           << "  plugin: name of a plugin with a signature \"long int (Detector*, int, char**)\" \n " 
0044           << "  e.g. GearForILD (same as 'default'), GearForCLIC, ..." << std::endl ; 
0045     
0046     exit(1) ;
0047   }
0048 
0049   std::string pluginName =  argv[1] ;
0050 
0051   std::string inFile =  argv[2] ;
0052 
0053   std::string outFile = ( argc>3  ?  argv[3]  : ""  ) ;
0054 
0055   Detector& description = Detector::getInstance();
0056 
0057   description.fromCompact( inFile );
0058 
0059   gear::GearMgr* gearMgr = ( pluginName == "default" ) ?  createGearMgr( description )  :   createGearMgr( description , pluginName )  ;
0060  
0061   //----------------------------------------------------------------------------------
0062 
0063   // std::cout << "  ***************************** GEAR parameters **************************************** " << std::endl ;
0064   // std::cout <<         *gearMgr ;
0065   // std::cout << "  ************************* End of GEAR parameters ************************************* " << std::endl ;
0066 
0067   //----------------------------------------------------------------------------------
0068   
0069 
0070   if( outFile.empty() ){
0071 
0072     outFile = "gear_"  + gearMgr->getDetectorName() + ".xml" ;
0073   }
0074     
0075   gear::GearXML::createXMLFile ( gearMgr, outFile ) ;
0076  
0077 
0078   std::cout << "  ************************************************************** " << std::endl ;
0079   std::cout << "   created gear file : " << outFile << std::endl ;
0080   std::cout << "  ************************************************************** " << std::endl ;
0081 
0082   return 0;
0083 }
0084 
0085 //=============================================================================