Exemplo n.º 1
0
    def convertSelector(self, eventSelector=None):
        '''Input:  Modify an EventSelector to switch to the new input connection strings
        Go from a list of connection strings or file names to a new list of connection strings

        convertSelector(self, eventSelector=None)

        If eventSelector is None, the default EventSelector will be found.
        If an event selector is passed, that one will be modified

        '''
        #don't do anything if _my_ type is MDF to avoid overwiting everything forever
        if self._inputPersistency == "MDF":
            return eventSelector

        if eventSelector is None:
            from Gaudi.Configuration import EventSelector
            eventSelector = EventSelector()

        if type(eventSelector.Input) is not list:
            return eventSelector

        eventSelector.Input = self.convertConnectionStrings(
            eventSelector.Input, "I")

        return eventSelector
Exemplo n.º 2
0
    def inputFiles(self, files, clear=False, eventSelector=None):
        '''Input: wrapper for IOHelper.inputFiles, where the persistency
        type is guessed from the file extension

        inputFiles(<list_of_files>, clear=False, eventSelector=None)

        if clear is True, empty the existing EventSelector list
        '''
        #print eventSelector
        #print eventSelector.__slots__

        if type(files) is not list:
            raise TypeError, "You need to pass a list of input files, but you passed a " + str(
                type(files)) + " instead"

        if eventSelector is None:
            from Gaudi.Configuration import EventSelector
            eventSelector = EventSelector()

        if clear:
            eventSelector.Input = []

        for file in files:
            eventSelector = self.getIOHelper(file).inputFiles(
                [file], clear=False, eventSelector=eventSelector)

        return eventSelector
Exemplo n.º 3
0
    def extensionString(self, setPersistency=False, eventSelector=None):
        '''Input:  return a string of the IOExtension which could be used in a new-style gaudi card
        if setPersistency is True, the default persistency for DST-like files will be specified in the string'''

        if eventSelector is None:
            from Gaudi.Configuration import EventSelector
            eventSelector = EventSelector()

        retstr = 'from GaudiConf import IOExtension\n'

        files = eventSelector.Input
        if files is not None and type(files) is not list:
            raise TypeError, "The EventSelector does not have a list of input files"
        if not len(files): return retstr + 'IOExtension().inputFiles([])\n'

        ioh = self.getIOHelper(files[0])

        if setPersistency:
            retstr += 'IOExtension("' + self._rootTypePersistency + '").inputFiles([\n'
        else:
            retstr += "IOExtension().inputFiles([\n"
        alen = 4
        for file in files[:-1]:
            retstr += ' ' * alen + '"' + ioh.undressFile(file) + '",\n'
        for file in files[-1:]:
            retstr += ' ' * alen + '"' + ioh.undressFile(file) + '"\n'
        retstr += ' ' * alen + '])'

        return retstr
Exemplo n.º 4
0
def testthisiox(iox):
    print "- test file detection and dressing"
    inputs=[]
    basename='eggs'
    for ext in exts:
        basename+='.spam_'
        file = basename+ext
        inputs.append(file)
        print iox.detectFileType(file)
        print iox.detectMinType(inputs)
        for IO in ['I','O']:
            print iox.dressFile(file,IO)

    print '- check you take the last extension'
    print iox.detectFileType(''.join(exts))
    print iox.detectFileType(''.join(exts+[exts[0]]))
    
    print "- test getting ioh"
    
    for ext in exts:
        ioh=iox.getIOHelper(basename+ext)
        print ioh
        for oext in exts:
            ioh=iox.getCompleteIOHelper([basename+ext],basename+oext)
            print ioh
    
    print "- test inputting files"

    print inputs
    iox.inputFiles(inputs)
    
    from Gaudi.Configuration import EventSelector
    print EventSelector().Input
    
    print "- test outputting files"
    
    for ext in exts:
        iox.outputAlgs(basename+ext,writer='OutputStream/Alg'+ext.replace('.',''))
        iox.outStream(basename+ext,writer='OutputStream/Str'+ext.replace('.',''))
    
    streams=IOHelper().activeStreams()
    print streams
    for stream in streams:
        print stream.Output
    
    print "- test file extensions which should not be known"
    print [iox.detectFileType('ni'+file) for file in ext]

    print "- input card printing test"
    
    for setPersistency in [True, False]:
        print iox.extensionString(setPersistency=setPersistency)
    
    import commands
    
    
    for setPersistency in [True, False]:
        print commands.getstatusoutput("python -c '"+iox.extensionString(setPersistency=setPersistency)+"'")
Exemplo n.º 5
0
    def selectorString(self, eventSelector=None):
        '''Input:  return a string of the event selector which could be used in an old-style gaudi card
        '''

        if eventSelector is None:
            from Gaudi.Configuration import EventSelector
            eventSelector = EventSelector()

        retstr = 'from Gaudi.Configuration import EventSelector\n'
        retstr += eventSelector.getType() + '('
        if eventSelector.getType() != eventSelector.getName():
            retstr += eventSelector.getType()

        retstr += ').Input=[\n'

        files = eventSelector.Input
        if files is not None and type(files) is not list:
            raise TypeError, "The EventSelector does not have a list of input files"

        alen = 4
        for file in files[:-1]:
            retstr += ' ' * alen + '"' + file + '",\n'
        for file in files[-1:]:
            retstr += ' ' * alen + '"' + file + '"\n'
        retstr += ' ' * alen + ']'
        return retstr
Exemplo n.º 6
0
    def debugIO(self):
        '''Information: print properties of all configured svc streams and selectors'''
        from pprint import pprint
        print "=========================="
        print "Debugging Persistencies"
        print self.activePersistencies()
        print "=========================="
        print "Debugging External Services"
        for svc in self.externalServices():
            if type(svc) is str:
                print svc
                continue
            print svc.getFullName()
            pprint(svc.getValuedProperties())
        print "=========================="
        print "Debugging Persistency Services"
        for svc in self.activeServices():
            if type(svc) is str:
                print svc
                continue
            print svc.getFullName()
            pprint(svc.getValuedProperties())
        print "=========================="
        print "Debugging Streams"
        for stream in self.activeStreams():
            if type(stream) is str:
                print stream
                continue

            print stream.getFullName()
            # ignore DataInputs, DataOutputs properties (only in Gaudi v27r0)
            pprint(
                dict((k, v) for k, v in stream.getValuedProperties().items()
                     if k not in ('DataInputs', 'DataOutputs')))
        print "=========================="
        print "Debugging Input"
        from Gaudi.Configuration import EventSelector
        print EventSelector().getFullName()
        pprint(EventSelector().getValuedProperties())
        print "=========================="
Exemplo n.º 7
0
def testthisioh(ioh):
    print 'isRootSupported? ', ioh.isRootSupported()

    print '- filedressing tests'

    ifi = 'PFN:itest.txt'
    dressedI = ioh.dressFile(ifi, "I")

    print dressedI

    undressedI = ioh.undressFile(dressedI)

    if ifi != undressedI:
        print dressedI, "!=", undressedI

    ofi = 'PFN:otest.txt'
    dressedO = ioh.dressFile(ofi, "O")

    print dressedO

    undressedO = ioh.undressFile(dressedO)

    if ofi != undressedO:
        print dressedO, "!=", undressedO

    print "- input assignment tests"

    ioh.inputFiles(['test1.blah', 'test2.blah'])
    from Gaudi.Configuration import EventSelector
    print EventSelector().Input

    print ioh.selectorString()
    for setPersistency in [True, False]:
        print ioh.helperString(setPersistency=setPersistency)

    import commands

    print commands.getstatusoutput('python -c "' +
                                   ioh.selectorString().replace('"', '\\"') +
                                   '"')

    for setPersistency in [True, False]:
        print commands.getstatusoutput("python -c '" + ioh.helperString(
            setPersistency=setPersistency) + "'")

    print "- change service tests"

    ioh.changeServices()
    print ioh.activeServices()
Exemplo n.º 8
0
def setData ( files , catalogs = [] ) :
    """
    Define the input data for the job:
    
    >>> files    = [ 'file1.dst' , 'file2.dst' ]
    
    >>> catalogs = ....
    
    >>> import USERSCRIPT
    
    >>> USERSCRIPT.setData ( files , catalogs )
    
    """
    from GaudiPython.Bindings import _gaudi
    
    if   type ( files    ) is str   : files    =      [ files    ]
    elif type ( files    ) is tuple : files    = list ( files    ) 
    if   type ( catalogs ) is str   : catalogs =      [ catalogs ]    
    elif type ( catalogs ) is tuple : catalogs = list ( catalogs )
    
    if not issubclass ( type ( files    ) , list ) :
        files    = [ f for f in files    ] 
    if not issubclass ( type ( catalogs ) , list ) :
        catalogs = [ c for c in catalogs ] 
    
    if not _gaudi :               ## here we deal with configurables!
        
        if files :
            
            files = [ extendfile ( f ) for f in files ]
            
            from Gaudi.Configuration import EventSelector
            EventSelector ( Input = files )
            
        if catalogs :
            
            from Gaudi.Configuration import Gaudi__MultiFileCatalog as FileCatalog
            FileCatalog   ( Catalogs = catalogs )
            from Gaudi.Configuration import FileCatalog
            FileCatalog   ( Catalogs = catalogs )
            
    else :                        ## here we deal with the actual components
        
        if files : 
            _e = _gaudi.evtSel()
            _e.open ( files )
        if catalogs :
            _f = _gaudi.service ( 'FileCatalog' )
            _f.Catalogs = catalogs
Exemplo n.º 9
0
    def inputFiles(self, files, clear=False, eventSelector=None):
        '''Input:  Edit the content of EventSelector and fill the Inputs with
        Go from a list of connection strings or file names to a new list of connection strings

        inputFiles(self,files,clear=True, eventSelector=None)

        If eventSelector is None, the default EventSelector will be found.
        If an event selector is passed, that one will be modified

        If clear is True the original Inputs are overwritten.
        If clear is False the original Inputs are also kept.
        '''

        if type(files) is not list:
            raise TypeError, "You need to pass a list of files to InputFiles, you have passed a " + str(
                type(files)) + " instead"

        if eventSelector is None:
            from Gaudi.Configuration import EventSelector
            eventSelector = EventSelector()

        if clear:
            eventSelector.Input = []

        if not clear:
            self.convertSelector(eventSelector)

        for file in files:
            #never convert a dressed MDF file, it's not needed
            if self.detectFileType(file) == "MDF":
                eventSelector.Input.append(file)
                continue
            eventSelector.Input += [
                self.dressFile(self.undressFile(file), 'I')
            ]
        return eventSelector
Exemplo n.º 10
0
    def helperString(self, eventSelector=None, setPersistency=False):
        '''Input:  return a string of the IOHelper which could be used in a new-style gaudi card
        if setPersistency is True, the given persistencies will be specified in the string
        '''

        if eventSelector is None:
            from Gaudi.Configuration import EventSelector
            eventSelector = EventSelector()

        retstr = 'from GaudiConf import IOHelper\n'

        files = eventSelector.Input
        if files is not None and type(files) is not list:
            raise TypeError, "The EventSelector does not have a list of input files"

        if not len(files): return retstr + 'IOHelper().inputFiles([])\n'

        #needs to be more complicated to handle MDF and Root files
        #first group into lists of the different types
        atype = self.detectFileType(files[0])
        grouped_files = [[]]
        group = 0
        for file in files:
            newtype = self.detectFileType(file)
            if newtype == atype:
                grouped_files[group].append(file)
                continue

            atype = newtype
            group = group + 1
            grouped_files.append([])
            grouped_files[group].append(file)

        #then loop over the groups
        for agroup in grouped_files:
            retstr += self._subHelperString(agroup, setPersistency) + '\n'

        return retstr
Exemplo n.º 11
0
def configureFileStager(keep=False, tmpdir=None, garbageCommand='garbage.exe'):
    import os
    if os.name != 'posix': return

    from Gaudi.Configuration import ApplicationMgr, EventSelector
    from Configurables import FileStagerSvc
    from Configurables import Gaudi__StagedIODataManager as IODataManager
    from Configurables import LHCb__RawDataCnvSvc as RawDataCnvSvc

    ApplicationMgr().ExtSvc += ['FileStagerSvc']

    # Remove existing IODataManager
    name = 'Gaudi::IODataManager/IODataManager'
    if name in ApplicationMgr().ExtSvc:
        ApplicationMgr().ExtSvc.remove(name)

    # Remove existing IODataManager
    from Gaudi.Configuration import allConfigurables
    if "IODataManager" in allConfigurables:
        del allConfigurables["IODataManager"]
    # Add our datamanager
    mgr = IODataManager("IODataManager")

    ApplicationMgr().ExtSvc += [mgr.getFullName()]

    from os import environ, listdir
    svc = FileStagerSvc()
    if tmpdir:
        svc.Tempdir = tmpdir
    svc.KeepFiles = keep
    svc.GarbageCollectorCommand = garbageCommand
    svc.CheckForLocalGarbageCollector = True

    # Configure other services to use the correct ones
    RawDataCnvSvc('RawDataCnvSvc').DataManager = mgr.getFullName()
    EventSelector().StreamManager = "StagedStreamTool"

    return svc
Exemplo n.º 12
0
def setData(files, catalogs=[], castor=False, grid=None):
    """ Define the input data for Bender job:    
    >>> files    = [ 'file1.dst' , 'file2.dst' ]    
    >>> catalogs = ....    
    >>> import USERSCRIPT    
    >>> USERSCRIPT.setData ( files , catalogs )    
    """

    if type(files) is str: files = [files]
    elif type(files) is tuple: files = list(files)
    if type(catalogs) is str: catalogs = [catalogs]
    elif type(catalogs) is tuple: catalogs = list(catalogs)

    if not issubclass(type(files), list):
        files = [f for f in files]
    if not issubclass(type(catalogs), list):
        catalogs = [c for c in catalogs]

    from GaudiPython.Bindings import _gaudi
    if not _gaudi:  ## here we deal with configurables!

        from Configurables import Gaudi__RootCnvSvc
        rcnv = Gaudi__RootCnvSvc('RootCnvSvc')
        rcnv.CacheBranches = []
        rcnv.VetoBranches = ['*']

        if files:

            from Bender.DataUtils import extendfile2
            files = [extendfile2(f, castor, grid) for f in files]

            from Gaudi.Configuration import EventSelector
            inpts = EventSelector().Input
            inpts += files
            EventSelector(Input=inpts)

        if catalogs:

            from Gaudi.Configuration import Gaudi__MultiFileCatalog as FileCatalog
            ctlgs = FileCatalog().Catalogs

            cc = []
            for c in catalogs:
                if c in cc: continue
                if 1 <= c.find('.xml'):
                    import os
                    if os.path.exists(c) or 0 != c.find('xmlcatalog_file:'):
                        logger.debug('Prepend catalog with protocol: %s' % c)
                        c = 'xmlcatalog_file:' + c
                if c in cc: continue
                cc.append(c)

            logger.debug('The catalogs: %s' % cc)
            ctlgs += cc

            FileCatalog(Catalogs=ctlgs)
            logger.debug('FileCatalog:\n %s' % FileCatalog())

            ## from Gaudi.Configuration import FileCatalog

    else:  ## here we deal with the actual components

        rcnv = _gaudi.service('Gaudi::RootCnvSvc/RootCnvSvc')
        rcnv.CacheBranches = []
        rcnv.VetoBranches = ['*']

        if files:

            from Bender.DataUtils import extendfile1
            files = [extendfile1(f, castor) for f in files]

            _e = _gaudi.evtSel()
            _e.open(files)

        if catalogs:
            _f = _gaudi.service('FileCatalog')
            _f.Catalogs = catalogs
#LHCbApp().CondDBtag = "HEAD"
LHCbApp().DDDBtag = 'head-20110823'
LHCbApp().CondDBtag = 'head-20110901'

from Configurables import (CondDB, CondDBAccessSvc)
cdb = CondDB()
#cdb.PartitionConnectionString["ONLINE"] = "sqlite_file:/afs/cern.ch/user/w/wouter/public/AlignDB/ONLINE-201103.db/ONLINE"
#cdb.Tags["ONLINE"] = "fake"

# maybe it works if we read it as a layer?
myOnline = CondDBAccessSvc('MyOnline')
myOnline.ConnectionString = 'sqlite_file:/afs/cern.ch/user/w/wouter/public/AlignDB/ONLINE-2011.db/ONLINE'
CondDB().addLayer(myOnline)
#importOptions("$APPCONFIGOPTS/DisableLFC.py")
cdb.UseOracle = False
cdb.DisableLFC = True

import os
runnr = os.environ['RUNNR']

filenames = ['/pool/spool/wouter/dimuons_%s.dst' % runnr]
for f in filenames:
    fullname = "DATAFILE='" + f + "' TYP='POOL_ROOTTREE' OPT='READ'"
    EventSelector().Input.append(fullname)

print "EvenSelector.Input:", EventSelector().Input

from Configurables import EventClockSvc
#EventClockSvc().InitialTime = 1314000149027776000
EventClockSvc().InitialTime = int(os.environ['INITIALTIME'])
Exemplo n.º 14
0
vetra.HistogramFile = "/PUVetoAlg_vetra63466.root"
# default settings
LHCbApp().DDDBtag = 'head-20080905'
LHCbApp().CondDBtag = 'head-20080905'

from Configurables import PuVetoAlg
l0PuVeto = PuVetoAlg()
l0PuVeto.OutputLevel = 3
# if in TAE mode...
#l0PuVeto.RawEventLocation = 'Prev1/DAQ/RawEvent'
#l0PuVeto.OutputFileName = "/calib/trg/l0pus/BeamData/PUVetoAlg_l0PuVeto63466.root"
#l0PuVeto.MakePlots = True

moniL0Pu = GaudiSequencer('Moni_L0PileUp')
moniL0Pu.Members = [l0PuVeto]


def myPU():
    GaudiSequencer('MoniVELOSeq').Members = [moniL0Pu]


appendPostConfigAction(myPU)

EventSelector().FirstEvent = 1
EventSelector().PrintFreq = 1
EventSelector().Input = [
    "DATAFILE='/daqarea/lhcb/data/2009/RAW/FULL/LHCb/COLLISION09/63466/063466_0000000001.raw' SVC='LHCb::MDFSelector'"
]

###############################################################################
Exemplo n.º 15
0
    print [iox.detectFileType('ni'+file) for file in ext]

    print "- input card printing test"
    
    for setPersistency in [True, False]:
        print iox.extensionString(setPersistency=setPersistency)
    
    import commands
    
    
    for setPersistency in [True, False]:
        print commands.getstatusoutput("python -c '"+iox.extensionString(setPersistency=setPersistency)+"'")


persistencies=[None, "ROOT"]

for persistency in persistencies:
    print '============================='
    print persistency
    print '============================='

    print "- input conversion tests "
    #preload with MDF
    
    iox=IOExtension(persistency)
    
    from Gaudi.Configuration import EventSelector
    EventSelector().Input=[]
    
    testthisiox(iox)
Exemplo n.º 16
0
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)
Exemplo n.º 17
0
LHCbApp().DDDBtag = "head-20100119"
LHCbApp().CondDBtag = "head-20091112"

# Latest cosmic run, with CALO, OT and (!!) RICH2 (35569 events)

# wouter's dsts
data = [
    'PFN:/data/user/data/2008/RAW/LHCb/wouter/run34120.dst',
    'PFN:/data/user/data/2008/RAW/LHCb/wouter/run31225.dst',
    'PFN:/data/user/data/2008/RAW/LHCb/wouter/run31557.dst',
    'PFN:/data/user/data/2008/RAW/LHCb/wouter/run34083.dst',
    'PFN:/data/user/data/2008/RAW/LHCb/wouter/run34117.dst'
]

# do not do the TES check because these data do not have the required lists
#GaudiSequencer("InitReprocSeq").Enable = False

EventSelector().Input = []
for d in data:
    name = "DATAFILE='" + d + "' TYP='POOL_ROOTTREE' OPT='READ'"
    EventSelector().Input.append(name)

# raw data
#Escher().InputType = 'MDF'
#data = [
#   'PFN:castor:/castor/cern.ch/grid/lhcb/data/2008/RAW/LHCb/BEAM/34120/034120_0000085567.raw' ]
#EventSelector().Input = []
#for d in data:
#    name = "DATAFILE='" + d + "' SVC='LHCb::MDFSelector'"
#    EventSelector().Input.append( name )
Exemplo n.º 18
0
    ioh.changeServices()
    print ioh.activeServices()


persistencies = [None, "ROOT", "MDF"]
if IOHelper().isPoolSupported():
    persistencies.append("POOL")

for persistency in persistencies:
    print '============================='
    print persistency
    print '============================='

    print "- input conversion tests "
    #preload with MDF
    iohm = IOHelper("MDF", "MDF")
    iohm.inputFiles(['IAMdf.mdf', 'IALSOAMdf.blah'])

    ioh = IOHelper(persistency, persistency)
    ioh.convertSelector()

    from Gaudi.Configuration import EventSelector
    print EventSelector().Input
    print ioh.selectorString()
    print ioh.helperString()

    EventSelector().Input = []

    testthisioh(ioh)
Exemplo n.º 19
0
def _minSetFileTypes():
    from GaudiConf import IOExtension
    from Gaudi.Configuration import EventSelector
    from Configurables import Moore
    files = Moore().inputFiles + EventSelector().Input
    return IOExtension().detectMinType(files)
Exemplo n.º 20
0
locationRoot = '/Event/MicroDST'
microDSTFile = ['']
histoFileName = "tags.root"
histoFile = HistoFile(histoFileName)
opts, args = getopt.getopt(sys.argv[1:], "i:r:h", ["input=", "root=", "help"])

for o, a in opts:
    if o in ("-h", "--help"):
        printHelp()
    elif o in ("-i", "--input"):
        microDSTFile = a
    elif o in ("-r", "--root"):
        locationRoot = a

# get rid of some spam
EventSelector().PrintFreq = 100

from MicroDSTExample.Selections import SeqBs2Jpsi2MuMuPhi2KK
selSequence = SeqBs2Jpsi2MuMuPhi2KK.SeqBs2Jpsi2MuMuPhi2KK
mainLocation = selSequence.outputLocation()

# set up some useful paths of locations on the MicroDST
flavTagPath = locationRoot + "/" + mainLocation + "/FlavourTags"
lhcbApp = LHCbApp()
lhcbApp.DDDBtag = 'default'
lhcbApp.CondDBtag = 'default'

appMgr = AppMgr(outputlevel=4)
appMgr.config(files=['$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts'])
appMgr.initialize()
appMgr.ExtSvc += ['LHCb::ParticlePropertySvc']
Exemplo n.º 21
0
for runnr in runnrs:
    put, get = os.popen4("rfdir " + path + runnr)
    for line in get.readlines():
        splittedline = line.split(' ')
        filestring = splittedline[len(splittedline) - 1].strip(' ')
        filestring = filestring.replace('\n', '')
        print 'adding file: ', runnr + "/" + filestring
        data.append((path + runnr, filestring))

# let's take only the first one
data = [data[0]]

print "found data files: ", data

# now stage the files locally. they will not like this:-)
EventSelector().Input = []
import os
targetdir = '/tmp/wouter/'

if os.path.isdir('/pool/spool/'):
    if not os.path.exists('/pool/spool/wouter'):
        os.system('mkdir /pool/spool/wouter')
    targetdir = '/pool/spool/wouter/'

for d in data:
    print 'd:', d
    if not os.path.exists(targetdir + d[1]):
        os.system('rfcp ' + d[0] + "/" + d[1] + ' ' + targetdir)
    EventSelector().Input.append("DATAFILE='" + targetdir + d[1] + "' " +
                                 "SVC='LHCb::MDFSelector'")