ATLAS Offline Software
Functions
ReadAthenaxAOD Namespace Reference

Functions

def _configure ()
 

Function Documentation

◆ _configure()

def ReadAthenaxAOD._configure ( )
private
Install the Athena-based TTree event selector and correctly configure
a few other services.

Definition at line 9 of file ReadAthenaxAOD.py.

9 def _configure():
10  """Install the Athena-based TTree event selector and correctly configure
11  a few other services.
12  """
13  from AthenaCommon import CfgMgr
14  from AthenaCommon.AppMgr import theApp
15  from AthenaCommon.AppMgr import ServiceMgr as svcMgr
16  from AthenaCommon.Logging import logging
17  from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
18  msg = logging.getLogger( 'ReadAthenaxAOD' )
19  msg.debug("Configuring Athena for reading xAOD files (via TEvent)...")
20 
21  #check if we already have a selector set up
22  if hasattr(svcMgr, 'EventSelector'):
23  err = "svcMgr already configured with another EventSelector: [%s]"%\
24  svcMgr.EventSelector.getFullJobOptName()
25  msg.error( err )
26  raise RuntimeError( err )
27 
28 
29 
30  #Setup our EventSelector
31  svcMgr += CfgMgr.Athena__xAODEventSelector( "EventSelector" )
32 
33  #for historical reasons, we now add configurables of a bunch of services
34  if not hasattr(svcMgr, 'THistSvc'): svcMgr += CfgMgr.THistSvc()
35  if not hasattr (svcMgr, 'ProxyProviderSvc'): svcMgr += CfgMgr.ProxyProviderSvc()
36  if not hasattr (svcMgr, 'InputMetaDataStore'): svcMgr += CfgMgr.StoreGateSvc("InputMetaDataStore")
37  if not hasattr (svcMgr, 'Athena::xAODCnvSvc'): svcMgr += CfgMgr.Athena__xAODCnvSvc()
38 
39  #Here we set various properties of things
40  theApp.ExtSvc += [ svcMgr.EventSelector.getFullName() ]
41  theApp.EvtSel = "EventSelector"
42  #default the input collections to the FilesInput from AthenaCommonFlags
43  #this is so that the eventselector picks up input files in grid jobs
44  svcMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput()
45 
46 
47  # suppress the event loop heartbeat as it is somewhat I/O hungry for
48  # no real gain in n-tuple reading/writing scenarii
49  if not hasattr(svcMgr, theApp.EventLoop): svcMgr += getattr(CfgMgr, theApp.EventLoop)()
50  evtloop = getattr(svcMgr, theApp.EventLoop)
51  try:
52  evtloop.EventPrintoutInterval = 10000
53  except Exception:
54  msg.info('disabling event loop heartbeat... [failed]')
55  msg.info('performances might be sub-par... sorry.')
56  pass
57 
58 
59 
60  msg.debug("Configuring Athena for reading ROOT files (via xAOD)... [OK]")
61  return
62 
63 # execute at module import
64 _configure()
65 
66 # clean-up namespace
ReadAthenaxAOD._configure
def _configure()
Definition: ReadAthenaxAOD.py:9