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
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
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()
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'] appMgr.HistogramPersistency = "ROOT" evtSvc = appMgr.evtSvc() toolSvc = appMgr.toolsvc() evtSel = appMgr.evtSel() nextEvent = Functors.NextEvent(appMgr) pp = Functors.PartPropSvc(appMgr) ppSvc = pp particleNameFunc = Functors.ParticleName(ppSvc) # open a DST or MicroDST evtSel.open(microDSTFile) histoPath = "MicroDST/Histos/" omegaPlots = {}
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 Rndm = cpp.Rndm IRndmGenSvc = cpp.IRndmGenSvc rndmSvc = gaudi.service('RndmGenSvc',IRndmGenSvc) if not rndmSvc : gaudi.createSvc('RndmGenSvc') rndmSvc = gaudi.service('RndmGenSvc',IRndmGenSvc) gauss = Rndm.Numbers ( cpp.SmartIF("IRndmGenSvc")(rndmSvc) , Rndm.Gauss ( 0.0 , 1.0 ) )
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() ## get some random numbers Rndm = cpp.Rndm IRndmGenSvc = cpp.IRndmGenSvc rndmSvc = gaudi.service('RndmGenSvc',IRndmGenSvc) if not rndmSvc : gaudi.createSvc('RndmGenSvc') rndmSvc = gaudi.service('RndmGenSvc',IRndmGenSvc)