From 99c93e9e7a2ff2f94fa30020a13f2d13fe2b8199 Mon Sep 17 00:00:00 2001 From: Eric Torrence <eric.torrence@cern.ch> Date: Wed, 18 May 2022 20:37:52 -0700 Subject: [PATCH] Allow mixed PDG ID --- ...son => FaserMC-MDC_PG_elec_100GeV-101103.json} | 6 +++--- ....json => FaserMC-MDC_PG_elec_logE-101101.json} | 4 ++-- .../mdc/FaserMC-MDC_PG_emi_100GeV-101104.json | 13 ------------- .../data/mdc/FaserMC-MDC_PG_emi_logE-101102.json | 13 ------------- .../mdc/FaserMC-MDC_PG_gam_100GeV-102201.json | 2 +- .../data/mdc/FaserMC-MDC_PG_mumi_logE-101302.json | 13 ------------- ....json => FaserMC-MDC_PG_muon_logE-101301.json} | 4 ++-- .../mdc/FaserMC-MDC_PG_pimi_100GeV-121102.json | 13 ------------- ...son => FaserMC-MDC_PG_pion_100GeV-121101.json} | 4 ++-- .../Generation/python/faserMDC_pgparser.py | 4 ++-- .../Generation/scripts/faserMDC_particlegun.py | 6 +++++- .../scripts/submit_faserMDC_particlegun.sh | 15 ++++++++++++++- 12 files changed, 31 insertions(+), 66 deletions(-) rename Control/CalypsoExample/Generation/data/mdc/{FaserMC-MDC_PG_epl_100GeV-101103.json => FaserMC-MDC_PG_elec_100GeV-101103.json} (66%) rename Control/CalypsoExample/Generation/data/mdc/{FaserMC-MDC_PG_epl_logE-101101.json => FaserMC-MDC_PG_elec_logE-101101.json} (77%) delete mode 100644 Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_emi_100GeV-101104.json delete mode 100644 Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_emi_logE-101102.json delete mode 100644 Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_mumi_logE-101302.json rename Control/CalypsoExample/Generation/data/mdc/{FaserMC-MDC_PG_mupl_logE-101301.json => FaserMC-MDC_PG_muon_logE-101301.json} (76%) delete mode 100644 Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pimi_100GeV-121102.json rename Control/CalypsoExample/Generation/data/mdc/{FaserMC-MDC_PG_pipl_100GeV-121101.json => FaserMC-MDC_PG_pion_100GeV-121101.json} (75%) diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_epl_100GeV-101103.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_100GeV-101103.json similarity index 66% rename from Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_epl_100GeV-101103.json rename to Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_100GeV-101103.json index 4b540f260..76297a723 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_epl_100GeV-101103.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_100GeV-101103.json @@ -1,13 +1,13 @@ { - "file_length": 500, + "file_length": 250, "mass": 0.511, "maxE": 100.0, "minE": 100.0, - "pid": -11, + "pid": [-11, 11], "radius": 100.0, "run": 101103, "sampler": "const", "segment": 0, - "short": "MDC_PG_epl_100GeV", + "short": "MDC_PG_elec_100GeV", "zpos": -1000.0 } diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_epl_logE-101101.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_logE-101101.json similarity index 77% rename from Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_epl_logE-101101.json rename to Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_logE-101101.json index 95fd9fa70..d2e0ab8e3 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_epl_logE-101101.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_elec_logE-101101.json @@ -3,11 +3,11 @@ "mass": 0.511, "maxE": 1000.0, "minE": 10.0, - "pid": -11, + "pid": [-11, 11], "radius": 100.0, "run": 101101, "sampler": "log", "segment": 0, - "short": "MDC_PG_epl_logE", + "short": "MDC_PG_elec_logE", "zpos": -1000.0 } diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_emi_100GeV-101104.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_emi_100GeV-101104.json deleted file mode 100644 index 434153301..000000000 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_emi_100GeV-101104.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "file_length": 500, - "mass": 0.511, - "maxE": 100.0, - "minE": 100.0, - "pid": 11, - "radius": 100.0, - "run": 101104, - "sampler": "const", - "segment": 0, - "short": "MDC_PG_emi_100GeV", - "zpos": -1000.0 -} diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_emi_logE-101102.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_emi_logE-101102.json deleted file mode 100644 index 56410bd94..000000000 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_emi_logE-101102.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "file_length": 200, - "mass": 0.511, - "maxE": 1000.0, - "minE": 10.0, - "pid": 11, - "radius": 100.0, - "run": 101102, - "sampler": "log", - "segment": 0, - "short": "MDC_PG_emi_logE", - "zpos": -1000.0 -} diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_gam_100GeV-102201.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_gam_100GeV-102201.json index 04ddbb05e..dd04adada 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_gam_100GeV-102201.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_gam_100GeV-102201.json @@ -1,5 +1,5 @@ { - "file_length": 500, + "file_length": 250, "mass": 0.0, "maxE": 100.0, "minE": 100.0, diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_mumi_logE-101302.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_mumi_logE-101302.json deleted file mode 100644 index 1387658b5..000000000 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_mumi_logE-101302.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "file_length": 2000, - "mass": 105.66, - "maxE": 2000.0, - "minE": 10.0, - "pid": 13, - "radius": 100.0, - "run": 101302, - "sampler": "log", - "segment": 0, - "short": "MDC_PG_mumi_logE", - "zpos": null -} diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_mupl_logE-101301.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_logE-101301.json similarity index 76% rename from Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_mupl_logE-101301.json rename to Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_logE-101301.json index dda3d48ab..1e638eed3 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_mupl_logE-101301.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_muon_logE-101301.json @@ -3,11 +3,11 @@ "mass": 105.66, "maxE": 2000.0, "minE": 10.0, - "pid": -13, + "pid": [-13, 13], "radius": 100.0, "run": 101301, "sampler": "log", "segment": 0, - "short": "MDC_PG_mupl_logE", + "short": "MDC_PG_muon_logE", "zpos": null } diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pimi_100GeV-121102.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pimi_100GeV-121102.json deleted file mode 100644 index cd8abc7eb..000000000 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pimi_100GeV-121102.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "file_length": 500, - "mass": 139.6, - "maxE": 100.0, - "minE": 100.0, - "pid": -211, - "radius": 100.0, - "run": 121102, - "sampler": "const", - "segment": 0, - "short": "MDC_PG_pimi_100GeV", - "zpos": -1000.0 -} diff --git a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pipl_100GeV-121101.json b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pion_100GeV-121101.json similarity index 75% rename from Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pipl_100GeV-121101.json rename to Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pion_100GeV-121101.json index 9874ba205..e40ea323a 100644 --- a/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pipl_100GeV-121101.json +++ b/Control/CalypsoExample/Generation/data/mdc/FaserMC-MDC_PG_pion_100GeV-121101.json @@ -3,11 +3,11 @@ "mass": 139.6, "maxE": 100.0, "minE": 100.0, - "pid": 211, + "pid": [211, -211], "radius": 100.0, "run": 121101, "sampler": "const", "segment": 0, - "short": "MDC_PG_pipl_100GeV", + "short": "MDC_PG_pion_100GeV", "zpos": -1000.0 } diff --git a/Control/CalypsoExample/Generation/python/faserMDC_pgparser.py b/Control/CalypsoExample/Generation/python/faserMDC_pgparser.py index 7c41638ea..255275cb9 100644 --- a/Control/CalypsoExample/Generation/python/faserMDC_pgparser.py +++ b/Control/CalypsoExample/Generation/python/faserMDC_pgparser.py @@ -26,8 +26,8 @@ def faserMDC_pgparser(): parser.add_argument("--tag", default=None, help="Generator tag (g0000)") - parser.add_argument("--pid", default=13, type=int, - help="Specify PDG ID of particle (note plus/minus different)") + parser.add_argument("--pid", default=[-13, 13], type=int, nargs='*', + help="Specify PDG ID of particle (note plus/minus different) or list (e.g.: --pid -13 13)") parser.add_argument("--mass", default=105.66, type=float, help="Specify particle mass (in MeV)") parser.add_argument("--radius", default=100., type=float, diff --git a/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py b/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py index fe827c0fd..60da030fb 100755 --- a/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py +++ b/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py @@ -83,10 +83,14 @@ if __name__ == '__main__': from AthenaCommon.SystemOfUnits import GeV, TeV, cm, m from AthenaCommon.PhysicalConstants import pi + print(f"Using pid: {args.pid}") + + # Note args.pid is a list + # For ParticleGun to accept this, we need to turn it into a set... import ParticleGun as PG ConfigFlags.Sim.Gun = { "Generator" : "SingleParticle", - "pid" : args.pid, "mass" : args.mass, + "pid" : set(args.pid), "mass" : args.mass, "theta" : PG.GaussianSampler(0, args.angle, oneside = True), "phi" : [0, 2*pi], "radius" : args.radius, "randomSeed" : args.outfile } diff --git a/Control/CalypsoExample/Generation/scripts/submit_faserMDC_particlegun.sh b/Control/CalypsoExample/Generation/scripts/submit_faserMDC_particlegun.sh index 1aa00c891..638da7243 100755 --- a/Control/CalypsoExample/Generation/scripts/submit_faserMDC_particlegun.sh +++ b/Control/CalypsoExample/Generation/scripts/submit_faserMDC_particlegun.sh @@ -60,11 +60,24 @@ config_file=$(basename "$config_path") defaultIFS=$IFS IFS='.' read config_file_stem ext <<< "$config_file" +# +# Try to find the run number +IFS='-' +# Read the split words into an array based on delimeter +read faser short run_number <<< "$config_file_stem" +# # Set the IFS delimeter back or else echo doesn't work... IFS=$defaultIFS # +# Check if we found a number, use full config name if not +output_directory="$working_directory/${run_number}" +re='^[0-9]+$' +if ! [[ $run_number =~ $re ]] ; then + # Not a number... + output_directory="$working_directory/${config_file_stem}" +fi +# # Make output directory if needed -output_directory="$working_directory/${config_file_stem}" mkdir -p "$output_directory" # # This magic redirects everything in this script to our log file -- GitLab