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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ it in future.
- The `--SND_design` option in `macro/run_simScript.py` now accepts multiple values and an 'all' option to enable all available SND designs.
- The geometry configuration and detector setup (`geometry/geometry_config.py`, `python/shipDet_conf.py`) have been updated to instantiate all requested SND detectors.
- This enables running with multiple SND subdetectors simultaneously and is future-proof for additional SND designs.
* Added YAML configuration files for Geant4 VMC setup (`g4Config.yaml`, `g4Config_basic.yaml`) to replace deprecated C macros
- Includes physics lists, Monte Carlo processes/cuts, and Geant4 macro commands
- Maintains full compatibility with original C configuration functionality
* Add SHiP::VMCConfig class to setup VMC from the YAML configuration

### Fixed

Expand Down Expand Up @@ -122,6 +126,9 @@ it in future.
- Add `SetTargetCoordinates()` method for robust geometry-based target configuration
- Maintain backward compatibility with legacy TGeo navigation as fallback
- The decorators from decorators.py now need to be applied explicitly using the new `apply_decorators` function.
* Updated all simulation scripts to use YAML configuration (`g4Config.yaml`) instead of deprecated C macros (`g4Config.C`)
- Added explicit ShipStack instantiation in Python code to maintain custom stack functionality
- Updated 8 scripts including `run_simScript.py`, `inspectGeant4Geo.py`, and muonShieldOptimization scripts

### Removed

Expand Down Expand Up @@ -150,6 +157,8 @@ it in future.
* Remove tankDesign variable, options
* Remove target versions older than CDR
* Remove hadron absorber in ShipTargetStation.cxx
* Removed deprecated Geant4 VMC configuration files (`g4Config.C`, `g4Config_basic.C`, `g4config.in`, `g4config_basic.in`)
* Remove GCUTS (replaced by CUTGAM in Geant4)

## 25.01

Expand Down
53 changes: 0 additions & 53 deletions gconfig/g4Config.C

This file was deleted.

44 changes: 44 additions & 0 deletions gconfig/g4Config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Geant4_UserGeometry: "geomRoot"
Geant4_PhysicsList: "QGSP_BERT_HP_PEN"
Geant4_SpecialProcess: "stepLimiter+specialCuts+specialControls"
Geant4_SpecialStacking: false
Geant4_Multithreaded: false

Geant4_MaxNStep: 10000 #default is 30000
Geant4_Commands:
- /mcVerbose/all 0
- /mcTracking/loopVerbose 0
- /mcPhysics/g4NeutronHPVerbose 0
- /mcPhysics/g4HadronicProcessStoreVerbose 0
- /physics_lists/em/PositronToMuons true
- /physics_lists/em/GammaToMuons true
- /process/em/verbose 0
- /process/eLoss/verbose 0
- /mcDet/setIsLocalMagField true

MonteCarlo_Process:
PAIR: 1 #pair production
COMP: 1 #Compton scattering
PHOT: 1 #photo electric effect
PFIS: 0 #photofission
DRAY: 1 #delta-ray
ANNI: 1 #annihilation
BREM: 1 #bremsstrahlung
HADR: 1 #hadronic process
MUNU: 1 #muon nuclear interaction
DCAY: 1 #decay
LOSS: 1 #energy loss
MULS: 1 #multiple scattering

MonteCarlo_Cut:
CUTGAM: 1.0E-3 #gammas (GeV)
CUTELE: 1.0E-3 #electrons (GeV)
CUTNEU: 1.0E-3 #neutral hadrons (GeV)
CUTHAD: 1.0E-3 #charged hadrons (GeV)
CUTMUO: 1.0E-3 #muons (GeV)
BCUTE: 1.0E-3 #electron bremsstrahlung (GeV)
BCUTM: 1.0E-3 #muon and hadron bremsstrahlung (GeV)
DCUTE: 1.0E-3 #electron delta-rays (GeV)
DCUTM: 1.0E-3 #muon and hadron delta-rays (GeV)
PPCUTM: 1.0E-3 #direct pair production by muons (GeV)
TOFMAX: 1.E10 #time of flight cut (s)
53 changes: 0 additions & 53 deletions gconfig/g4Config_basic.C

This file was deleted.

42 changes: 42 additions & 0 deletions gconfig/g4Config_basic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Geant4_UserGeometry: "geomRoot"
Geant4_PhysicsList: "emStandard"
Geant4_SpecialProcess: ""
Geant4_SpecialStacking: false
Geant4_Multithreaded: false

Geant4_MaxNStep: 10000 #default is 30000
Geant4_Commands:
- /mcVerbose/all 0
- /mcTracking/loopVerbose 0
- /mcPhysics/g4NeutronHPVerbose 0
- /mcPhysics/g4HadronicProcessStoreVerbose 0
- /process/em/verbose 0
- /process/eLoss/verbose 0
- /mcDet/setIsLocalMagField true

MonteCarlo_Process:
PAIR: 1 #pair production
COMP: 1 #Compton scattering
PHOT: 1 #photo electric effect
PFIS: 0 #photofission
DRAY: 1 #delta-ray
ANNI: 1 #annihilation
BREM: 1 #bremsstrahlung
HADR: 1 #hadronic process
MUNU: 1 #muon nuclear interaction
DCAY: 1 #decay
LOSS: 1 #energy loss
MULS: 1 #multiple scattering

MonteCarlo_Cut:
CUTGAM: 1.0E-3 #gammas (GeV)
CUTELE: 1.0E-3 #electrons (GeV)
CUTNEU: 1.0E-3 #neutral hadrons (GeV)
CUTHAD: 1.0E-3 #charged hadrons (GeV)
CUTMUO: 1.0E-3 #muons (GeV)
BCUTE: 1.0E-3 #electron bremsstrahlung (GeV)
BCUTM: 1.0E-3 #muon and hadron bremsstrahlung (GeV)
DCUTE: 1.0E-3 #electron delta-rays (GeV)
DCUTM: 1.0E-3 #muon and hadron delta-rays (GeV)
PPCUTM: 1.0E-3 #direct pair production by muons (GeV)
TOFMAX: 1.E10 #time of flight cut (s)
33 changes: 0 additions & 33 deletions gconfig/g4config.in

This file was deleted.

28 changes: 0 additions & 28 deletions gconfig/g4config_basic.in

This file was deleted.

2 changes: 1 addition & 1 deletion macro/ShipAna.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
run = ROOT.FairRunSim()
run.SetName("TGeant4") # Transport engine
run.SetSink(ROOT.FairRootFileSink(ROOT.TMemFile('output', 'recreate'))) # Dummy output file
run.SetUserConfig("g4Config_basic.C") # geant4 transport not used, only needed for the mag field
ROOT.gInterpreter.ProcessLine('FairRunSim::Instance()->SetSimulationConfig(std::make_unique<SHiP::VMCConfig>("g4Config", "g4Config_basic.yaml"));') # geant4 transport not used, only needed for the mag field
rtdb = run.GetRuntimeDb()
# -----Create geometry----------------------------------------------
modules = shipDet_conf.configure(run,ShipGeo)
Expand Down
2 changes: 1 addition & 1 deletion macro/ShipReco.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def mem_monitor():
run = ROOT.FairRunSim()
run.SetName("TGeant4") # Transport engine
run.SetSink(ROOT.FairRootFileSink(ROOT.TMemFile('output', 'recreate'))) # Dummy output file
run.SetUserConfig("g4Config_basic.C") # geant4 transport not used, only needed for creating VMC field
ROOT.gInterpreter.ProcessLine('FairRunSim::Instance()->SetSimulationConfig(std::make_unique<SHiP::VMCConfig>("g4Config", "g4Config_basic.yaml"));') # geant4 transport not used, only needed for creating VMC field
rtdb = run.GetRuntimeDb()
# -----Create geometry----------------------------------------------
modules = shipDet_conf.configure(run,ShipGeo)
Expand Down
7 changes: 4 additions & 3 deletions macro/create_field_perturbation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ def create_csv_field_map(options):

run = r.FairRunSim()
run.SetName('TGeant4') # Transport engine
run.SetSink(ROOT.FairRootFileSink("tmp_file")) # Output file
# user configuration file default g4Config.C
run.SetUserConfig('g4Config.C')
run.SetSink(r.FairRootFileSink("tmp_file")) # Output file
# Use SHiP::VMCConfig for YAML configuration
r.gInterpreter.ProcessLine('FairRunSim::Instance()->SetSimulationConfig(std::make_unique<SHiP::VMCConfig>("g4Config", "g4Config.yaml"));')
modules = shipDet_conf.configure(run, ship_geo)
primGen = r.FairPrimaryGenerator()
primGen.SetTarget(ship_geo.target.z0+70.845*u.m, 0.)
#
run.SetGenerator(primGen)
run.SetStoreTraj(r.kFALSE)
# ShipStack is now automatically created by SHiP::VMCConfig
run.Init()
fieldMaker = geomGeant4.addVMCFields(ship_geo, '', True)

Expand Down
6 changes: 5 additions & 1 deletion macro/inspectGeant4Geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
fgeo = ROOT.TFile(fname)
sGeo = fgeo.Get("FAIRGeom")
import shipDet_conf

run = ROOT.FairRunSim()
upkl = Unpickler(fgeo)
ShipGeo = upkl.load('ShipGeo')
modules = shipDet_conf.configure(run, ShipGeo)
run.SetUserConfig('g4Config.C')
# Use SHiP::VMCConfig for YAML configuration
ROOT.gInterpreter.ProcessLine('FairRunSim::Instance()->SetSimulationConfig(std::make_unique<SHiP::VMCConfig>("g4Config", "g4Config.yaml"));')
run.SetName('TGeant4')
run.SetSink(ROOT.FairRootFileSink(ROOT.TMemFile('output', 'recreate')))
# ShipStack is now automatically created by SHiP::VMCConfig
run.Init()
run.Run(0)
import geomGeant4

geomGeant4.printVMCFields()
geomGeant4.printWeightsandFields()
7 changes: 6 additions & 1 deletion macro/run_simScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,14 @@
run = ROOT.FairRunSim()
run.SetName(mcEngine) # Transport engine
run.SetSink(ROOT.FairRootFileSink(outFile)) # Output file
run.SetUserConfig("g4Config.C") # user configuration file default g4Config.C
# Use SHiP::VMCConfig for YAML configuration via C++ interpreter
ROOT.gInterpreter.ProcessLine('FairRunSim::Instance()->SetSimulationConfig(std::make_unique<SHiP::VMCConfig>("g4Config", "g4Config.yaml"));')
rtdb = run.GetRuntimeDb()
# -----Create geometry----------------------------------------------
# import shipMuShield_only as shipDet_conf # special use case for an attempt to convert active shielding geometry for use with FLUKA
# import shipTarget_only as shipDet_conf
import shipDet_conf

modules = shipDet_conf.configure(run,ship_geo)
# -----Create PrimaryGenerator--------------------------------------
primGen = ROOT.FairPrimaryGenerator()
Expand Down Expand Up @@ -515,6 +517,9 @@
#--- Use it only to display but not for production!
if options.eventDisplay: run.SetStoreTraj(ROOT.kTRUE)
else: run.SetStoreTraj(ROOT.kFALSE)

# ShipStack is now automatically created by SHiP::VMCConfig

# -----Initialize simulation run------------------------------------
run.Init()
if options.dryrun: # Early stop after setting up Pythia 8
Expand Down
4 changes: 3 additions & 1 deletion muonShieldOptimization/run_fixedTarget.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def get_work_dir(run_number,tag=None):
run = ROOT.FairRunSim()
run.SetName(mcEngine) # Transport engine
run.SetSink(ROOT.FairRootFileSink(outFile)) # Output file
run.SetUserConfig("g4Config.C") # user configuration file default g4Config.C
# Use SHiP::VMCConfig for YAML configuration
run.SetSimulationConfig(ROOT.std.make_unique[ROOT.SHiP.VMCConfig]("g4Config", "g4Config.yaml"))
rtdb = run.GetRuntimeDb()

# -----Materials----------------------------------------------
Expand Down Expand Up @@ -214,6 +215,7 @@ def get_work_dir(run_number,tag=None):
#
run.SetGenerator(primGen)
# -----Initialize simulation run------------------------------------
# ShipStack is now automatically created by SHiP::VMCConfig
run.Init()

gMC = ROOT.TVirtualMC.GetMC()
Expand Down
Loading