From 95facdb6d9f3965319dcd73c70c119535aca629c Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Wed, 21 May 2014 15:01:17 +0000 Subject: [PATCH] - removed GEAR dependency - GEAR is now only used if DD4HEP_WITH_GEAR is true --- examples/ILDExDet/CMakeLists.txt | 19 +++++++++++++------ examples/ILDExDet/src/ILDExSIT_geo.cpp | 8 +++++++- examples/ILDExDet/src/ILDExTPC_geo.cpp | 5 ++++- examples/ILDExDet/src/ILDExVXD_geo.cpp | 7 ++++++- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/examples/ILDExDet/CMakeLists.txt b/examples/ILDExDet/CMakeLists.txt index 1408ecac7..d4245ba8b 100644 --- a/examples/ILDExDet/CMakeLists.txt +++ b/examples/ILDExDet/CMakeLists.txt @@ -41,14 +41,21 @@ find_package( ROOT REQUIRED ) set( ROOT_COMPONENT_LIBRARIES Geom Reflex) -find_package( GEAR REQUIRED COMPONENTS ) -# add all gear library pathes to External_LIBRARY_DIRS for the environment script -foreach(lp ${GEAR_LIBRARY_DIRS}) - set( External_LIBRARY_DIRS "${External_LIBRARY_DIRS} ${lp}") -endforeach(lp) -#message( STATUS " *** pathes : ${External_LIBRARY_DIRS} " ) +if(DD4HEP_WITH_GEAR) + + find_package( GEAR REQUIRED COMPONENTS ) + + # add all gear library pathes to External_LIBRARY_DIRS for the environment script + foreach(lp ${GEAR_LIBRARY_DIRS}) + set( External_LIBRARY_DIRS "${External_LIBRARY_DIRS} ${lp}") + endforeach(lp) + #message( STATUS " *** pathes : ${External_LIBRARY_DIRS} " ) + + add_definitions("-D DD4HEP_WITH_GEAR") + +endif() #------------------------------------------------------------- # add additional packages here diff --git a/examples/ILDExDet/src/ILDExSIT_geo.cpp b/examples/ILDExDet/src/ILDExSIT_geo.cpp index c75b4857c..087f2e4bc 100644 --- a/examples/ILDExDet/src/ILDExSIT_geo.cpp +++ b/examples/ILDExDet/src/ILDExSIT_geo.cpp @@ -9,8 +9,10 @@ #include "DD4hep/DetFactoryHelper.h" +#ifdef DD4HEP_WITH_GEAR #include "DDRec/DDGear.h" #include "gearimpl/ZPlanarParametersImpl.h" +#endif #include "DDRec/Surface.h" @@ -28,13 +30,14 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { PlacedVolume pv; +#ifdef DD4HEP_WITH_GEAR //--------------- gear: create gear::ZPlanarParameters and add them as Extension gear::ZPlanarParametersImpl* gearZPlanar = new gear::ZPlanarParametersImpl( gear::ZPlanarParameters::HYBRID , 0.0, 0.0, 0.0, 0.0, 0.0 ) ; // ZPlanarParametersImpl( int type, double shellInnerRadius, double shellOuterRadius, double shellHalfLength, double shellGap, double shellRadLength ) ; // -> the SIT has no outer shell - set type to HYPRID to keep gear happy (needs fix in gear) sit.addExtension<GearHandle>( new GearHandle( gearZPlanar, "SITParameters" ) ) ; //-------------------------------------------------------------------- - +#endif for(xml_coll_t c(e,_U(layer)); c; ++c) { @@ -129,6 +132,8 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { volSurfaceList( ladderDE )->push_back( surf ) ; } + +#ifdef DD4HEP_WITH_GEAR //----------------- gear --------------------------------------------- double ladderRadLength = suppmat->GetMaterial()->GetRadLen() /tgeo::mm ; double sensitiveRadLength = sensmat->GetMaterial()->GetRadLen() /tgeo::mm ; @@ -139,6 +144,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // addLayer (int nLadders, double phi0, double ladderDistance, double ladderOffset, double ladderThickness, double ladderLength, double ladderWidth, double ladderRadLength, // double sensitiveDistance, double sensitiveOffset, double sensitiveThickness, double sensitiveLength, double sensitiveWidth, double sensitiveRadLength) //----------------- gear --------------------------------------------- +#endif } diff --git a/examples/ILDExDet/src/ILDExTPC_geo.cpp b/examples/ILDExDet/src/ILDExTPC_geo.cpp index 53026db3b..db0d0f555 100644 --- a/examples/ILDExDet/src/ILDExTPC_geo.cpp +++ b/examples/ILDExDet/src/ILDExTPC_geo.cpp @@ -19,10 +19,11 @@ #include "TPCData.h" +#ifdef DD4HEP_WITH_GEAR #include "DDRec/DDGear.h" - #include "gearimpl/TPCParametersImpl.h" #include "gearimpl/FixedPadSizeDiskLayout.h" +#endif using namespace std; //using namespace tgeo ; @@ -255,6 +256,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { }//subdetectors tpc_vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); +#ifdef DD4HEP_WITH_GEAR //--------------- create gear::TPCParameters and add them as Extension // GearTPCParameters* gearTPC = new GearTPCParameters( g_driftlength , gear::PadRowLayout2D::POLAR ) ; gear::TPCParametersImpl* gearTPC = new gear::TPCParametersImpl( g_driftlength , gear::PadRowLayout2D::POLAR ) ; @@ -281,6 +283,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { tpc.addExtension< GearHandle >( new GearHandle( gearTPC, "TPCParameters" ) ) ; //-------------------------------------------------------------------- +#endif PlacedVolume phv = lcdd.pickMotherVolume(tpc).placeVolume(tpc_vol); phv.addPhysVolID("system",x_det.id()); diff --git a/examples/ILDExDet/src/ILDExVXD_geo.cpp b/examples/ILDExDet/src/ILDExVXD_geo.cpp index 1c49a2270..8ad79b2bd 100644 --- a/examples/ILDExDet/src/ILDExVXD_geo.cpp +++ b/examples/ILDExDet/src/ILDExVXD_geo.cpp @@ -9,8 +9,10 @@ #include "DD4hep/DetFactoryHelper.h" #include "VXDData.h" +#ifdef DD4HEP_WITH_GEAR #include "DDRec/DDGear.h" #include "gearimpl/ZPlanarParametersImpl.h" +#endif #include "DDRec/Surface.h" @@ -41,12 +43,14 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { vxd_data->id = x_det.id(); +#ifdef DD4HEP_WITH_GEAR //--------------- gear: create gear::ZPlanarParameters and add them as Extension gear::ZPlanarParametersImpl* gearZPlanar = new gear::ZPlanarParametersImpl( gear::ZPlanarParameters::CCD , 0.0, 0.0, 0.0, 0.0, 0.0 ) ; // ZPlanarParametersImpl( int type, double shellInnerRadius, double shellOuterRadius, double shellHalfLength, double shellGap, double shellRadLength ) ; // -> this VXD has no outer shell ... vxd.addExtension<GearHandle>( new GearHandle( gearZPlanar, "VXDParameters" ) ) ; //-------------------------------------------------------------------- +#endif for(xml_coll_t c(e,_U(layer)); c; ++c) { @@ -250,6 +254,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } vxd.setVisAttributes(lcdd, x_det.visStr(),laddervol); +#ifdef DD4HEP_WITH_GEAR //----------------- gear --------------------------------------------- double ladderRadLength = suppmat->GetMaterial()->GetRadLen() /tgeo::mm ; double sensitiveRadLength = sensmat->GetMaterial()->GetRadLen() /tgeo::mm ; @@ -260,7 +265,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // addLayer (int nLadders, double phi0, double ladderDistance, double ladderOffset, double ladderThickness, double ladderLength, double ladderWidth, double ladderRadLength, // double sensitiveDistance, double sensitiveOffset, double sensitiveThickness, double sensitiveLength, double sensitiveWidth, double sensitiveRadLength) //----------------- gear --------------------------------------------- - +#endif layer_assembly->GetShape()->ComputeBBox() ; -- GitLab