Draft: Port configuration from ConfigurableUser to GaudiConfig2
Strategy
- Take a ConfigurableUser class and convert its methods to 'plain' functions
- we may decide to revert to classes
-
__slots__
becomes a module-level variableDEFAULTS
- the
__apply_configuration__
function is what gets called from the outside: takes anApplicationMgr
object and a dict of properties. The first thing it does isparams = DEFAULTS | kwargs
params
to the other methods
- Test by configuring a job with
ConfigurableUser
and output a.json
options file, then doing the same withGaudiConfig2
and taking a diff:$ gaudirun.py --dry-run --all-opts --output=old.json options.py ... $ gaudirun.py --dry-run --all-opts --output=new.json Module:function ... $ diff old.json new.json
Example
from GaudiConfig2 import Configurables as C
from GaudiConfig2 import mergeConfigs
from Gaussino.GaudiConfig2.Configuration import __apply_configuration__ as Gaussino
from Gaussino.GaudiConfig2.Generation import __apply_configuration__ as GaussinoGeneration
def main():
app = C.ApplicationMgr(AppName="Gaussino", EvtSel="NONE")
configs = [
app,
*Gaussino(app, Phases=["Generator"]),
*GaussinoGeneration(app, ParticleGun=True),
]
return mergeConfigs(configs)
Classes ported
-
Gaussino
-
GaussinoGeneration
-
GaussinoSimulation
-
GaussinoGeometry
-
ExternalDetectorEmbedder
-
ParallelGeometry
-
CustomSimulation
To-do
-
unit tests of individual functions -
integration tests with existing examples
Edited by Adam Morris