ATLAS Offline Software
Loading...
Searching...
No Matches
ReadAthenaRoot Namespace Reference

Functions

 _configure ()

Function Documentation

◆ _configure()

ReadAthenaRoot._configure ( )
protected
Install the Athena-based TTree event selector and correctly configure
a few other services.

Definition at line 10 of file ReadAthenaRoot.py.

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