Esempio 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
Esempio n. 2
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
Esempio n. 3
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 ()
Esempio n. 4
0
    def finalize(self):
        print "INFO: finalize"
        # dump the histograms to a file
        self.output['histograms'].dump(opts.histofile)

        numAlignEvents = self.output['derivatives'].equations().numEvents()
        print 'INFO: number of events in derivatives: ', self.output[
            'derivatives'].equations().numEvents()
        if numAlignEvents > 0:
            # write the derivative file
            if len(opts.derivativefile) > 0:
                self.output['derivatives'].equations().writeToFile(
                    derivativefile)

            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(['GaudiSequencer/AlignSequence'])
            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)
            # call the xml writer tool
            writertool = appMgr.toolsvc().create(
                "WriteMultiAlignmentConditionsTool",
                interface="IWriteAlignmentConditionsTool")
            writertool.write()
            # now call finalize to write the conditions. there must be a better way.
            det = appMgr.detsvc()
            if self.output['otmonodata'] and det['OTMonoLayerAlignData']:
                det['OTMonoLayerAlignData'].add(self.output['otmonodata'])

            appMgr.finalize()
            # finally create a database layer
            import os
            os.system(
                "copy_files_to_db.py -c sqlite_file:Alignment.db{0} -s xml".
                format(condtag))
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")