diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fe8bc91ea2cfbb1fb740d274136848f861973c39..250143317f84b57f453ef448fc16f60230db0768 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,6 +58,7 @@ common:detector: - ln -s "${LOCAL_DATA_PATH}/sim_output" sim_output - ln -s "${LOCAL_DATA_PATH}/datasets/data" data - ls -lrtha + - curl -sL https://eicweb.phy.anl.gov/EIC/benchmarks/detector_benchmarks/-/jobs/artifacts/master/raw/results/emcal_barrel_calibration.json?job=collect_results:barrel_ecal --output config/emcal_barrel_calibration.json interruptible: true include: diff --git a/benchmarks/clustering/options/full_cal_reco.py b/benchmarks/clustering/options/full_cal_reco.py index 3f23faa1d75c975fb769cacc2b22e2fa784045b3..4d3f9d672b33b2f61032e052ca0aa172e3a38c9c 100644 --- a/benchmarks/clustering/options/full_cal_reco.py +++ b/benchmarks/clustering/options/full_cal_reco.py @@ -2,6 +2,7 @@ An example option file to digitize/reconstruct/clustering calorimeter hits ''' from Gaudi.Configuration import * +import json import os import ROOT @@ -12,13 +13,21 @@ detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) 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: + calib_data = json.load(f)['electron'] + +print(calib_data) + +cb_ecal_sf = float(calib_data['sampling_fraction_img']) +scifi_barrel_sf = float(calib_data['sampling_fraction_scfi']) + # get sampling fractions from system environment variable, 1.0 by default ci_ecal_sf = float(os.environ.get("CI_ECAL_SAMP_FRAC", 0.253)) -cb_ecal_sf = float(os.environ.get("CB_ECAL_SAMP_FRAC", 0.01324)) cb_hcal_sf = float(os.environ.get("CB_HCAL_SAMP_FRAC", 0.038)) 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)) -scifi_barrel_sf = float(os.environ.get("CB_EMCAL_SCFI_SAMP_FRAC",0.0938)) + # input and output input_sims = [f.strip() for f in str.split(os.environ["JUGGLER_SIM_FILE"], ",") if f.strip()] output_rec = str(os.environ["JUGGLER_REC_FILE"]) diff --git a/benchmarks/ecal/options/barrel.py b/benchmarks/ecal/options/barrel.py index 870f6bf03b2ca7944f313e43f19a2c53e680a498..a7d22cda4cf6469bf795d611b444135d7ef8e20a 100644 --- a/benchmarks/ecal/options/barrel.py +++ b/benchmarks/ecal/options/barrel.py @@ -2,6 +2,7 @@ An example script to digitize/reconstruct/clustering endcap ecal hits ''' from Gaudi.Configuration import * +import json import os import ROOT @@ -16,7 +17,12 @@ compact_path = str(os.environ.get("JUGGLER_COMPACT_PATH", "{}.xml".format(os.pat input_sims = [f.strip() for f in str.split(os.environ["JUGGLER_SIM_FILE"], ",") if f.strip()] output_rec = str(os.environ["JUGGLER_REC_FILE"]) n_events = int(os.environ["JUGGLER_N_EVENTS"]) -cb_ecal_sf = float(os.environ.get("CB_ECAL_SAMP_FRAC", 0.01324)) + +# input arguments from calibration file +with open('config/emcal_barrel_calibration.json') as f: + calib_data = json.load(f)['electron'] + +cb_ecal_sf = float(calib_data['sampling_fraction_img']) # geometry service geo_service = GeoSvc("GeoSvc", detectors=[compact_path], OutputLevel=INFO) diff --git a/benchmarks/full/options/full_reconstruction.py b/benchmarks/full/options/full_reconstruction.py index 7ff92cfd425eac4f25fdb8990de7116b427144b5..7f0c9708ac9a2f9073535a64c044112eaaf4c721 100644 --- a/benchmarks/full/options/full_reconstruction.py +++ b/benchmarks/full/options/full_reconstruction.py @@ -4,6 +4,8 @@ from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc from GaudiKernel import SystemOfUnits as units from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad +import json + detector_name = "athena" if "JUGGLER_DETECTOR" in os.environ : detector_name = str(os.environ["JUGGLER_DETECTOR"]) @@ -18,13 +20,20 @@ compact_path = os.path.join(detector_path, detector_name) qe_data = [(1.0, 0.25), (7.5, 0.25),] # CAL reconstruction -# get sampling fractions from system environment variable, 1.0 by default +# get sampling fractions from system environment variable ci_ecal_sf = float(os.environ.get("CI_ECAL_SAMP_FRAC", 0.253)) -cb_ecal_sf = float(os.environ.get("CB_ECAL_SAMP_FRAC", 0.01324)) cb_hcal_sf = float(os.environ.get("CB_HCAL_SAMP_FRAC", 0.038)) 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)) -scifi_barrel_sf = float(os.environ.get("CB_EMCAL_SCFI_SAMP_FRAC",0.0938)) + +# input arguments from calibration file +with open('config/emcal_barrel_calibration.json') as f: + calib_data = json.load(f)['electron'] + +print(calib_data) + +cb_ecal_sf = float(calib_data['sampling_fraction_img']) +scifi_barrel_sf = float(calib_data['sampling_fraction_scfi']) # input and output input_sims = [f.strip() for f in str.split(os.environ["JUGGLER_SIM_FILE"], ",") if f.strip()] diff --git a/benchmarks/imaging_ecal/options/hybrid_cluster.py b/benchmarks/imaging_ecal/options/hybrid_cluster.py index 5b2e1ead2d8aa0343ba032ec264069269392bbbb..4f91158dbe94710e81e421df3016bd6239bbf18d 100644 --- a/benchmarks/imaging_ecal/options/hybrid_cluster.py +++ b/benchmarks/imaging_ecal/options/hybrid_cluster.py @@ -1,8 +1,8 @@ +import json import os import ROOT from Gaudi.Configuration import * from GaudiKernel.SystemOfUnits import MeV, mm, cm, mrad, rad, ns - from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc from Configurables import PodioInput @@ -16,12 +16,17 @@ from Configurables import Jug__Reco__ImagingPixelReco as ImagingPixelReco from Configurables import Jug__Reco__ImagingTopoCluster as ImagingTopoCluster from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco +# input arguments from calibration file +with open('config/emcal_barrel_calibration.json') as f: + calib_data = json.load(f)['electron'] + +print(calib_data) -# input arguments through environment variables kwargs = dict() -kwargs['img_sf'] = float(os.environ.get('CB_EMCAL_IMG_SF', '0.01324')) -kwargs['scfi_sf'] = float(os.environ.get('CB_EMCAL_SCFI_SF', '0.0938')) -# raise error if not defined +kwargs['img_sf'] = float(calib_data['sampling_fraction_img']) +kwargs['scfi_sf'] = float(calib_data['sampling_fraction_scfi']) + +# input arguments through environment variables kwargs['input'] = os.environ['CB_EMCAL_SIM_FILE'] kwargs['output'] = os.environ['CB_EMCAL_REC_FILE'] kwargs['compact'] = os.environ['CB_EMCAL_COMPACT_PATH'] diff --git a/benchmarks/imaging_ecal/options/imaging_2dcluster.py b/benchmarks/imaging_ecal/options/imaging_2dcluster.py index 9baee078be3c9ce85cbe14607772950489f60e1b..45669e17d087e204af97ea9aab1d839064df23eb 100644 --- a/benchmarks/imaging_ecal/options/imaging_2dcluster.py +++ b/benchmarks/imaging_ecal/options/imaging_2dcluster.py @@ -1,3 +1,4 @@ +import json import os import ROOT from Gaudi.Configuration import * @@ -11,10 +12,14 @@ from Configurables import Jug__Reco__CalorimeterHitsEtaPhiProjector as CalHitsPr from Configurables import Jug__Reco__CalorimeterIslandCluster as IslandCluster from Configurables import Jug__Reco__ClusterRecoCoG as RecoCoG +# input arguments from calibration file +with open('config/emcal_barrel_calibration.json') as f: + calib_data = json.load(f)['electron'] -# input arguments through environment variables kwargs = dict() -kwargs['sf'] = float(os.environ.get('CB_EMCAL_SCFI, SAMP_FRAC', '0.0134')) +kwargs['sf'] = float(calib_data['sampling_fraction_scfi']) + +# input arguments through environment variables kwargs['input'] = os.environ.get('CB_EMCAL_SIM_FILE', '../topside/barrel_pion0_5GeV.root') kwargs['output'] = os.environ.get('CB_EMCAL_REC_FILE', 'barrel_pion0_5GeV_cluster.root') kwargs['compact'] = os.environ.get('CB_EMCAL_COMPACT_PATH', '../topside/test.xml') @@ -26,8 +31,6 @@ if kwargs['nev'] < 1: print(kwargs) -# get sampling fraction from system environment variable, 1.0 by default -sf = float(os.environ.get('CB_EMCAL_SAMP_FRAC', '1.0')) geo_service = GeoSvc('GeoSvc', detectors=kwargs['compact'].split(','), OutputLevel=INFO) podioevent = EICDataSvc('EventDataSvc', inputs=kwargs['input'].split(','), OutputLevel=DEBUG) diff --git a/benchmarks/imaging_ecal/options/imaging_topocluster.py b/benchmarks/imaging_ecal/options/imaging_topocluster.py index 9c715fcc10f9dffd3f44ed7b57415866f394556e..94901baa93f49326f8f9ccd3028955f5b408b784 100644 --- a/benchmarks/imaging_ecal/options/imaging_topocluster.py +++ b/benchmarks/imaging_ecal/options/imaging_topocluster.py @@ -1,3 +1,4 @@ +import json import os import ROOT from Gaudi.Configuration import * @@ -14,9 +15,14 @@ from Configurables import Jug__Reco__ImagingTopoCluster as ImagingTopoCluster from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco -# input arguments through environment variables +# input arguments from calibration file +with open('config/emcal_barrel_calibration.json') as f: + calib_data = json.load(f)['electron'] + kwargs = dict() -kwargs['sf'] = float(os.environ.get('CB_EMCAL_SAMP_FRAC', '1.0')) +kwargs['sf'] = float(calib_data['sampling_fraction_img']) + +# input arguments through environment variables kwargs['input'] = os.environ.get('CB_EMCAL_SIM_FILE', '../topside/barrel_pion0_5GeV.root') kwargs['output'] = os.environ.get('CB_EMCAL_REC_FILE', 'barrel_pion0_5GeV_cluster.root') kwargs['compact'] = os.environ.get('CB_EMCAL_COMPACT_PATH', '../topside/test.xml') @@ -28,8 +34,6 @@ if kwargs['nev'] < 1: print(kwargs) -# get sampling fraction from system environment variable, 1.0 by default -sf = float(os.environ.get('CB_EMCAL_SAMP_FRAC', '1.0')) geo_service = GeoSvc("GeoSvc", detectors=kwargs['compact'].split(','), OutputLevel=INFO) podioevent = EICDataSvc("EventDataSvc", inputs=kwargs['input'].split(','), OutputLevel=DEBUG) out = PodioOutput("out", filename=kwargs['output']) diff --git a/benchmarks/imaging_ecal/options/scfi_cluster.py b/benchmarks/imaging_ecal/options/scfi_cluster.py index 3926326be757d46cfbfa85fd5e12ce41ddfc7a78..1c0def2be533f886001acc64119897b14c35d2e9 100644 --- a/benchmarks/imaging_ecal/options/scfi_cluster.py +++ b/benchmarks/imaging_ecal/options/scfi_cluster.py @@ -1,3 +1,4 @@ +import json import os import ROOT from Gaudi.Configuration import * @@ -11,10 +12,14 @@ from Configurables import Jug__Reco__CalorimeterHitsMerger as CalHitsMerger from Configurables import Jug__Reco__CalorimeterIslandCluster as IslandCluster from Configurables import Jug__Reco__ClusterRecoCoG as RecoCoG +# input arguments from calibration file +with open('config/emcal_barrel_calibration.json') as f: + calib_data = json.load(f)['electron'] -# input arguments through environment variables kwargs = dict() -kwargs['sf'] = float(os.environ.get('CB_EMCAL_SCFI, SAMP_FRAC', '0.0938')) +kwargs['sf'] = float(calib_data['sampling_fraction_scfi']) + +# input arguments through environment variables kwargs['input'] = os.environ.get('CB_EMCAL_SIM_FILE', '../topside/barrel_pion0_5GeV.root') kwargs['output'] = os.environ.get('CB_EMCAL_REC_FILE', 'barrel_pion0_5GeV_cluster.root') kwargs['compact'] = os.environ.get('CB_EMCAL_COMPACT_PATH', '../topside/test.xml')