Example #1
0
def doIt():
    """
    specific post-config action for (x)GEN-files 
    """
    extension = "xgen"
    ext = extension.upper()

    from Configurables import DataOnDemandSvc
    dod  = DataOnDemandSvc ()
    from copy import deepcopy 
    algs = deepcopy ( dod.AlgMap ) 
    bad  = set() 
    for key in algs :
        if     0 <= key.find ( 'Rec'     )                  : bad.add ( key )
        elif   0 <= key.find ( 'Raw'     )                  : bad.add ( key )
        elif   0 <= key.find ( 'DAQ'     )                  : bad.add ( key )
        elif   0 <= key.find ( 'Trigger' )                  : bad.add ( key )
        elif   0 <= key.find ( 'Phys'    )                  : bad.add ( key )
        elif   0 <= key.find ( 'Prev/'   )                  : bad.add ( key )
        elif   0 <= key.find ( 'Next/'   )                  : bad.add ( key )
        elif   0 <= key.find ( '/MC/'    ) and 'GEN' == ext : bad.add ( key )
    for b in bad :
        del algs[b]

    dod.AlgMap = algs

    from Configurables import EventClockSvc, CondDB 
    EventClockSvc ( EventTimeDecoder = "FakeEventTime" )
    CondDB  ( IgnoreHeartBeat = True )
Example #2
0
    def _gen_postconfig_():
        """
        specific post-config action for (x)GEN-files 
        """
        logger.info('Start post-config action for (x)gen-files')
        from Configurables import DataOnDemandSvc
        dod = DataOnDemandSvc()
        from copy import deepcopy
        algs = deepcopy(dod.AlgMap)
        bad = set()
        for key in algs:
            if 0 <= key.find('Rec'): bad.add(key)
            elif 0 <= key.find('Raw'): bad.add(key)
            elif 0 <= key.find('DAQ'): bad.add(key)
            elif 0 <= key.find('Trigger'): bad.add(key)
            elif 0 <= key.find('Phys'): bad.add(key)
            elif 0 <= key.find('Prev/'): bad.add(key)
            elif 0 <= key.find('Next/'): bad.add(key)
            elif 0 <= key.find('/MC/') and 'GEN' == ext: bad.add(key)

        for b in bad:
            logger.debug('Remove key from DataOnDemand actions %s' % key)
            del algs[b]

        logger.info('Remove %d keys from DataOnDemand actions ' % len(bad))
        dod.AlgMap = algs

        from Configurables import EventClockSvc, CondDB
        EventClockSvc(EventTimeDecoder="FakeEventTime")
        logger.info('Use fake event time decoder for (x)gen-files')
        CondDB(IgnoreHeartBeat=True)
        logger.info('Ignore Heart-beat for (x)gen-files')
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