def setLines(desiredlines1, desiredlines2): from HltLine.HltLine import hlt1Lines lines1 = [i for i in hlt1Lines() if i.name() in desiredlines1] Sequence("Hlt1").Members = [i.configurable() for i in lines1] from HltLine.HltLine import hlt2Lines lines2 = [i for i in hlt2Lines() if i.name() in desiredlines2] Sequence("Hlt2").Members = [i.configurable() for i in lines2] from HltConf.HltMonitoring import HltMonitoringConf HltMonitoringConf().configureHltMonitoring(lines1, lines2) Sequence("HltEndSequence").Members = []
def configureHltMonitoring(self, lines1, lines2): """ HLT Monitoring configuration """ ## Only do things here that need to know the list of instantiated HLT ## lines. This function is called from the postConfigAction of ## HltConf.Configuration. monSeq = self.getProp("MonitorSequence") monSeq.IgnoreFilterPassed = True # enforce execution of all sub-sequences if lines1: hlt1Mon = self.__hlt1_monitoring(lines1) monSeq.Members += [hlt1Mon] if lines2: hlt2Mon = self.__hlt2_monitoring(lines2) monSeq.Members += [hlt2Mon] # Disable production of histograms for all (most) of the algorithms from HltLine.HltLine import hlt1Lines, hlt2Lines if self.getProp('HistogrammingLevel') == 'None': for i in hlt1Lines() + hlt2Lines(): _disableHistograms(i.configurable()) elif self.getProp('HistogrammingLevel') == 'Line': for i in hlt1Lines() + hlt2Lines(): _disableHistograms(i.configurable(), lambda x: x.getType() != 'Hlt::Line') elif self.getProp('HistogrammingLevel') == 'NotLine': for i in hlt1Lines() + hlt2Lines(): _disableHistograms(i.configurable(), lambda x: x.getType() == 'Hlt::Line') else: ValueError( "HltMonitoringConf: HistogrammingLevel property must be set to 'None', 'Line' or 'NotLine'." ) # Enable production of histograms for some algorithms, see _enableMonitoring() if self.getProp('EnableAlgMonitoring'): for i in hlt1Lines() + hlt2Lines(): _recurse(i.configurable(), _enableMonitoring)
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 from HltConf.HltMonitoring import HltMonitoringConf HltMonitoringConf().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 = []
def postConfigAction(self): from Configurables import GaudiSequencer as Sequence from Configurables import HltConf 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 from HltConf.HltMonitoring import HltMonitoringConf HltMonitoringConf().configureHltMonitoring(lines1, lines2) #HltConf().configureHltMonitoring( lines1, lines2 ) for hltLine in Sequence("Hlt1").Members + Sequence("Hlt2").Members: if hasattr(hltLine, "Prescale"): hltLine.Prescale.AcceptFraction = 1 try: postscale = getattr(hltLine, "Postscale") if hasattr(postscale, "AcceptFraction"): postscale.AcceptFraction = 1 elif hasattr(postscale, "Code"): postscale.Code = "FALL" except AttributeError: pass