def post_action_for_cpp():
    """
    Post-configh action to enforce initialization of DoD-algorithms
    """

    from Gaudi.Configuration import log
    from Configurables import ApplicationMgr
    app = ApplicationMgr(OutputLevel=3)
    app.EvtMax = 0
    app.EvtSel = 'NONE'

    from Configurables import LHCb__ParticlePropertySvc as PPSvc
    from Configurables import DetDataSvc
    from Configurables import LoKiSvc

    #
    ## some reshuffling of order of services is needed
    #    in particular DOD should come after PPSVC, LoKiSvc and ToolSvc
    #

    services = app.ExtSvc
    app.ExtSvc = [
        DetDataSvc('DetectorDataSvc'),
        PPSvc(),
        LoKiSvc(Welcome=False)
    ] + services

    #
    ## suppress some prints
    #
    from Configurables import TimingAuditor
    timer = TimingAuditor()
    from Configurables import SequencerTimerTool
    timer.addTool(SequencerTimerTool, 'TIMER')
    timer.TIMER.OutputLevel = 5

    # suppress printout of various summaries from algorithms.
    from Gaudi.Configuration import allConfigurables
    for conf in allConfigurables.itervalues():
        for opt in ('StatPrint', 'ErrorsPrint', 'HistoPrint'):
            if opt in conf.__slots__:
                setattr(conf, opt, False)

    # ensure that prints from the main tools/factories are not suppressed
    import Configurables
    from Configurables import LoKi__Hybrid__CoreFactory as CoreFactory
    from Configurables import LoKi__Hybrid__Tool as HybridFactory
    from Configurables import LoKi__Hybrid__HltFactory as HltFactory
    for Factory, names in {
            HltFactory: ("HltFactory", "Hlt1HltFactory", "Hlt2HltFactory"),
            CoreFactory: ("Hlt1CoreFactory", "Hlt2CoreFactory", "Hlt1Factory"),
            HybridFactory: ("Hlt1HybridFactory", "Hlt2HybridFactory")
    }.iteritems():
        for name in names:
            f = Factory(name)
            f.OutputLevel = 2
            f.StatPrint = True
Beispiel #2
0
import os
from GaudiKernel import SystemOfUnits as units
from GaudiKernel import PhysicalConstants as constants

from Gaudi.Configuration import *

from Configurables import ApplicationMgr
main = ApplicationMgr()
main.EvtSel = 'NONE'
main.EvtMax = 10
main.TopAlg = []
main.ExtSvc = []

# PODIO algorithm
from Configurables import FCCDataSvc
podioevent = FCCDataSvc("EventDataSvc")
main.ExtSvc += [podioevent]

### Generation #################################################

from Configurables import GaussSmearVertex
smeartool = GaussSmearVertex()
smeartool.xVertexSigma = 0.5 * units.mm
smeartool.yVertexSigma = 0.5 * units.mm
smeartool.zVertexSigma = 40.0 * units.mm
smeartool.tVertexSigma = 180.0 * units.picosecond

from Configurables import ConstPtParticleGun
pgun_tool = ConstPtParticleGun()
pgun_tool.PdgCodes = [13]
pgun_tool.PhiMin = 0.0
def post_action_for_cpp():
    """
    Post-configh action to enforce initialization of DoD-algorithms
    """

    from Gaudi.Configuration import log

    log.info(
        '# VB: Post-action to enforce the initialization of DoD-algorithms')

    from Configurables import DataOnDemandSvc
    dod = DataOnDemandSvc()
    dod.PreInitialize = True  ## this is the most important line here

    ## dod.AllowPreInitializeFailure = True
    ## dod.Dump                      = True

    removed = []
    for key in dod.AlgMap:
        if 0 <= key.find('Raw/UT'):
            removed.append(key)
            log.warning('# VB:   REMOVE UT decoding from DataOnDemand!')
    dct = dod.AlgMap
    for k in removed:
        del dct[k]
    dod.AlgMap = dct

    from Configurables import ApplicationMgr
    app = ApplicationMgr(OutputLevel=5)
    app.EvtMax = 0
    app.EvtSel = 'NONE'

    from Configurables import LHCb__ParticlePropertySvc as PPSvc
    from Configurables import DetDataSvc
    from Configurables import LoKiSvc

    #
    ## some reshuffling of order of services is needed
    #    in particular DOD should come after PPSVC, LoKiSvc and ToolSvc
    #

    services = app.ExtSvc
    app.ExtSvc = [
        DetDataSvc('DetectorDataSvc'),
        PPSvc(),
        LoKiSvc(Welcome=False)
    ] + services + [dod]

    #
    ## suppress some prints
    #
    from Configurables import TimingAuditor
    timer = TimingAuditor()
    from Configurables import SequencerTimerTool
    timer.addTool(SequencerTimerTool, 'TIMER')
    timer.TIMER.OutputLevel = 5

    # suppress printout of various summaries from algorithms.
    from Gaudi.Configuration import allConfigurables
    for conf in allConfigurables.itervalues():
        for opt in ('StatPrint', 'ErrorsPrint', 'HistoPrint'):
            if opt in conf.__slots__:
                setattr(conf, opt, False)

    # ensure that prints from the main tools/factories are not suppressed
    import Configurables
    for factory in ('Tool', 'CoreFactory', 'TrackFunctorFactory', 'HltFactory',
                    'Hlt1HltFactory', 'Hlt2HltFactory'):
        factory = 'LoKi__Hybrid__%s' % factory
        try:
            factory = getattr(Configurables, factory)
            factory(OutputLevel=2, StatPrint=True)
        except AttributeError:
            # ignore unknown factories
            pass
Beispiel #4
0
import os
from Gaudi.Configuration import *

from Configurables import ApplicationMgr
app = ApplicationMgr()
app.TopAlg = []
app.EvtSel = 'NONE'
app.EvtMax = 1
app.ExtSvc = []
app.OutputLevel = INFO

# DD4hep geometry service
from Configurables import GeoSvc
## parse the given xml file
path_to_detectors = os.environ.get("FCCDETECTORS", "")
geoservice = GeoSvc("GeoSvc")
geoservice.detectors = [
    os.path.join(path_to_detectors,
                 'Detector/DetFCCeeCLD/compact/FCCee_o2_v02/FCCee_o2_v02.xml'),
]
ApplicationMgr().ExtSvc += [geoservice]

from Configurables import SimG4Svc
geantservice = SimG4Svc("SimG4Svc")
ApplicationMgr().ExtSvc += [geantservice]

from Configurables import GeoToGdmlDumpSvc
geodumpservice = GeoToGdmlDumpSvc()
geodumpservice.gdml = "DetFCCeeCLD.gdml"
ApplicationMgr().ExtSvc += [geodumpservice]