diff --git a/.github/workflows/build-run.yml b/.github/workflows/build-run.yml index 3415259f1e..dd4a136ccd 100644 --- a/.github/workflows/build-run.yml +++ b/.github/workflows/build-run.yml @@ -84,38 +84,38 @@ jobs: run: | source /cvmfs/ship.cern.ch/$version/setUp.sh eval $(alienv load FairShip/latest) - python $FAIRSHIP/macro/run_simScript.py --test --debug 2 --${{ matrix.vessel_option }} --SND --SND_design=${{ matrix.SND_option }} --shieldName ${{ matrix.muon_shield }} --target-yaml=$FAIRSHIP/geometry/target_config_${{ matrix.target }}.yaml --EvtGenDecayer + python $FAIRSHIP/macro/run_simScript.py --test --debug 2 --${{ matrix.vessel_option }} --SND --SND_design=${{ matrix.SND_option }} --shieldName ${{ matrix.muon_shield }} --target-yaml=$FAIRSHIP/geometry/target_config_${{ matrix.target }}.yaml --EvtGenDecayer --tag ci-test - name: Overlap check run: | source /cvmfs/ship.cern.ch/$version/setUp.sh eval $(alienv load FairShip/latest) - python $FAIRSHIP/python/experimental/check_overlaps.py --geofile geofile_full.conical.Pythia8-TGeant4.root | tee log + python $FAIRSHIP/python/experimental/check_overlaps.py --geofile geo_ci-test.root | tee log ! grep "Overlap" log - name: Geo information run: | source /cvmfs/ship.cern.ch/$version/setUp.sh eval $(alienv load FairShip/latest) - python $FAIRSHIP/macro/getGeoInformation.py --geometry geofile_full.conical.Pythia8-TGeant4.root --level 2 + python $FAIRSHIP/macro/getGeoInformation.py --geometry geo_ci-test.root --level 2 - name: Run Reco run: | source /cvmfs/ship.cern.ch/$version/setUp.sh eval $(alienv load FairShip/latest) - python $FAIRSHIP/macro/ShipReco.py -f ship.conical.Pythia8-TGeant4.root -g geofile_full.conical.Pythia8-TGeant4.root --Debug + python $FAIRSHIP/macro/ShipReco.py -f sim_ci-test.root -g geo_ci-test.root --Debug - name: Run Ana run: | source /cvmfs/ship.cern.ch/$version/setUp.sh eval $(alienv load FairShip/latest) - python $FAIRSHIP/macro/ShipAna.py -f ship.conical.Pythia8-TGeant4.root -r ship.conical.Pythia8-TGeant4_rec.root -g geofile_full.conical.Pythia8-TGeant4.root + python $FAIRSHIP/macro/ShipAna.py -f sim_ci-test.root -r sim_ci-test_rec.root -g geo_ci-test.root - name: Run examples run: | source /cvmfs/ship.cern.ch/$version/setUp.sh eval $(alienv load FairShip/latest) - python $FAIRSHIP/examples/analysis_example.py -f ship.conical.Pythia8-TGeant4.root -r ship.conical.Pythia8-TGeant4_rec.root -g geofile_full.conical.Pythia8-TGeant4.root + python $FAIRSHIP/examples/analysis_example.py -f sim_ci-test.root -r sim_ci-test_rec.root -g geo_ci-test.root # - name: Extract physics metrics # run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c7ab72d69..1221915a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ it in future. ### Changed + +* Change naming convention for simulation files to `{sim,geo,params}_{uuid4}.root`, with optional `--tag` parameter to specify custom identifier + ### Fixed + Update run_fixedTarget to save tracks for hits in post-target sensitive plane diff --git a/macro/run_simScript.py b/macro/run_simScript.py index 37ad2c276a..26bd011b73 100755 --- a/macro/run_simScript.py +++ b/macro/run_simScript.py @@ -4,6 +4,7 @@ import os import sys +import uuid import ROOT import shipunit as u @@ -171,6 +172,7 @@ ) parser.add_argument("--noSND", dest="SND", help="Deactivate SND. NOOP, as it currently defaults to off.", action='store_false') parser.add_argument("--target-yaml", help="Path to the yaml target config file", default=os.path.expandvars("$FAIRSHIP/geometry/target_config_Jun25.yaml")) +parser.add_argument("--tag", dest="output_tag", help="Custom tag for output files instead of auto-generated UUID", default=None) @@ -196,7 +198,6 @@ if options.MM: motherMode=options.MM if options.cosmics: - simEngine = "Cosmics" Opt_high = int(options.cosmics) if options.inputFile: if options.inputFile == "none": options.inputFile = None @@ -257,33 +258,22 @@ TARGET_YAML=options.target_yaml ) -# Output file name, add dy to be able to setup geometry with ambiguities. -if options.command == "PG": - tag = f"PG_{options.pID}-{mcEngine}" -elif options.command == "Genie": - tag = f"Genie-{mcEngine}" - simEngine = "Genie" -else: +if not options.command: for g in ["pythia8", "evtcalc", "pythia6", "nuradio", "ntuple", "muonback", "mudis", "fixedTarget", "cosmics"]: if getattr(options, g): - simEngine = g.capitalize() break else: - simEngine = "Pythia8" options.pythia8 = True # Ensure Pythia8 is enabled by default - tag = f"{simEngine}-{mcEngine}" -if charmonly: tag = simEngine+"CharmOnly-"+mcEngine -if options.eventDisplay: tag = tag+'_D' -tag = 'conical.'+tag + +# Output file name +# Use custom tag if provided, otherwise use random UUID version 4 +run_identifier = options.output_tag if options.output_tag else str(uuid.uuid4()) if not os.path.exists(options.outputDir): os.makedirs(options.outputDir) -outFile = f"{options.outputDir}/ship.{tag}.root" +outFile = f"{options.outputDir}/sim_{run_identifier}.root" -# rm older files !!! -for x in os.listdir(options.outputDir): - if not x.find(tag)<0: os.system(f"rm {options.outputDir}/{x}" ) # Parameter file name -parFile=f"{options.outputDir}/ship.params.{tag}.root" +parFile=f"{options.outputDir}/params_{run_identifier}.root" # In general, the following parts need not be touched # ======================================================================== @@ -603,11 +593,12 @@ rtdb.printParamContexts() getattr(rtdb,"print")() # ------------------------------------------------------------------------ -run.CreateGeometryFile(f"{options.outputDir}/geofile_full.{tag}.root") +geofile_name = f"{options.outputDir}/geo_{run_identifier}.root" +run.CreateGeometryFile(geofile_name) # save ShipGeo dictionary in geofile import saveBasicParameters -saveBasicParameters.execute(f"{options.outputDir}/geofile_full.{tag}.root",ship_geo) +saveBasicParameters.execute(geofile_name,ship_geo) # checking for overlaps if options.check_overlaps: @@ -634,6 +625,7 @@ print("Output file is ", outFile) print("Parameter file is ",parFile) +print("Geometry file is ", geofile_name) print("Real time ",rtime, " s, CPU time ",ctime,"s") # remove empty events