From f81c06839fc1dfc32bd9bd7de5238f94300729ad Mon Sep 17 00:00:00 2001
From: Christopher Dilks <dilks@jlab.org>
Date: Fri, 11 Feb 2022 03:34:43 +0000
Subject: [PATCH] Resolve "change eRICH to pfRICH"

---
 .gitlab-ci.yml                          |   2 +-
 CMakeLists.txt                          |   2 +-
 compact/display.xml                     |   2 +-
 compact/display_detailed.xml            |   2 +-
 compact/display_geoviewer.xml           |   2 +-
 compact/optical_materials.xml           |  16 ++--
 compact/{erich.xml => pfrich.xml}       | 104 ++++++++++++------------
 compact/pid_config_canyonlands.xml      |   2 +-
 compact/pid_config_deathvalley.xml      |   2 +-
 compact/subsystem_views/pfrich_only.xml |   4 +-
 compact/subsystem_views/tof_only.xml    |   2 +-
 src/{PfRICH_geo.cpp => PFRICH_geo.cpp}  |  11 ++-
 12 files changed, 75 insertions(+), 76 deletions(-)
 rename compact/{erich.xml => pfrich.xml} (58%)
 rename src/{PfRICH_geo.cpp => PFRICH_geo.cpp} (97%)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d92a00ba..0115879d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -125,7 +125,7 @@ dump_geometry:
         dd_web_display --output geo/${geo_name} ${DETECTOR_PATH}/geo.xml
       done
     ## Lower-resolution display of the pfRICH sensors for global views
-    - sed -i 's/_default"\/>/_lores"\/>/' ${DETECTOR_PATH}/compact/erich.xml
+    - sed -i 's/_default"\/>/_lores"\/>/' ${DETECTOR_PATH}/compact/pfrich.xml
     ## full geo with downstream beamline
     - dd_web_display --output geo/detector_geo_full.root ${DETECTOR_PATH}/athena.xml
     ## only central detector geo
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fd6a239f..4bb91368 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,7 +30,7 @@ dd4hep_add_plugin(${a_lib_name} SOURCES
   src/CylinderTrackerBarrel_geo.cpp
   src/DIRC_geo.cpp
   src/DRICH_geo.cpp
-  src/PfRICH_geo.cpp
+  src/PFRICH_geo.cpp
   src/FileLoader.cpp
   src/FieldMapBrBz.cpp
   src/GaseousRICH_geo.cpp
diff --git a/compact/display.xml b/compact/display.xml
index ff97364d..55e19d52 100644
--- a/compact/display.xml
+++ b/compact/display.xml
@@ -137,7 +137,7 @@
     <vis name="DRICH_filter_vis"  alpha="1.0" r="1.0" g="1.0" b="0.0" showDaughters="true" visible="true" />
     <vis name="DRICH_mirror_vis"  ref="AnlGray" showDaughters="true" visible="true" />
     <vis name="DRICH_sensor_vis"  ref="AnlBlue" showDaughters="true" visible="true" />
-    <vis name="ERICH_sensor_vis"  ref="AnlBlue" showDaughters="true" visible="true" />
+    <vis name="PFRICH_sensor_vis" ref="AnlBlue" showDaughters="true" visible="true" />
 
     <vis name="MRICH_aerogel_vis" ref="AnlTeal" showDaughters="true" visible="true" />
     <vis name="MRICH_frame_vis" ref="AnlGold" showDaughters="true" visible="true" />
diff --git a/compact/display_detailed.xml b/compact/display_detailed.xml
index 2bebee61..9a2ba137 100644
--- a/compact/display_detailed.xml
+++ b/compact/display_detailed.xml
@@ -134,7 +134,7 @@
     <vis name="DRICH_filter_vis"  alpha="1.0" r="1.0" g="1.0" b="0.0" showDaughters="true" visible="true" />
     <vis name="DRICH_mirror_vis"  ref="AnlGray" showDaughters="true" visible="true" />
     <vis name="DRICH_sensor_vis"  ref="AnlGreen" showDaughters="true" visible="true" />
-    <vis name="ERICH_sensor_vis"  ref="AnlGreen" showDaughters="true" visible="true" /> 
+    <vis name="PFRICH_sensor_vis" ref="AnlGreen" showDaughters="true" visible="true" /> 
 
     <vis name="MRICH_aerogel_vis" ref="AnlTeal" showDaughters="true" visible="true" />
     <vis name="MRICH_frame_vis" ref="AnlGold" showDaughters="true" visible="true" />
diff --git a/compact/display_geoviewer.xml b/compact/display_geoviewer.xml
index 3998698d..3ea9a820 100644
--- a/compact/display_geoviewer.xml
+++ b/compact/display_geoviewer.xml
@@ -133,7 +133,7 @@
     <vis name="DRICH_filter_vis"  alpha="1.0" r="1.0" g="1.0" b="0.0" showDaughters="true" visible="true" />
     <vis name="DRICH_mirror_vis"  ref="AnlGray" showDaughters="true" visible="true" />
     <vis name="DRICH_sensor_vis"  ref="AnlGreen" showDaughters="true" visible="true" />
-    <vis name="ERICH_sensor_vis"  ref="AnlGreen" showDaughters="true" visible="true" /> <!-- invisible, to speedup graphics -->
+    <vis name="PFRICH_sensor_vis" ref="AnlGreen" showDaughters="true" visible="true" /> <!-- invisible, to speedup graphics -->
 
     <vis name="MRICH_aerogel_vis" ref="AnlTeal" showDaughters="true" visible="true" />
     <vis name="MRICH_frame_vis" ref="AnlGold" showDaughters="true" visible="true" />
diff --git a/compact/optical_materials.xml b/compact/optical_materials.xml
index 552ba5c4..0f7be147 100644
--- a/compact/optical_materials.xml
+++ b/compact/optical_materials.xml
@@ -373,7 +373,7 @@
       1240*eV/210  10*mm
       1240*eV/200  0*mm
       "/>
-    <!-- BEGIN dRICh and eRICh material properties
+    <!-- BEGIN dRICh and pfRICh material properties
          - dumped from fun4all implementation
          - see https://github.com/cisbani/dRICh/blob/main/share/source/g4dRIChOptics.hh
          -->
@@ -402,8 +402,8 @@
       4.85156*eV  10.0*m
       6.19921*eV  10.0*m
       "/>
-    <!-- eRICh gas -->
-    <matrix name="RINDEX__C4F10_ERICH" coldim="2" values="
+    <!-- pfRICh gas -->
+    <matrix name="RINDEX__C4F10_PFRICH" coldim="2" values="
       1.7712*eV   1.0013
       1.92389*eV  1.0013
       2.10539*eV  1.00131
@@ -415,7 +415,7 @@
       4.85156*eV  1.0014
       6.19921*eV  1.00149
       "/>
-    <matrix name="ABSLENGTH__C4F10_ERICH" coldim="2" values="
+    <matrix name="ABSLENGTH__C4F10_PFRICH" coldim="2" values="
       1.7712*eV   6.0*m
       1.92389*eV  6.0*m
       2.10539*eV  6.0*m
@@ -894,7 +894,7 @@
       <property name="RINDEX" ref="RINDEX__Acrylic"/>
       <property name="ABSLENGTH" ref="ABSLENGTH__Acrylic"/>
     </material>
-    <!-- BEGIN dRICh and eRICh material definitions -->
+    <!-- BEGIN dRICh and pfRICh material definitions -->
     <material name="C2F6_DRICH">
       <D type="density" value="0.005734" unit="g/cm3"/>
       <composite n="2" ref="C"/>
@@ -902,12 +902,12 @@
       <property name="RINDEX"    ref="RINDEX__C2F6_DRICH"/>
       <property name="ABSLENGTH" ref="ABSLENGTH__C2F6_DRICH"/>
     </material>
-    <material name="C4F10_ERICH">
+    <material name="C4F10_PFRICH">
       <D type="density" value="0.009935" unit="g/cm3"/>
       <composite n="4" ref="C"/>
       <composite n="10" ref="F"/>
-      <property name="RINDEX"    ref="RINDEX__C4F10_ERICH"/>
-      <property name="ABSLENGTH" ref="ABSLENGTH__C4F10_ERICH"/>
+      <property name="RINDEX"    ref="RINDEX__C4F10_PFRICH"/>
+      <property name="ABSLENGTH" ref="ABSLENGTH__C4F10_PFRICH"/>
     </material>
     <material name="Aerogel_DRICH_OLD">
       <D type="density" value="0.100" unit="g/cm3"/>
diff --git a/compact/erich.xml b/compact/pfrich.xml
similarity index 58%
rename from compact/erich.xml
rename to compact/pfrich.xml
index 6c57d1b4..2dbf6213 100644
--- a/compact/erich.xml
+++ b/compact/pfrich.xml
@@ -3,36 +3,36 @@
 
 <define>
 <!-- vessel geometry -->
-<constant name="ERICH_Length"             value="BackwardRICHRegion_length"/>  <!-- vessel z-length -->
-<constant name="ERICH_zmin"               value="-BackwardRICHRegion_zmin"/> <!-- vessel front -->
-<constant name="ERICH_zmax"               value="ERICH_zmin - ERICH_Length"/>  <!-- vessel back -->
-<constant name="ERICH_rmin0"              value="BackwardPIDRegion_tan * BackwardRICHRegion_zmin"/>  <!-- bore radius at vessel frontplane -->
-<constant name="ERICH_rmin1"              value="BackwardPIDRegion_tan * (BackwardRICHRegion_zmin + BackwardRICHRegion_length)"/>  <!-- bore radius at vessel backplane -->
-<constant name="ERICH_rmax"               value="BackwardPIDRegion_rmax - 2*cm"/>  <!-- vessel backplane radius -->
-<constant name="ERICH_wall_thickness"     value="0.5*cm"/>  <!-- thickness of radial walls -->
-<constant name="ERICH_window_thickness"   value="0.1*cm"/>  <!-- thickness of entrance and exit walls -->
+<constant name="PFRICH_Length"             value="BackwardRICHRegion_length"/>  <!-- vessel z-length -->
+<constant name="PFRICH_zmin"               value="-BackwardRICHRegion_zmin"/> <!-- vessel front -->
+<constant name="PFRICH_zmax"               value="PFRICH_zmin - PFRICH_Length"/>  <!-- vessel back -->
+<constant name="PFRICH_rmin0"              value="BackwardPIDRegion_tan * BackwardRICHRegion_zmin"/>  <!-- bore radius at vessel frontplane -->
+<constant name="PFRICH_rmin1"              value="BackwardPIDRegion_tan * (BackwardRICHRegion_zmin + BackwardRICHRegion_length)"/>  <!-- bore radius at vessel backplane -->
+<constant name="PFRICH_rmax"               value="BackwardPIDRegion_rmax - 2*cm"/>  <!-- vessel backplane radius -->
+<constant name="PFRICH_wall_thickness"     value="0.5*cm"/>  <!-- thickness of radial walls -->
+<constant name="PFRICH_window_thickness"   value="0.1*cm"/>  <!-- thickness of entrance and exit walls -->
 <!-- additional parameters -->
-<constant name="ERICH_aerogel_thickness"  value="3.0*cm"/>  <!-- aerogel thickness -->
-<constant name="ERICH_sensor_active_size_default" value="24.0*mm"/> <!-- sensor side length (effective area) -->
-<constant name="ERICH_sensor_full_size_default"   value="25.8*mm"/> <!-- sensor side length (full size, with enclosure) -->
+<constant name="PFRICH_aerogel_thickness"  value="3.0*cm"/>  <!-- aerogel thickness -->
+<constant name="PFRICH_sensor_active_size_default" value="24.0*mm"/> <!-- sensor side length (effective area) -->
+<constant name="PFRICH_sensor_full_size_default"   value="25.8*mm"/> <!-- sensor side length (full size, with enclosure) -->
 <!-- lores values are used for global vizualizations _only_ -->
-<constant name="ERICH_sensor_active_size_lores" value="ERICH_sensor_active_size_default * 4"/>
-<constant name="ERICH_sensor_full_size_lores" value="ERICH_sensor_full_size_default * 4"/>
+<constant name="PFRICH_sensor_active_size_lores" value="PFRICH_sensor_active_size_default * 4"/>
+<constant name="PFRICH_sensor_full_size_lores"   value="PFRICH_sensor_full_size_default * 4"/>
 <!-- actual values used by the parametrization -->
-<constant name="ERICH_sensor_active_size" value="ERICH_sensor_active_size_default"/>
-<constant name="ERICH_sensor_full_size" value="ERICH_sensor_full_size_default"/>
+<constant name="PFRICH_sensor_active_size" value="PFRICH_sensor_active_size_default"/>
+<constant name="PFRICH_sensor_full_size"   value="PFRICH_sensor_full_size_default"/>
 
 
-<constant name="ERICH_sensor_thickness"   value="1.5*mm"/> <!-- sensor thickness -->
-<constant name="ERICH_sensor_dist"        value="40*cm"/> <!-- distance between aerogel exit plane and sensor entrance plane -->
-<constant name="ERICH_num_px"             value="8"/> <!-- number of pixels along one side of the sensor -->
+<constant name="PFRICH_sensor_thickness"   value="1.5*mm"/> <!-- sensor thickness -->
+<constant name="PFRICH_sensor_dist"        value="40*cm"/> <!-- distance between aerogel exit plane and sensor entrance plane -->
+<constant name="PFRICH_num_px"             value="8"/> <!-- number of pixels along one side of the sensor -->
 <!-- debugging switches -->
 <comment>
-- `ERICH_debug_optics`:  1 = all components become vacuum; test opticalphotons from IP
+- `PFRICH_debug_optics`:  1 = all components become vacuum; test opticalphotons from IP
                          2 = all components become vacuum, except for `gasvol`, test charged particles from IP
                          0 = off
 </comment>
-<constant name="ERICH_debug_optics"  value="0"/>
+<constant name="PFRICH_debug_optics"  value="0"/>
 </define>
 
 
@@ -41,18 +41,18 @@
 
 <!-- /detectors/detector -->
 <documentation level="10">
-### eRICH: Electron Endcap RICH (name TBD)
+### pfRICH: Proximity Focusing RICH
 </documentation>
 <detector
   id="BackwardRICH_ID"
-  name="ERICH"
-  type="athena_ERICH"
-  readout="ERICHHits"
-  gas="C4F10_ERICH"
+  name="PFRICH"
+  type="athena_PFRICH"
+  readout="PFRICHHits"
+  gas="C4F10_PFRICH"
   material="Aluminum"
   vis_vessel="DRICH_vessel_vis"
   vis_gas="DRICH_gas_vis"
-  debug_optics="ERICH_debug_optics"
+  debug_optics="PFRICH_debug_optics"
   >
 
 
@@ -68,15 +68,15 @@
   - `window_thickness`: thickness of entrance and exit disks
 </documentation>
 <dimensions
-  zmin="ERICH_zmin"
-  zmax="ERICH_zmax"
-  length="ERICH_Length"
-  rmin0="ERICH_rmin0"
-  rmin1="ERICH_rmin1"
-  rmax0="ERICH_rmax"
-  rmax1="ERICH_rmax"
-  wall_thickness="ERICH_wall_thickness"
-  window_thickness="ERICH_window_thickness"
+  zmin="PFRICH_zmin"
+  zmax="PFRICH_zmax"
+  length="PFRICH_Length"
+  rmin0="PFRICH_rmin0"
+  rmin1="PFRICH_rmin1"
+  rmax0="PFRICH_rmax"
+  rmax1="PFRICH_rmax"
+  wall_thickness="PFRICH_wall_thickness"
+  window_thickness="PFRICH_window_thickness"
   />
 
 
@@ -94,16 +94,16 @@
   - `pitch`: controls the angle of the radiator (0=vertical)
 </documentation>
 <radiator
-  frontplane="-ERICH_window_thickness"
-  rmin="ERICH_rmin0 + ERICH_wall_thickness + 0.2*cm"
-  rmax="(ERICH_rmax/ERICH_zmax)*ERICH_zmin + 8.0*cm"
+  frontplane="-PFRICH_window_thickness"
+  rmin="PFRICH_rmin0 + PFRICH_wall_thickness + 0.2*cm"
+  rmax="(PFRICH_rmax/PFRICH_zmax)*PFRICH_zmin + 8.0*cm"
   phiw="60*degree"
   pitch="0*degree"
   >
   <aerogel
     material="Aerogel_DRICH"
     vis="DRICH_aerogel_vis"
-    thickness="ERICH_aerogel_thickness"
+    thickness="PFRICH_aerogel_thickness"
     />
   <filter
     material="Acrylic_DRICH"
@@ -139,10 +139,10 @@
 <module
   material="Silicon"
   surface="SensorSurface_DRICH"
-  vis="ERICH_sensor_vis"
-  side="ERICH_sensor_active_size"
-  thickness="ERICH_sensor_thickness"
-  gap="0.5*(ERICH_sensor_full_size-ERICH_sensor_active_size) + 0.5*mm"
+  vis="PFRICH_sensor_vis"
+  side="PFRICH_sensor_active_size"
+  thickness="PFRICH_sensor_thickness"
+  gap="0.5*(PFRICH_sensor_full_size-PFRICH_sensor_active_size) + 0.5*mm"
   />
 
 
@@ -156,9 +156,9 @@
     - `rmax`: maximum radial position of a sensor's centroid
 </documentation>
 <plane
-  sensordist="ERICH_sensor_dist"
-  rmin="ERICH_rmin1 + 2*cm"
-  rmax="ERICH_rmax  - 4*cm"
+  sensordist="PFRICH_sensor_dist"
+  rmin="PFRICH_rmin1 + 2*cm"
+  rmax="PFRICH_rmax  - 4*cm"
   />
 
 <services>
@@ -187,20 +187,20 @@
 
   | indicator | offset | length |
   |-----------|--------|--------|
-  | eRICH ID  | 0      | 8      |
+  | pfRICH ID | 0      | 8      |
   | sensor    | 8      | 12     |
   | x pixel   | 20     | 16     |
   | y pixel   | 36     | 16     |
 
 </documentation>
 <readouts>
-  <readout name="ERICHHits">
+  <readout name="PFRICHHits">
     <segmentation
       type="CartesianGridXY"
-      grid_size_x="ERICH_sensor_active_size/(ERICH_num_px-1)"
-      grid_size_y="ERICH_sensor_active_size/(ERICH_num_px-1)"
-      offset_x="-ERICH_sensor_active_size/2.0"
-      offset_y="-ERICH_sensor_active_size/2.0"
+      grid_size_x="PFRICH_sensor_active_size/(PFRICH_num_px-1)"
+      grid_size_y="PFRICH_sensor_active_size/(PFRICH_num_px-1)"
+      offset_x="-PFRICH_sensor_active_size/2.0"
+      offset_y="-PFRICH_sensor_active_size/2.0"
       />
     <id>system:8,module:12,x:20:16,y:16</id>
   </readout>
diff --git a/compact/pid_config_canyonlands.xml b/compact/pid_config_canyonlands.xml
index 75b30477..361fdfd7 100644
--- a/compact/pid_config_canyonlands.xml
+++ b/compact/pid_config_canyonlands.xml
@@ -3,6 +3,6 @@
 <include ref="fake_dirc.xml"/>
 <!--include ref="dirc.xml"/-->
 <include ref="drich.xml"/>
-<include ref="erich.xml"/>
+<include ref="pfrich.xml"/>
 
 </lccdd>
diff --git a/compact/pid_config_deathvalley.xml b/compact/pid_config_deathvalley.xml
index c0427fdd..9a3f18f8 100644
--- a/compact/pid_config_deathvalley.xml
+++ b/compact/pid_config_deathvalley.xml
@@ -3,7 +3,7 @@
 <include ref="fake_dirc.xml"/>
 <!--include ref="dirc.xml"/-->
 <include ref="drich.xml"/>
-<include ref="erich.xml"/>
+<include ref="pfrich.xml"/>
 
 <!--include ref="tof_endcap.xml"/-->
 <include ref="tof_barrel.xml"/>
diff --git a/compact/subsystem_views/pfrich_only.xml b/compact/subsystem_views/pfrich_only.xml
index 11971d74..3fd28f92 100644
--- a/compact/subsystem_views/pfrich_only.xml
+++ b/compact/subsystem_views/pfrich_only.xml
@@ -63,9 +63,9 @@
   </display>
 
   <documentation level="10">
-    ## eRICH only
+    ## pfRICH only
   </documentation>
   <include ref="ip6/beampipe.xml" />
-  <include ref="compact/erich.xml" />
+  <include ref="compact/pfrich.xml" />
 
 </lccdd>
diff --git a/compact/subsystem_views/tof_only.xml b/compact/subsystem_views/tof_only.xml
index 8bd4fdea..4392434c 100644
--- a/compact/subsystem_views/tof_only.xml
+++ b/compact/subsystem_views/tof_only.xml
@@ -63,7 +63,7 @@
   </display>
 
   <documentation level="10">
-    ## eRICH only
+    ## TOF only
   </documentation>
   <include ref="ip6/beampipe.xml" />
   <include ref="compact/tof_barrel.xml" />
diff --git a/src/PfRICH_geo.cpp b/src/PFRICH_geo.cpp
similarity index 97%
rename from src/PfRICH_geo.cpp
rename to src/PFRICH_geo.cpp
index 0878cc04..a6f71956 100644
--- a/src/PfRICH_geo.cpp
+++ b/src/PFRICH_geo.cpp
@@ -1,5 +1,5 @@
 //----------------------------------
-//  eRICH: Electron endcap RICH
+//  pfRICH: Proximity Focusing RICH
 //  Author: C. Dilks
 //----------------------------------
 
@@ -79,7 +79,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
   // if debugging optics, override some settings
   bool debug_optics = debug_optics_mode > 0;
   if (debug_optics) {
-    printout(WARNING, "ERich_geo", "DEBUGGING ERICH OPTICS");
+    printout(WARNING, "PFRICH_geo", "DEBUGGING PFRICH OPTICS");
     switch (debug_optics_mode) {
     case 1:
       vesselMat = aerogelMat = filterMat = sensorMat = gasvolMat = desc.material("VacuumOptical");
@@ -88,7 +88,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
       vesselMat = aerogelMat = filterMat = sensorMat = desc.material("VacuumOptical");
       break;
     default:
-      printout(FATAL, "ERich_geo", "UNKNOWN debug_optics_mode");
+      printout(FATAL, "PFRICH_geo", "UNKNOWN debug_optics_mode");
       return det;
     };
     aerogelVis = sensorVis;
@@ -96,7 +96,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
   };
 
   // BUILD VESSEL //////////////////////////////////////
-  /* - `vessel`: aluminum enclosure, the mother volume of the eRICh
+  /* - `vessel`: aluminum enclosure, the mother volume of the pfRICH
    * - `gasvol`: gas volume, which fills `vessel`; all other volumes defined below
    *   are children of `gasvol`
    */
@@ -313,5 +313,4 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
 };
 
 // clang-format off
-DECLARE_DETELEMENT(athena_PfRICH, createDetector)
-DECLARE_DETELEMENT(athena_ERICH, createDetector)
+DECLARE_DETELEMENT(athena_PFRICH, createDetector)
-- 
GitLab