From 22ca69f6341990c851386644e1298e2466f9f41c Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Thu, 16 Oct 2014 12:20:35 +0000 Subject: [PATCH] - added support for gear::ZPlanarParameters - implemented for the VXD --- DDRec/include/DDRec/DetectorData.h | 68 +++++++++++++++++++++++++++-- DDRec/src/gear/DDGear.cpp | 6 +-- DDRec/src/gear/createGearForILD.cpp | 49 +++++++++++++++------ 3 files changed, 103 insertions(+), 20 deletions(-) diff --git a/DDRec/include/DDRec/DetectorData.h b/DDRec/include/DDRec/DetectorData.h index 4f6519e1b..3c833b636 100644 --- a/DDRec/include/DDRec/DetectorData.h +++ b/DDRec/include/DDRec/DetectorData.h @@ -7,7 +7,7 @@ namespace DD4hep { /** Wrapper class for adding structs or pods as extensions to DetElements. * Provides default implementations of the c'tors required by the extension mechamism. - * Structs (or classes) can be defined w/o any c'tors relying in the default ones + * Structs (or classes) can be defined w/o any c'tors relying on the default ones * created by the compiler. * * @author F.Gaede, CERN/DESY @@ -23,10 +23,10 @@ namespace DD4hep { StructExtension(const StructExtension<T>& t, const Geometry::DetElement& d) : T(t) {} }; - /** Simple data structure holding data that is relevant for + /** Simple data structure with key parameters for * reconstruction of a cylindrical TPC with a pad plane that * is symmetrically populated with one size pads. - * ( Can be used to instantiate a gear::TPCParmeter object + * ( Can be used to instantiate a gear::TPCParameter object * with a FixedPadSizeDiskLayout ) * * @author F.Gaede, CERN/DESY @@ -50,6 +50,68 @@ namespace DD4hep { typedef StructExtension<FixedPadSizeTPCStruct> FixedPadSizeTPCData ; + + /** Simple data structure with key parameters for + * reconstruction of a planar silicon tracking detector + * with planes parallel to the z-axis. + * ( Can be used to instantiate a gear::ZPlanarParameters object ) + * + * @author F.Gaede, CERN/DESY + * @date Oct, 15 2014 + * @version $Id: $ + */ + struct ZPlanarStruct{ + /// The half length (z) of the support shell (w/o gap) - 0. if no shell exists. + double zHalfShell ; + /// The length of the gap in mm (gap position at z=0). + double gapShell ; + /// The inner radius of the support shell. + double rInnerShell ; + /// The outer radius of the support shell. + double rOuterShell ; + + /**Internal helper struct for defining the layer layout. Layers are defined + * with a sensitive part and a support part. + */ + struct LayerLayout{ + + /// The number of ladders in the layer. + int ladderNumber ; + + /// Azimuthal angle of the (outward pointing) normal of the first ladder. + double phi0 ; + + /// The distance of the ladder support from the origin (IP). + double distanceSupport ; + /// The thickness of the ladder support from the origin (IP). + double thicknessSupport ; + /// The offset of the ladder support, i.e. the shift in the direction of increasing phi, perpendicular to the ladders's normal. + double offsetSupport ; + ///The width of the ladder support. + double widthSupport ; + ///The half length of the ladder support in z. + double zHalfSupport ; + + /// The distance of the ladder sensitive from the origin (IP). + double distanceSensitive ; + /// The thickness of the ladder sensitive from the origin (IP). + double thicknessSensitive ; + /// The offset of the ladder sensitive, i.e. the shift in the direction of increasing phi, perpendicular to the ladders's normal. + double offsetSensitive ; + ///The width of the ladder sensitive. + double widthSensitive ; + ///The half length of the ladder sensitive in z. + double zHalfSensitive ; + } ; + + std::vector<LayerLayout> layers ; + + } ; + typedef StructExtension<ZPlanarStruct> ZPlanarData ; + + + + } /* namespace DDRec */ } /* namespace DD4hep */ diff --git a/DDRec/src/gear/DDGear.cpp b/DDRec/src/gear/DDGear.cpp index dbdeee2b8..d90fd0c58 100644 --- a/DDRec/src/gear/DDGear.cpp +++ b/DDRec/src/gear/DDGear.cpp @@ -99,10 +99,10 @@ namespace DD4hep{ 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() == "ZPlanarParameters" ) { 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() == "ZPlanarParameters" ) { gearMgr->setSITParameters ( dynamic_cast<gear::ZPlanarParameters* >( gearH->takeGearObject() ) ) ; } + else if( gearH->name() == "ZPlanarParameters" ) { gearMgr->setSETParameters ( dynamic_cast<gear::ZPlanarParameters* >( gearH->takeGearObject() ) ) ; } else if( gearH->name() == "SiPlanesParameters" ) { gearMgr->setSiPlanesParameters ( dynamic_cast<gear::SiPlanesParameters* >( gearH->takeGearObject() ) ) ; } else { diff --git a/DDRec/src/gear/createGearForILD.cpp b/DDRec/src/gear/createGearForILD.cpp index 8364988eb..9c48d0c91 100644 --- a/DDRec/src/gear/createGearForILD.cpp +++ b/DDRec/src/gear/createGearForILD.cpp @@ -1,12 +1,13 @@ #include "DD4hep/LCDD.h" #include "DD4hep/Factories.h" +#include "DD4hep/DD4hepUnits.h" #include "DDRec/DetectorData.h" - #include "DDRec/DDGear.h" + #include "gearimpl/TPCParametersImpl.h" #include "gearimpl/FixedPadSizeDiskLayout.h" - +#include "gearimpl/ZPlanarParametersImpl.h" #include <iostream> @@ -32,28 +33,48 @@ namespace DD4hep{ std::cout << " **** running plugin createGearForILD ! " << std::endl ; - //***** TPC ******** + //========= TPC ============================================================================== DetElement tpcDE = lcdd.detector("TPC") ; FixedPadSizeTPCData* tpc = tpcDE.extension<FixedPadSizeTPCData>() ; - gear::TPCParametersImpl* gearTPC = new gear::TPCParametersImpl( tpc->driftLength , gear::PadRowLayout2D::POLAR ) ; + gear::TPCParametersImpl* gearTPC = new gear::TPCParametersImpl( tpc->driftLength /dd4hep::mm , gear::PadRowLayout2D::POLAR ) ; - gearTPC->setPadLayout( new gear::FixedPadSizeDiskLayout( tpc->rMinReadout, tpc->rMaxReadout, tpc->padHeight, tpc->padWidth, tpc->maxRow, tpc->padGap ) ) ; + gearTPC->setPadLayout( new gear::FixedPadSizeDiskLayout( tpc->rMinReadout/dd4hep::mm , tpc->rMaxReadout/dd4hep::mm, tpc->padHeight/dd4hep::mm, + tpc->padWidth/dd4hep::mm , tpc->maxRow, tpc->padGap /dd4hep::mm ) ) ; - gearTPC->setDoubleVal("tpcInnerRadius", tpc->rMin ) ; // inner r of support tube - gearTPC->setDoubleVal("tpcOuterRadius", tpc->rMax ) ; // outer radius of TPC - gearTPC->setDoubleVal("tpcInnerWallThickness", tpc->innerWallThickness ) ; // thickness of inner shell - gearTPC->setDoubleVal("tpcOuterWallThickness", tpc->outerWallThickness ) ; // thickness of outer shell + gearTPC->setDoubleVal("tpcInnerRadius", tpc->rMin/dd4hep::mm ) ; // inner r of support tube + gearTPC->setDoubleVal("tpcOuterRadius", tpc->rMax/dd4hep::mm ) ; // outer radius of TPC + gearTPC->setDoubleVal("tpcInnerWallThickness", tpc->innerWallThickness/dd4hep::mm ) ; // thickness of inner shell + gearTPC->setDoubleVal("tpcOuterWallThickness", tpc->outerWallThickness/dd4hep::mm ) ; // thickness of outer shell tpcDE.addExtension< GearHandle >( new GearHandle( gearTPC, "TPCParameters" ) ) ; - //******************** - - - - + //========= VXD ============================================================================== + + DetElement vxdDE = lcdd.detector("VTX") ; + + ZPlanarData* vxd = vxdDE.extension<ZPlanarData>() ; + + // ZPlanarParametersImpl (int type, double shellInnerRadius, double shellOuterRadius, double shellHalfLength, double shellGap, double shellRadLength) + int type = gear::ZPlanarParameters::CMOS ; + gear::ZPlanarParametersImpl* gearVXD = new gear::ZPlanarParametersImpl( type, vxd->rInnerShell/dd4hep::mm, vxd->rOuterShell/dd4hep::mm, + vxd->zHalfShell/dd4hep::mm , vxd->gapShell/dd4hep::mm , 0. ) ; + + for(unsigned i=0,n=vxd->layers.size() ; i<n; ++i){ + + const DDRec::ZPlanarData::LayerLayout& l = vxd->layers[i] ; + + // FIXME set rad lengths to 0 -> need to get from DD4hep .... + gearVXD->addLayer( l.ladderNumber, l.phi0, + l.distanceSupport/dd4hep::mm, l.offsetSupport/dd4hep::mm, l. thicknessSupport/dd4hep::mm, l.zHalfSupport/dd4hep::mm, l.widthSupport/dd4hep::mm, 0. , + l.distanceSensitive/dd4hep::mm, l.offsetSensitive/dd4hep::mm, l. thicknessSensitive/dd4hep::mm, l.zHalfSensitive/dd4hep::mm, l.widthSensitive/dd4hep::mm, 0. ) ; + + } + + vxdDE.addExtension< GearHandle >( new GearHandle( gearVXD, "ZPlanarParameters" ) ) ; + //============================================================================================ // --- LCDD::apply() expects return code 1 if all went well ! ---- return 1; -- GitLab