def initialise(): # Initialise a few things from Configurables import DDDBConf, CondDB, LHCbApp, CondDBAccessSvc cDB = CondDB() #DDDBConf(DataType = "2009") #LHCbApp().DDDBtag = "head-20110303" #LHCbApp().CondDBtag = "head-20110524" #DDDBConf(DataType = "2010") #LHCbApp().DDDBtag = "head-20110721" #LHCbApp().CondDBtag = "cond-20140328" #DDDBConf(DataType = "2011") #LHCbApp().DDDBtag = "head-20110722" #LHCbApp().CondDBtag = "head-20110722" #DDDBConf(DataType = "2012") #LHCbApp().DDDBtag = "dddb-20120831" #LHCbApp().CondDBtag = "cond-20121025" DDDBConf(DataType = "2015") LHCbApp().DDDBtag = "dddb-20150526" LHCbApp().CondDBtag = "cond-20150625" # Set message level to info and above only msgSvc().setOutputLevel(3) # Finally, initialize GaudiPython GaudiPython.AppMgr().initialize()
def end_config_checkpoint(print_config, checkpoint): try: import GaudiPython.Bindings setattr(GaudiPython.Bindings.AppMgr, 'exit', dummy_exit_handler) except: pass import os, sys, GaudiPython forker = Configs.LHCb__CheckpointSvc("CheckpointSvc") forker.NumberOfInstances = 0 #forker.NumberOfInstances = 5 forker.UseCores = False # -> N(core-1) procs! forker.ChildSessions = False forker.DumpFiles = False forker.Checkpoint = checkpoint forker.PrintLevel = 3 # 1=MTCP_DEBUG 2=MTCP_INFO 3=MTCP_WARNING 4=MTCP_ERROR forker.OutputLevel = 2 # 1=VERBOSE 2=DEBUG 3=INFO 4=WARNING 5=ERROR 6=FATAL forker.ExitAfterCheckpoint = 2 forker.CheckpointLibs = "/dev/shm/checkpoint" forker.CheckpointSaveFlags = 2 ApplicationMgr().ExtSvc.append(forker) if CFG.allConfigurables.has_key('MEPManager'): mep = CFG.allConfigurables['MEPManager'] mep.ConnectWhen = 'start' print 'Modified MEPManager to connect at start' printConfiguration() print 132 * '=' print "== Starting checkpoint generation." print 132 * '=' sys.stdout.flush() gaudi = GaudiPython.AppMgr() gaudi.service('MEPManager').ConnectWhen = 'start' patchExitHandler() return gaudi
def _appMgr() : #print 'starting appMgr @ pid = %s' % getpid() ApplicationMgr().AppName = "" ApplicationMgr().OutputLevel = ERROR appMgr = GaudiPython.AppMgr() appMgr.initialize() return appMgr
def main(): configure() from Gaudi.Configuration import configurationDict from pprint import pprint import GaudiPython app = GaudiPython.AppMgr() pprint(configurationDict()) app.initialize() dq = app.service("DQFLAGS", GaudiPython.gbl.ICondDBReader) dbData = [(datetime(2012, 1, 1, 0), datetime(2012, 1, 2, 0)), (datetime(2012, 1, 2, 0), datetime(2012, 1, 3, 0)), (datetime(2012, 1, 3, 0), datetime(2012, 1, 4, 0)), (datetime(2012, 1, 5, 0), datetime(2012, 1, 6, 0))] tests = [ (datetime(2012, 1, 1, 0), datetime(2012, 1, 4, 0), dbData[0:3]), (datetime(2012, 1, 1, 12), datetime(2012, 1, 3, 12), dbData[0:3]), (datetime(2012, 1, 2, 12), datetime(2012, 1, 5, 12), dbData[1:4]), (datetime(2012, 1, 4, 12), datetime(2012, 1, 6, 12), dbData[3:4]), ] print "\n=== Begin Tests ===" bad = 0 for since, until, expected in tests: if not checkIOVs(dq, since, until, expected): bad += 1 print "=== End Tests ===" if bad: print "\nFailed %d tests out of %d\n" % (bad, len(tests)) sys.exit(1) print ""
def event_summaries(fname, N, tests, results): """Execute all `tests` on `N` events in `fname` For each event a list of the return values of each test is send to `results`. """ app_mgr = GaudiPython.AppMgr() input = app_mgr.evtsel() input.open([fname]) evt = app_mgr.evtsvc() # Nasty way of having det available inside # test functions without having to pass it # explicitly global det det = app_mgr.detSvc() for n in xrange(N): app_mgr.run(1) res = [] for test in tests: res.append(test(evt)) results.send(res) results.send(None) results.close()
def __init__(self, filename, name=None): """ Create a new `TrendingTool` and open the specified file for reading. """ identifier = 'TrendingTool' if name is not None: identifier += '/{}'.format(name) self.ttool = gp.AppMgr().toolsvc().create(identifier, interface='ITrendingTool') self.ttool.openRead(filename)
def initialise(): if not globals()['initialised']: import os # Check results dir if not os.path.exists("results"): os.mkdir("results") from ROOT import gROOT # No info messages gROOT.ProcessLine("gErrorIgnoreLevel = kWarning;") # Batch mode (no TCanvas) gROOT.SetBatch(True) import GaudiPython # Initialise a few things from Configurables import DDDBConf, CondDB, LHCbApp, CondDBAccessSvc cDB = CondDB() #DDDBConf(DataType = "2009") #LHCbApp().DDDBtag = "head-20110303" #LHCbApp().CondDBtag = "head-20110524" #DDDBConf(DataType = "2010") #LHCbApp().DDDBtag = "head-20110303" #LHCbApp().CondDBtag = "head-20110524" #DDDBConf(DataType = "2011") #LHCbApp().DDDBtag = "head-20110722" #LHCbApp().CondDBtag = "head-20110722" #LHCbApp().CondDBtag = "HEAD" DDDBConf(DataType="2012") LHCbApp().DDDBtag = "head-20120413" LHCbApp().CondDBtag = "cond-20120730" CondDB().addLayer( CondDBAccessSvc( "2012Aerogel", ConnectionString="sqlite_file:2012Aerogel.db/LHCBCOND", DefaultTAG="HEAD")) # Set message level to info and above only msgSvc().setOutputLevel(3) # Finally, initialize GaudiPython GaudiPython.AppMgr().initialize() # Initialise various DeRich objects loadRichDet() # flag as done globals()['initialised'] = True
def initialise(): global appMgr, evt, poca, extrap, vertex_fitter, loki_algo appMgr = GaudiPython.AppMgr() evt = appMgr.evtsvc() poca = appMgr.toolsvc().create('TrajPoca', interface='ITrajPoca') extrap = appMgr.toolsvc().create('TrackParabolicExtrapolator', interface='ITrackExtrapolator') # vertex_fitter = appMgr.toolsvc().create('OfflineVertexFitter', interface='IVertexFit') vertex_fitter = appMgr.toolsvc().create('LoKi::VertexFitter', interface='IVertexFit') run.n = -1 loki_algo = LoKiAlgo.decorators.Algo('loki_algo') return appMgr, evt
def start_appmgr(initialize=True): '''Import GaudiPython and start AppMgr. If initialise = True, then call appMtr.initialize().''' # For ppSvc decorator # Not sure why this means the EventSelector then can't be found ... #import PartProp.PartPropAlg #import PartProp.Service import GaudiPython appmgr = GaudiPython.AppMgr() if initialize: appmgr.initialize() #ppsvc = appmgr.ppSvc() toolsvc = appmgr.toolSvc() evtsvc = tes = TES = appmgr.evtSvc() return locals()
def make_geometry_json(scenario): with tempfile.NamedTemporaryFile(mode='wt', suffix='.py') as f_options: f_options.write( jinja2.Environment(loader=jinja2.FileSystemLoader('assets')) .get_template('check_geometry_options_template.py') .render(scenario=scenario)) # Ensure the options have been written to disk f_options.flush() appMgr = GaudiPython.AppMgr(outputlevel=3, joboptions=f_options.name) output_fn_local = join('output/scenarios/', scenario, 'local_geo.json') output_fn_global = join('output/scenarios/', scenario, 'global_geo.json') sides = ['Left', 'Right'] det = appMgr.detSvc() local_geometry = {} global_geometry = {} for i in range(52): module_key = ( '/dd/Structure/LHCb/BeforeMagnetRegion/VP/VP{side}/' 'Module{i:002d}WithSupport/Module{i:002d}' .format(i=i, side=sides[i % 2 == 1]) ) for ladder in det[module_key].childIDetectorElements(): geo = ladder.geometry() corners = find_corners_of_cuboid(geo) # Convert the XYZPoint to tuples pos_local, pos_global = {}, {} for key, point_loc in corners.items(): point_glob = geo.toGlobal(point_loc) pos_local[key] = (point_loc.x(), point_loc.y(), point_loc.z()) pos_global[key] = (point_glob.x(), point_glob.y(), point_glob.z()) local_geometry[ladder.name()] = pos_local global_geometry[ladder.name()] = pos_global # Dump the geometry to json with open(output_fn_local, 'wt') as f: json.dump(local_geometry, f) with open(output_fn_global, 'wt') as f: json.dump(global_geometry, f) return local_geometry, global_geometry
def store_module_positions(options, output_fn): appMgr = GaudiPython.AppMgr(outputlevel=3, joboptions=options) det = appMgr.detSvc() with open(output_fn, 'wt') as f: for i in range(52): for name, x, y, z in get_ladders(i, det): f.write(name.rjust(85)) f.write(format(x)) f.write(format(y)) f.write(format(z)) f.write('\n') print(name, x, y, z) appMgr.exit()
def startGaudiInspect(aligndb=""): global appMgr LHCbApp().DDDBtag = "" LHCbApp().CondDBtag = "" if aligndb: from Configurables import (CondDB, CondDBAccessSvc) counter = 1 for db in aligndb: alignCond = CondDBAccessSvc('AlignCond' + str(counter)) alignCond.ConnectionString = 'sqlite_file:' + db + '/LHCBCOND' CondDB().addLayer(alignCond) counter += 1 appConf = ApplicationMgr(OutputLevel=INFO, AppName='myBrunel') appMgr = GaudiPython.AppMgr()
def make_geometry_json(misaligned=False): if misaligned: options_fn = 'options_{}.py'.format(misaligned) output_fn_local = 'output/velo_geometry_{}_local.json'.format( misaligned) output_fn_global = 'output/velo_geometry_{}_global.json'.format( misaligned) sides = ['Left', 'Right'] else: options_fn = 'options.py' output_fn_local = 'output/velo_geometry_local.json' output_fn_global = 'output/velo_geometry_global.json' sides = ['Right', 'Left'] appMgr = GaudiPython.AppMgr(outputlevel=3, joboptions=options_fn) det = appMgr.detSvc() velo_geometry_local = {} velo_geometry_global = {} for i in range(52): module_key = ('/dd/Structure/LHCb/BeforeMagnetRegion/VP/VP{side}/' 'Module{i:002d}WithSupport/Module{i:002d}'.format( i=i, side=sides[i % 2 == 1])) for ladder in det[module_key].childIDetectorElements(): geo = ladder.geometry() corners = find_corners_of_cuboid(geo) # Convert the XYZPoint to tuples pos_local, pos_global = {}, {} for key, point_loc in corners.items(): point_glob = geo.toGlobal(point_loc) pos_local[key] = (point_loc.x(), point_loc.y(), point_loc.z()) pos_global[key] = (point_glob.x(), point_glob.y(), point_glob.z()) velo_geometry_local[ladder.name()] = pos_local velo_geometry_global[ladder.name()] = pos_global # Dump the geometry to json with open(output_fn_local, 'wt') as f: json.dump(velo_geometry_local, f) with open(output_fn_global, 'wt') as f: json.dump(velo_geometry_global, f) return velo_geometry_local, velo_geometry_global
def main(conf): configure(conf) from Gaudi.Configuration import configurationDict from pprint import pprint import GaudiPython app = GaudiPython.AppMgr() pprint(configurationDict()) app.initialize() dds = app.detsvc() # load everything in the store nodes = node_names(dds) nodes.sort() print "=== Begin Nodes ===" for n in nodes: print n print "=== End Nodes ==="
def end_config_normal(print_config=True): import sys, traceback try: import GaudiPython.Bindings setattr(GaudiPython.Bindings.AppMgr, 'exit', dummy_exit_handler) except: pass try: import GaudiPython gaudi = GaudiPython.AppMgr() patchExitHandler() if print_config: printConfiguration() return gaudi except Exception, X: print '[ERROR] Exception:', str(X) info = sys.exc_info() if info is not None and info[0] is not None: lns = traceback.format_exception(info[0], info[1], info[2]) for line in lns: print '[ERROR] Exception:', str(line)
def startInspect(): global appMgr LHCbApp().DDDBtag = "head-20100518" LHCbApp().CondDBtag = "head-20100518" try: if alignDB: from Configurables import ( CondDB, CondDBAccessSvc ) counter = 1 for db in alignDB: alignCond = CondDBAccessSvc( 'AlignCond' + str(counter) ) alignCond.ConnectionString = 'sqlite_file:' + db + '/LHCBCOND' CondDB().addLayer( alignCond ) counter += 1 except: pass appConf = ApplicationMgr( OutputLevel = INFO, AppName = 'myBrunel' ) appMgr = GaudiPython.AppMgr() print "/dd/Structure/LHCb/BeforeMagnetRegion/TT"
def main(use_case="simple"): if use_case not in use_cases: print "ERROR: uknown use case to test '%s'" % use_case return 2 screenwidth = 120 print "#" * screenwidth txt_use_case = "testing use case '%s': %s" % (use_case, use_cases[use_case]) print " " * max(0, (screenwidth - len(txt_use_case)) / 2) + txt_use_case print "#" * screenwidth configure(use_case) from Gaudi.Configuration import configurationDict from pprint import pprint import ROOT Math = ROOT.ROOT.Math import GaudiPython app = GaudiPython.AppMgr() pprint(configurationDict()) app.initialize() app.start() dds = app.detsvc() # load everything in the store nodes = node_names(dds) app.run(1) print "=== Begin Conditions ===" for n in ConditionPaths: print n print dds[n] print "=== End Conditions ===" if use_case == "simple": expected = { "Left": Math.Transform3D(1, 0, 0, 30, 0, 1, 0, 1, 0, 0, 1, 0), "Right": Math.Transform3D(1, 0, 0, -30, 0, 1, 0, 15, 0, 0, 1, 0) } elif use_case == "override_motion_system": expected = { "Left": Math.Transform3D(1, 0, 0, 30, 0, 1, 0, 100, 0, 0, 1, 0), "Right": Math.Transform3D(1, 0, 0, -30, 0, 1, 0, -480, 0, 0, 1, 0) } elif use_case == "override_alignment": expected = { "Left": Math.Transform3D(1, 0, 0, 30, 0, 1, 0, 101, 0, 0, 1, 0), "Right": Math.Transform3D(1, 0, 0, -30, 0, 1, 0, 15, 0, 0, 1, 0) } elif use_case == "override_alignment2": expected = { "Left": Math.Transform3D(1, 0, 0, 30, 0, 1, 0, 15, 0, 0, 1, 0), "Right": Math.Transform3D(1, 0, 0, -30, 0, 1, 0, 1, 0, 0, 1, 0) } result = 0 # success for i in expected: path = "/dd/Conditions/Alignment/Velo/Velo%s" % i m = dds[path].offNominalMatrix() if m != expected[i]: print "ERROR: transforamtion for %s is not what expected" % path result = 1 return result
# New persistency if options.ROOT: from GaudiConf import IOHelper IOHelper("ROOT", "ROOT").postConfigServices() # FileStager if options.filestager: from FileStager.Configuration import configureFileStager configureFileStager() # Disable muons in TisTosTool from Configurables import TriggerTisTos ToolSvc().addTool(TriggerTisTos, 'TriggerTisTos') ToolSvc().TriggerTisTos.TOSFracMuon = 0. gaudi = GaudiPython.AppMgr(outputlevel=3) gaudi.initialize() TES = gaudi.evtsvc() SEL = gaudi.evtSel() SEL.OutputLevel = 6 SEL.firstEvent = startingEvent #Now after the initialize some more job dependent stuff if swimStripping: dod = gaudi.service('DataOnDemandSvc') outputs = gaudi.algorithm('killStripping').Nodes for l in dod.AlgMap.keys(): if l.find('Phys') == -1: continue l = '/'.join(l.split('/')[:-1]) outputs.append(l)
from ROOT import TH1, TH2, TCanvas, Math, TH2F, TLegend import os import sys from ROOT import gROOT, gRandom, gStyle from ROOT import TCanvas, TF1, TH1F, TH2F BRUNELOPTS = os.environ['ESCHEROPTS'] # User Options OPTIONS = 'Options_with_align1.py' # options file label = '_align1' # label for pdt and txt files xpos = 0 # xposition in local frame ypos = 0 # yposition in local frame appMgr = GaudiPython.AppMgr(outputlevel=3, joboptions=OPTIONS) EVT = appMgr.evtSvc() SEL = appMgr.evtSel() det = appMgr.detSvc() # get some math-stuff Math = GaudiPython.gbl.ROOT.Math gROOT.Reset() gROOT.SetStyle("Pub") gStyle.SetPadColor(10) gStyle.SetGridColor(16) gStyle.SetFrameFillColor(10)
def iDetDataSvc(): import GaudiPython return GaudiPython.AppMgr().service('DetectorDataSvc','IDetDataSvc')
######################################################################################### from Configurables import DaVinci DV = DaVinci() DV.DataType = 'DC06' #DaVinci().DDDBtag = 'head-20090112' #DaVinci().CondDBtag = 'sim-20090112' DV.UserAlgorithms = [mySeqRZTr, mySeqBGTrig] DV.InputType = 'DST' print DV ######################################################################################### #################### GaudiPython; Other Imports; Type Shortcuts ####################### ######################################################################################### import GaudiPython appMgr = GaudiPython.AppMgr() #appMgr.DLLs = [ 'GaudiAlg', 'RootHistCnv' ] from GaudiPython import PyAlgorithm from ROOT import TH1F, TH1D, TCanvas, gStyle from LinkerInstances.eventassoc import * import math SUCCESS = GaudiPython.SUCCESS LHCb = GaudiPython.gbl.LHCb ######################################################################################### ####################### DEFINE THE ANALYSIS ALGORITHM ############################# ######################################################################################### evCounter = 0
# LHCbApp().CondDBtag = ... # Pass file to open as first command line argument inputFiles = [sys.argv[-1]] IOHelper('ROOT').inputFiles(inputFiles) # Configure two instances of the TriggerTisTos tool to pick things up from the # split Hlt1 and Hlt2 locations. for stage in ('Hlt1', 'Hlt2'): ToolSvc().addTool(TriggerTisTos, stage + "TriggerTisTos") ttt = getattr(ToolSvc(), stage + "TriggerTisTos") ttt.HltDecReportsLocation = stage + '/DecReports' ttt.HltSelReportsLocation = stage + '/SelReports' # Configuration done, run time! appMgr = GP.AppMgr() evt = appMgr.evtsvc() # Instantiate the TisTos tools we configured above hlt1TisTosTool = appMgr.toolsvc().create('TriggerTisTos/Hlt1TriggerTisTos', interface="ITriggerTisTos") hlt2TisTosTool = appMgr.toolsvc().create('TriggerTisTos/Hlt2TriggerTisTos', interface="ITriggerTisTos") # process some events n = None n_tos = 0 n_tis = 0 n_tistos = 0 while advance():
def iDataSvc(): import GaudiPython return GaudiPython.AppMgr().detSvc()
def rawDataToNtuple(options): # print options required_options = [ "runNumber", "start", "end", "outputdir", "nEvtsPerStep", "totsteps" ] for check_opts in required_options: if not options.has_key(check_opts): print "Please specify minimal options!" print "Option \'" + check_opts + "\' is missing!" sys.exit() start = options["start"] end = options["end"] runNumber = options["runNumber"] outputdir = options["outputdir"] totsteps = options["totsteps"] nEvtsPerStep = options["nEvtsPerStep"] from Configurables import DDDBConf, CondDB, CondDBAccessSvc, NTupleSvc, EventClockSvc, Brunel, LHCbApp # if options.has_key("IgnoreHeartBeat"): # CondDB().IgnoreHeartBeat = options["IgnoreHeartBeat"] if options.has_key("addCondDBLayer"): altag = "HEAD" if options.has_key("addCondDBLayer_tag"): altag = options["addCondDBLayer_tag"] CondDB().addLayer( CondDBAccessSvc("myCond", ConnectionString="sqlite_file:" + options["addCondDBLayer"] + "/LHCBCOND", DefaultTAG=altag)) # Need this line so as to not get db errors- should be fixed properly at some point CondDB().IgnoreHeartBeat = True CondDB().EnableRunStampCheck = False # customDBs = glob.glob('/group/rich/ActiveDBSlices/*.db') # for db in customDBs: # CondDB().addLayer( CondDBAccessSvc(os.path.basename(db), ConnectionString="sqlite_file:"+db+"/LHCBCOND", DefaultTAG="HEAD") ) # importOptions('$STDOPTS/DecodeRawEvent.py') #importOptions("$STDOPTS/RootHist.opts") #importOptions("$STDOPTS/RawDataIO.opts") #DEBUG by DisplayingHitMaps=False from Configurables import MDMRich1Algorithm mdmAlg = MDMRich1Algorithm("Rich1MDCS") mdmAlg.NumberOfEventsPerStep = nEvtsPerStep mdmAlg.StoreHistos = False mdmAlg.DEBUG = False if options.has_key("StoreHistos"): mdmAlg.StoreHistos = options["StoreHistos"] if options.has_key("DEBUG"): mdmAlg.DEBUG = options["DEBUG"] print "start step: " + str(start) print "stop step: " + str(end) print "processing " + str(nEvtsPerStep * (end - start)) + " events" tuplestring = "NTuple_Run%i_Steps%04d-%04d.root" % (runNumber, start, end) if options.has_key("TupleName"): tuplestring = options["TupleName"] histoname = "Histos_Run%i_Steps%04d-%04d.root" % (runNumber, start, end) if options.has_key("HistoName"): histoname = options["HistoName"] if outputdir != "": tuplestring = "%s/%s" % (outputdir, tuplestring) histoname = "%s/%s" % (outputdir, histoname) tuplename = "RICHTUPLE1 DATAFILE=\'%s\' TYP=\'ROOT\' OPT=\'NEW\'" % ( tuplestring) # Currently put in manually. Edit here to use correct db and conddb tags LHCbApp().DDDBtag = "dddb-20150724" LHCbApp().CondDBtag = "cond-20160123" if options.has_key("DDDBtag"): LHCbApp().DDDBtag = options["DDDBtag"] if options.has_key("CondDBtag"): LHCbApp().CondDBtag = options["CondDBtag"] #customDBs = glob.glob('/group/rich/ActiveDBSlices/*.db') #for db in customDBs: # CondDB().addLayer( CondDBAccessSvc(os.path.basename(db), ConnectionString="sqlite_file:"+db+"/LHCBCOND", DefaultTAG="HEAD") ) ApplicationMgr().TopAlg += [mdmAlg] ApplicationMgr().ExtSvc += ['DataOnDemandSvc'] ApplicationMgr().EvtMax = end * nEvtsPerStep # Timing information for application from Configurables import AuditorSvc, SequencerTimerTool ApplicationMgr().ExtSvc += ['AuditorSvc'] ApplicationMgr().AuditAlgorithms = True AuditorSvc().Auditors += ['TimingAuditor'] SequencerTimerTool().OutputLevel = 4 LHCbApp().TimeStamp = True HistogramPersistencySvc().OutputFile = histoname NTupleSvc().Output = [tuplename] EventSelector().PrintFreq = 10 EventSelector().PrintFreq = nEvtsPerStep EventSelector().FirstEvent = start * nEvtsPerStep print "First event: " + str(start * nEvtsPerStep) print "Last event: " + str(end * nEvtsPerStep) #get data, will look in local cluster first, then on castor isLocal = True if options.has_key("isLocal"): isLocal = options["isLocal"] DATA_and_Year = (getData(runNumber, start, end, totsteps, isLocal)) DATA = DATA_and_Year["DATA"] if not len(DATA) > 0: print "Data not found in local, switching to CASTOR" DATA_and_Year = getData(runNumber, start, end, totsteps, not isLocal) DATA = DATA_and_Year["DATA"] if not len(DATA) > 0: print "DATA not found anywhere!" sys.exit() LHCbApp.DataType = str(DATA_and_Year["year"]) EventSelector().Input = DATA EventClockSvc().EventTimeDecoder = "OdinTimeDecoder" appMgr = GaudiPython.AppMgr() appMgr.HistogramPersistency = "ROOT" #appMgr.OutputLevel=DEBUG evtSvc = appMgr.evtSvc() esel = appMgr.evtsel() esel.PrintFreq = nEvtsPerStep appMgr.initialize() appMgr.run(nEvtsPerStep * (end - start)) appMgr.stop() appMgr.finalize()
LumiAlgsConf().OutputLevel = INFO def action(): from Configurables import GetIntegratedLuminosity, LumiIntegrateFSR alg = GetIntegratedLuminosity('GetIntegratedLuminosity') alg.WriteCountersDetails = False alg.OutputLevel = INFO LumiIntegrateFSR('IntegrateBeamCrossing').OutputLevel = INFO LumiIntegrateFSR('IntegrateBeamCrossing').AccumulateMu = True # LumiIntegrateFSR('IntegrateBeamCrossing').MuKeyName = 'PoissonPV3D' appendPostConfigAction(action) appMgr = GaudiPython.AppMgr(outputlevel=INFO) # some short-cuts to services evtSvc = appMgr.evtSvc() toolSvc = appMgr.toolsvc() evCounter = 0 # store store = {} class myAnalysisAlgo(GaudiAlgo): """ Algorithm to interrogate the lumi integration tools """ def __init__(self, name='myAnalysisAlgo', **args): GaudiAlgo.__init__(self, name, **args) # essential def initialize(self):
def iToolSvc(): import GaudiPython return GaudiPython.AppMgr().toolSvc()
def _appMgr(): ApplicationMgr().AppName = "" ApplicationMgr().OutputLevel = ERROR appMgr = GaudiPython.AppMgr() appMgr.initialize() return appMgr
def msgSvc(): import GaudiPython return GaudiPython.AppMgr().service('MessageSvc','IMessageSvc')
ToolSvc().addTool(TriggerTisTos, stage + "TriggerTisTos") tool = getattr(ToolSvc(), stage + "TriggerTisTos") tool.HltDecReportsLocation = '/Event/' + stage + '/DecReports' tool.HltSelReportsLocation = '/Event/' + stage + '/SelReports' # Access to classes. from collections import OrderedDict import ROOT, array, GaudiPython from GaudiPython.Bindings import gbl STD = gbl.std LHCB = gbl.LHCb from Ntuple import Ntuple # GaudiPython configuration. gaudi = GaudiPython.AppMgr() tes = gaudi.evtsvc() # Run. import sys, ROOT from math import floor evtmax = -1 #' #try: evtmax = int(sys.argv[1]) #except: evtmax = float('inf') evtnum = 0 ntuple = Ntuple('output.root', tes, gaudi.toolsvc(), gaudi.detSvc(), recJB.Output, recSVs.outputLocation(), recMus.algorithm().Output) #gaudi.run(39000)#TODO while evtmax < 0 or evtnum < evtmax: gaudi.run(1) if not bool(tes['/Event']): break
def umsSvc(): import GaudiPython GaudiPython.AppMgr().createSvc('UpdateManagerSvc') return GaudiPython.AppMgr().service('UpdateManagerSvc','IUpdateManagerSvc')