From 046d760b487ae6283d7882e0c503151da5bce086 Mon Sep 17 00:00:00 2001 From: chchatte92 Date: Fri, 17 Feb 2023 12:37:19 +0100 Subject: [PATCH 01/10] Dual Mirrors Implementated; Splice faulty --- compact/pid/drich.xml | 36 +++--- src/DRICH_geo.cpp | 271 ++++++++++++++++++++++++++++++------------ 2 files changed, 213 insertions(+), 94 deletions(-) diff --git a/compact/pid/drich.xml b/compact/pid/drich.xml index 624b2e97e..882991c49 100644 --- a/compact/pid/drich.xml +++ b/compact/pid/drich.xml @@ -15,10 +15,11 @@ - - + + - + + @@ -42,7 +43,7 @@ - `DRICH_debug_mirror`: 1 = draw full mirror shape for single sector; 0 = off - `DRICH_debug_sensors`: 1 = draw full sensor sphere for a single sector; 0 = off - + @@ -152,19 +153,20 @@ to the sensor sphere center (i.e., set both to zero for focus at the sensor sphere center (ignoring spherical aberrations effects)) - - + splice_mode="1" + debug="DRICH_debug_mirror" + > + + + #### Sensors @@ -209,15 +211,15 @@ - `zmin`: z-plane cut diff --git a/src/DRICH_geo.cpp b/src/DRICH_geo.cpp index 57eac8fc2..b960d3679 100644 --- a/src/DRICH_geo.cpp +++ b/src/DRICH_geo.cpp @@ -74,17 +74,18 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec auto airgapVis = desc.visAttributes(airgapElem.attr(_Unicode(vis))); double airgapThickness = airgapElem.attr(_Unicode(thickness)); // - mirror - auto mirrorElem = detElem.child(_Unicode(mirror)); - auto mirrorMat = desc.material(mirrorElem.attr(_Unicode(material))); - auto mirrorVis = desc.visAttributes(mirrorElem.attr(_Unicode(vis))); - auto mirrorSurf = surfMgr.opticalSurface(mirrorElem.attr(_Unicode(surface))); - double mirrorBackplane = mirrorElem.attr(_Unicode(backplane)); - double mirrorThickness = mirrorElem.attr(_Unicode(thickness)); - double mirrorRmin = mirrorElem.attr(_Unicode(rmin)); - double mirrorRmax = mirrorElem.attr(_Unicode(rmax)); - double mirrorPhiw = mirrorElem.attr(_Unicode(phiw)); - double focusTuneZ = mirrorElem.attr(_Unicode(focus_tune_z)); - double focusTuneX = mirrorElem.attr(_Unicode(focus_tune_x)); + auto mirrorsElem = detElem.child(_Unicode(mirrors)); + auto mirrorMat = desc.material(mirrorsElem.attr(_Unicode(material))); + auto mirrorVis = desc.visAttributes(mirrorsElem.attr(_Unicode(vis))); + auto mirrorSurf = surfMgr.opticalSurface(mirrorsElem.attr(_Unicode(surface))); + //double mirrorBackplane = mirrorElem.attr(_Unicode(backplane)); + double mirrorThickness = mirrorsElem.attr(_Unicode(thickness)); + double mirrorRmin = mirrorsElem.attr(_Unicode(rmin)); + double mirrorRmax = mirrorsElem.attr(_Unicode(rmax)); + double mirrorPhiw = mirrorsElem.attr(_Unicode(phiw)); + int spliceMode = mirrorsElem.attr(_Unicode(splice_mode)); + //double focusTuneZ = mirrorElem.attr(_Unicode(focus_tune_z)); + //double focusTuneX = mirrorElem.attr(_Unicode(focus_tune_x)); // - sensor module auto sensorElem = detElem.child(_Unicode(sensors)).child(_Unicode(module)); auto sensorMat = desc.material(sensorElem.attr(_Unicode(material))); @@ -237,6 +238,8 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec PlacedVolume vesselPV = motherVol.placeVolume(vesselVol, vesselPos); vesselPV.addPhysVolID("system", detID); det.setPlacement(vesselPV); + std::vector> mirrorCoords; + std::vector> spliceList; // BUILD RADIATOR ==================================================================== @@ -334,75 +337,189 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec // - sensor sphere center, w.r.t. IP double zS = sensorSphCenterZ + vesselZmin; double xS = sensorSphCenterX; - // - distance between IP and mirror back plane - double b = vesselZmax - mirrorBackplane; - // - desired focal region: sensor sphere center, offset by focus-tune (z,x) parameters - double zF = zS + focusTuneZ; - double xF = xS + focusTuneX; - - // determine the mirror that focuses the IP to this desired region - /* - uses point-to-point focusing to derive spherical mirror center - * `(mirrorCenterZ,mirrorCenterX)` and radius `mirrorRadius` for given - * image point coordinates `(zF,xF)` and `b`, defined as the z-distance - * between the object (IP) and the mirror surface - * - all coordinates are specified w.r.t. the object point (IP) - */ - double mirrorCenterZ = b * zF / (2 * b - zF); - double mirrorCenterX = b * xF / (2 * b - zF); - double mirrorRadius = b - mirrorCenterZ; - - // translate mirror center to be w.r.t vessel front plane - mirrorCenterZ -= vesselZmin; - - // spherical mirror patch cuts and rotation - double mirrorThetaRot = std::asin(mirrorCenterX / mirrorRadius); - double mirrorTheta1 = mirrorThetaRot - std::asin((mirrorCenterX - mirrorRmin) / mirrorRadius); - double mirrorTheta2 = mirrorThetaRot + std::asin((mirrorRmax - mirrorCenterX) / mirrorRadius); - - // if debugging, draw full sphere - if (debugMirror) { - mirrorTheta1 = 0; - mirrorTheta2 = M_PI; /*mirrorPhiw=2*M_PI;*/ - } - - // solid : create sphere at origin, with specified angular limits; - // phi limits are increased to fill gaps (overlaps are cut away later) - Sphere mirrorSolid1(mirrorRadius, mirrorRadius + mirrorThickness, mirrorTheta1, mirrorTheta2, -40 * degree, + //Tube pieSlice( 0.01*cm, vesselRmax2,tankLength/2.0, -mirrorPhiw/2.0, mirrorPhiw/2.0); + //Looping over the mirrors + int iMir =0; + for(xml::Collection_t mirrorElem(mirrorsElem, _Unicode(mirror)); mirrorElem; ++mirrorElem, ++iMir){ + + double mirrorBackplane = mirrorElem.attr(_Unicode(backplane)); + double focusTuneZ = mirrorElem.attr(_Unicode(focus_tune_z)); + double focusTuneX = mirrorElem.attr(_Unicode(focus_tune_x)); + // - distance between IP and mirror back plane + double b = vesselZmax - mirrorBackplane; + // - desired focal region: sensor sphere center, offset by focus-tune (z,x) parameters + double zF = zS + focusTuneZ; + double xF = xS + focusTuneX; + + // determine the mirror that focuses the IP to this desired region + /* - uses point-to-point focusing to derive spherical mirror center + * `(mirrorCenterZ,mirrorCenterX)` and radius `mirrorRadius` for given + * image point coordinates `(zF,xF)` and `b`, defined as the z-distance + * between the object (IP) and the mirror surface + * - all coordinates are specified w.r.t. the object point (IP) + */ + double mirrorCenterZ = b * zF / (2 * b - zF); + double mirrorCenterX = b * xF / (2 * b - zF); + double mirrorRadius = b - mirrorCenterZ; + + // translate mirror center to be w.r.t vessel front plane + mirrorCenterZ -= vesselZmin; + if(debugMirror && isec==0) { + printf("\n"); + printf("SECTOR %d MIRROR %d coordinates (w.r.t IP):\n",isec,iMir); + printf(" centerZ = %.2f cm\n centerX = %.2f cm\n radius = %.2f cm\n",mirrorCenterZ,mirrorCenterX,mirrorRadius); + }; + + mirrorCoords.push_back(std::tuple(mirrorCenterZ, mirrorCenterX, mirrorRadius )); + } // All mirror related information stored/ + + spliceList.clear(); + double imirrorCenterZ[2], imirrorCenterX[2], imirrorRadius[2]; + double spliceBoxSize = 5*vesselRmax2; + Box spliceBox = Box(spliceBoxSize,spliceBoxSize,spliceBoxSize); + for(auto mirrorC=mirrorCoords.begin(); mirrorC(mirrorC[i]); + imirrorCenterX[i] = std::get<1>(mirrorC[i]); + imirrorRadius[i] = std::get<2>(mirrorC[i]); + }; + + // distance between mirror0 and mirror1 centers + double centerDist = std::hypot( + imirrorCenterX[1] - imirrorCenterX[0], + imirrorCenterZ[1] - imirrorCenterZ[0] + ); + + // polar angle of vector from mirror0 center to mirror1 center + double psi = std::atan2( + imirrorCenterX[1] - imirrorCenterX[0], + imirrorCenterZ[1] - imirrorCenterZ[0] + ); + if(debugMirror && isec==0) printf("\nPSI = %f degrees\n\n",psi/degree); + + // distance between mirror0 center and plane of intersection + double intersectionDist = + ( std::pow(imirrorRadius[0],2) - std::pow(imirrorRadius[1],2) + std::pow(centerDist,2) ) / + ( 2 * centerDist ); + + // define pair of splice surfaces, one for each mirror + // Box implementation (cf. HalfSpace below): + Translation3D spliceBoxPos[2]; + int spliceDir; + for(int b=0; b<2; b++) { + // if mirrors intersect in a plane, there are two choices of mirror pairs, applied by `spliceDir`: + spliceDir = b==spliceMode ? + 1: // convergent choice: reflections tend to point toward each other + -1; // divergent choice: reflections tend to point away from each other + spliceBoxPos[b] = + Translation3D(originFront) * + Translation3D( + imirrorCenterX[0] + (intersectionDist + spliceDir*spliceBoxSize) * std::sin(psi), + 0., + imirrorCenterZ[0] + (intersectionDist + spliceDir*spliceBoxSize) * std::cos(psi) + ); + }; + spliceList.push_back( std::pair ( + Transform3D( spliceBoxPos[0] * RotationY(psi) ), + Transform3D( spliceBoxPos[1] * RotationY(psi) ) + )); + + // HalfSpace implementation: + /* // TODO: use this instead, when `HalfSpace` is supported downstream + // -- position: start at mirror0 center and translate to intersection plane, along + // the line containing both mirrors' centers + double halfSpacePos[3] = { + mirrorCenterX[0] + intersectionDist * std::sin(psi), + 0., + mirrorCenterZ[0] + intersectionDist * std::cos(psi) // NOTE: probably need to add `originFront` + }; + // -- normals + double halfSpaceDir[2][3] = { + { (mirrorCenterX[0]-mirrorCenterX[1])/centerDist, 0., (mirrorCenterZ[0]-mirrorCenterZ[1])/centerDist }, // toward mirror0 + { (mirrorCenterX[1]-mirrorCenterX[0])/centerDist, 0., (mirrorCenterZ[1]-mirrorCenterZ[0])/centerDist } // toward mirror1 + }; + // -- definition + spliceList.push_back( std::pair ( + HalfSpace( halfSpacePos, halfSpaceDir[0] ), // normal vector points toward mirror0 + HalfSpace( halfSpacePos, halfSpaceDir[1] ) // normal vector points toward mirror1 + )); + */ + + }; // end mirror pair loop + + + iMir=0; + for(auto mirrorC=mirrorCoords.begin(); mirrorC(mirrorC[0]); + imirrorCenterX[0] = std::get<1>(mirrorC[0]); + imirrorRadius[0] = std::get<2>(mirrorC[0]); + + // spherical mirror patch cuts and rotation + double mirrorThetaRot = std::asin(imirrorCenterX[0] / imirrorRadius[0]); + double mirrorTheta1 = mirrorThetaRot - std::asin((imirrorCenterX[0] - mirrorRmin) / imirrorRadius[0]); + double mirrorTheta2 = mirrorThetaRot + std::asin((mirrorRmax - imirrorCenterX[0]) / imirrorRadius[0]); + // if debugging, draw full sphere + if (debugMirror) { + mirrorTheta1 = 0; + mirrorTheta2 = M_PI; /*mirrorPhiw=2*M_PI;*/ + } + + // solid : create sphere at origin, with specified angular limits; + // phi limits are increased to fill gaps (overlaps are cut away later) + Sphere mirrorSolid1(imirrorRadius[0], imirrorRadius[0] + mirrorThickness, mirrorTheta1, mirrorTheta2, -40 * degree, 40 * degree); - // mirror placement transformation (note: transformations are in reverse order) - auto mirrorPos = Position(mirrorCenterX, 0., mirrorCenterZ) + originFront; - auto mirrorPlacement(Translation3D(mirrorPos.x(), mirrorPos.y(), mirrorPos.z()) // re-center to specified position + // mirror placement transformation (note: transformations are in reverse order) + auto mirrorPos = Position(imirrorCenterX[0], 0., imirrorCenterZ[0]) + originFront; + auto mirrorPlacement(Translation3D(mirrorPos) // re-center to specified position * RotationY(-mirrorThetaRot) // rotate about vertical axis, to be within vessel radial walls - ); - - // cut overlaps with other sectors using "pie slice" wedges, to the extent specified - // by `mirrorPhiw` - Tube pieSlice(0.01 * cm, vesselRmax2, tankLength / 2.0, -mirrorPhiw / 2.0, mirrorPhiw / 2.0); - IntersectionSolid mirrorSolid2(pieSlice, mirrorSolid1, mirrorPlacement); - - // mirror volume, attributes, and placement - Volume mirrorVol(detName + "_mirror_" + secName, mirrorSolid2, mirrorMat); - mirrorVol.setVisAttributes(mirrorVis); - auto mirrorSectorPlacement = Transform3D(sectorRotation); // rotate about beam axis to sector - auto mirrorPV = gasvolVol.placeVolume(mirrorVol, mirrorSectorPlacement); - - // properties - DetElement mirrorDE(det, "mirror_de_" + secName, isec); - mirrorDE.setPlacement(mirrorPV); - SkinSurface mirrorSkin(desc, mirrorDE, "mirror_optical_surface_" + secName, mirrorSurf, mirrorVol); - mirrorSkin.isValid(); - - // reconstruction constants (w.r.t. IP) - // - access sector center after `sectorRotation` - auto mirrorFinalPlacement = mirrorSectorPlacement * mirrorPlacement; - auto mirrorFinalCenter = vesselPos + mirrorFinalPlacement.Translation().Vect(); - desc.add(Constant("DRICH_mirror_center_x_" + secName, std::to_string(mirrorFinalCenter.x()))); - desc.add(Constant("DRICH_mirror_center_y_" + secName, std::to_string(mirrorFinalCenter.y()))); - desc.add(Constant("DRICH_mirror_center_z_" + secName, std::to_string(mirrorFinalCenter.z()))); - if (isec == 0) - desc.add(Constant("DRICH_mirror_radius", std::to_string(mirrorRadius))); - + ); + + // cut overlaps with other sectors using "pie slice" wedges, to the extent specified + // by `mirrorPhiw` + Tube pieSlice(0.01 * cm, vesselRmax2, tankLength / 2.0, -mirrorPhiw / 2.0, mirrorPhiw / 2.0); + IntersectionSolid mirrorSolid2(pieSlice, mirrorSolid1, mirrorPlacement); + Solid mirrorSolid3; + if(mirrorCmirrorCoords.begin()) { + mirrorSolid4 = IntersectionSolid( mirrorSolid3, spliceBox, spliceList[iMir-1].second ); + } else { + mirrorSolid4 = mirrorSolid3; + }; + + // mirror volume, attributes, and placement + Volume mirrorVol(detName + "_mirror_" + secName, mirrorSolid2, mirrorMat); + mirrorVol.setVisAttributes(mirrorVis); + auto mirrorSectorPlacement = Transform3D(sectorRotation); // rotate about beam axis to sector + auto mirrorPV = gasvolVol.placeVolume(mirrorVol, mirrorSectorPlacement); + + // properties + DetElement mirrorDE(det, "mirror_de_"+iMir + secName, isec); + mirrorDE.setPlacement(mirrorPV); + SkinSurface mirrorSkin(desc, mirrorDE, "mirror_optical_surface_" + secName, mirrorSurf, mirrorVol); + mirrorSkin.isValid(); + + // reconstruction constants (w.r.t. IP) + // - access sector center after `sectorRotation` + auto mirrorFinalPlacement = mirrorSectorPlacement * mirrorPlacement; + auto mirrorFinalCenter = vesselPos + mirrorFinalPlacement.Translation().Vect(); + desc.add(Constant("DRICH_mirror_center_x_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.x()))); + desc.add(Constant("DRICH_mirror_center_y_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.y()))); + desc.add(Constant("DRICH_mirror_center_z_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.z()))); + if (isec == 0) + desc.add(Constant("DRICH_mirror_radius", +iMir+"_" +std::to_string(imirrorRadius[0]))); + } //end of mirror loop + // BUILD SENSORS ==================================================================== // if debugging sphere properties, restrict number of sensors drawn From 0e760727bbb62b081a804e87687775d51a8e409f Mon Sep 17 00:00:00 2001 From: Chandradoy Chatterjee Date: Tue, 28 Feb 2023 11:49:38 +0100 Subject: [PATCH 02/10] Snout slope adjusted with proper trigonometry --- compact/pid/drich.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compact/pid/drich.xml b/compact/pid/drich.xml index 882991c49..c0df7a105 100644 --- a/compact/pid/drich.xml +++ b/compact/pid/drich.xml @@ -17,9 +17,8 @@ - - - + + From e4b74659711aeb21431001b75a826dfbfc37cf13 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 10:59:52 +0000 Subject: [PATCH 03/10] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- compact/pid/drich.xml | 2 +- src/DRICH_geo.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compact/pid/drich.xml b/compact/pid/drich.xml index c0df7a105..ad5a868c4 100644 --- a/compact/pid/drich.xml +++ b/compact/pid/drich.xml @@ -17,7 +17,7 @@ - + diff --git a/src/DRICH_geo.cpp b/src/DRICH_geo.cpp index b960d3679..04d01a798 100644 --- a/src/DRICH_geo.cpp +++ b/src/DRICH_geo.cpp @@ -83,7 +83,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec double mirrorRmin = mirrorsElem.attr(_Unicode(rmin)); double mirrorRmax = mirrorsElem.attr(_Unicode(rmax)); double mirrorPhiw = mirrorsElem.attr(_Unicode(phiw)); - int spliceMode = mirrorsElem.attr(_Unicode(splice_mode)); + int spliceMode = mirrorsElem.attr(_Unicode(splice_mode)); //double focusTuneZ = mirrorElem.attr(_Unicode(focus_tune_z)); //double focusTuneX = mirrorElem.attr(_Unicode(focus_tune_x)); // - sensor module @@ -369,10 +369,10 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec printf("SECTOR %d MIRROR %d coordinates (w.r.t IP):\n",isec,iMir); printf(" centerZ = %.2f cm\n centerX = %.2f cm\n radius = %.2f cm\n",mirrorCenterZ,mirrorCenterX,mirrorRadius); }; - + mirrorCoords.push_back(std::tuple(mirrorCenterZ, mirrorCenterX, mirrorRadius )); - } // All mirror related information stored/ - + } // All mirror related information stored/ + spliceList.clear(); double imirrorCenterZ[2], imirrorCenterX[2], imirrorRadius[2]; double spliceBoxSize = 5*vesselRmax2; @@ -451,15 +451,15 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec iMir=0; for(auto mirrorC=mirrorCoords.begin(); mirrorC(mirrorC[0]); imirrorCenterX[0] = std::get<1>(mirrorC[0]); imirrorRadius[0] = std::get<2>(mirrorC[0]); - + // spherical mirror patch cuts and rotation double mirrorThetaRot = std::asin(imirrorCenterX[0] / imirrorRadius[0]); double mirrorTheta1 = mirrorThetaRot - std::asin((imirrorCenterX[0] - mirrorRmin) / imirrorRadius[0]); - double mirrorTheta2 = mirrorThetaRot + std::asin((mirrorRmax - imirrorCenterX[0]) / imirrorRadius[0]); + double mirrorTheta2 = mirrorThetaRot + std::asin((mirrorRmax - imirrorCenterX[0]) / imirrorRadius[0]); // if debugging, draw full sphere if (debugMirror) { mirrorTheta1 = 0; @@ -519,7 +519,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec if (isec == 0) desc.add(Constant("DRICH_mirror_radius", +iMir+"_" +std::to_string(imirrorRadius[0]))); } //end of mirror loop - + // BUILD SENSORS ==================================================================== // if debugging sphere properties, restrict number of sensors drawn From 52cce866a15439f1083ad276ffc77ebd3536126e Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Fri, 24 Mar 2023 10:44:19 -0400 Subject: [PATCH 04/10] fix: make the mirror splicing work! --- compact/pid/drich.xml | 2 +- src/DRICH_geo.cpp | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/compact/pid/drich.xml b/compact/pid/drich.xml index ccc7ed49d..c1cef8ae3 100644 --- a/compact/pid/drich.xml +++ b/compact/pid/drich.xml @@ -162,7 +162,7 @@ splice_mode="1" debug="DRICH_debug_mirror" > - + diff --git a/src/DRICH_geo.cpp b/src/DRICH_geo.cpp index 04d01a798..f6d062fec 100644 --- a/src/DRICH_geo.cpp +++ b/src/DRICH_geo.cpp @@ -497,8 +497,19 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec mirrorSolid4 = mirrorSolid3; }; + /* + // DEBUG splicing: uncomment this section to draw splicing `Box` + mirrorSolid4 = mirrorSolid2; // undo splice cuts + if(iMir==0) { // place splice volume + Volume spliceVol(detName+"_splice_"+secName+"_"+mirName, spliceBox, mirrorMat); + auto splicePV = gasvolVol.placeVolume(spliceVol,spliceList[iMir].first); + DetElement spliceDE(det, Form("splice_de_%d_%d", isec, iMir), 10*isec+iMir); + spliceDE.setPlacement(splicePV); + }; + */ + // mirror volume, attributes, and placement - Volume mirrorVol(detName + "_mirror_" + secName, mirrorSolid2, mirrorMat); + Volume mirrorVol(detName + "_mirror_" + secName, mirrorSolid4, mirrorMat); mirrorVol.setVisAttributes(mirrorVis); auto mirrorSectorPlacement = Transform3D(sectorRotation); // rotate about beam axis to sector auto mirrorPV = gasvolVol.placeVolume(mirrorVol, mirrorSectorPlacement); @@ -511,11 +522,11 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec // reconstruction constants (w.r.t. IP) // - access sector center after `sectorRotation` - auto mirrorFinalPlacement = mirrorSectorPlacement * mirrorPlacement; - auto mirrorFinalCenter = vesselPos + mirrorFinalPlacement.Translation().Vect(); - desc.add(Constant("DRICH_mirror_center_x_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.x()))); - desc.add(Constant("DRICH_mirror_center_y_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.y()))); - desc.add(Constant("DRICH_mirror_center_z_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.z()))); + // auto mirrorFinalPlacement = mirrorSectorPlacement * mirrorPlacement; + // auto mirrorFinalCenter = vesselPos + mirrorFinalPlacement.Translation().Vect(); + // desc.add(Constant("DRICH_mirror_center_x_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.x()))); // FIXME + // desc.add(Constant("DRICH_mirror_center_y_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.y()))); + // desc.add(Constant("DRICH_mirror_center_z_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.z()))); if (isec == 0) desc.add(Constant("DRICH_mirror_radius", +iMir+"_" +std::to_string(imirrorRadius[0]))); } //end of mirror loop From 223035ae51f5b30b861b62f460ae9035d9da9ce0 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Fri, 24 Mar 2023 12:33:46 -0400 Subject: [PATCH 05/10] fix: int->string conversion for `clang` --- src/DRICH_geo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DRICH_geo.cpp b/src/DRICH_geo.cpp index f6d062fec..91828d829 100644 --- a/src/DRICH_geo.cpp +++ b/src/DRICH_geo.cpp @@ -515,7 +515,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec auto mirrorPV = gasvolVol.placeVolume(mirrorVol, mirrorSectorPlacement); // properties - DetElement mirrorDE(det, "mirror_de_"+iMir + secName, isec); + DetElement mirrorDE(det, "mirror_de_mir" + std::to_string(iMir) + "_" + secName, isec); mirrorDE.setPlacement(mirrorPV); SkinSurface mirrorSkin(desc, mirrorDE, "mirror_optical_surface_" + secName, mirrorSurf, mirrorVol); mirrorSkin.isValid(); From ed2e049ae2c30d9ac475452e0002f42e3d0c16d5 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Fri, 24 Mar 2023 13:11:36 -0400 Subject: [PATCH 06/10] fix: another int->string conversion for `clang` --- src/DRICH_geo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DRICH_geo.cpp b/src/DRICH_geo.cpp index 91828d829..21524c62b 100644 --- a/src/DRICH_geo.cpp +++ b/src/DRICH_geo.cpp @@ -528,7 +528,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec // desc.add(Constant("DRICH_mirror_center_y_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.y()))); // desc.add(Constant("DRICH_mirror_center_z_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.z()))); if (isec == 0) - desc.add(Constant("DRICH_mirror_radius", +iMir+"_" +std::to_string(imirrorRadius[0]))); + desc.add(Constant("DRICH_mirror_radius_mir" + std::to_string(iMir), std::to_string(imirrorRadius[0]))); } //end of mirror loop // BUILD SENSORS ==================================================================== From 9154b4841296317017fe3890e7a5b8bf73f2f08d Mon Sep 17 00:00:00 2001 From: Chandradoy Chatterjee Date: Wed, 29 Mar 2023 17:38:27 +0200 Subject: [PATCH 07/10] Mirror centres print added in compact search --- src/DRICH_geo.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/DRICH_geo.cpp b/src/DRICH_geo.cpp index 21524c62b..110f3bf83 100644 --- a/src/DRICH_geo.cpp +++ b/src/DRICH_geo.cpp @@ -522,11 +522,18 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec // reconstruction constants (w.r.t. IP) // - access sector center after `sectorRotation` - // auto mirrorFinalPlacement = mirrorSectorPlacement * mirrorPlacement; - // auto mirrorFinalCenter = vesselPos + mirrorFinalPlacement.Translation().Vect(); - // desc.add(Constant("DRICH_mirror_center_x_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.x()))); // FIXME - // desc.add(Constant("DRICH_mirror_center_y_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.y()))); - // desc.add(Constant("DRICH_mirror_center_z_" +iMir+"_"+ secName, std::to_string(mirrorFinalCenter.z()))); + auto mirrorFinalPlacement = mirrorSectorPlacement * mirrorPlacement; + auto mirrorFinalCenter = vesselPos + mirrorFinalPlacement.Translation().Vect(); + + auto MirrCenterX = "DRICH_mirror_center_x_" + std::to_string(iMir)+"_"; + auto MirrCenterY = "DRICH_mirror_center_y_" + std::to_string(iMir)+"_"; + auto MirrCenterZ = "DRICH_mirror_center_z_" + std::to_string(iMir)+"_"; + + if(isec==0){ + desc.add(Constant(MirrCenterX+ secName, std::to_string(mirrorFinalCenter.x()))); // FIXME + desc.add(Constant(MirrCenterY+ secName, std::to_string(mirrorFinalCenter.y()))); + desc.add(Constant(MirrCenterZ+ secName, std::to_string(mirrorFinalCenter.z()))); + } if (isec == 0) desc.add(Constant("DRICH_mirror_radius_mir" + std::to_string(iMir), std::to_string(imirrorRadius[0]))); } //end of mirror loop @@ -551,9 +558,11 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec // reconstruction constants auto sensorSphFinalCenter = sectorRotation * Position(xS, 0.0, zS); - desc.add(Constant("DRICH_sensor_sph_center_x_" + secName, std::to_string(sensorSphFinalCenter.x()))); - desc.add(Constant("DRICH_sensor_sph_center_y_" + secName, std::to_string(sensorSphFinalCenter.y()))); - desc.add(Constant("DRICH_sensor_sph_center_z_" + secName, std::to_string(sensorSphFinalCenter.z()))); + if (isec == 0){ + desc.add(Constant("DRICH_sensor_sph_center_x_" + secName, std::to_string(sensorSphFinalCenter.x()))); + desc.add(Constant("DRICH_sensor_sph_center_y_" + secName, std::to_string(sensorSphFinalCenter.y()))); + desc.add(Constant("DRICH_sensor_sph_center_z_" + secName, std::to_string(sensorSphFinalCenter.z()))); + } if (isec == 0) desc.add(Constant("DRICH_sensor_sph_radius", std::to_string(sensorSphRadius))); From 8e8fed3594d83388750030fddf7fb5992a60899b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 Mar 2023 15:38:59 +0000 Subject: [PATCH 08/10] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/DRICH_geo.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DRICH_geo.cpp b/src/DRICH_geo.cpp index 110f3bf83..7bfd2ce72 100644 --- a/src/DRICH_geo.cpp +++ b/src/DRICH_geo.cpp @@ -525,9 +525,9 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec auto mirrorFinalPlacement = mirrorSectorPlacement * mirrorPlacement; auto mirrorFinalCenter = vesselPos + mirrorFinalPlacement.Translation().Vect(); - auto MirrCenterX = "DRICH_mirror_center_x_" + std::to_string(iMir)+"_"; - auto MirrCenterY = "DRICH_mirror_center_y_" + std::to_string(iMir)+"_"; - auto MirrCenterZ = "DRICH_mirror_center_z_" + std::to_string(iMir)+"_"; + auto MirrCenterX = "DRICH_mirror_center_x_" + std::to_string(iMir)+"_"; + auto MirrCenterY = "DRICH_mirror_center_y_" + std::to_string(iMir)+"_"; + auto MirrCenterZ = "DRICH_mirror_center_z_" + std::to_string(iMir)+"_"; if(isec==0){ desc.add(Constant(MirrCenterX+ secName, std::to_string(mirrorFinalCenter.x()))); // FIXME From edbcb296c1f4b46050d7eaf8a30e8d61d18e6a47 Mon Sep 17 00:00:00 2001 From: Chandradoy Chatterjee Date: Wed, 19 Apr 2023 10:29:34 +0200 Subject: [PATCH 09/10] Tuning the dual mirror --- compact/pid/drich.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/compact/pid/drich.xml b/compact/pid/drich.xml index c1cef8ae3..377158990 100644 --- a/compact/pid/drich.xml +++ b/compact/pid/drich.xml @@ -16,7 +16,7 @@ - + @@ -41,7 +41,7 @@ - `DRICH_debug_mirror`: 1 = draw full mirror shape for single sector; 0 = off - `DRICH_debug_sensors`: 1 = draw full sensor sphere for a single sector; 0 = off - + @@ -156,14 +156,14 @@ surface="MirrorSurface_DRICH" vis="DRICH_mirror_vis" rmin="DRICH_rmin1 + DRICH_wall_thickness - 1.0*cm" - rmax="DRICH_rmax2 - DRICH_wall_thickness - 3.0*cm" + rmax="DRICH_rmax2 - DRICH_wall_thickness - 2.0*cm" phiw="59.5*degree" thickness="0.2*cm" splice_mode="1" debug="DRICH_debug_mirror" > - - + + @@ -211,15 +211,15 @@ - `zmin`: z-plane cut From a8e8f7043d8e3e26a4ba3bb0cbffe4be73b00108 Mon Sep 17 00:00:00 2001 From: Chandradoy Chatterjee Date: Tue, 25 Apr 2023 10:09:54 +0200 Subject: [PATCH 10/10] tuning 2 mirrors close to ideal --- compact/pid/drich.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compact/pid/drich.xml b/compact/pid/drich.xml index 377158990..0a648a194 100644 --- a/compact/pid/drich.xml +++ b/compact/pid/drich.xml @@ -163,7 +163,7 @@ debug="DRICH_debug_mirror" > - +