From efa0b7e6994297309233fc01cc12f3ae3461b2df Mon Sep 17 00:00:00 2001
From: Chao Peng <cpeng@anl.gov>
Date: Sun, 8 Sep 2024 17:13:36 -0500
Subject: [PATCH] fix a bug in setting the event numbers in ml_imaging_data.py

---
 benchmarks/imaging_shower_ML/options/imaging_ml_data.py | 5 +++--
 benchmarks/imaging_shower_ML/scripts/ml_imaging_data.py | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/benchmarks/imaging_shower_ML/options/imaging_ml_data.py b/benchmarks/imaging_shower_ML/options/imaging_ml_data.py
index 15a9d5b7..2e7fd7e4 100644
--- a/benchmarks/imaging_shower_ML/options/imaging_ml_data.py
+++ b/benchmarks/imaging_shower_ML/options/imaging_ml_data.py
@@ -27,6 +27,7 @@ if kwargs['nev'] < 1:
 print(kwargs)
 # get sampling fraction from system environment variable, 1.0 by default
 sf = float(os.environ.get('JUGGLER_SAMP_FRAC', '1.0'))
+print(kwargs['compact'])
 
 geo_service  = GeoSvc('GeoSvc', detectors=[f.strip() for f in kwargs['compact'].split(',')])
 podev = EICDataSvc('EventDataSvc', inputs=[f.strip() for f in kwargs['input'].split(',')])
@@ -103,8 +104,8 @@ becal_scfi_reco = CalHitReco('becal_scfi_reco',
         thresholdFactor=5.0,
         readoutClass='EcalBarrelScFiHits',
         layerField='layer',
-        sectorField='module',
-        localDetFields=['system', 'module'], # use local coordinates in each module (stave)
+        sectorField='sector',
+        localDetFields=['system', 'sector'], # use local coordinates in each module (stave)
         **becal_scfi_daq)
 
 # merge hits in different layer (projection to local x-y plane)
diff --git a/benchmarks/imaging_shower_ML/scripts/ml_imaging_data.py b/benchmarks/imaging_shower_ML/scripts/ml_imaging_data.py
index 61eee623..72c484ab 100644
--- a/benchmarks/imaging_shower_ML/scripts/ml_imaging_data.py
+++ b/benchmarks/imaging_shower_ML/scripts/ml_imaging_data.py
@@ -204,9 +204,9 @@ if __name__ == '__main__':
                 'momentum.x', 'momentum.y', 'momentum.z',
                 'mass'
                 ])
+        dfm.loc[:, 'event'] = mevs
         # select incident particles
         dfm = dfm[dfm['generatorStatus'].isin([0, 1])]
-        dfm.loc[:, 'event'] = mevs
         # NOTE: assumed single particles
         dfm = dfm.groupby('event').first()
         # True momentum
-- 
GitLab