The Gaudi Framework  v29r0 (ff2e7097)
MiniBrunelScenario.py
Go to the documentation of this file.
1 import json
2 from Gaudi.Configuration import *
3 # ============================================================================
4 from Configurables import GaudiExamplesCommonConf, CPUCruncher, HiveSlimEventLoopMgr, HiveWhiteBoard, InertMessageSvc, ForwardSchedulerSvc
5 # ============================================================================
6 '''
7 Json file format:
8 
9 "algorithms" : [
10  {
11  "name" : "Loader",
12  "type" : "HiveReader",
13  "inputs" : ["ROOT File"],
14  "outputs" : ["DAQ/ODIN", "DAQ/RawEvent"
15 
16  ],
17  "runtimes_wall" : [0.05]
18  },
19 '''
20 #-------------------------------------------------------------------------------
21 # Metaconfig
22 
23 NUMBEROFEVENTS = 828
24 NUMBEROFEVENTSINFLIGHT = 1
25 NUMBEROFALGOSINFLIGHT = 100
26 NUMBEROFTHREADS = 1
27 CLONEALGOS = False
28 DUMPQUEUES = False
29 VERBOSITY = 3
30 
31 
32 NumberOfEvents = NUMBEROFEVENTS
33 NumberOfEventsInFlight = NUMBEROFEVENTSINFLIGHT
34 NumberOfAlgosInFlight = NUMBEROFALGOSINFLIGHT
35 NumberOfThreads = NUMBEROFTHREADS
36 CloneAlgos = CLONEALGOS
37 DumpQueues = DUMPQUEUES
38 Verbosity = VERBOSITY
39 
40 
41 miniBruneljson = {
42  "algorithms": [
43  {
44  "name": "Loader",
45  "type": "HiveReader",
46  "inputs": [],
47  "outputs": ["/Event/DAQ/ODIN", "/Event/DAQ/RawEvent"
48 
49  ],
50  "runtimes_wall": [0.16]
51  },
52  {
53  "name": "BrunelInit",
54  "type": "RecInit",
55  "inputs": ["DAQ/ODIN", "DAQ/RawEvent"],
56  "outputs": ["/Event/Rec/Status", "/Event/Rec/Header"],
57  "runtimes_wall": [0.183]
58  },
59  {
60  "name": "BrunelEventCount",
61  "type": "EventCountHisto",
62  "inputs": [],
63  "outputs": [],
64  "runtimes_wall": [2.000000e-03]
65  },
66  {
67  "name": "HltDecReportsDecoder",
68  "type": "HltDecReportsDecoder",
69  "inputs": ["DAQ/RawEvent"],
70  "outputs": ["/Event/Hlt/DecReports"],
71  "runtimes_wall": [2.3]
72  },
73  {
74  "name": "PrsFromRaw",
75  "type": "CaloDigitsFromRaw",
76  "inputs": ["DAQ/RawEvent"],
77  "outputs": ["/Event/Raw/Prs/Digits"],
78  "runtimes_wall": [0.357]
79  },
80  {
81  "name": "EcalZSup",
82  "type": "CaloZSupAlg",
83  "inputs": ["DAQ/RawEvent"],
84  "outputs": ["/Event/Raw/Ecal/Digits"],
85  "runtimes_wall": [0.750]
86  },
87  {
88  "name": "HcalZSup",
89  "type": "CaloZSupAlg",
90  "inputs": ["DAQ/RawEvent"],
91  "outputs": ["/Event/Raw/Hcal/Digits"],
92  "runtimes_wall": [0.197]
93  },
94  {
95  "name": "L0DUFromRaw",
96  "type": "L0DUFromRawAlg",
97  "inputs": ["DAQ/RawEvent"],
98  "outputs": ["/Event/Trig/L0/L0DUReport"],
99  "runtimes_wall": [0.293]
100  },
101  {
102  "name": "DecodeVeloClusters",
103  "type": "DecodeVeloRawBuffer",
104  "inputs": ["DAQ/RawEvent"],
105  "outputs": ["/Event/Raw/Velo/LiteClusters", "/Event/Raw/Velo/Clusters"],
106  "runtimes_wall": [1.095]
107  },
108  {
109  "name": "CreateTTClusters",
110  "type": "RawBankToSTClusterAlg",
111  "inputs": ["DAQ/ODIN", "DAQ/RawEvent"],
112  "outputs": ["/Event/Raw/TT/Clusters", "/Event/Rec/TT/Summary"],
113  "runtimes_wall": [0.809]
114  },
115  {
116  "name": "CreateTTLiteClusters",
117  "type": "RawBankToSTLiteClusterAlg",
118  "inputs": ["DAQ/ODIN", "DAQ/RawEvent"],
119  "outputs": ["/Event/Raw/TT/LiteClusters"],
120  "runtimes_wall": [0.208]
121  },
122  {
123  "name": "CreateITClusters",
124  "type": "RawBankToSTClusterAlg",
125  "inputs": ["DAQ/ODIN", "DAQ/RawEvent"],
126  "outputs": ["/Event/Raw/IT/Clusters", "/Event/Rec/IT/Summary"],
127  "runtimes_wall": [0.672]
128  },
129  {
130  "name": "CreateITLiteClusters",
131  "type": "RawBankToSTLiteClusterAlg",
132  "inputs": ["DAQ/ODIN", "DAQ/RawEvent"],
133  "outputs": ["/Event/Raw/IT/LiteClusters"],
134  "runtimes_wall": [0.177]
135  },
136  {
137  "name": "FastVeloTracking",
138  "type": "FastVeloTracking",
139  "inputs": ["Raw/Velo/LiteClusters"],
140  "outputs": ["/Event/Rec/Track/Velo"],
141  "runtimes_wall": [4.3]
142  }
143  ]
144 }
145 
146 
148  workflow = miniBruneljson
149  cpu_cruncher_algos = []
150  for algo in workflow["algorithms"]:
151  theAvgRuntime = float(algo["runtimes_wall"][0] / 1000.)
152  new_algo = CPUCruncher("%s@%s" % (algo["name"], algo["type"]),
153  avgRuntime=theAvgRuntime,
154  varRuntime=theAvgRuntime * 0.01,
155  DataInputs=algo["inputs"],
156  DataOutputs=algo["outputs"],
157  OutputLevel=INFO
158  )
159  cpu_cruncher_algos.append(new_algo)
160  return cpu_cruncher_algos
161 
162 # Set output level threshold 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
163 
164 
165 msgSvc = InertMessageSvc("MessageSvc", OutputLevel=INFO)
166 ApplicationMgr().SvcMapping.append(msgSvc)
167 ApplicationMgr(MessageSvcType=msgSvc.getType(),
168  OutputLevel=INFO)
169 
170 crunchers = load_scenario()
171 
172 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=NumberOfEventsInFlight)
173 
174 slimeventloopmgr = HiveSlimEventLoopMgr(OutputLevel=INFO)
175 
176 scheduler = ForwardSchedulerSvc(MaxEventsInFlight=NumberOfEventsInFlight,
177  MaxAlgosInFlight=100,
178  OutputLevel=WARNING)
179 
180 # And the Application Manager
182 app.TopAlg = crunchers
183 app.EvtSel = "NONE" # do not use any event input
184 app.EvtMax = NumberOfEvents
185 app.EventLoop = slimeventloopmgr
186 app.ExtSvc = [whiteboard]
The Application Manager class.