def _suppressMonitoring(self): if self.getProp("UseTCK"): trans = {} trans['.*HltGlobalMonitor'] = {'Enable': {"^.*$": "False"}} trans['.*BeetleSyncMonitor.*'] = {'Enable': {"^.*$": "False"}} trans['HltL0GlobalMonitor'] = {'Enable': {"^.*$": "False"}} Funcs._mergeTransform(trans) else: hltConf = HltConf() hltConf.setProp("EnableMonitoring", False)
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
def __apply_configuration__(self): if not self.isPropertySet("OutputAlgProperties"): self.OutputAlgProperties = self.__MDFWriterProperties # Configure ApplicationMgr().Outstream first, because the rest depends # on ThresholdSettings self.__configureOutStream() # When running online from TCK, this is all that is needed if self.getProp('UseTCK'): return # Do we want to write lumi events and strip them? from Configurables import HltConf sets = HltConf().settings() if self.getProp("EnableLumiEventWriting"): self.__propFromSettings(sets, 'NanoBanks') # Check assignment of streams to output streams from Settings self.__propFromSettings(sets, 'StreamsWithBanks') streams = [c for c in chain.from_iterable([e[0] for e in self.getProp('StreamsWithBanks')])] if len(set(streams)) != len(streams): raise ValueError('Streams can be part of only one group in StreamsWithBanks') streams = self.__configureStreams() # Configure the routing bits and update the streams routingBits = self.__configureRoutingBits(streams) self.__configureEndSequence(streams, routingBits)
def ActiveHlt2Lines(self): """ Returns a list of active Hlt2 lines """ # Disable afterburner because it runs the reco from Configurables import HltConf HltConf().EnableHltAfterburner = False return ['Hlt2PassThrough']
def _config_with_hltconf(self): """ Propagate settings to HltConf """ hltConf = HltConf() self.setOtherProps(hltConf, [ 'ThresholdSettings', 'DataType', 'Split', 'ForceSingleL0Configuration' ]) if self.getProp("OutputLevel") < INFO: hltConf.setProp("Verbose", True) from Configurables import Hlt2Conf #cannot do this for the TCK right now. Ideally I want a transform which does the same as this. if MooreExpert().getProp("Hlt2Independent") and ( "Hlt1TrackOption" in Hlt2Conf().__slots__ or hasattr(Hlt2Conf(), "Hlt1TrackOption") ) and not Hlt2Conf().isPropertySet("Hlt1TrackOption"): Hlt2Conf().setProp("Hlt1TrackOption", "Rerun")
def _configureOutput(self): if self.getProp('Split') != 'Hlt1' and self.getProp( 'EnableOutputStreaming'): self.forceOtherProps(HltConf(), ['EnableOutputStreaming']) from Configurables import HltOutputConf outputConf = HltOutputConf() for (op, tp) in { 'outputFile': 'OutputFile', 'generateConfig': 'GenerateTCK' }.iteritems(): outputConf.setProp(tp, self.getProp(op)) self.forceOtherProps(outputConf, [ 'Split', 'UseTCK', 'RunOnline', 'WriterRequires', 'EnableOutputStreaming', 'Simulation' ])
def postConfigAction( self ): from HltLine.HltLine import hlt1Lines from HltLine.HltLine import hlt2Lines # Reconfigure the Hlt sequences lines1 = [ i for i in hlt1Lines() if i.name() in self.hlt1Lines ] print "HLT1LINES" for hltLine in lines1: print hltLine.name() Sequence( "Hlt1" ).Members = [ i.configurable() for i in lines1 ] lines2 = [ i for i in hlt2Lines() if i.name() in self.hlt2Lines ] print "HLT2LINES" for hltLine in lines2: print hltLine.name() print "ENDLINES" Sequence( "Hlt2" ).Members = [ i.configurable() for i in lines2 ] # Reconfigure the monitoring to expect the correct lines HltConf().configureHltMonitoring( lines1, lines2 ) for hltLine in Sequence( "Hlt1" ).Members + Sequence( "Hlt2" ).Members: try: prescale = getattr( hltLine, "Prescale" ) if hasattr( prescale, "AcceptFraction" ): prescale.AcceptFraction = 1 elif hasattr( prescale, "Code" ): prescale.Code = "FALL" postscale = getattr( hltLine, "Postscale" ) if hasattr( postscale, "AcceptFraction" ): postscale.AcceptFraction = 1 elif hasattr( postscale, "Code" ): postscale.Code = "FALL" except AttributeError: pass # This is rather nasty, but required. It is possible because we don't need # an output file. Sequence( "HltEndSequence" ).Members = []
import os, sys, pkgutil, importlib import Gaudi.Configuration from Configurables import HltConf conf = HltConf() knownStreams = conf.knownStreams() def getSettings(): import HltSettings settings = {} for _, name, is_pkg in pkgutil.iter_modules(HltSettings.__path__[:2]): if is_pkg: continue pkg_name = HltSettings.__name__ + '.' + name try: settings[name] = getattr(importlib.import_module(pkg_name), name)() except ImportError as e: pass except AttributeError as e: print 'WARNING: Badly named settings object in %s' % pkg_name continue return settings passed = True sets = getSettings() for name, settings in sets.iteritems(): if not hasattr(settings, 'Streams'): continue for stream, rb in settings.Streams().iteritems():
def _generateConfig(self): from HltConf.ThresholdUtils import Name2Threshold settings = Name2Threshold(HltConf().getProp('ThresholdSettings')) svcs = MooreExpert().getProp("configServices") algs = MooreExpert().getProp("configAlgorithms") if MooreExpert().getProp('TCKpersistency').lower() in [ 'tarfile', 'zipfile', 'cdb' ]: self.getConfigAccessSvc().Mode = 'ReadWrite' #self.getConfigAccessSvc().OutputLevel = 1 from Configurables import HltGenConfig print 'requesting following svcs: %s ' % svcs gen = HltGenConfig(ConfigTop=[i.rsplit('/')[-1] for i in algs], ConfigSvc=[i.rsplit('/')[-1] for i in svcs], ConfigAccessSvc=self.getConfigAccessSvc().getName(), HltType=settings.HltType(), MooreRelease=self.getRelease(), Label=self.getProp('configLabel')) # make sure gen is the very first Top algorithm... from HltLine.HltDecodeRaw import DecodeODIN ApplicationMgr().TopAlg = DecodeODIN.members() + [ gen.getFullName() ] + ApplicationMgr().TopAlg def genConfigAction(): def gather(c, overrule): def check(config, prop, value): if prop not in config.getDefaultProperties(): return False if hasattr(config, prop): return getattr(config, prop) == value return config.getDefaultProperties()[prop] == value def addOverrule(config, rule): if c.name() not in overrule.keys(): overrule[c.name()] = [] if rule not in overrule[c.name()]: overrule[c.name()] += [rule] if check(c, 'HistoProduce', False): addOverrule(c, 'HistoProduce:@OnlineEnv.Monitor@False') if c.getType() in ['FilterDesktop', 'CombineParticles' ] and check(c, 'Monitor', False): addOverrule(c, 'Monitor:@OnlineEnv.Monitor@False') if check(c, 'Enable', False): addOverrule(c, 'OutputLevel:3') for p in ['Members', 'Filter0', 'Filter1']: if not hasattr(c, p): continue x = getattr(c, p) if list is not type(x): x = [x] for i in x: gather(i, overrule) from Configurables import HltGenConfig, GaudiSequencer HltGenConfig().Overrule = { 'Hlt1ODINTechnicalPreScaler': ['AcceptFraction:@OnlineEnv.AcceptRate@0'] } gather(GaudiSequencer('Hlt'), HltGenConfig().Overrule) print HltGenConfig() from Gaudi.Configuration import appendPostConfigAction appendPostConfigAction(genConfigAction)
from Configurables import Moore, HltConf HltConf().ThresholdSettings="Hlt1_IncLinesOnly" Moore().UseTCK = False
from Configurables import Moore, HltConf HltConf().ThresholdSettings = "Hlt1_TrackingOnly" Moore().UseTCK = False
Moore().EvtMax = -1 Moore().EnableTimer = True 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