Skip to content

Draft: Port configuration from ConfigurableUser to GaudiConfig2

Adam Morris requested to merge admorris/gaudiconfig2 into master

Strategy

  • Take a ConfigurableUser class and convert its methods to 'plain' functions
    • we may decide to revert to classes
    • __slots__ becomes a module-level variable DEFAULTS
    • the __apply_configuration__ function is what gets called from the outside: takes an ApplicationMgr object and a dict of properties. The first thing it does is
      params = DEFAULTS | kwargs
      then passes params to the other methods
  • Test by configuring a job with ConfigurableUser and output a .json options file, then doing the same with GaudiConfig2 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

Merge request reports