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
31 svcMgr += CfgMgr.Athena__RootNtupleEventSelector( "EventSelector" )
32
33
34
35
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
42 theApp.ExtSvc += [ svcMgr.EventSelector.getFullName() ]
43 theApp.EvtSel = "EventSelector"
44
45
46 svcMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput()
47
48
49
50
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