From 1647d08df34ebcecfba136ff44bcaad17eebface Mon Sep 17 00:00:00 2001 From: Jihee Kim <jihee.kim@anl.gov> Date: Fri, 30 Apr 2021 21:16:04 +0000 Subject: [PATCH] Resolve "Fix the cluster benchmark to use sampling fraction" --- benchmarks/clustering/barrel_clusters.sh | 4 ++++ .../options/calorimeter_clustering.py | 19 +++++++++++++++++-- benchmarks/ecal/options/emcal_barrel_reco.py | 8 +++++++- benchmarks/ecal/run_emcal_barrel_electrons.sh | 4 ++++ benchmarks/ecal/run_emcal_barrel_pions.sh | 4 ++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/benchmarks/clustering/barrel_clusters.sh b/benchmarks/clustering/barrel_clusters.sh index 5e19e09e..4223d3b6 100644 --- a/benchmarks/clustering/barrel_clusters.sh +++ b/benchmarks/clustering/barrel_clusters.sh @@ -17,6 +17,10 @@ if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then export JUGGLER_N_EVENTS=100 fi +if [[ ! -n "${CB_EMCAL_SAMP_FRAC}" ]] ; then + export CB_EMCAL_SAMP_FRAC=0.014 +fi + export JUGGLER_FILE_NAME_TAG="barrel_clusters" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" diff --git a/benchmarks/clustering/options/calorimeter_clustering.py b/benchmarks/clustering/options/calorimeter_clustering.py index a45e642a..f2ac4f25 100644 --- a/benchmarks/clustering/options/calorimeter_clustering.py +++ b/benchmarks/clustering/options/calorimeter_clustering.py @@ -12,6 +12,11 @@ if "JUGGLER_DETECTOR" in os.environ : if "JUGGLER_DETECTOR_PATH" in os.environ : detector_name = str(os.environ["JUGGLER_DETECTOR_PATH"]) + "/" + detector_name +# get sampling fraction from system environment variable, 1.0 by default +sf = 1.0 +if "CB_EMCAL_SAMP_FRAC" in os.environ : + sf = str(os.environ["CB_EMCAL_SAMP_FRAC"]) + # todo add checks input_sim_file = str(os.environ["JUGGLER_SIM_FILE"]) output_rec_file = str(os.environ["JUGGLER_REC_FILE"]) @@ -70,6 +75,7 @@ ec_barrel_cluster = IslandCluster("ec_barrel_cluster", minClusterCenterEdep=1*units.MeV, groupRange=2.0, OutputLevel=DEBUG) + crystal_ec_cluster = IslandCluster("crystal_ec_cluster", inputHitCollection="RecoEcalHits", outputClusterCollection="EcalClusters", @@ -82,8 +88,17 @@ simple_cluster = SimpleClustering("simple_cluster", outputClusters="SimpleClusters", OutputLevel=DEBUG) +ec_barrel_clusterreco = RecoCoG("ec_barrel_clusterreco", + clusterCollection="EcalBarrelClusters", + logWeightBase=6.2, + samplingFraction=sf) -clusterreco = RecoCoG("cluster_reco", clusterCollection="EcalClusters", logWeightBase=4.2, moduleDimZName="CrystalBox_z_length",OutputLevel=DEBUG) +clusterreco = RecoCoG("cluster_reco", + clusterCollection="EcalClusters", + logWeightBase=4.2, + moduleDimZName="CrystalBox_z_length", + samplingFraction=sf, + OutputLevel=DEBUG) out = PodioOutput("out", filename=output_rec_file) @@ -93,7 +108,7 @@ ApplicationMgr( TopAlg = [podioinput, copier, calcopier, ecdigi, emcaldigi, crystal_ec_reco, ecal_reco, - ec_barrel_cluster, crystal_ec_cluster, clusterreco, + ec_barrel_cluster, crystal_ec_cluster, ec_barrel_clusterreco, clusterreco, simple_cluster, out], EvtSel = 'NONE', diff --git a/benchmarks/ecal/options/emcal_barrel_reco.py b/benchmarks/ecal/options/emcal_barrel_reco.py index 63125734..a5354e3d 100644 --- a/benchmarks/ecal/options/emcal_barrel_reco.py +++ b/benchmarks/ecal/options/emcal_barrel_reco.py @@ -33,6 +33,11 @@ n_events = 100 if "JUGGLER_N_EVENTS" in os.environ : n_events = str(os.environ["JUGGLER_N_EVENTS"]) +# get sampling fraction from system environment variable, 1.0 by default +sf = 1.0 +if "CB_EMCAL_SAMP_FRAC" in os.environ : + sf = str(os.environ["CB_EMCAL_SAMP_FRAC"]) + geo_service = GeoSvc("GeoSvc", detectors=["{}.xml".format(detector_name)]) podioevent = EICDataSvc("EventDataSvc", inputs=[input_sim_file], OutputLevel=DEBUG) @@ -99,7 +104,8 @@ embarrelcluster = IslandCluster("ecal_barrel_cluster", # Reconstruct the cluster with Center of Gravity method embarrelclusterreco = RecoCoG("ecal_barrel_clusterreco", clusterCollection="EcalBarrelClusters", - logWeightBase=6.2) + logWeightBase=6.2, + samplingFraction=sf) out = PodioOutput("out", filename=output_rec_file) diff --git a/benchmarks/ecal/run_emcal_barrel_electrons.sh b/benchmarks/ecal/run_emcal_barrel_electrons.sh index 6450e642..95b7e270 100755 --- a/benchmarks/ecal/run_emcal_barrel_electrons.sh +++ b/benchmarks/ecal/run_emcal_barrel_electrons.sh @@ -25,6 +25,10 @@ if [[ ! -n "${E_end}" ]] ; then export E_end=5.0 fi +if [[ ! -n "${CB_EMCAL_SAMP_FRAC}" ]] ; then + export CB_EMCAL_SAMP_FRAC=0.014 +fi + export JUGGLER_FILE_NAME_TAG="emcal_barrel_uniform_electrons" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" diff --git a/benchmarks/ecal/run_emcal_barrel_pions.sh b/benchmarks/ecal/run_emcal_barrel_pions.sh index 5115a63d..05d3db92 100755 --- a/benchmarks/ecal/run_emcal_barrel_pions.sh +++ b/benchmarks/ecal/run_emcal_barrel_pions.sh @@ -25,6 +25,10 @@ if [[ ! -n "${E_end}" ]] ; then export E_end=5.0 fi +if [[ ! -n "${CB_EMCAL_SAMP_FRAC}" ]] ; then + export CB_EMCAL_SAMP_FRAC=0.01 +fi + export JUGGLER_FILE_NAME_TAG="emcal_barrel_uniform_pions" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" -- GitLab