def addTT(): import Gaudi from Gaudi.Configuration import ApplicationMgr, AuditorSvc try: from Configurables import LHCbTimingAuditor as TA from Configurables import LHCbSequencerTimerTool as STT except ImportError: from Configurables import TimingAuditor as TA from Configurables import SequencerTimerTool as STT timer=TA("TIMER") timer.addTool(STT,"TIMER") if hasattr(timer.TIMER, "SummaryFile") or "SummaryFile" in timer.TIMER.__slots__: timer.TIMER.SummaryFile=Gaudi.Diff["prefix"]+".csv" if 'AuditorSvc' not in ApplicationMgr().ExtSvc : ApplicationMgr().ExtSvc.append( 'AuditorSvc' ) #swap your timer for mine ;) remove=[] for auditor in AuditorSvc().Auditors: sauditor=auditor if type(sauditor) is not str: sauditor=auditor.getFullName() if "TIMER" or "TimingAuditor" in auditor: remove.append(auditor) AuditorSvc().Auditors=[a for a in AuditorSvc().Auditors if a not in remove] AuditorSvc().Auditors.append(timer) timer.Enable=True
def _profile(self): ApplicationMgr().AuditAlgorithms = 1 auditors = self.getProp('EnableAuditor') if hasattr(self, "EnableTimer") and self.getProp('EnableTimer') is not None: #print self.getProp('EnableTimer') from Configurables import LHCbTimingAuditor, LHCbSequencerTimerTool LHCbTimingAuditor('TIMER').addTool(LHCbSequencerTimerTool, name="TIMER") LHCbTimingAuditor('TIMER').TIMER.NameSize = self.getProp( "TimingTableWidth") auditors = [LHCbTimingAuditor('TIMER')] + auditors if type(self.getProp('EnableTimer')) is not bool and len( self.getProp('EnableTimer')): LHCbTimingAuditor('TIMER').TIMER.SummaryFile = self.getProp( 'EnableTimer') #LHCbSequencerTimerTool().SummaryFile=self.getProp('EnableTimer') for i in auditors: self.addAuditor(i)
# to DEFAULT_TURBO_BANKS. non_default_raw_bank_types = { # Full-like line # does not influence what is kept since it is filtered by the stream filter 'Hlt2DiMuonBDecision': list(set(ALL_RAWBANKS) - set(['DstData'])), # Let's try to keep some Muon banks for a muon line and Rich for charm 'Hlt2DiMuonBTurboDecision': DEFAULT_TURBO_BANKS + ['Muon'], 'Hlt2CharmHadDspToPimPipPipTurboDecision': DEFAULT_TURBO_BANKS + ['Rich'], 'Hlt2CharmHadD02KmPipTurboDecision': DEFAULT_TURBO_BANKS + ['Rich'], # Very important line, so let's keep everything 'Hlt2CharmHadDpToKmPipPip_ForKPiAsymTurboDecision': ALL_RAWBANKS, } ApplicationMgr().ExtSvc.append(svc.getFullName()) # Setup the timing table LHCbTimingAuditor('TIMER').addTool(LHCbSequencerTimerTool, name="TIMER") ApplicationMgr().ExtSvc.append('AuditorSvc') AuditorSvc().Auditors.append(LHCbTimingAuditor('TIMER')) ApplicationMgr().AuditAlgorithms = True # Setup the input data test_file_db['HltDAQ-routingbits_full'].run(configurable=LHCbApp()) # LHCbApp().SkipEvents = EventSelector().PrintFreq = 100 # Get rid of warnings IODataManager().DisablePFNWarning = True HistogramPersistencySvc().OutputLevel = 5 LoKiSvc().Welcome = False # Filter nanofied events if the file is HLT2 accepted
#!/usr/bin/env gaudirun.py # # Minimal file for running Moore from python prompt # Syntax is: # gaudirun.py ../options/Moore.py # or just # ../options/Moore.py # import Gaudi.Configuration from Moore.Configuration import Moore Moore().EvtMax = 1200 Moore().ForceSingleL0Configuration = False from Configurables import LHCbTimingAuditor, LHCbSequencerTimerTool LHCbTimingAuditor("TIMING").addTool(LHCbSequencerTimerTool, "TIMING") #normalize the timing table in tests LHCbTimingAuditor("TIMING").TIMING.Normalised = True
def configure(**kwargs): # Add some expected stuff to OnlineEnv import OnlineEnv from Gaudi.Configuration import INFO, WARNING output_level = kwargs.pop('OutputLevel', WARNING) OnlineEnv.OutputLevel = output_level moore_tests = __import__("MooreTests", globals(), locals(), [kwargs.get('UserPackage')]) user_package = getattr(moore_tests, kwargs.pop('UserPackage')) input_type = kwargs.pop('InputType', 'MEP') # Only a single setting directly for Moore from Moore.Configuration import Moore, MooreExpert moore = Moore() moore.OutputLevel = output_level moore.RunOnline = True # We need MooreOnline to setup the buffer manager infrastructure etc, but we # don't want to use things like the RunChangeHandler and database snapshots. from MooreOnlineConf.Configuration import MooreOnline mooreOnline = MooreOnline() mooreOnline.RunOnline = False mooreOnline.EnableTimer = False mooreOnline.EnableRunChangeHandler = None mooreOnline.UseDBSnapshot = False mooreOnline.CheckOdin = False mooreOnline.EnableUpdateAndReset = False # Add the timing auditor by hand with output level INFO, as Moore is never # going to do it for us if the rest is at WARNING from Gaudi.Configuration import ApplicationMgr, AuditorSvc from Configurables import LHCbTimingAuditor, LHCbSequencerTimerTool ApplicationMgr().AuditAlgorithms = 1 ta = LHCbTimingAuditor('TIMER') ta.OutputLevel = INFO ta.addTool(LHCbSequencerTimerTool, name='TIMER') ta.TIMER.NameSize = 90 ta.TIMER.OutputLevel = INFO if 'AuditorSvc' not in ApplicationMgr().ExtSvc: ApplicationMgr().ExtSvc.append('AuditorSvc') AuditorSvc().Auditors.append(ta) ta.Enable = True # Hack the shit out of the CondDB services to stop them from spawning a # thread that will segfault on finalize with forking def no_timeout(): from Gaudi.Configuration import allConfigurables from Configurables import CondDBAccessSvc for conf in allConfigurables.itervalues(): if type(conf) == CondDBAccessSvc: conf.ConnectionTimeOut = 0 from Gaudi.Configuration import appendPostConfigAction appendPostConfigAction(no_timeout) ## from Gaudi.Configuration import appendPostConfigAction ## def info_dammit(): ## from Configurables import LHCbTimingAuditor, LHCbSequencerTimerTool ## ta = LHCbTimingAuditor('TIMER') ## ta.OutputLevel = OnlineEnv.OutputLevel ## ta.addTool(LHCbSequencerTimerTool, name = 'TIMER') ## ta.TIMER.OutputLevel = OnlineEnv.OutputLevel ## appendPostConfigAction(info_dammit) userOptions = user_package.MooreOptions # This is the stuff that should come from the PRConfig user module # This is the stuff that should come from the PRConfig user module for conf, d in { moore: { 'DDDBtag': str, 'CondDBtag': str }, mooreOnline: { 'UseTCK': bool, 'Simulation': bool, 'DataType': tuple(str(y) for y in range(2011, 2017)), 'HltLevel': ('Hlt1', 'Hlt2', 'Hlt1Hlt2') } }.iteritems(): for a, t in d.iteritems(): ua = userOptions.pop(a) if hasattr(t, '__iter__'): if ua not in t: raise ValueError( 'Property %s should be one of %s, not %s.' % (a, t, ua)) else: if type(ua) != t: raise ValueError( 'Property %s should be of type %s, not %s.' % (a, t, ua)) conf.setProp(a, ua) if 'InitialTCK' in userOptions: moore.setProp('InitialTCK', userOptions['InitialTCK']) if userOptions.pop('Split', None): print 'WARNING: Split property is ignored, value from HltLevel will be used instead.' if mooreOnline.getProp('HltLevel') == 'Hlt1Hlt2': moore.setProp('Split', '') else: moore.setProp('Split', mooreOnline.getProp('HltLevel')) if input_type == 'MEP' and 'Hlt1' in mooreOnline.HltLevel: mooreOnline.REQ1 = "EvType=1;TriggerMask=0xffffffff,0xffffffff,0xffffffff,0xffffffff;VetoMask=0,0,0,0;MaskType=ANY;UserType=ONE;Frequency=PERC;Perc=100.0" elif input_type == 'MDF' and 'Hlt1' in mooreOnline.HltLevel: mooreOnline.ForceMDFInput = True mooreOnline.REQ1 = "EvType=2;TriggerMask=0xffffffff,0xffffffff,0xffffffff,0xffffffff;VetoMask=0,0,0,0;MaskType=ANY;UserType=ONE;Frequency=PERC;Perc=100.0" elif mooreOnline.HltLevel == 'Hlt2': mooreOnline.REQ1 = "EvType=2;TriggerMask=0xffffffff,0xffffffff,0xffffffff,0xffffffff;VetoMask=0,0,0,0;MaskType=ANY;UserType=ONE;Frequency=PERC;Perc=100.0" # Apparently we need to set this, otherwise something goes wrong with # default properties being retrieved that have the wrong type. from Gaudi.Configuration import EventSelector moore.inputFiles = [] EventSelector().Input = [] # Extra options from Configurables import MooreExpert userOptions.update(kwargs) for k, v in userOptions.iteritems(): #iterate through the available configurables to set required properties found = False for conf in [mooreOnline, moore, MooreExpert()]: if k in conf.__slots__ or hasattr(conf, k): conf.setProp(k, v) found = True break if not found: print "# WARNING: skipping setting '" + str(k) + ":" + str( v) + "' because no configurable has that option" user_package.configure() OnlineEnv.end_config(False)
from PRConfig import TestFileDB TestFileDB.test_file_db["2012_raw_default"].run() from Configurables import createODIN, EventCountAlg, PostScaler ApplicationMgr().TopAlg += [ createODIN(), EventCountAlg(), PostScaler(), GaudiSequencer("WAAAATUP") ] from Configurables import LHCbTimingAuditor, LHCbSequencerTimerTool, TimingAuditor, AuditorSvc LHCbTimingAuditor().addTool(LHCbSequencerTimerTool, name="TIMER") LHCbTimingAuditor().TIMER.SummaryFile = "timing.dat" LHCbTimingAuditor().TIMER.OutputLevel = DEBUG LHCbTimingAuditor().TIMER.NameSize = 2 ApplicationMgr().ExtSvc.append('AuditorSvc') AuditorSvc().Auditors.append(LHCbTimingAuditor()) LHCbTimingAuditor().Enable = True LHCbTimingAuditor().OutputLevel = VERBOSE AuditorSvc().Auditors.append(TimingAuditor()) TimingAuditor().Enable = True from Configurables import IODataManager IODataManager().DisablePFNWarning = True
from Configurables import HltOutputSvc, HltOutputSequence outputSvc = HltOutputSvc() ApplicationMgr().ExtSvc += [outputSvc] from Configurables import GaudiSequencer as Sequence from Configurables import LHCb__RawEventCopy as RawEventCopy from Configurables import DeterministicPrescaler from PRConfig.TestFileDB import test_file_db test_file_db['2015HLTValidationData_L0filtered_0x0050'].run(configurable=app) from Configurables import LHCbTimingAuditor, LHCbSequencerTimerTool, AuditorSvc from Configurables import SequencerTimerTool SequencerTimerTool().OutputLevel = 4 ApplicationMgr().ExtSvc.append('AuditorSvc') ta = LHCbTimingAuditor('TIMER', Enable=True) ta.addTool(LHCbSequencerTimerTool, name='TIMER') AuditorSvc().Auditors.append(ta) sequence = GaudiSequencer("TopSequence", IgnoreFilterPassed=True) def groupName(subs): return sorted(subs)[0] groups = {("Full", "TurboFull"): 0.5, ("Turbo", ): 0.2} filters = {} for substreams, fraction in groups.iteritems(): gn = sorted(substreams)[0]