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 
147  workflow = miniBruneljson
148  cpu_cruncher_algos = []
149  for algo in workflow["algorithms"]:
150  theAvgRuntime=float(algo["runtimes_wall"][0]/1000.)
151  new_algo = CPUCruncher("%s@%s" %(algo["name"],algo["type"]),
152  avgRuntime=theAvgRuntime,
153  varRuntime=theAvgRuntime*0.01,
154  DataInputs = algo["inputs"],
155  DataOutputs = algo["outputs"],
156  OutputLevel=INFO
157  )
158  cpu_cruncher_algos.append(new_algo)
159  return cpu_cruncher_algos
160 
161 # Set output level threshold 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
162 
163 msgSvc = InertMessageSvc("MessageSvc",OutputLevel=INFO)
164 ApplicationMgr().SvcMapping.append(msgSvc)
165 ApplicationMgr(MessageSvcType=msgSvc.getType(),
166  OutputLevel=INFO)
167 
168 crunchers = load_scenario()
169 
170 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots = NumberOfEventsInFlight)
171 
172 slimeventloopmgr = HiveSlimEventLoopMgr(OutputLevel = INFO)
173 
174 scheduler = ForwardSchedulerSvc(MaxEventsInFlight = NumberOfEventsInFlight,
175  MaxAlgosInFlight = 100,
176  OutputLevel = WARNING)
177 
178 # And the Application Manager
180 app.TopAlg = crunchers
181 app.EvtSel = "NONE" # do not use any event input
182 app.EvtMax = NumberOfEvents
183 app.EventLoop = slimeventloopmgr
184 app.ExtSvc =[whiteboard]
185 
The Application Manager class.