Ejemplo n.º 1
0
def configure( gaudi = None  ) :
    """ Configuration of the job """

    if not gaudi :
        from GaudiPython.Bindings import AppMgr
        gaudi = AppMgr()

    gaudi.JobOptionsType       = 'NONE'
    gaudi.EvtSel               = 'NONE'
    gaudi.HistogramPersistency = 'ROOT'

    gaudi.ExtSvc += ["NTupleSvc" ]

    ntSvc = gaudi.service('NTupleSvc')
    ntSvc.Output = [ "MYLUN DATAFILE='TupleEx.root' OPT='NEW' TYP='ROOT'" ]

    gaudi.config()

    gaudi.DLLs = [ 'GaudiAlg', 'RootHistCnv', ]

    alg = TupleEx(
        ## configure the property
        NTupleLUN = 'MYLUN'
        )
    
    gaudi.setAlgorithms( [alg] )

    return SUCCESS
Ejemplo n.º 2
0
def configure() :
        
    importOptions('Common.opts')
    
    ApplicationMgr (
        TopAlg = [
        HelloWorld() ,
        GaudiSequencer ( 'MySequencer'      ,
                         MeasureTime = True , 
                         Members = [ HelloWorld ('Hello1') ,
                                     HelloWorld ('Hello2') ] )
        ] , 
        # do not use any event input
        EvtSel = 'NONE'
        )

    
    gaudi = AppMgr()
    
    ## create two "identical" algorithms:
    
    myAlg1 = SimpleAlgo ( 'Simple1' )
    myAlg2 = SimpleAlgo ( 'Simple2' )

    ## Adding something into TopAlg-sequence is OK:
    gaudi.setAlgorithms( [ myAlg1 ] + gaudi.TopAlg )
    
    ## Extending of "other"-sequences causes failures: 
    seq = gaudi.algorithm('MySequencer')    

    seq.Members += [ 'HelloWorld/Hello3']   ## it is ok 
    seq.Members += [ myAlg2.name() ]        ## it fails 
    
    cpp.StatusCode.enableChecking ()
Ejemplo n.º 3
0
def useScript( histos ) :
    "  the third way to convert AIDA histograms into ROOT "
    
    from GaudiPython.Bindings import AppMgr
    g    = AppMgr()

    hsvc = g.histsvc()

    i = 0
    for histo in histos :
        root   = hsvc.getAsROOT(histo)
        if not root :
            print "ERROR in access the histogram '%s' "%histo
            continue
        canvas = ROOT.TCanvas('canvas_%d' % i,histo,250,250)
        root.Draw()
        name = histo.replace ('/','_')
        name = name.replace  ('\\','_')
        name = name.replace  ('"','_')
        name = name.replace  ("'",'_')
        name = name.replace  ("'",'_')
        name = name.replace  (" ",'_')
        name = name.replace(os.sep,'_') + '.png'
        if os.path.exists(name):
            # strictly speaking, it is not needed, but avoids a message on the stderr
            os.remove(name)
        canvas.Print(name)
        print "The file name is '%s'"%name
        i += 1
Ejemplo n.º 4
0
def _getAppMgr   ( **kwargs  ) :
    """
    Helper private auxiliary function to get Application Manager
    """
    gaudi = kwargs.get ( 'gaudi' , None )
    if not gaudi : gaudi = AppMgr()
    if not gaudi : raise RuntimeError, 'Unable to get valid ApplicationMgr'

    state = gaudi._isvc.FSMState()
    if state < cpp.Gaudi.StateMachine.CONFIGURED  : gaudi.config     ()
    state = gaudi._isvc.FSMState()
    if state < cpp.Gaudi.StateMachine.INITIALIZED : gaudi.initialize ()

    return gaudi                                               ## RETURN
Ejemplo n.º 5
0
def _getToolSvc(**kwargs):
    """ Helper private auxillary utility to get Tool Service """
    svc = kwargs.get("toolSvc", None)
    if not svc:
        svc = kwargs.get("toolsvc", None)
    if not svc:
        svc = kwargs.get("service", None)
    if not svc:
        svc = kwargs.get("svc", None)
    else:
        return svc  ## RETURN
    gaudi = kwargs.get("gaudi", None)
    if not gaudi:
        gaudi = AppMgr()
    return gaudi.toolsvc()  ## RETURN
Ejemplo n.º 6
0
def configure( gaudi = None  ) :
    """ Configuration of the job """

    import HistoEx
    
    if not gaudi :
        from GaudiPython.Bindings import AppMgr
        gaudi = AppMgr()

    HistoEx.configure( gaudi )

    alg = HistoEx1('HistoEx1')
    gaudi.addAlgorithm( alg )

    alg.HistoPrint = True

    return SUCCESS
Ejemplo n.º 7
0
def configure( gaudi = None ) :
    """ the main configuration method """

    if not gaudi :
        from GaudiPython.Bindings import AppMgr
        gaudi = AppMgr()

    # reuse the previous example
    import HistoEx2
    HistoEx2.configure( gaudi )

    # create the algorithms
    alg1 = Aida2RootEx1()
    alg2 = Aida2RootEx2()
    # append them to the list of Top-Level algorithms
    gaudi.addAlgorithm( alg1 )
    gaudi.addAlgorithm( alg2 )

    return SUCCESS
Ejemplo n.º 8
0
def start_app_mgr() :
    gaudi = AppMgr()

    global started
    if not started :
        gaudi.initialize()
        started = True

    ppsvc   = gaudi.ppSvc()
    toolsvc = gaudi.toolSvc()
    evtsvc = tes = TES = gaudi.evtSvc()
    return locals()
Ejemplo n.º 9
0
ApplicationMgr (
    EvtSel = "NONE"
    , TopAlg  = [ ep2 ]
    , EvtMax  = 10
    )

# =============================================================================
# The actual job excution
# =============================================================================
if '__main__' == __name__ :

    print __doc__ , __author__

    from GaudiPython.Bindings import AppMgr

    gaudi = AppMgr()

    gaudi.run(5)

    xp2 = gaudi.algorithm('xProps2')

    xp2.Point3D  = '(-10,3, Z : 24)'
    xp2.Vector3D = [-120,-30,-40]
    if not isWin:
        xp2.Vector4D = [-100,-200,-300,400]
        xp2.Vector4D = (-100,-200,-300,400)
        xp2.Vector4D = [(-100,-200,-300),400]
        xp2.Vector4D = [[-100,-200,-300],400]
        xp2.Vector4D = ((-100,-200,-300),400)
        xp2.Vector4D = ([-100,-200,-300],400)
Ejemplo n.º 10
0
              active=True,
              banks=["HC"],
              outputs={
                  "DigitLocation": "Raw/HC/Digits",
                  "L0DigitLocation": "Raw/HC/L0Digits"
              },
              inputs={"RawEventLocations": ['/Event/DAQ/RawEvent']},
              properties={
                  "DigitLocation": "Raw/HC/Digits",
                  "L0DigitLocation": "Raw/HC/L0Digits"
              },
              conf=DecoderDB)
conf = dec.setup()

from GaudiPython.Bindings import AppMgr
appMgr = AppMgr()
appMgr.HistogramPersistency = "ROOT"
hpSvc = appMgr.service('HistogramPersistencySvc')
hpSvc.OutputFile = options.OutputDirectory + '/' + options.runNumber + '/' + options.analysisType + '_' + options.runNumber + '.root'

ntSvc = appMgr.ntupleSvc()
ntSvc.Output = [
    "FILE1 DATAFILE='" + options.OutputDirectory + '/' + options.runNumber +
    '/' + options.analysisType + '_' + options.runNumber +
    "Tuple.root'  TYP='ROOT'  OPT='NEW'"
]

eventTimeDecoder = appMgr.toolsvc().create("OdinTimeDecoder",
                                           interface="IEventTimeDecoder")

appMgr.addAlgorithm('LbAppInit')
Ejemplo n.º 11
0
    
    alg.HistoPrint = True
    
    return SUCCESS


# =============================================================================
# The actual job execution 
# =============================================================================
if '__main__' == __name__ :
    print __doc__ , __author__

    from GaudiPython.Bindings import AppMgr
    import GaudiPython.HistoUtils
    
    gaudi = AppMgr()
    configure( gaudi )

    gaudi.run(20)

    # Skip the next part when running within QMTest
    for alg in ( 'HistoEx'  ,
                 'HistoEx1' ,
                 'HistoEx2' ) :
        alg = gaudi.algorithm ( alg )
        histos = alg.Histos()
        for key in histos :
            histo = histos[key]
            print " Alg='%s', ID='%s' , Histo=%s " % ( alg.name() , key , histo ) 
            if hasattr ( histo , 'dump' ) :
                print histo.dump ( 60 , 20 , True)
Ejemplo n.º 12
0
        printHelp()
    elif o in ("-i", "--input"):
        microDSTFile=a
    elif o in ("-s", "--selection"):
        selection = a
    elif o in ("-r", "--root"):
        locationRoot = a

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

# set up some useful paths of locations on the MicroDST
hltPath = locationRoot + "/Hlt/DecReports"
l0Path = locationRoot + "/Trig/L0/L0DUReport"

appMgr = AppMgr(outputlevel=4)
appMgr.config( files = ['$STDOPTS/LHCbApplication.opts',
                        '$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts',
                        '$DDDBROOT/options/DC06.opts'])
appMgr.initialize()
appMgr.ExtSvc += ['LHCb::ParticlePropertySvc']
appMgr.HistogramPersistency = "ROOT"

evtSvc = appMgr.evtSvc()
evtSel = appMgr.evtSel()
nextEvent = Helpers.NextEvent(appMgr)

# open a DST or MicroDST
evtSel.open(microDSTFile)

nEvents=0
Ejemplo n.º 13
0
    EvtMax=-1)

# =============================================================================
## the actual job steering
if '__main__' == __name__:

    ## make printout of the own documentations
    print '*' * 120
    print __doc__
    print ' Author  : %s ' % __author__
    print ' Version : %s ' % __version__
    print ' Date    : %s ' % __date__
    print '*' * 120

    from GaudiPython.Bindings import AppMgr
    gaudi = AppMgr()

    evtSel = gaudi.evtSel()
    evtSel.open(
        'castor:/castor/cern.ch/grid/lhcb/user/a/apuignav/7318/7318685/KaliPi0.fmDST'
    )

    gaudi.run(100000)

    import KaliCalo.Pi0HistoFit as Fit

    import GaudiPython.GaudiAlgs
    pi0 = gaudi.algorithm('KaliPi0')
    histos = pi0.Histos()
    if histos:
        keys = histos.keys()
Ejemplo n.º 14
0
    delayScan.MinBX = options.minBx
    delayScan.MaxBX = options.maxBx
    mainSeq.Members += [delayScan]

appConf = ApplicationMgr(OutputLevel=INFO, AppName=options.analysisType)
appConf.TopAlg += [mainSeq]
'''
locations =  ["Raw/HC/Digits"]  
if  options.analysisType == 'TAE':
  for k in ['Prev','Next']:
    for i in range(options.TAE):
      location = k + repr(options.TAE - i)
      locations.append(location+"/Raw/HC/Digits")
mainAlgorithm.DigitLocation = locations
'''

from GaudiPython.Bindings import AppMgr
appMgr = AppMgr()
appMgr.HistogramPersistency = "ROOT"
hpSvc = appMgr.service('HistogramPersistencySvc')
hpSvc.OutputFile = options.OutputDirectory + '/' + options.runNumber + '/' + options.analysisType + '_' + options.runNumber + '.root'

ntSvc = appMgr.ntupleSvc()
ntSvc.Output = [
    "FILE1 DATAFILE='" + options.OutputDirectory + '/' + options.runNumber +
    '/' + options.analysisType + '_' + options.runNumber +
    "Tuple.root'  TYP='ROOT'  OPT='NEW'"
]

appMgr.run(options.NumberOfEvents)
Ejemplo n.º 15
0
        name = name.replace  (" ",'_')
        name = name.replace(os.sep,'_') + '.png'
        if os.path.exists(name):
            # strictly speaking, it is not needed, but avoids a message on the stderr
            os.remove(name)
        canvas.Print(name)
        print "The file name is '%s'"%name
        i += 1

# =============================================================================


# =============================================================================
# The actual job execution
# =============================================================================
if '__main__' == __name__ :
    print __doc__ , __author__
    
    from GaudiPython.Bindings import AppMgr
    
    gaudi = AppMgr()
    configure( gaudi )
    gaudi.run(5)

    # use the scripts
    useScript( paths )

# =============================================================================
# The END
# =============================================================================
Ejemplo n.º 16
0
# =============================================================================
from math import sin, cos 

from   GaudiPython.Bindings   import AppMgr
from   GaudiPython.Bindings   import gbl as cpp

from   GaudiPython.HistoUtils import (
    book      ,
    fill      , 
    aida2root 
    )

print __doc__ 

## get the application manager   (create if needed) 
gaudi = AppMgr()

## no external input
gaudi.EvtSel = 'NONE'

## define the histogram persistency 
gaudi.HistogramPersistency = "ROOT"

## define the name of the output file with histograms:
hsvc = gaudi.service('HistogramPersistencySvc')
hsvc.OutputFile = "HistoUtilsEx.root"

## configure & initialize 
gaudi.config()
gaudi.initialize()
Ejemplo n.º 17
0
    EvtSel = "NONE"
    , TopAlg  = [ ske ]
    , EvtMax  = 10
    )

# =============================================================================
# The actual job excution
# =============================================================================
if '__main__' == __name__ :

    print __doc__
    print __author__

    from GaudiPython.Bindings import AppMgr

    gaudi = AppMgr ()

    gaudi.run(1)

    ske = gaudi.algorithm('StringKeys')

    ske.PropertiesPrint = True

    from GaudiPython.Bindings import gbl as cpp

    SK = cpp.Gaudi.StringKey

    key = SK('new Key' )

    print 'set new key: ', key
Ejemplo n.º 18
0
    'Budget',
    #
    zPlane=970.0,
    Shots=100,
    #
    Grid=False,
    Rapidity=False,
    #
)

from Configurables import ApplicationMgr

ApplicationMgr(TopAlg=[budget], EvtSel='NONE', EvtMax=1)

# =============================================================================
if "__main__" == __name__:

    print __doc__
    print __author__
    print __version__

    from GaudiPython.Bindings import AppMgr

    gaudi = AppMgr()

    gaudi.run(1)

# =============================================================================
# The END
# =============================================================================
Ejemplo n.º 19
0
                    )

## ensure that NTuple Service will be finalized AFTER ToolSvc 
ApplicationMgr (
    ExtSvc = [ NTupleSvc() , ToolSvc()  , RndmGenSvc() ]
    )

## go to dynamic configuration

from   GaudiPython.Bindings   import AppMgr, loaddict 
from   GaudiPython.Bindings   import gbl as cpp 
import GaudiPython.TupleUtils as TupleUtils


## get the application manager   (create if needed) 
gaudi = AppMgr() 

import atexit
atexit.register ( gaudi.exit )


gaudi.EvtSel               = 'NONE' ## no external event input
#gaudi.HistogramPersistency = 'HBOOK' ## define the persistency type for N-tuples
gaudi.HistogramPersistency = 'ROOT' ## define the persistency type for N-tuples


## configure & initialize 
gaudi.config()
gaudi.initialize()

## get some random numbers
Ejemplo n.º 20
0
AlignAlgorithm('Alignment').InputDataFiles = derivativefiles
AlignAlgorithm('Alignment').OutputDataFile = ''

# set the database layer
if opts.aligndb:
    counter = 1
    for db in opts.aligndb:
        from Configurables import (CondDB, CondDBAccessSvc)
        alignCond = CondDBAccessSvc('AlignCond' + str(counter))
        alignCond.ConnectionString = 'sqlite_file:' + db + '/LHCBCOND'
        CondDB().addLayer(alignCond)
        counter += 1
    print 'added databases: ', opts.aligndb

from GaudiPython.Bindings import AppMgr
appMgr = AppMgr()
# we want to reinitialize, but we don't want to initialize all
# the reco algorithms, so we add just the alignment sequence:
appMgr.setAlgorithms(['AlignAlgorithm/Alignment'])
appMgr.configure()
appMgr.initialize()
# update the geometry
# updatetool = appMgr.toolsvc().create( typ = "Al::AlignUpdateTool", name = "ToolSvc.AlignUpdateTool", interface = "IAlignUpdateTool" )
#updatetool = appMgr.toolsvc().create( "Al::AlignUpdateTool", interface = "Al::IAlignUpdateTool" )
#updatetool.process(  self.output['derivatives'].equations(), opts.iter, 1)
# now call finalize to write the conditions. there must be a better way.
appMgr.finalize()
# finally create a database layer
import os
os.system("copy_files_to_db.py -c sqlite_file:Alignment.db/LHCBCOND -s xml")
Ejemplo n.º 21
0
import PartProp.PartPropSvc
from GaudiPython.Bindings import AppMgr 
gaudi = AppMgr()
# get the service from Gaudi:
ppSvc = gaudi.ppSvc() 
# loop over all particle properties:
for pp in ppSvc :  print pp.particle()
# print them as table:
print ppSvc.all() 
Ejemplo n.º 22
0
    locationRoot = options.root
    output = options.output
    verbose = options.verbose
    nevents = options.nevents
    branch = options.branch
    
    particleLoc = locationRoot + '/' + branch + '/Particles'
    particleLoc = particleLoc.replace('//', '/')
    particleLocation = particleLoc.replace('/Particles/Particles', '/Particles')

    from Configurables import DaVinci
    dv = DaVinci()
    dv.DataType = '2010'
    dv.Simulation = False
    dv.InputType = 'DST'
    appMgr = AppMgr(outputlevel=4)
    appMgr.config( files = ['$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts'])
    appMgr.initialize()

    import atexit
    atexit.register(appMgr.exit)

    evtSvc = appMgr.evtSvc()

    evtSel = appMgr.evtSel()

    nextEvent = Functors.NextEvent(appMgr, nevents)

    evtSel.open(filename)

    nEvents=0
#  @date 2010-10-22
# =============================================================================
"""

Trivial script to dump the table of Particle Properties 

Last modification $Date$
               by $Author$
"""
# =============================================================================
__author__  = "Vanya BELYAEV [email protected]"
__version__ = "version $Revision: 1.3 $" 
# =============================================================================
import PartProp.PartPropAlg
import PartProp.Service
from   GaudiPython.Bindings import AppMgr
# =============================================================================

gaudi = AppMgr()

gaudi.initialize()

pps   = gaudi.ppSvc()

print pps.all()


# =============================================================================
# The END 
# =============================================================================
Ejemplo n.º 24
0
def run(input_files, output_file):

    ## Bit of extra configuration
    from GaudiConf import IOHelper
    IOHelper().inputFiles(input_files)
    HistogramPersistencySvc().OutputFile = output_file.replace('.root', '_histos.root')

    ## GaudiPython
    import GaudiPython
    import cppyy
    cppyy.load_reflection_info('libLinkerEvent')
    cppyy.load_reflection_info('libLinkerInstancesDict')

    from GaudiPython.Bindings import AppMgr
    appMgr = AppMgr(outputlevel = 3)
    appMgr.config()

    appMgr.HistogramPersistency = 'ROOT'
    ntSvc = GaudiPython.iService('NTupleSvc')
    ntSvc.Output = ["MATCHZERRLUN DATAFILE='{0}' OPT='NEW'".format(output_file)]

    from Hlt1Muons.MatchAlgo import MatchResidualAlgo
    match_algo = MatchResidualAlgo("MatchResidualAlgo", MatchVeloMuon = mvm.getFullName())
    match_algo.NTupleLUN = 'MATCHZERRLUN'
    appMgr.addAlgorithm(match_algo)

    from Hlt1Muons.MatchAlgo import MatchChi2Algo
    chi2_algo = MatchChi2Algo("MatchChi2Algo", MatchVeloMuon = mvm_chi2.getFullName())
    chi2_algo.NTupleLUN = 'MATCHZERRLUN'
    appMgr.addAlgorithm(chi2_algo)

    if mvm_old:
        chi2_algo_old = MatchChi2Algo("MatchChi2AlgoOld", MatchVeloMuon = mvm_old.getFullName())
        chi2_algo_old.NTupleLUN = 'MATCHZERRLUN'
        appMgr.addAlgorithm(chi2_algo_old)

    appMgr.initialize()
    appMgr.run(options.nevents)
    appMgr.stop()
    appMgr.finalize()
    appMgr.exit()
Ejemplo n.º 25
0
import PartProp.PartPropSvc
from GaudiPython.Bindings import AppMgr

gaudi = AppMgr()
# get the service from Gaudi:
ppSvc = gaudi.ppSvc()
# loop over all particle properties:
for pp in ppSvc:
    print pp.particle()
# print them as table:
print ppSvc.all()
Ejemplo n.º 26
0
    cpp.StatusCode.enableChecking ()
    

if '__main__' == __name__ :

    ## make printout of the own documentations 
    print '*'*120
    print                      __doc__
    print ' Author  : %s ' %   __author__    
    print ' Version : %s ' %   __version__
    print ' Date    : %s ' %   __date__
    print '*'*120

    configure()

    gaudi = AppMgr()

    gaudi.run ( 4 ) 

    # add 'late' algorithms
    
    myAlg3 = SimpleAlgo ( 'Simple3' )
    
    seq = gaudi.algorithm('MySequencer')    
    seq.Members += [ 'HelloWorld/Hello4']   

    gaudi.run ( 8 ) 

    seq.Members += [ myAlg3.name() ]        

    gaudi.run ( 3 ) 
Ejemplo n.º 27
0
from ROOT import TCanvas
from LHCbAlgs.Configuration import *

lhcbApp = LHCbApp(DDDBtag="default", CondDBtag="default", DataType="2010", Simulation=False)

from AnalysisPython import Dir, Functors
from GaudiPython.Bindings import gbl, AppMgr, Helper

appMgr = AppMgr(outputlevel=4)
# appMgr.config( files = ['$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts'])
appMgr.ExtSvc += ["DataOnDemandSvc"]
appMgr.initialize()

evt = appMgr.evtsvc()

appMgr.run(1)
evt.dump()

import atexit

atexit.register(appMgr.exit)
refitVertexAssocPath = selectionPath + '/P2ReFitPVSortedRelations'
mcParticlePath = locationRoot+'/MC/Particles'
flavTagPath = locationRoot + "/Phys/Tagging"
pvLocation = locationRoot+"/Rec/Vertex/Primary"

# configure the new Particle->MCPatricle associator tool MCMatchObjP2MCRelator
myP2MCP = MCMatchObjP2MCRelator()
myP2MCP.OutputLevel=4
myP2MCP.MCParticleDefaultLocation = mcParticlePath
myP2MCP.RelTableLocations = [particle2mcPath]

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']
appMgr.HistogramPersistency = "ROOT"

import atexit
atexit.register(appMgr.exit)

evtSvc = appMgr.evtSvc()
toolSvc = appMgr.toolsvc()
evtSel = appMgr.evtSel()
nextEvent = Functors.NextEvent(appMgr)
pp = Functors.PartPropSvc(appMgr)
ppSvc = pp
Ejemplo n.º 29
0
        
        def oracle_online():
            oo = CondDBAccessSvc('ONLINE_ORACLE')
            oo.ConnectionString = 'CondDBOnline/ONLINE'
            CondDBDispatcherSvc('MainCondDBReader').Alternatives['/Conditions/Online'] = oo
            
        appendPostConfigAction(oracle_online)
        os.environ['CORAL_DBLOOKUP_PATH'] = os.environ['CORAL_AUTH_PATH'] = '/group/online/condb_viewer'
#'''

from Configurables import DumpConditions, GaudiSequencer
dumpSeq = GaudiSequencer("DumpSequence", Members = [DumpConditions()])
ApplicationMgr().TopAlg = [dumpSeq]
ApplicationMgr().ExtSvc += ["IncidentSvc"]
ApplicationMgr().EvtSel = "NONE"

# Run
from GaudiPython.Bindings import AppMgr
gaudi = AppMgr()
for meth, args in (('initialize' , None), ('run' , [1]), ('stop' , None),
                   ('finalize' , None), ('exit', None)):
    m = getattr(gaudi, meth)
    if args:
        status = m(*args)
    else:
        status = m()
    if status.isFailure():
        print 'Failed in ' + meth
        sys.exit(1)

Ejemplo n.º 30
0
# Make sure there is data to run on
if len(args) != 1:
    print "error, no settings specified"
    sys.exit(2)

from Gaudi.Configuration import *
from Moore.Configuration import *

Moore().ThresholdSettings = args[0]
Moore().EvtMax = options.EvtMax

#Moore().DataType = options.DataType
Moore().DDDBtag = options.DDDBtag
Moore().CondDBtag = options.CondDBtag
Moore().ForceSingleL0Configuration = (not options.multil0)
Moore().EnableTimer = args[0] + ".csv"

#take the test data and automatically set with the PRConfig
from PRConfig import TestFileDB
TestFileDB.test_file_db[options.Data].run(withDB=False, configurable=Moore())

EventSelector().PrintFreq = 100

## GaudiPython
from GaudiPython.Bindings import AppMgr
appMgr = AppMgr()
appMgr.initialize()

appMgr.run(Moore().EvtMax)
Ejemplo n.º 31
0
def configure( gaudi = None  ) :
    """ Configuration of the job """
    
    if not gaudi :
        from GaudiPython.Bindings import AppMgr
        gaudi = AppMgr()

    gaudi.JobOptionsType       = 'NONE'
    gaudi.EvtSel               = 'NONE'
    gaudi.HistogramPersistency = 'ROOT'

    gaudi.config()

    gaudi.DLLs = [ 'GaudiAlg', 'RootHistCnv', ]

    alg = HistoEx('HistoEx')
    gaudi.setAlgorithms( [alg] )
    alg.HistoPrint = True

    hsvc = gaudi.service('HistogramPersistencySvc')
    hsvc.OutputFile = "histo1.root"

    # This does not harm and tests bug #50389
    getMyalgBack = gaudi.algorithm ( 'HistoEx' )

    return SUCCESS
Ejemplo n.º 32
0
    ntSvc.Output = [ "MYLUN DATAFILE='TupleEx.root' OPT='NEW' TYP='ROOT'" ]

    gaudi.config()

    gaudi.DLLs = [ 'GaudiAlg', 'RootHistCnv', ]

    alg = TupleEx(
        ## configure the property
        NTupleLUN = 'MYLUN'
        )
    
    gaudi.setAlgorithms( [alg] )

    return SUCCESS


# =============================================================================
## The actual job excution
#  @author Vanya BELYAEV [email protected]
#  @date 2006-11-26
if '__main__' == __name__ :
    print __doc__
    from GaudiPython.Bindings import AppMgr 
    gaudi = AppMgr()
    configure( gaudi )
    gaudi.run(20)

# =============================================================================
# The END
# =============================================================================
Ejemplo n.º 33
0
"""
Demo-file for interactive work with new Particle Property Service
"""
# =============================================================================
__author__ = "Vanya BELYAEV [email protected]"
__version__ = "CVS tag $Name: not supported by cvs2svn $, version $Revision$"
# =============================================================================
import PartProp.PartPropAlg
import PartProp.decorators
import PartProp.Service
from GaudiPython.Bindings import AppMgr
# =============================================================================
## test the nodes
from PartProp.Nodes import *

gaudi = AppMgr()

gaudi.initialize()


## simple test-function
def test():
    """
    
    simple function for the test
    
    """
    pps = gaudi.ppSvc()

    for l in range(1, 6):
Ejemplo n.º 34
0
# Sim08a (MC2012)
#app.DDDBtag = 'Sim08-20130503-1'
#app.CondDBtag = 'Sim08-20130503-vc-md100'
# Sim05 (MC11a)
#app.DDDBtag = 'MC11-20111102'
#app.CondDBtag = 'sim-20111111-vc-md100'
# Sim08e (MC2012)
app.DDDBtag = 'dddb-20130929-1'
app.CondDBtag = 'sim-20130522-1-vc-md100'

ApplicationMgr().ExtSvc += [LHCb__ParticlePropertySvc()]

from GaudiPython.Bindings import AppMgr
import PartProp.Service

appMgr = AppMgr()
appMgr.initialize()

ppSvc = appMgr.ppSvc()
B_s0H = ppSvc.find("B_s0H")
B_s0L = ppSvc.find("B_s0L")

GH = 1./B_s0H.lifetime()/1000
GL = 1./B_s0L.lifetime()/1000

G  = (GL + GH)/2.
DG = (GL - GH)
y = DG/(2*G)

#MC2012 values
Azero_sq = 0.5213
Ejemplo n.º 35
0
    assert os.path.isfile(dddbroot), 'No such file \'{0}\''.format(dddbroot)

    if dddbroot.endswith('.xml'):
        from Configurables import DDDBConf
        DDDBConf().DbRoot = dddbroot
    else:
        assert dddbroot.endswith('.db'), 'Unsupported format of DDDB'
        CondDB().addLayer(dbFile=dddbroot, dbName="DDDB")
else:
    print 'Using default DDDB'

from Configurables import MessageSvc

MessageSvc().Format = '% F%40W%S%7W%R%T %0W%M'

appMgr = AppMgr(outputlevel=4)
appMgr.ExtSvc += ['TransportSvc']
det = appMgr.detSvc()

transSvc = appMgr.service('TransportSvc', 'ITransportSvc')

# define intersections
std = GaudiPython.gbl.std
Interval = std.pair('double', 'double')
Intersection = std.pair(Interval, 'const Material*')
Intersections = std.vector(Intersection)
intersepts = Intersections()
tickMin = 0.
tickMax = 1.

Ejemplo n.º 36
0
ApplicationMgr (
    EvtSel = "NONE"
    , TopAlg  = [ ap ]
    , EvtMax  = 10
    )

# =============================================================================
# The actual job excution
# =============================================================================
if '__main__' == __name__ :

    print __doc__ , __author__

    from GaudiPython.Bindings import AppMgr

    gaudi = AppMgr()

    gaudi.run(5)

    ap = gaudi.algorithm('ArrayProps')

    ap.PropertiesPrint = True

    ap.Strings = [ 'qu-qu' , 'qu-qu' , 'qu-qu' , 'qu-qu' ]
    ap.Doubles = [ 0 , -1 , 2 , -3 , 4 ]

    ap.PropertiesPrint = True



# =============================================================================
Ejemplo n.º 37
0
    alg = HistoEx1('HistoEx1')
    gaudi.addAlgorithm( alg )

    alg.HistoPrint = True

    return SUCCESS


# =============================================================================
# The actual job excution
# =============================================================================
if '__main__' == __name__ :
    print __doc__ , __author__
    
    from GaudiPython.Bindings import AppMgr
    gaudi = AppMgr()
    
    configure( gaudi )
    
    gaudi.run(20)
    import GaudiPython.HistoUtils
    
    alg = gaudi.algorithm( 'HistoEx1' )
    histos = alg.Histos()
    for key in histos :
        histo = histos[ key ]
        if hasattr ( histo , 'dump' ) :
            print histo.dump ( 80 , 20 , True )

# =============================================================================
Ejemplo n.º 38
0
ApplicationMgr (
    EvtSel = "NONE"
    , TopAlg  = [ bap ]
    , EvtMax  = 10
    )

# =============================================================================
# The actual job excution
# =============================================================================
if '__main__' == __name__ :

    print __doc__ , __author__

    from GaudiPython.Bindings import AppMgr

    gaudi = AppMgr()

    gaudi.run(5)

    bap = gaudi.algorithm('BoostArrayProps')

    bap.PropertiesPrint = True

    bap.Doubles = [ -1 , -2 , -3 , -4 , -5 ]
    bap.Strings = [ 'a1' , 'a2' , 'a3' , 'a4' ]

    bap.PropertiesPrint = True



# =============================================================================
Ejemplo n.º 39
0
    @author M.Frank
    """

    from Gaudi.Configuration import *
    from Configurables import CondDB
    #cdb = CondDB()
    #cdb.PartitionConnectionString["LHCBCOND"] = "sqlite_file:$HOME/cmtuser/data/tryLHCBCOND.db/LHCBCOND"
    #cdb.Tags["LHCBCOND"] = ""

    #Online = importOnline()

    app = Gaudi.ApplicationMgr()
    #Configs.AuditorSvc().Auditors = []
    #app.MessageSvcType = 'LHCb::FmcMessageSvc'
    #if Gaudi.allConfigurables.has_key('MessageSvc'):
    #    del Gaudi.allConfigurables['MessageSvc']
    #msg = Configs.LHCb__FmcMessageSvc('MessageSvc')
    #msg.fifoPath      = os.environ['LOGFIFO']
    #msg.LoggerOnly    = True
    #msg.doPrintAlways = False
    #msg.OutputLevel   = MSG_INFO # Online.OutputLevel

    from GaudiConf import IOHelper
    IOHelper('MDF').inputFiles(input_files)
    #IOHelper('MDF').inputFiles(['/home/dsavrina/cmtuser/data/154030_0000000173_07.raw'])

    from GaudiPython.Bindings import AppMgr
    gaudi = AppMgr()

    gaudi.run(1000)