Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 13 additions & 21 deletions macro/run_simScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import os
import sys
import uuid
import ROOT

import shipunit as u
Expand Down Expand Up @@ -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)



Expand All @@ -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
Expand Down Expand Up @@ -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
# ========================================================================
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
Loading