From da17b70f08c8b1eac5441df0508876d823ec2c16 Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Tue, 28 Oct 2014 13:40:20 +0000 Subject: [PATCH] - added new class ZDiskPetalsStruct/ZDiskPetalsData - added treatment of gear::FTDParameters (for ILD ) --- DDRec/include/DDRec/DetectorData.h | 96 +++++++++++++++++++++++++++++ DDRec/src/gear/createGearForILD.cpp | 47 ++++++++++++++ 2 files changed, 143 insertions(+) diff --git a/DDRec/include/DDRec/DetectorData.h b/DDRec/include/DDRec/DetectorData.h index 60d3abd14..5ffc69723 100644 --- a/DDRec/include/DDRec/DetectorData.h +++ b/DDRec/include/DDRec/DetectorData.h @@ -1,6 +1,7 @@ #ifndef DDRec_DetectorData_H_ #define DDRec_DetectorData_H_ +#include <bitset> namespace DD4hep { namespace DDRec { @@ -145,6 +146,101 @@ namespace DD4hep { + /** Simple data structure with key parameters for + * reconstruction of a silicon tracking detector + * with disks (roughly orthogonal to the z-axis) built from petals. + * ( Can be used to instantiate a gear::FTDParameters object ) + * + * @author F.Gaede, CERN/DESY + * @date Oct, 20 2014 + * @version $Id: $ + */ + struct ZDiskPetalsStruct{ + + /// width of the strips (if applicable ) + double widthStrip ; + /// length of the strips (if applicable ) + double lengthStrip ; + /// strip pitch (if applicable ) + double pitchStrip ; + /// strip stereo angle (if applicable ) + double angleStrip ; + + /// enum for encoding the sensor type in typeFlags + struct SensorType{ + enum { + DoubleSided=0, + Pixel + }; + } ; + + /** Internal helper struct for defining the layer layout. Layers are defined + * with a sensitive part and a support part. + */ + struct LayerLayout{ + + + /// half angle covered by petal + double petalHalfAngle ; + + /** angle alpha by which the petal is rotated away from the plane + * that is orthogonal to the z-axis + */ + double alphaPetal ; + + /// z-position of layer ( z-position of middle axis ) + double zPosition ; + + /// The number of petals in the layer. + int petalNumber ; + + /// number of sensor per petal + int sensorsPerPetal ; + + /// Bit flag describing sensor type - use enum SensorType to access the bits. + std::bitset<32> typeFlags ; + + /// azimuthal angle of vector defined by the Z-axis to first petal x-positive, y-positive edge + double phi0 ; + + /** z-offset of support petals from layer z-position - signed for first + * petal, following petals have alternating sign + */ + double zOffsetSupport ; + /// The distance of the petal support from the z-axis. + double distanceSupport ; + /// The thickness of the petal support. + double thicknessSupport ; + /// The inner width of the petal support. + double widthInnerSupport ; + /// The outer width of the petal support. + double widthOuterSupport ; + /// The radial length of the petal support. + double lengthSupport ; + + /** z-offset of sensitive petals from layer z-position - signed for first + * petal, following petals have alternating sign + */ + double zOffsetSensitive ; + /// The distance of the petal sensitive from the z-axis. + double distanceSensitive ; + /// The thickness of the petal sensitive. + double thicknessSensitive ; + /// The inner width of the petal sensitive. + double widthInnerSensitive ; + /// The outer width of the petal sensitive. + double widthOuterSensitive ; + /// The radial length of the petal sensitive. + double lengthSensitive ; + } ; + + std::vector<LayerLayout> layers ; + + } ; + typedef StructExtension<ZDiskPetalsStruct> ZDiskPetalsData ; + + + } /* namespace DDRec */ } /* namespace DD4hep */ diff --git a/DDRec/src/gear/createGearForILD.cpp b/DDRec/src/gear/createGearForILD.cpp index 780009d7d..0b06802d9 100644 --- a/DDRec/src/gear/createGearForILD.cpp +++ b/DDRec/src/gear/createGearForILD.cpp @@ -8,6 +8,7 @@ #include "gearimpl/TPCParametersImpl.h" #include "gearimpl/FixedPadSizeDiskLayout.h" #include "gearimpl/ZPlanarParametersImpl.h" +#include "gearimpl/FTDParametersImpl.h" #include <iostream> @@ -145,6 +146,52 @@ namespace DD4hep{ setDE.addExtension< GearHandle >( new GearHandle( gearSET, "SETParameters" ) ) ; //============================================================================================ + DetElement ftdDE = lcdd.detector("FTD") ; + + ZDiskPetalsData* ftd = ftdDE.extension<ZDiskPetalsData>() ; + + gear::FTDParametersImpl* gearFTD = new gear::FTDParametersImpl(); + + for(unsigned i=0,n=ftd->layers.size() ; i<n; ++i){ + + const DDRec::ZDiskPetalsData::LayerLayout& l = ftd->layers[i] ; + + + bool isDoubleSided = l.typeFlags[ DDRec::ZDiskPetalsStruct::SensorType::DoubleSided ] ; + int sensorType = ( l.typeFlags[ DDRec::ZDiskPetalsStruct::SensorType::Pixel ] ? + gear::FTDParameters::PIXEL : gear::FTDParameters::STRIP ) ; + + double zoffset = fabs( l.zOffsetSupport ) ; + double signoffset = l.zOffsetSupport > 0 ? 1. : -1 ; + + gearFTD->addLayer( l.petalNumber, l.sensorsPerPetal, + isDoubleSided, sensorType, + l.petalHalfAngle, l.phi0, l.alphaPetal, + l.zPosition/dd4hep::mm, zoffset/dd4hep::mm, signoffset, + l.distanceSupport/dd4hep::mm, l.thicknessSupport/dd4hep::mm, + l.widthInnerSupport/dd4hep::mm, l.widthOuterSupport/dd4hep::mm, + l.lengthSupport/dd4hep::mm, + 0., + l.distanceSensitive/dd4hep::mm, l.thicknessSensitive/dd4hep::mm, + l.widthInnerSensitive/dd4hep::mm, l.widthOuterSensitive/dd4hep::mm, + l.lengthSensitive/dd4hep::mm, + 0. ) ; + + + // FIXME set rad lengths to 0 -> need to get from DD4hep .... + } + + gearFTD->setDoubleVal("strip_width_mm" , ftd->widthStrip / dd4hep::mm ) ; + gearFTD->setDoubleVal("strip_length_mm" , ftd->lengthStrip/ dd4hep::mm ) ; + gearFTD->setDoubleVal("strip_pitch_mm" , ftd->pitchStrip / dd4hep::mm ) ; + gearFTD->setDoubleVal("strip_angle_deg" , ftd->angleStrip / dd4hep::deg ) ; + + + ftdDE.addExtension< GearHandle >( new GearHandle( gearFTD, "FTDParameters" ) ) ; + //============================================================================================ + + + // --- LCDD::apply() expects return code 1 if all went well ! ---- return 1; } -- GitLab