diff --git a/examples/ILDExDet/CMakeLists.txt b/examples/ILDExDet/CMakeLists.txt index d8c48f2c60c3947c82d5564742bc318bab2ec1d9..afcb2366dcf93e09a985441e1ef94cbdfdb376aa 100644 --- a/examples/ILDExDet/CMakeLists.txt +++ b/examples/ILDExDet/CMakeLists.txt @@ -41,8 +41,7 @@ find_package( ROOT REQUIRED ) set( ROOT_COMPONENT_LIBRARIES Geom Reflex) - -find_package( GEAR REQUIRED) +find_package( GEAR REQUIRED COMPONENTS geartgeo) # add all gear library pathes to External_LIBRARY_DIRS for the environment script foreach(lp ${GEAR_LIBRARY_DIRS}) @@ -77,10 +76,20 @@ endif() add_library(${PackageName} SHARED ${sources}) target_link_libraries(${PackageName} ${DD4hep_LIBRARIES} + ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES} + ${GEAR_LIBRARIES} ${GEAR_COMPONENT_LIBRARIES} + ) + +#------ binary ---------- + +add_executable( convertToGear src/convertToGear.cc) + +target_link_libraries(convertToGear ${PackageName} ${DD4hep_LIBRARIES} ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES} ${GEAR_LIBRARIES} ) + #---Rootmap generation-------------------------------------------------------------- if(APPLE) @@ -117,7 +126,7 @@ INSTALL(FILES ${hfiles} ) -install(TARGETS ${PackageName} +install(TARGETS ${PackageName} convertToGear RUNTIME DESTINATION bin LIBRARY DESTINATION lib ) diff --git a/examples/ILDExDet/compact/ILDEx.xml b/examples/ILDExDet/compact/ILDEx.xml index bc191d450a99a56fa5e31a5d921a049a4573f896..0216db18f64b5f20680dfa24b34789a5d0fcb506 100644 --- a/examples/ILDExDet/compact/ILDEx.xml +++ b/examples/ILDExDet/compact/ILDEx.xml @@ -156,12 +156,12 @@ <detector name="TPC" type="ILDExTPC" vis="TPCVis" id="3" limits="TPC_limits" readout="TPCCollection" insideTrackingVolume="true"> + <tubs rmin="TPC_inner_radius" rmax="TPC_outer_radius" zhalf="TPC_zhalf"/> - <!-- GEAR Data--> - <driftlength value="TPC_zhalf*0.9"/> - <!-- End of GEAR Data--> - <material name="Air"/> + <global driftLength="TPC_zhalf-TPC_endcap_thickness" padWidth="1.0*mm"/> + + <!-- <material name="Air"/> --> <detector name="TPC_InnerWall" type="TubeSegment" reflect="true" vis="TPCSupportVis" id="2"> <material name="Carbon"/> @@ -192,6 +192,7 @@ <position x="0" y="0" z="0"/> <rotation x="0" y="0" z="0"/> </detector> + </detector> <comment>Calorimeters</comment> diff --git a/examples/ILDExDet/include/DDGear.h b/examples/ILDExDet/include/DDGear.h new file mode 100644 index 0000000000000000000000000000000000000000..337ae36d1c5b1d66149ca867dd7345f981186647 --- /dev/null +++ b/examples/ILDExDet/include/DDGear.h @@ -0,0 +1,70 @@ +#ifndef DDGear_H +#define DDGear_H + +#include "DD4hep/Detector.h" + +#include "gear/GEAR.h" +#include "gearimpl/GearParametersImpl.h" +#include "gear/GearMgr.h" + +namespace DD4hep { + + /** + Simple wrapper class for objects of type GearParametersImpl that + can be added to DetElements with the extension mechanism. + There can only be one such object added to any given DetElement + @author F.Gaede, DESY + @version $Id:$ + */ + + class GearHandle : public gear::GearParametersImpl { + + protected: + gear::GearParametersImpl* _gObj ; + std::string _name ; + + public : + /** Default c'tor - only used by DD4hep extenbsion mechanism.*/ + GearHandle() : _gObj( 0 ) , _name( "UNKNOWN" ) {} + + /** User c'tor - specify a name (should be the canonical name used in gear, eg. TPCParameters, SITParameters, etc.) and + the GearParametersImpl object */ + GearHandle( gear::GearParametersImpl* gearObj, const std::string& name ) : _gObj( gearObj ) , _name( name ) {} + + /** D'tor deletes GearParametersImpl object if ownerhsip has not been taken away */ + virtual ~GearHandle() { + if( _gObj) + delete _gObj ; + } + + /** Name of GearParametersImpl object - should be the canonical name used in gear, eg. TPCParameters, SITParameters, etc. */ + const std::string& name() { return _name ; } + + /** Get GearParametersImpl object */ + gear::GearParametersImpl* gearObject() { return _gObj ; } + + /** Get GearParametersImpl object _and_ transfer ownership */ + gear::GearParametersImpl* takeGearObject() { + gear::GearParametersImpl* obj = _gObj ; + _gObj = 0 ; + return obj ; + } + + /** dummy implementation of required c'tors to allow using the extension mechanism */ + GearHandle(const Geometry::DetElement& d) : _gObj(0) {} + GearHandle(const GearHandle& c,const Geometry::DetElement& det) : _gObj(0) {} + } ; + + + //=============================================================================================================== + + /** Factory method that creates a GearMgr object pobulated with the GearParametersImpl objects from + all (top level) DetElements in the lcdd object + @author F.Gaede, DESY + @version $Id:$ + */ + gear::GearMgr* createGearMgr( const Geometry::LCDD& lcdd ) ; + +} + +#endif diff --git a/examples/ILDExDet/include/GearWrapper.h b/examples/ILDExDet/include/GearWrapper.h deleted file mode 100644 index ce4304bda90ff368c7f5a9997a985489fc1ed2fc..0000000000000000000000000000000000000000 --- a/examples/ILDExDet/include/GearWrapper.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef GearWrapper_H -#define GearWrapper_H -//==================================================================== - -#include "DD4hep/Detector.h" -//#include "DD4hepExceptions.h" - -#include "gear/GEAR.h" -#include "gear/TPCParameters.h" -#include "gearimpl/TPCParametersImpl.h" -#include "gearimpl/ZPlanarParametersImpl.h" - -namespace DD4hep { - - - - - //// generic wrapper class for gear::XXXParametersImpl: - //template <class GEAR> - //struct GearWrapper : public GEAR { - // // required c'tors for extension mechanism - // GearWrapper(const Geometry::DetElement& d){} - // GearWrapper(const GearWrapper<GEAR>& c,const Geometry::DetElement& det){} - //} ; - // - //// specialized c'tor - //template <> - //GearWrapper<gear::TPCParametersImpl>( double maxDriftLength, int coordinateType ) - //: gear::TPCParametersImpl( maxDriftLength, coordinateType){ } - // - //typedef GearWrapper<gear::TPCParametersImpl> GearTPCParameters ; - - // wrapper class for gear::TPCParametersImpl: - struct GearTPCParameters : public gear::TPCParametersImpl { - // required c'tors for extension mechanism - GearTPCParameters(const Geometry::DetElement& d){} - GearTPCParameters(const GearTPCParameters& c,const Geometry::DetElement& det){} - GearTPCParameters( double maxDriftLength, int coordinateType ) : gear::TPCParametersImpl( maxDriftLength, coordinateType){} - } ; - - - struct GearZPlanarParameters : public gear::ZPlanarParametersImpl { - - // required c'tors for extension mechanism - - GearZPlanarParameters(const Geometry::DetElement& d) : gear::ZPlanarParametersImpl(ZPlanarParametersImpl::CMOS,0,0,0,0,0) {} - - GearZPlanarParameters(const GearZPlanarParameters& c,const Geometry::DetElement& det) - : gear::ZPlanarParametersImpl(ZPlanarParametersImpl::CMOS,0,0,0,0,0) {} - - GearZPlanarParameters( int type=ZPlanarParametersImpl::CMOS, - double shellInnerRadius=0., double shellOuterRadius=0., - double shellHalfLength=0., double shellGap=0., double shellRadLength=0.) - : gear::ZPlanarParametersImpl( type, shellInnerRadius, shellOuterRadius, - shellHalfLength, shellGap, shellRadLength ){} - } ; - -} - -#endif diff --git a/examples/ILDExDet/src/DDGear.cpp b/examples/ILDExDet/src/DDGear.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6500677ad8dcaedb4114ef6a39c7d154aee5447b --- /dev/null +++ b/examples/ILDExDet/src/DDGear.cpp @@ -0,0 +1,118 @@ +#include "DDGear.h" + +#include "DD4hep/LCDD.h" +#include "DD4hep/TGeoUnits.h" +#include "DD4hep/Fields.h" + +// ROOT +//#include "TGeoManager.h" + +//---- GEAR ---- +#include "gear/GEAR.h" +#include "gearxml/GearXML.h" + +#include "gearimpl/Util.h" +#include "gearimpl/ConstantBField.h" +#include "gearimpl/GearMgrImpl.h" + +#include "geartgeo/TGeoGearPointProperties.h" +#include "geartgeo/TGeoGearDistanceProperties.h" + + +namespace DD4hep{ + + using namespace Geometry ; + + + gear::GearMgr* createGearMgr( const Geometry::LCDD& lcdd ){ + + + DetElement world = lcdd.world() ; + + + gear::GearMgrImpl* gearMgr = new gear::GearMgrImpl() ; + + gearMgr->setDetectorName( lcdd.header().name() ) ; + + std::cout << " **** will convert detector " << lcdd.header().name() << " to Gear \n" + << " Iterating over all subdetectors: " << std::endl ; + + + //------------------ SubdetectorParamters ---------------------------------- + + typedef std::map<std::string, DetElement> DEMap ; + DEMap chMap = world.children() ; + + for ( DEMap::const_iterator it=chMap.begin() ; it != chMap.end() ; ++it ){ + + DetElement subDet = (*it).second ; + + std::cout << " *** subdetector : " << subDet.name() << std::endl ; + + DD4hep::GearHandle* gearH = 0 ; + try{ + + gearH = subDet.extension<DD4hep::GearHandle>() ; + + } catch( std::exception& e) { + + std::cout << " *** " << e.what() << std::endl ; + + continue ; // with next DetElement + } + + // --- check for canonical names of GearHandle objects : + // (fixme: will have to iterate over daughters as well ... ) + + if ( gearH->name() == "TPCParameters" ) { gearMgr->setTPCParameters ( dynamic_cast<gear::TPCParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "EcalBarrelParameters" ) { gearMgr->setEcalBarrelParameters( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "EcalEndcapParameters" ) { gearMgr->setEcalEndcapParameters( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "EcalPlugParameters" ) { gearMgr->setEcalPlugParameters ( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "YokeBarrelParameters" ) { gearMgr->setYokeBarrelParameters( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "YokeEndcapParameters" ) { gearMgr->setYokeEndcapParameters( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "YokePlugParameters" ) { gearMgr->setYokePlugParameters ( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "HcalBarrelParameters" ) { gearMgr->setHcalBarrelParameters( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "HcalEndcapParameters" ) { gearMgr->setHcalEndcapParameters( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "HcalRingParameters" ) { gearMgr->setHcalRingParameters ( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "LcalParameters" ) { gearMgr->setLcalParameters ( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "LHcalParameters" ) { gearMgr->setLHcalParameters ( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "BeamCalParameters" ) { gearMgr->setBeamCalParameters ( dynamic_cast<gear::CalorimeterParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "VXDParameters" ) { gearMgr->setVXDParameters ( dynamic_cast<gear::ZPlanarParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "FTDParameters" ) { gearMgr->setFTDParameters ( dynamic_cast<gear::FTDParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "SITParameters" ) { gearMgr->setSITParameters ( dynamic_cast<gear::ZPlanarParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "SETParameters" ) { gearMgr->setSETParameters ( dynamic_cast<gear::ZPlanarParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "SiPlanesParameters" ) { gearMgr->setSiPlanesParameters ( dynamic_cast<gear::SiPlanesParameters* >( gearH->takeGearObject() ) ) ; } + else { + + gearMgr->setGearParameters( gearH->name() , gearH->takeGearObject() ) ; + } + + } + std::cout << std::endl ; + + //------------------ Bfield ---------------------------------- + + // fixme: for now we just assume a constant field - should be a real field map ... + double origin[3] = { 0., 0., 0. } ; + double bfield[3] ; + OverlayedField ovField = lcdd.field() ; + ovField.magneticField( origin , bfield ) ; + + gearMgr->setBField( new gear::ConstantBField( gear::Vector3D( bfield[0]/ tgeo::tesla , bfield[1]/ tgeo::tesla , bfield[2] / tgeo::tesla ) ) ) ; + + + //----------------- PointProperties and DistanceProperties ------------------------- + + TGeoManager *geoManager = world.volume()->GetGeoManager(); + + gearMgr->setPointProperties( new gear::TGeoGearPointProperties( geoManager ) ) ; + + gearMgr->setDistanceProperties( new gear::TGeoGearDistanceProperties( geoManager ) ) ; + + //---------------------------------------------------------------------------------- + + return gearMgr ; + + } +} + diff --git a/examples/ILDExDet/src/ILDExSIT_geo.cpp b/examples/ILDExDet/src/ILDExSIT_geo.cpp index bb54c120c4ce3a4f87ffd44dec6d9f87da33ea31..16202789f38fd572cae6ddf9f3dde072851d76fd 100644 --- a/examples/ILDExDet/src/ILDExSIT_geo.cpp +++ b/examples/ILDExDet/src/ILDExSIT_geo.cpp @@ -9,7 +9,8 @@ #include "DD4hep/DetFactoryHelper.h" -#include "GearWrapper.h" +#include "DDGear.h" +#include "gearimpl/ZPlanarParametersImpl.h" using namespace std; using namespace DD4hep; @@ -24,8 +25,12 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //--------------- create gear::ZPlanarParameters and add them as Extension - GearZPlanarParameters* gearZPlanar = new GearZPlanarParameters ; - sit.addExtension<GearZPlanarParameters>( gearZPlanar ) ; + gear::ZPlanarParametersImpl* gearZPlanar = new gear::ZPlanarParametersImpl( 0 , 0.0, 0.0, 0.0, 0.0, 0.0 ) ; + + // ZPlanarParametersImpl( int type, double shellInnerRadius, double shellOuterRadius, double shellHalfLength, double shellGap, double shellRadLength ) ; + + + sit.addExtension<GearHandle>( new GearHandle( gearZPlanar, "SITParameters" ) ) ; //-------------------------------------------------------------------- for(xml_coll_t c(e,_U(layer)); c; ++c) { diff --git a/examples/ILDExDet/src/ILDExTPC_geo.cpp b/examples/ILDExDet/src/ILDExTPC_geo.cpp index 4f39d9aea75a05b956b8dd2da791f5326304bd4a..371a5c8366a696373d6b8c705c2afe67a6ada26e 100644 --- a/examples/ILDExDet/src/ILDExTPC_geo.cpp +++ b/examples/ILDExDet/src/ILDExTPC_geo.cpp @@ -1,3 +1,4 @@ + // $Id: ILDExTPC_geo.cpp 680 2013-08-06 15:07:53Z gaede $ //==================================================================== // AIDA Detector description implementation for LCD @@ -9,15 +10,16 @@ #include "DD4hep/DetFactoryHelper.h" #include "DD4hep/Detector.h" -//#include "TPCModuleData.h" +#include "DD4hep/TGeoUnits.h" + #include "TPCData.h" -//#include "TPCModule.h" -//#include "FixedPadAngleDiskLayout.h" -#include "GearWrapper.h" -#include <gearimpl/FixedPadSizeDiskLayout.h> +#include "DDGear.h" +#include "gearimpl/TPCParametersImpl.h" +#include "gearimpl/FixedPadSizeDiskLayout.h" using namespace std; +//using namespace tgeo ; using namespace DD4hep; using namespace DD4hep::Geometry; @@ -25,7 +27,9 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; xml_comp_t x_tube (x_det.child(_U(tubs))); string name = x_det.nameStr(); - Material mat (lcdd.material(x_det.materialStr())); + + Material envmat = lcdd.material("Air" ) ; // x_det.materialStr())); + //if data is needed do this TPCData* tpcData = new TPCData(); DetElement tpc(tpcData, name, x_det.typeStr()); @@ -33,7 +37,8 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //else do this //DetElement tpc (name,x_det.typeStr(),x_det.id()); Tube tpc_tub(x_tube.rmin(),x_tube.rmax(),x_tube.zhalf()); - Volume tpc_vol(name+"_envelope_volume", tpc_tub, mat); + Volume tpc_vol(name+"_envelope_volume", tpc_tub, envmat); + Readout readout(sens.readout()); //--- some parameters needed for gear: @@ -41,6 +46,15 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double g_rMin, g_rMax, g_padHeight, g_padWidth, g_maxRow, g_padGap, g_phiMax ; double g_inner_r, g_outer_r, g_inner_wt, g_outer_wt ; + xml_comp_t x_global( x_det.child( _Unicode( global ) ) ); + + //-------- global gear parameters ---------------- + + g_driftlength = x_global.attr<double>("driftLength") ; + g_padWidth = x_global.attr<double>("padWidth") ; + + //-------- global gear parameters ---------------- + for(xml_coll_t c(e,_U(detector)); c; ++c) { @@ -49,6 +63,9 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { xml_dim_t px_pos (px_det.child(_U(position))); xml_dim_t px_rot (px_det.child(_U(rotation))); xml_comp_t px_mat (px_det.child(_U(material))); + + + string part_nam(px_det.nameStr()); Material part_mat(lcdd.material(px_mat.nameStr())); @@ -85,11 +102,10 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //---------------------------- gear stuff -------------- - g_driftlength = zh ; - g_rMin = r0 ; - g_rMax = r1 ; - g_padHeight = 2. * dR ; - g_padWidth = 1.0 ; // FIXME: where do we define this ? + g_driftlength = zh / tgeo::mm ; + g_rMin = r0 / tgeo::mm ; + g_rMax = r1 / tgeo::mm ; + g_padHeight = 2. * dR / tgeo::mm ; g_maxRow = nTPClayer ; g_padGap = 0. ; g_phiMax = 6.283185307e+00 ; // FIXME: where to define ? is it allways 2PI ? @@ -183,26 +199,32 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { tpc_vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); //--------------- create gear::TPCParameters and add them as Extension - GearTPCParameters* gearTPC = new GearTPCParameters( g_driftlength , gear::PadRowLayout2D::POLAR ) ; + // GearTPCParameters* gearTPC = new GearTPCParameters( g_driftlength , gear::PadRowLayout2D::POLAR ) ; + gear::TPCParametersImpl* gearTPC = new gear::TPCParametersImpl( g_driftlength , gear::PadRowLayout2D::POLAR ) ; gearTPC->setPadLayout( new gear::FixedPadSizeDiskLayout( g_rMin, g_rMax, g_padHeight, g_padWidth, g_maxRow, g_padGap, g_phiMax ) ) ; Tube t = DetElement(tpcData->innerWall).volume().solid() ; - g_inner_r = t->GetRmin() * 10. ; - g_inner_wt = ( t->GetRmax() - t->GetRmin() ) * 10. ; + g_inner_r = t->GetRmin() / tgeo::mm ; + g_inner_wt = ( t->GetRmax() - t->GetRmin() ) / tgeo::mm ; t = DetElement(tpcData->outerWall).volume().solid() ; - g_outer_r = t->GetRmax() * 10. ; - g_outer_wt = ( t->GetRmax() - t->GetRmin() ) * 10. ; + g_outer_r = t->GetRmax() / tgeo::mm ; + g_outer_wt = ( t->GetRmax() - t->GetRmin() ) / tgeo::mm ; gearTPC->setDoubleVal("tpcInnerRadius", g_inner_r ) ; // inner r of support tube gearTPC->setDoubleVal("tpcOuterRadius", g_outer_r ) ; // outer radius of TPC gearTPC->setDoubleVal("tpcInnerWallThickness", g_inner_wt) ; // thickness of inner shell gearTPC->setDoubleVal("tpcOuterWallThickness", g_outer_wt) ; // thickness of outer shell - tpc.addExtension<GearTPCParameters>( gearTPC ) ; - //-------------------------------------------------------------------- + // tpc.addExtension<GearTPCParameters>( gearTPC ) ; + // tpc.addExtension<GearHandle<gear::TPCParametersImpl> >( new GearHandle<gear::TPCParametersImpl>( gearTPC ) ) ; + + tpc.addExtension< GearHandle >( new GearHandle( gearTPC, "TPCParameters" ) ) ; + + //-------------------------------------------------------------------- + PlacedVolume phv = lcdd.pickMotherVolume(tpc).placeVolume(tpc_vol); phv.addPhysVolID("system",x_det.id()); tpc.setPlacement(phv); diff --git a/examples/ILDExDet/src/convertToGear.cc b/examples/ILDExDet/src/convertToGear.cc new file mode 100644 index 0000000000000000000000000000000000000000..c1083281c5cf6170c6163ff93225963f672e3373 --- /dev/null +++ b/examples/ILDExDet/src/convertToGear.cc @@ -0,0 +1,64 @@ +#include "DD4hep/LCDD.h" +#include "DD4hep/TGeoUnits.h" +#include "DD4hep/Fields.h" + +#include "TGeoManager.h" + +//---- GEAR ---- +#include "gear/GEAR.h" +#include "gearxml/GearXML.h" + +#include "gearimpl/Util.h" +#include "gearimpl/ConstantBField.h" +#include "gearimpl/GearMgrImpl.h" + +#include "geartgeo/TGeoGearPointProperties.h" +#include "geartgeo/TGeoGearDistanceProperties.h" + +#include "DDGear.h" + +using namespace std ; +using namespace DD4hep ; +using namespace DD4hep::Geometry; +using namespace tgeo ; + +//============================================================================= + +int main(int argc, char** argv ){ + + if( argc < 2 ) { + std::cout << " usage: convertToGear compact.xml [gear_file.xml]" << std::endl ; + exit(1) ; + } + + std::string inFile = argv[1] ; + + std::string outFile = ( argc>2 ? argv[2] : "" ) ; + + LCDD& lcdd = LCDD::getInstance(); + + lcdd.fromCompact( inFile ); + + gear::GearMgr* gearMgr = createGearMgr( lcdd ) ; + + //---------------------------------------------------------------------------------- + + std::cout << " ***************************** GEAR parameters **************************************** " << std::endl ; + std::cout << *gearMgr ; + std::cout << " ************************* End of GEAR parameters ************************************* " << std::endl ; + + //---------------------------------------------------------------------------------- + + + if( outFile.empty() ){ + + outFile = "gear_" + gearMgr->getDetectorName() + ".xml" ; + } + + + gear::GearXML::createXMLFile ( gearMgr, outFile ) ; + + return 0; +} + +//=============================================================================