示例#1
0
def extendfile2 ( filename       ,
                  castor = False ,
                  grid   = ''    ) :
    """
    Helper function to 'extend' the short file name 
    """
    ##
    from GaudiPython.Bindings import _gaudi
    ##
    if 0 <= filename.find ( ' '         ) : return filename
    if 0 <= filename.find ( 'DATAFILE=' ) : return filename
    ##
    ## @see extendfile1 
    filename = extendfile1 ( filename , castor , grid ) 
    ##
    ##
    #
    from GaudiConf import IOHelper
    #
    fname_upper = filename.upper()
    #
    if 0 < fname_upper.find ( '.MDF' ) or \
       0 < fname_upper.find ( '.RAW' ) :
        ioh = IOHelper ( Input = 'MDF'  , Output = 'ROOT' )
    else :
        ioh = IOHelper ( Input = 'ROOT' , Output = 'ROOT' )
        #
    iohstr = str(ioh) 
    if not _gaudi and not _local_dict_.has_key( iohstr ) : 
        logger.verbose ( 'extendfile2: make use of IOHelper.setupServices() ')
        ioh.setupServices ()
        _local_dict_[ iohstr ] = 1
        ##
    #
    return ioh.dressFile ( filename , 'I')
示例#2
0
    def _action():
        """
        Reset all DaVinci sequences
        """
        from Gaudi.Configuration import allConfigurables
        from Gaudi.Configuration import getConfigurable
        for seq in ('DaVinciInitSeq', 'DaVinciMainSequence', 'DaVinciSequence',
                    'MonitoringSequence', 'FilteredEventSeq'):

            if not seq in allConfigurables: continue
            cSeq = getConfigurable(seq)
            if cSeq and hasattr(cSeq, 'Members'):
                logger.info('Reset the sequence %s' % cSeq.name())
                cSeq.Members = []

            ## reset the list of top-level algorithms
            from Configurables import ApplicationMgr
            a = ApplicationMgr()
            a.TopAlg = []
            a.OutputLevel = options.OutputLevel

            from Configurables import MessageSvc
            m = MessageSvc(OutputLevel=options.OutputLevel)

            from GaudiConf import IOHelper
            ioh = IOHelper()
            ioh.setupServices()
示例#3
0
def copyGoodEvents(filename, extraitems=[], incident='GoodEvent'):
    """
    Utitity to copy ``good/tagged'' events

    It is based on configurables,
    thus it needs to be invoked BEFORE GaudiPython
    
    #
    ##Configurables:
    #
    from Bender.Utils import copyGoodEvents
    copyGoodEvents ( filename = 'SelectedEvents' )
    
    """
    from GaudiConf import IOHelper
    ioh = IOHelper('ROOT', 'ROOT')
    algs = ioh.outputAlgs(filename, 'InputCopyStream/%s' % incident)

    ioh.setupServices()
    from Configurables import Gaudi__IncidentFilter as Tagger
    tag = Tagger("%sInc" % incident, Incidents=[incident])

    from Configurables import GaudiSequencer
    seq = GaudiSequencer('%sSeq' % incident, Members=[tag] + algs)

    from Configurables import ApplicationMgr
    AM = ApplicationMgr()

    if not AM.OutStream: AM.OutStream = []

    AM.OutStream.append(seq)

    logger.info("Prepare the file %s to keep ``%s'' incidents" %
                (filename, incident))