From 0d4fb4ee4de5663338448c0c40d8ad26a9fa47a7 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Mon, 11 Apr 2022 01:08:45 +0000
Subject: [PATCH] Resolve "Remove get_calibrations script and use dd4hep file
 loader"

---
 .gitlab-ci.yml            |  2 +-
 bin/get_calibrations      | 18 ------------------
 options/reconstruction.py |  6 ++----
 3 files changed, 3 insertions(+), 23 deletions(-)
 delete mode 100755 bin/get_calibrations

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a4121a14..7cdd83db 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -47,6 +47,7 @@ common:detector:
   script:
     - source .local/bin/env.sh && build_detector.sh
     - mkdir_local_data_link sim_output
+    - mkdir_local_data_link datasets
     - mkdir -p results
     - mkdir -p config
     - print_env.sh
@@ -66,7 +67,6 @@ common:detector:
     - ln -s "${LOCAL_DATA_PATH}/sim_output" sim_output
     - ln -s "${LOCAL_DATA_PATH}/datasets/data" data
     - ls -lrtha
-    - bash bin/get_calibrations
   retry:
     max: 2
     when:
diff --git a/bin/get_calibrations b/bin/get_calibrations
deleted file mode 100755
index 2b24dd0b..00000000
--- a/bin/get_calibrations
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-branch=${1:-master}
-detector_benchmarks=https://eicweb.phy.anl.gov/EIC/benchmarks/detector_benchmarks/-/jobs/artifacts/${branch}/raw/
-
-mkdir -p config
-for i in results/emcal_barrel_calibration.json results/material-maps.json ; do
-  curl --fail -sL ${detector_benchmarks}/${i}?job=deploy_results --output config/$(basename ${i})
-  if [[ "$?" -ne "0" ]] ; then
-      if find ${DETECTOR_PATH} -name $(basename $i) ; then
-      echo "Warning: falling back to DETECTOR_PATH for calibration ${i}."
-      cp $(find ${DETECTOR_PATH} -name $(basename $i)) config/$(basename ${i})
-    else
-      echo "Error: could not retrieve calibrations!"
-      exit 1
-    fi
-  fi
-done
diff --git a/options/reconstruction.py b/options/reconstruction.py
index e8482f1a..270a3719 100644
--- a/options/reconstruction.py
+++ b/options/reconstruction.py
@@ -63,14 +63,14 @@ ci_hcal_sf = float(os.environ.get("CI_HCAL_SAMP_FRAC", 0.025))
 ce_hcal_sf = float(os.environ.get("CE_HCAL_SAMP_FRAC", 0.025))
 
 # input arguments from calibration file
-with open('config/emcal_barrel_calibration.json') as f:
+with open(f'{detector_path}/calibrations/emcal_barrel_calibration.json') as f:
     calib_data = json.load(f)['electron']
 
 print(calib_data)
 
 # input calorimeter DAQ info
 calo_daq = {}
-with open('{}/calibrations/calo_digi_{}.json'.format(detector_path, detector_version)) as f:
+with open(f'{detector_path}/calibrations/calo_digi_{detector_version}.json') as f:
     calo_config = json.load(f)
     ## add proper ADC capacity based on bit depth
     for sys in calo_config:
@@ -96,8 +96,6 @@ services = []
 # auditor service
 services.append(AuditorSvc("AuditorSvc", Auditors=['ChronoAuditor', 'MemStatAuditor']))
 # geometry service
-## only have material maps for acadia right now
-
 ## note: old version of material map is called material-maps.XXX, new version is materials-map.XXX
 ##       these names are somewhat inconsistent, and should probably all be renamed to 'material-map.XXX'
 ##       FIXME
-- 
GitLab