| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

IOTest.py
Go to the documentation of this file.
1 """
2
3 Simple test application to read LHCb dst files
4 For reading other root files: change the data access
5 if '/Event/Rec/Header' is not present.
6
7 Requires: 'SetupProject LHCb'
8
9 Script inherited from T.Ruf
10 M.Frank CERN/LHCb
11
12 """
13 import os
14 import sys
15 import time
16 from Configurables import ApplicationMgr, EventSelector, Gaudi__RootCnvSvc
17 from Gaudi.Configuration import *
18 from GaudiKernel import *
19
20 input_file = 'castor://castorlhcb.cern.ch//castor/cern.ch/grid/lhcb/LHCb/Collision11/SEMILEPTONIC.DST/00012569/0000/00012569_00000004_1.semileptonic.dst?svcClass=lhcbdisk'
21 input_file = 'root://castorlhcb.cern.ch//castor/cern.ch/grid//lhcb/data/2010/BHADRON.DST/00008399/0000/00008399_00001052_1.bhadron.dst?svcClass=lhcbdisk'
22
23 # -----------------------------------------------------------------------------
24
25
26 def storeExplorer(load=1, freq=0.0001, name='StoreExplorerAlg'):
27 from Configurables import StoreExplorerAlg
28 alg = StoreExplorerAlg(name)
29 alg.Load = load
30 alg.PrintFreq = freq
31 return alg
32
33 # -----------------------------------------------------------------------------
34
35
36 if len(sys.argv) > 1:
37 input_file = sys.argv[1]
38
39 appConf = ApplicationMgr(OutputLevel=INFO)
40 appConf.HistogramPersistency = "NONE"
41 appConf.ExtSvc.append('Gaudi::IODataManager/IODataManager')
42 appConf.ExtSvc.append('Gaudi::RootCnvSvc/RootCnvSvc')
43 appConf.TopAlg.append(storeExplorer(freq=1.0))
44
45 EventDataSvc().RootCLID = 1
46 EventDataSvc().EnableFaultHandler = True
47 root = Gaudi__RootCnvSvc('RootCnvSvc')
48 root.CacheBranches = []
49 root.VetoBranches = ['*']
50
51 #root.OutputLevel = 2
52 # Enable specialized branch caching:
53 root.CacheBranches = [
54 '_Event.*',
55 '_Event_R.*',
56 '_Event_Rec.*',
57 '_Event_Rec_R.*',
58 '_Event_Rec_Header.*'
59 '_Event_Rec_Header_R.*'
60 ]
61 root.VetoBranches = [
62 # '_Event_pRec_*',
63 # '_Event_Semileptonic_*'
64 ]
65
66 EventPersistencySvc().CnvServices.append(root)
67 EventSelector().Input = ["DATA='PFN:" + input_file +
68 "' SVC='Gaudi::RootEvtSelector'"]
69 EventSelector().PrintFreq = 1000
70 MessageSvc().OutputLevel = 3
71
72
73 def update():
74 statistic = {}
75 test = open('/proc/self/io')
76 io = test.readlines()
77 test.close()
78 for l in io:
79 temp = l.split(':')
80 statistic[temp[0]] = int(temp[1])
81 statistic['time'] = time.time()
82 return statistic
83
84
85 def printDelta(s0, s1):
86 for s in s1:
87 if s == 'time':
88 print '%15s : %10.2F sec' % (s, (s1[s] - s0[s]))
89 else:
90 print '%15s : %10.2F MB' % (s, (s1[s] - s0[s]) / 1.E6)
91
92
93 import GaudiPython
94 appMgr = GaudiPython.AppMgr()
95 sel = appMgr.evtsel()
96 evt = appMgr.evtsvc()
97 print sel.Input
98
99 start = update()
100 # test 1
101 N = 0
102 while 1 > 0:
103 rc = appMgr.run(1)
104 if N == 10:
105 start = update()
106 # if not evt['/Event/DAQ/RawEvent']:
107 # print 'Failed to access /Event/DAQ/RawEvent'
108 if not evt['/Event/Rec/Header']:
109 print 'Failed to access /Event/Rec/Header'
110 break
111 N += 1
112 if N > 100000:
113 break
114 end = update()
115 print 'Read %d events' % N
116 printDelta(start, end)
IOTest.update
def update()
Definition: IOTest.py:73
IOTest.storeExplorer
def storeExplorer(load=1, freq=0.0001, name='StoreExplorerAlg')
Definition: IOTest.py:26
Gaudi.Configuration
Definition: Configuration.py:1
IOTest.printDelta
def printDelta(s0, s1)
Definition: IOTest.py:85
StoreExplorerAlg
Small algorith, which traverses the data store and prints generic information about all leaves...
Definition: StoreExplorerAlg.cpp:32
MessageSvc
Definition: MessageSvc.h:30
GaudiPython.Bindings.AppMgr
Definition: Bindings.py:883