diff --git a/examples/ILDExDet/CMakeLists.txt b/examples/ILDExDet/CMakeLists.txt index 93e5e7814f56dcceae569a65ef6f4e5a211323cb..8b95c21f4c14e6d77da3acacf7eca13354b3bb98 100644 --- a/examples/ILDExDet/CMakeLists.txt +++ b/examples/ILDExDet/CMakeLists.txt @@ -31,7 +31,7 @@ ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -find_package( DD4hep ) +find_package( DD4hep REQUIRED) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_ROOT}/cmake ) include( DD4hep ) @@ -40,6 +40,8 @@ find_package( ROOT REQUIRED ) #find_package( ROOT REQUIRED COMPONENTS Geom Reflex) set( ROOT_COMPONENT_LIBRARIES Geom Reflex) + +find_package( Gear REQUIRED) #------------------------------------------------------------- # add additional packages here @@ -50,7 +52,8 @@ include_directories( ${CMAKE_SOURCE_DIR}/include include ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIR} - ) + ${GEAR_INCLUDE_DIRS} + ) file(GLOB sources src/*.cpp ) file(GLOB headers include/*.h) @@ -64,7 +67,10 @@ endif() add_library(${PackageName} SHARED ${sources}) -target_link_libraries(${PackageName} ${DD4hep_LIBRARIES} ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES} ) +target_link_libraries(${PackageName} ${DD4hep_LIBRARIES} + ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES} + ${GEAR_LIBRARIES} + ) #---Rootmap generation-------------------------------------------------------------- @@ -85,6 +91,13 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/this${PackageName}.sh #--- install target------------------------------------- + +FILE(GLOB hfiles "include/*.h") +INSTALL(FILES ${hfiles} + DESTINATION include/${PackageName} + ) + + install(TARGETS ${PackageName} RUNTIME DESTINATION bin LIBRARY DESTINATION lib diff --git a/examples/ILDExDet/compact/ILDEx.xml b/examples/ILDExDet/compact/ILDEx.xml index bc9ab41e582f538d35bd4f8047dc23176212cb49..d5814b8b7ad52c45be9a834f8ea7382dc0b3f6fa 100644 --- a/examples/ILDExDet/compact/ILDEx.xml +++ b/examples/ILDExDet/compact/ILDEx.xml @@ -243,7 +243,7 @@ <readouts> <readout name="VXDCollection"> - <id>system:5,side:-2,layer:9,module:8,sensor:8</id> + <id>system:5,side:2,layer:9,module:8,sensor:8</id> </readout> <readout name="SITCollection"> <id>system:5,side:-2,layer:9,module:8,sensor:8</id> diff --git a/examples/ILDExDet/compact/geant4.xml b/examples/ILDExDet/compact/geant4.xml index fb21f8807ac92627c81dc269f604ac7efeb024b2..dd3f7a2140382512a8192ae447feb3b54e129a93 100644 --- a/examples/ILDExDet/compact/geant4.xml +++ b/examples/ILDExDet/compact/geant4.xml @@ -2,31 +2,31 @@ <geant4> <sensitive_detectors> <sd name="VXD" - type="Geant4Tracker" + type="Tracker" ecut="1.0*keV" verbose="true" hit_aggregation="position"> </sd> <sd name="SIT" - type="Geant4Tracker" + type="Tracker" ecut="1.0*keV" verbose="true" hit_aggregation="position"> </sd> <sd name="TPC" - type="Geant4Tracker" + type="Tracker" ecut="0.01*keV" verbose="true" hit_aggregation="position"> </sd> <sd name="HcalBarrel" - type="Geant4Calorimeter" + type="Calorimeter" ecut="0.5*keV" verbose="true" hit_aggregation="position"> </sd> <sd name="HcalEndcap" - type="Geant4Calorimeter" + type="Calorimeter" ecut="0.5*keV" verbose="true" hit_aggregation="position"> diff --git a/examples/ILDExDet/src/ILDExSIT_geo.cpp b/examples/ILDExDet/src/ILDExSIT_geo.cpp index 29bb045f3c2748857f8fac5080aa89cc999f0bf6..bb54c120c4ce3a4f87ffd44dec6d9f87da33ea31 100644 --- a/examples/ILDExDet/src/ILDExSIT_geo.cpp +++ b/examples/ILDExDet/src/ILDExSIT_geo.cpp @@ -9,6 +9,7 @@ #include "DD4hep/DetFactoryHelper.h" +#include "GearWrapper.h" using namespace std; using namespace DD4hep; @@ -22,6 +23,11 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { PlacedVolume pv; + //--------------- create gear::ZPlanarParameters and add them as Extension + GearZPlanarParameters* gearZPlanar = new GearZPlanarParameters ; + sit.addExtension<GearZPlanarParameters>( gearZPlanar ) ; + //-------------------------------------------------------------------- + for(xml_coll_t c(e,_U(layer)); c; ++c) { @@ -67,6 +73,9 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } } + + + pv = lcdd.pickMotherVolume(sit).placeVolume(assembly) ; pv.addPhysVolID("system", x_det.id()).addPhysVolID("side",0 ) ; diff --git a/examples/ILDExDet/src/ILDExTPC_geo.cpp b/examples/ILDExDet/src/ILDExTPC_geo.cpp index 3beacfe158587dd911a5935a4dcbc5d2cbdcc442..4f39d9aea75a05b956b8dd2da791f5326304bd4a 100644 --- a/examples/ILDExDet/src/ILDExTPC_geo.cpp +++ b/examples/ILDExDet/src/ILDExTPC_geo.cpp @@ -14,6 +14,9 @@ //#include "TPCModule.h" //#include "FixedPadAngleDiskLayout.h" +#include "GearWrapper.h" +#include <gearimpl/FixedPadSizeDiskLayout.h> + using namespace std; using namespace DD4hep; using namespace DD4hep::Geometry; @@ -33,6 +36,12 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { Volume tpc_vol(name+"_envelope_volume", tpc_tub, mat); Readout readout(sens.readout()); + //--- some parameters needed for gear: + double g_driftlength ; + 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 ; + + for(xml_coll_t c(e,_U(detector)); c; ++c) { xml_comp_t px_det (c); @@ -75,6 +84,17 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double dR = ( r1 - r0 ) / ( 2.* nTPClayer ) ; + //---------------------------- 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_maxRow = nTPClayer ; + g_padGap = 0. ; + g_phiMax = 6.283185307e+00 ; // FIXME: where to define ? is it allways 2PI ? + //------------------------------------------------------ + for(int i=0 ; i < nTPClayer ; ++i){ Tube gas_tubL( r0 + (2*i) * dR , r0 + (2*i+1) * dR , zh ); @@ -162,6 +182,27 @@ 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()); + //--------------- create gear::TPCParameters and add them as Extension + GearTPCParameters* gearTPC = new GearTPCParameters( 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. ; + + t = DetElement(tpcData->outerWall).volume().solid() ; + g_outer_r = t->GetRmax() * 10. ; + g_outer_wt = ( t->GetRmax() - t->GetRmin() ) * 10. ; + + 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 ) ; + //-------------------------------------------------------------------- + PlacedVolume phv = lcdd.pickMotherVolume(tpc).placeVolume(tpc_vol); phv.addPhysVolID("system",x_det.id()); tpc.setPlacement(phv); diff --git a/examples/ILDExDet/src/ILDExVXD_geo.cpp b/examples/ILDExDet/src/ILDExVXD_geo.cpp index 0c8a8adba088ced7e61767a2a2488922cc2bc7e4..d9b07cfad91fb93473eea922a2ea4f594be03159 100644 --- a/examples/ILDExDet/src/ILDExVXD_geo.cpp +++ b/examples/ILDExDet/src/ILDExVXD_geo.cpp @@ -15,6 +15,8 @@ using namespace std; using namespace DD4hep; using namespace DD4hep::Geometry; +#define no_split_ladders 0 + static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { DetElement vxd; xml_det_t x_det = e; @@ -50,7 +52,13 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { int nLadders = x_ladder.number(); string layername = name+_toString(layer_id,"_layer%d"); double dphi = 2.*M_PI/double(nLadders); + +#if no_split_ladders double zhalf = x_ladder.zhalf(); +#else + double zhalf = x_ladder.zhalf() / 2 ; +#endif + double offset = x_ladder.offset(); double sens_radius= x_ladder.radius(); double sens_thick = x_ladder.thickness(); @@ -128,7 +136,8 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { RotationZYX rot( phi , 0, 0 ) ; -#if 0 +#if no_split_ladders + pv = assembly.placeVolume( laddervol,Transform3D( rot, Position( (radius + lthick/2.)*cos(phi) - offset * sin( phi ) , (radius + lthick/2.)*sin(phi) + offset * cos( phi ) , 0. ) ));