Beispiel #1
0
    def __configureStreams(self):
        if self.isPropertySet('_streams'):
            return self.getProp('_streams')

        ## Stream configuration
        knownStreams = self.knownStreams()

        ## Figure out which streams we really want to enable
        from Configurables import HltConf
        sets = HltConf().settings()
        ep = 'EnabledStreams'
        enabledStreams = self.getProp(ep)
        defaultEnabled = self.getDefaultProperty(ep)
        if self.isPropertySet(ep) and enabledStreams != defaultEnabled:
            log.warning( '##########################################################')
            log.warning( 'Non-default stream configuration specified from EnabledStreams property')
            log.warning( 'This will overwrite any other setting of the streams, for example from the settings.')
        elif sets and hasattr(sets, 'Streams') and set(sets.Streams()) != set(self.getDefaultProperty(ep)):
            log.warning( '##########################################################')
            log.warning( 'Non-default stream configuration specified in Settings')
            enabledStreams = sets.Streams()

        streams = {s : (bit, None, False) for s, bit in knownStreams.iteritems()}
        for stream, expr in enabledStreams.iteritems():
            if stream not in streams:
                log.fatal("Attempt to enable a non-existent stream %s." % stream)
                raise RuntimeError
            if stream not in defaultEnabled:
                log.warning("Enabling non-default enabled stream %s." % stream)
            bit = streams[stream][0]
            streams[stream] = (bit, expr, True)

        ## Check if default enabled streams are on
        disabled = [s[0] for s in streams.iteritems() if not s[1][2] and s[0] in defaultEnabled]
        if disabled:
            log.warning( '##########################################################')
            log.warning( 'Normally enabled streams are disabled: %s.' % ', '.join(disabled) )
            log.warning( '##########################################################')

        enabled = set([k for (k, (_, _, on)) in streams.iteritems() if on])
        if  enabled != set(defaultEnabled.keys()):
            log.warning( '##########################################################' )
            log.warning( 'Non-standard stream configuration' )
            log.warning( 'Enabled:  %s' % ', '.join(s[0] for s in streams.iteritems() if s[1][2]) )
            log.warning( 'Disabled: %s' % ', '.join(s[0] for s in streams.iteritems() if not s[1][2]) )
            log.warning( '##########################################################' )

        streams = {k.capitalize() : v for k, v in streams.iteritems()}
        self.setProp('_streams', streams)
        return streams
Beispiel #2
0
from PRConfig.TestFileDB import test_file_db
input = test_file_db['2015HLTValidationData_L0filtered_0x0050']
input.run(configurable=Moore())

Moore().CondDBtag = 'cond-20150828'
Moore().DDDBtag = 'dddb-20150724'
Moore().DataType = '2015'

from GaudiKernel.Configurable import applyConfigurableUsers
applyConfigurableUsers()

from Configurables import HltConf
conf = HltConf()
settings = HltConf().settings()

configuredStreams = settings.Streams()
knownStreams = conf.knownStreams()

from Configurables import HltRoutingBitsWriter
rb1 = HltRoutingBitsWriter('Hlt1RoutingBitsWriter')
rb2 = HltRoutingBitsWriter('Hlt2RoutingBitsWriter')

passed = True
for stream, rb in configuredStreams.iteritems():
    try:
        bit, default = knownStreams[stream]
        if bit <= 64:
            rbs = rb1.RoutingBits
        else:
            rbs = rb2.RoutingBits
        assert (bit in rbs), ("Routing bit %d was not set to the writer." % bit)