From c8a2698298cb3be0ee27f5b184c315d3deb8f169 Mon Sep 17 00:00:00 2001 From: Christopher Dilks <dilks@jlab.org> Date: Tue, 10 Aug 2021 23:40:33 +0000 Subject: [PATCH] fix drich segmentation --- compact/drich.xml | 31 ++++++++++++++++++++++--------- src/DRich_geo.cpp | 6 +++++- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/compact/drich.xml b/compact/drich.xml index 6a700900..a7051d23 100644 --- a/compact/drich.xml +++ b/compact/drich.xml @@ -23,6 +23,9 @@ <constant name="DRICH_rmax2" value="200*cm"/> <!-- cylinder radius; 20 cm gap between dRICh and HCalBarrel --> <!-- additional parameters --> <constant name="DRICH_aerogel_thickness" value="4.0*cm"/> <!-- aerogel thickness --> + <constant name="DRICH_sensor_size" value="48.0*mm"/> <!-- sensor side length --> + <constant name="DRICH_sensor_thickness" value="35.0*mm"/> <!-- sensor thickness --> + <constant name="DRICH_num_px" value="16"/> <!-- number of pixels along one side of the sensor --> </define> <detectors> @@ -127,8 +130,8 @@ material="Silicon" surface="SensorSurface_DRICH" vis="DRICH_sensor_vis" - side="48*mm" - thickness="35*mm" + side="DRICH_sensor_size" + thickness="DRICH_sensor_thickness" gap="0.5*(52-48)*mm + 2*mm" /> <!-- sensors will be tiled on this sphere @@ -165,15 +168,25 @@ <readouts> <readout name="DRICHHits"> - <segmentation type="CartesianGridXY" grid_size_x="3*mm" grid_size_y="3*mm"/> + <!-- segmentation: square matrix of pixels + - note: for `grid_size`, divide sensor size by 1 less than the + number of pixels, to account for fenceposting + --> + <segmentation + type="CartesianGridXY" + grid_size_x="DRICH_sensor_size/(DRICH_num_px-1)" + grid_size_y="DRICH_sensor_size/(DRICH_num_px-1)" + offset_x="-DRICH_sensor_size/2.0" + offset_y="-DRICH_sensor_size/2.0" + /> <!-- cellID: 64bits - - bits 1-8: dRICh ID - - bits 9-16: sector number - - bits 17-32: photosensor number - - bits 33-48: x pixel (signed) - - bits 49-64: y pixel (signed) + - offset 0, length 8: dRICh ID + - offset 8, length 3: sector number + - offset 11, length 12: photosensor number + - offset 23, length 16: x pixel + - offset 39, length 16: y pixel --> - <id>system:8,sector:8,module:16,x:32:-16,y:-16</id> + <id>system:8,sector:3,module:12,x:23:16,y:16</id> </readout> </readouts> diff --git a/src/DRich_geo.cpp b/src/DRich_geo.cpp index 5d9ebd83..645d2965 100644 --- a/src/DRich_geo.cpp +++ b/src/DRich_geo.cpp @@ -296,7 +296,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec */ // initialize module number for this sector - int imod=1; + int imod=0; // thetaGen loop: iterate less than "0.5 circumference / sensor size" times double nTheta = M_PI*sensorSphRadius / (sensorSide+sensorGap); @@ -354,8 +354,12 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec * RotationZ(thetaGen) // rotate about `yGen` * Translation3D(sensorSphRadius, 0., 0.) // push radially to spherical surface * RotationY(M_PI/2) // rotate sensor to be compatible with generator coords + * RotationZ(-M_PI/2) // correction for readout segmentation mapping ); + // generate LUT for module number -> sensor position, for readout mapping tests + //if(isec==0) printf("%d %f %f\n",imod,sensorPV.position().x(),sensorPV.position().y()); + // properties sensorPV.addPhysVolID("sector", isec).addPhysVolID("module", imod); DetElement sensorDE(det, Form("sensor_de%d_%d", isec, imod), 10000*isec+imod); -- GitLab