def process(self, eventoffset): from GaudiPython.Bindings import AppMgr appMgr = AppMgr() if eventoffset == 0: from Escher.Utils import printsequence printsequence(appMgr) # ugly: change the algorithm after initialization. otherwise it doesn't work for 'reused' applications. #numeventsPerProc = opts.numevents / opts.numprocs + 1 #numeventsThisProc = numeventsPerProc #if eventoffset is opts.numprocs - 1: # numeventsThisProc -= opts.numprocs * numeventsPerProc - opts.numevents #appMgr.evtSel().FirstEvent = eventoffset * numeventsPerProc #appMgr.evtSel().reinitialize() #appMgr.run(numeventsThisProc) appMgr.algorithm(prescalername).Offset = eventoffset appMgr.algorithm(prescalername).Interval = opts.numprocs appMgr.run(opts.numevents) #evt = appMgr.evtsvc() #while 0 < 1:> # check if there are still valid events # if evt['Rec/Header'] == None : break det = appMgr.detsvc() alignderivatives = det['AlignDerivativeData'] #self.output['derivatives'] = copy.deepcopy(alignderivatives) if alignderivatives: self.output['derivatives'].add(alignderivatives) otmonodata = det['OTMonoLayerAlignData'] if otmonodata: self.output['otmonodata'].add(otmonodata) histsvc = appMgr.histsvc() self.output['histograms'].collect(histsvc)
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 ()
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
, 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 # ============================================================================= # The END # =============================================================================
, 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 # ============================================================================= # The END # =============================================================================
alignCond.ConnectionString = 'sqlite_file:' + db + '/DDDB' CondDB().addLayer(alignCond) counter += 1 ## Instantiate application manager from GaudiPython.Bindings import AppMgr appMgr = AppMgr() ## print the sequence if not opts.skipprintsequence: from Escher.Utils import printsequence printsequence(appMgr) evtSel = appMgr.evtSel() evtSel.OutputLevel = 1 mainSeq = appMgr.algorithm("EscherSequencer") print evtSel.Input for i in range(opts.numiter): print "Iteration nr: ", i # rewind if not opts.do_not_rewind: mainSeq.Enable = False evtSel.rewind() mainSeq.Enable = True # steer the monitor sequence depending on the iteration appMgr.algorithm('AlignMonitorSeq').Enable = (i == 0) appMgr.algorithm('Moni').Enable = (i == 0) if opts.numiter > 1:
## get some input data from Gaudi.Configuration import importOptions importOptions('$STRIPPINGSELECTIONSROOT/tests/data/Reco15a_Run164668.py') ## ## GaudiPython ## from GaudiPython.Bindings import AppMgr gaudi = AppMgr() alg = gaudi.algorithm('KAONS') mainseq = 'DaVinciEventSeq' from LoKiHlt.algorithms import ALG_EXECUTED, ALG_PASSED, ALG_ENABLED ## start event loop for i in range(10) : gaudi.run(1) alg = gaudi.algorithm('KAONS') print ' [%d] KAONS initialized? %s [counterintuitive]' % ( i , alg._ialg.isInitialized () ) print ' [%d] KAONS executed? %s ' % ( i , alg._ialg.isExecuted () ) print ' without fix in $LOKICORE/src/AlgFunctors.cpp following lines produce segmentation violation'
#evtSel.open ( 'KaliPi0_2k+11.fmdst_test') from GaudiPython.Bindings import AppMgr gaudi = AppMgr() ## === OR with test fmDSTs evtSel = gaudi.evtSel() ## run over events gaudi.run(5000) from KaliCalo.FitUtils import fitPi0, getPi0Params, s2b import GaudiPython.GaudiAlgs pi0 = gaudi.algorithm('KaliPi0') histos = pi0.Histos() if histos: keys = histos.keys() keys.sort() for h in keys: histo = histos[h] if hasattr(histo, 'dump'): print histo.dump(60, 25, True) st = fitPi0(histo) print 'Fit : ', st print 'N(pi0) : ', getPi0Params(histo)[0] print 'Mass : ', getPi0Params(histo)[1] print 'Sigma : ', getPi0Params(histo)[2] print 'S/B : ', s2b(histo.toROOT())
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 ) # ============================================================================= # The END # =============================================================================
) # ============================================================================= # 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) xp2.SVector5 = (1,2,3,4,5) xp2.SVector5 = [1,2,3,4,5]
if options.TAE > 0: for k in ['Prev', 'Next']: for i in range(options.TAE): location = k + repr(options.TAE - i) decoderName = "HCRawBankDecoder/HCRawBankDecoder" + location appMgr.addAlgorithm(decoderName) appMgr.addAlgorithm("HCRawBankDecoder/HCRawBankDecoder") mainAlgorithm = None if options.analysisType == 'NTuple': from Configurables import HCDigitTuple appMgr.addAlgorithm("HCDigitTuple") mainAlgorithm = appMgr.algorithm('HCDigitTuple') elif options.analysisType == 'Pedestals': from Configurables import HCDigitMonitor appMgr.addAlgorithm("HCDigitMonitor") mainAlgorithm = appMgr.algorithm('HCDigitMonitor') mainAlgorithm.MinBx = options.minBx mainAlgorithm.MaxBx = options.maxBx elif options.analysisType == 'CommonMode': from Configurables import HCPedestalCorrection appMgr.addAlgorithm("HCPedestalCorrection") mainAlgorithm = appMgr.algorithm('HCPedestalCorrection') mainAlgorithm.MinBx = 500 mainAlgorithm.MaxBx = options.maxBx elif options.analysisType == 'DelayScan': from Configurables import HCDelayScan appMgr.addAlgorithm("HCDelayScan")
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 ) # =============================================================================
# ============================================================================= # 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 ske.Key = key keys = [ key , 'rrr' , SK('s') ]
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)