9def _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
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
31 svcMgr += CfgMgr.Athena__xAODEventSelector( "EventSelector" )
32
33
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
40 theApp.ExtSvc += [ svcMgr.EventSelector.getFullName() ]
41 theApp.EvtSel = "EventSelector"
42
43
44 svcMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput()
45
46
47
48
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