From 0a5c70b95b6951818e8a34c38bc2e9ce67372e0d Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Mon, 11 Apr 2022 01:22:23 +0000
Subject: [PATCH] Remove bin/get_calibrations

---
 .gitlab-ci.yml                                 |  1 -
 benchmarks/clustering/options/full_cal_reco.py |  2 +-
 benchmarks/ecal/options/barrel.py              |  2 +-
 .../imaging_ecal/options/hybrid_cluster.py     |  4 +++-
 .../imaging_ecal/options/imaging_2dcluster.py  |  4 +++-
 .../options/imaging_topocluster.py             |  3 ++-
 .../imaging_ecal/options/scfi_cluster.py       |  4 +++-
 bin/get_calibrations                           | 18 ------------------
 8 files changed, 13 insertions(+), 25 deletions(-)
 delete mode 100755 bin/get_calibrations

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 956e7ddf..5c314382 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -69,7 +69,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/benchmarks/clustering/options/full_cal_reco.py b/benchmarks/clustering/options/full_cal_reco.py
index 1f783453..fcf9ed62 100644
--- a/benchmarks/clustering/options/full_cal_reco.py
+++ b/benchmarks/clustering/options/full_cal_reco.py
@@ -14,7 +14,7 @@ detector_path = str(os.environ.get("DETECTOR_PATH", "."))
 compact_path = os.path.join(detector_path, detector_name)
 
 # 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)
diff --git a/benchmarks/ecal/options/barrel.py b/benchmarks/ecal/options/barrel.py
index 88fcea48..f4bfd902 100644
--- a/benchmarks/ecal/options/barrel.py
+++ b/benchmarks/ecal/options/barrel.py
@@ -19,7 +19,7 @@ output_rec = str(os.environ["JUGGLER_REC_FILE"])
 n_events = int(os.environ["JUGGLER_N_EVENTS"])
 
 # 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']
 
 cb_ecal_sf = float(calib_data['sampling_fraction_img'])
diff --git a/benchmarks/imaging_ecal/options/hybrid_cluster.py b/benchmarks/imaging_ecal/options/hybrid_cluster.py
index 1e6405c8..1d62058e 100644
--- a/benchmarks/imaging_ecal/options/hybrid_cluster.py
+++ b/benchmarks/imaging_ecal/options/hybrid_cluster.py
@@ -15,8 +15,10 @@ from Configurables import Jug__Reco__ImagingPixelReco as ImagingPixelReco
 from Configurables import Jug__Reco__ImagingTopoCluster as ImagingTopoCluster
 from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco
 
+detector_path = str(os.environ.get("DETECTOR_PATH", "."))
+
 # 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)
diff --git a/benchmarks/imaging_ecal/options/imaging_2dcluster.py b/benchmarks/imaging_ecal/options/imaging_2dcluster.py
index 70b66255..d7dd39bb 100644
--- a/benchmarks/imaging_ecal/options/imaging_2dcluster.py
+++ b/benchmarks/imaging_ecal/options/imaging_2dcluster.py
@@ -12,8 +12,10 @@ from Configurables import Jug__Reco__CalorimeterHitsEtaPhiProjector as CalHitsPr
 from Configurables import Jug__Reco__CalorimeterIslandCluster as IslandCluster
 from Configurables import Jug__Reco__ClusterRecoCoG as RecoCoG
 
+detector_path = str(os.environ.get("DETECTOR_PATH", "."))
+
 # 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']
 
 kwargs = dict()
diff --git a/benchmarks/imaging_ecal/options/imaging_topocluster.py b/benchmarks/imaging_ecal/options/imaging_topocluster.py
index 414e65d2..9117d9b3 100644
--- a/benchmarks/imaging_ecal/options/imaging_topocluster.py
+++ b/benchmarks/imaging_ecal/options/imaging_topocluster.py
@@ -12,9 +12,10 @@ from Configurables import Jug__Reco__ImagingPixelReco as ImagingPixelReco
 from Configurables import Jug__Reco__ImagingTopoCluster as ImagingTopoCluster
 from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco
 
+detector_path = str(os.environ.get("DETECTOR_PATH", "."))
 
 # 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']
 
 kwargs = dict()
diff --git a/benchmarks/imaging_ecal/options/scfi_cluster.py b/benchmarks/imaging_ecal/options/scfi_cluster.py
index b7f52ac8..f356da04 100644
--- a/benchmarks/imaging_ecal/options/scfi_cluster.py
+++ b/benchmarks/imaging_ecal/options/scfi_cluster.py
@@ -12,8 +12,10 @@ from Configurables import Jug__Reco__CalorimeterHitsMerger as CalHitsMerger
 from Configurables import Jug__Reco__CalorimeterIslandCluster as IslandCluster
 from Configurables import Jug__Reco__ClusterRecoCoG as RecoCoG
 
+detector_path = str(os.environ.get("DETECTOR_PATH", "."))
+
 # 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']
 
 kwargs = dict()
diff --git a/bin/get_calibrations b/bin/get_calibrations
deleted file mode 100755
index e23d6194..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
-- 
GitLab