O2-DQ User Interface 1.0.0
Loading...
Searching...
No Matches
runTableMaker.py
Go to the documentation of this file.
1#!/usr/bin/env python
2# PYTHON_ARGCOMPLETE_OK
3# -*- coding: utf-8 -*-
4
5# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
6# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
7# All rights not expressly granted are reserved.
8#
9# This software is distributed under the terms of the GNU General Public
10# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
11#
12# In applying this license CERN does not waive the privileges and immunities
13# granted to it by virtue of its status as an Intergovernmental Organization
14# or submit itself to any jurisdiction.
15
16# \Author: ionut.cristian.arsene@cern.ch
17# \Interface: cevat.batuhan.tolon@cern.ch
18
19# Orginal Task: https://github.com/AliceO2Group/O2Physics/blob/master/PWGDQ/TableProducer/tableMaker.cxx
20
21import json
22import logging
23import logging.config
24import os
25from extramodules.converterManager import converterManager
26
27from extramodules.debugSettings import debugSettings
28from extramodules.monitoring import dispArgs
29from extramodules.descriptor import inputDescriptors, outputDescriptors
30from extramodules.dqTranscations import aodFileChecker, centTranscation, forgettedArgsChecker, jsonTypeChecker, filterSelsTranscation, mainTaskChecker, trackPropChecker, trackPropTransaction
31from extramodules.configSetter import multiConfigurableSet
32from extramodules.pycacheRemover import runPycacheRemover
33
34from dqtasks.tableMaker import TableMaker
35
36
39
40centralityTableParameters = [
41 "estRun2V0M", "estRun2SPDtks", "estRun2SPDcls", "estRun2CL0", "estRun2CL1", "estFV0A", "estFT0M", "estFDDM", "estNTPV"
42 ]
43# TODO Add genname parameter
44
45ft0Parameters = ["processFT0", "processNoFT0", "processOnlyFT0", "processRun2"]
46
47pidParameters = ["pid-el", "pid-mu", "pid-pi", "pid-ka", "pid-pr", "pid-de", "pid-tr", "pid-he", "pid-al"]
48
49booleanSelections = ["true", "false"]
50
51ttreeList = []
52
53# Predefined Search Lists
54fullSearch = []
55barrelSearch = []
56muonSearch = []
57covSearch = []
58centSearch = []
59filterSearch = []
60
61
64
65commonDeps = ["o2-analysis-timestamp", "o2-analysis-event-selection", "o2-analysis-multiplicity-table"]
66barrelDeps = [
67 "o2-analysis-trackselection", "o2-analysis-trackextension", "o2-analysis-pid-tof-base", "o2-analysis-pid-tof",
68 "o2-analysis-pid-tof-full", "o2-analysis-pid-tof-beta", "o2-analysis-pid-tpc-full"
69 ]
70specificDeps = {
71 "processFull": [],
72 "processFullTiny": [],
73 "processFullWithCov": [],
74 "processFullWithCent": ["o2-analysis-centrality-table"],
75 "processBarrelOnly": [],
76 "processBarrelOnlyWithCov": [],
77 "processBarrelOnlyWithV0Bits": ["o2-analysis-dq-v0-selector"],
78 "processBarrelOnlyWithEventFilter": ["o2-analysis-dq-filter-pp"],
79 "processBarrelOnlyWithQvector": ["o2-analysis-centrality-table", "o2-analysis-dq-flow"],
80 "processBarrelOnlyWithCent": ["o2-analysis-centrality-table"],
81 "processMuonOnly": [],
82 "processMuonOnlyWithCov": [],
83 "processMuonOnlyWithCent": ["o2-analysis-centrality-table"],
84 "processMuonOnlyWithQvector": ["o2-analysis-centrality-table", "o2-analysis-dq-flow"],
85 "processMuonOnlyWithFilter": ["o2-analysis-dq-filter-pp"]
86 # "processFullWithCentWithV0Bits": ["o2-analysis-centrality-table","o2-analysis-dq-v0-selector", "o2-analysis-weak-decay-indices"],
87 # "processFullWithEventFilterWithV0Bits": ["o2-analysis-dq-filter-pp","o2-analysis-dq-v0-selector", "o2-analysis-weak-decay-indices"],
88 }
89
90
93
94# Definition of all the tables we may write
95tables = {
96 "ReducedEvents": {
97 "table": "AOD/REDUCEDEVENT/0",
98 "treename": "ReducedEvents"
99 },
100 "ReducedEventsExtended": {
101 "table": "AOD/REEXTENDED/0",
102 "treename": "ReducedEventsExtended",
103 },
104 "ReducedEventsVtxCov": {
105 "table": "AOD/REVTXCOV/0",
106 "treename": "ReducedEventsVtxCov",
107 },
108 "ReducedEventsQvector": {
109 "table": "AOD/REQVECTOR/0",
110 "treename": "ReducedEventsQvector",
111 },
112 "ReducedMCEventLabels": {
113 "table": "AOD/REMCCOLLBL/0",
114 "treename": "ReducedMCEventLabels",
115 },
116 "ReducedMCEvents": {
117 "table": "AOD/REMC/0",
118 "treename": "ReducedMCEvents"
119 },
120 "ReducedTracks": {
121 "table": "AOD/REDUCEDTRACK/0",
122 "treename": "ReducedTracks"
123 },
124 "ReducedTracksBarrel": {
125 "table": "AOD/RTBARREL/0",
126 "treename": "ReducedTracksBarrel",
127 },
128 "ReducedTracksBarrelCov": {
129 "table": "AOD/RTBARRELCOV/0",
130 "treename": "ReducedTracksBarrelCov",
131 },
132 "ReducedTracksBarrelPID": {
133 "table": "AOD/RTBARRELPID/0",
134 "treename": "ReducedTracksBarrelPID",
135 },
136 "ReducedTracksBarrelLabels": {
137 "table": "AOD/RTBARRELLABELS/0",
138 "treename": "ReducedTracksBarrelLabels",
139 },
140 "ReducedMCTracks": {
141 "table": "AOD/RTMC/0",
142 "treename": "ReducedMCTracks"
143 },
144 "ReducedMuons": {
145 "table": "AOD/RTMUON/0",
146 "treename": "ReducedMuons"
147 },
148 "ReducedMuonsExtra": {
149 "table": "AOD/RTMUONEXTRA/0",
150 "treename": "ReducedMuonsExtra",
151 },
152 "ReducedMuonsCov": {
153 "table": "AOD/RTMUONCOV/0",
154 "treename": "ReducedMuonsCov"
155 },
156 "ReducedMuonsLabels": {
157 "table": "AOD/RTMUONSLABELS/0",
158 "treename": "ReducedMuonsLabels",
159 }
160 }
161# Tables to be written, per process function
162commonTables = ["ReducedEvents", "ReducedEventsExtended", "ReducedEventsVtxCov"]
163barrelCommonTables = ["ReducedTracks", "ReducedTracksBarrel", "ReducedTracksBarrelPID"]
164muonCommonTables = ["ReducedMuons", "ReducedMuonsExtra"]
165specificTables = {
166 "processFull": [],
167 "processFullTiny": [],
168 "processFullWithCov": ["ReducedTracksBarrelCov", "ReducedMuonsCov"],
169 "processFullWithCent": [],
170 "processBarrelOnly": [],
171 "processBarrelOnlyWithCov": ["ReducedTracksBarrelCov"],
172 "processBarrelOnlyWithV0Bits": [],
173 "processBarrelOnlyWithQvector": ["ReducedEventsQvector"],
174 "processBarrelOnlyWithEventFilter": [],
175 "processBarrelOnlyWithCent": [],
176 "processMuonOnly": [],
177 "processMuonOnlyWithCov": ["ReducedMuonsCov"],
178 "processMuonOnlyWithCent": [],
179 "processMuonOnlyWithQvector": ["ReducedEventsQvector"],
180 "processMuonOnlyWithFilter": [],
181 }
182
183# init args manually
184initArgs = TableMaker()
185
186initArgs.mergeArgs()
187initArgs.parseArgs()
188
189args = initArgs.parseArgs()
190configuredCommands = vars(args) # for get args
191
192# Debug Settings
193debugSettings(args.debug, args.logFile, fileName = "tableMaker.log")
194
195# Transcation management
196forgettedArgsChecker(configuredCommands)
197
198
201
202# add prefix for args.process for table-maker/table-maker-m-c and d-q-filter-p-p
203if args.process is not None:
204 prefix_process = "process"
205 args.process = [prefix_process + sub for sub in args.process]
206
207# add prefix for args.pid for pid selection
208if args.pid is not None:
209 prefix_pid = "pid-"
210 args.pid = [prefix_pid + sub for sub in args.pid]
211
212# add prefix for args.est for centrality-table
213if args.est is not None:
214 prefix_est = "est"
215 args.est = [prefix_est + sub for sub in args.est]
216
217# add prefix for args.FT0 for tof-event-time
218if args.FT0 is not None:
219 prefix_process = "process"
220 args.FT0 = prefix_process + args.FT0
221
222
223
224# Load the configuration file provided as the first parameter
225config = {}
226with open(args.cfgFileName) as configFile:
227 config = json.load(configFile)
228
229jsonTypeChecker(args.cfgFileName)
230
231runOverMC = False
232logging.info("runOverMC : %s, Reduced Tables will be produced for Data", runOverMC)
233
234taskNameInConfig = "table-maker"
235taskNameInCommandLine = "o2-analysis-dq-table-maker"
236
237mainTaskChecker(config, taskNameInConfig)
238
239# ===========================
240# Start Interface Processes =
241# ===========================
242
243logging.info("Only Select Configured as %s", args.onlySelect)
244if args.onlySelect == "true":
245 logging.info("INTERFACE MODE : JSON Overrider")
246if args.onlySelect == "false":
247 logging.info("INTERFACE MODE : JSON Additional")
248
249# For adding a process function from TableMaker and all process should be added only once so set type used
250tableMakerProcessSearch = set()
251
252for key, value in config.items():
253 if isinstance(value, dict):
254 for value, value2 in value.items():
255
256 # aod
257 if value == "aod-file" and args.aod:
258 config[key][value] = args.aod
259 logging.debug(" - [%s] %s : %s", key, value, args.aod)
260
261 # table-maker/table-maker-m-c process selections
262 # TODO Refactor
263 if (value in specificDeps.keys()) and args.process:
264 if value in args.process:
265
266 # processOnlyBCs have to always be true
267 if "processOnlyBCs" not in args.process:
268 args.process.append("processOnlyBCs")
269 logging.warning("You forget to add OnlyBCs value in --process parameter! It will automaticaly added.")
270 value2 = "true"
271 config[key][value] = value2
272 logging.debug(" - [%s] %s : %s", key, value, value2)
273
274 for s in config[key].keys():
275 if s in specificDeps.keys():
276 tableMakerProcessSearch.add(s)
277
278 fullSearch = [s for s in args.process if "Full" in s]
279 barrelSearch = [s for s in args.process if "Barrel" in s]
280 muonSearch = [s for s in args.process if "Muon" in s]
281 filterSearch = [s for s in args.process if "Filter" in s]
282 centSearch = [s for s in args.process if "Cent" in s]
283
284 if len(barrelSearch) > 0 or len(fullSearch) > 0:
285 if args.isBarrelSelectionTiny == "true":
286 config["d-q-barrel-track-selection-task"]["processSelection"] = "false"
287 config["d-q-barrel-track-selection-task"]["processSelectionTiny"] = args.isBarrelSelectionTiny
288
289 if (len(barrelSearch) == 0 and len(fullSearch) == 0 and args.runData and args.onlySelect == "true"):
290 config["d-q-barrel-track-selection-task"]["processSelection"] = "false"
291 config["d-q-barrel-track-selection-task"]["processSelectionTiny"] = "false"
292 config["d-q-barrel-track-selection-task"]["processDummy"] = "true"
293
294 if (len(muonSearch) == 0 and len(fullSearch) == 0 and args.runData and args.onlySelect == "true"):
295 config["d-q-muons-selection"]["processSelection"] = "false"
296 config["d-q-muons-selection"]["processDummy"] = "true"
297
298 if len(filterSearch) > 0 and args.runData:
299 config["d-q-filter-p-p-task"]["processFilterPP"] = "true"
300 config["d-q-filter-p-p-task"]["processFilterPPTiny"] = "false"
301
302 if args.isFilterPPTiny == "true":
303 config["d-q-filter-p-p-task"]["processFilterPP"] = "false"
304 config["d-q-filter-p-p-task"]["processFilterPPTiny"] = "true"
305
306 if len(filterSearch) == 0 and args.runData and args.onlySelect == "true":
307 config["d-q-filter-p-p-task"]["processFilterPP"] = "false"
308 config["d-q-filter-p-p-task"]["processFilterPPTiny"] = "false"
309 config["d-q-filter-p-p-task"]["processDummy"] = "false"
310
311 elif args.onlySelect == "true":
312 if value == "processOnlyBCs":
313 config[key][value] = "true"
314 logging.debug(" - [%s] %s : true", key, value)
315 else:
316 value2 = "false"
317 config[key][value] = value2
318 logging.debug(" - [%s] %s : %s", key, value, value2)
319
320 # filterPP Selections
321 if value == "cfgBarrelSels" and args.cfgBarrelSels:
322 multiConfigurableSet(config, key, value, args.cfgBarrelSels, args.onlySelect)
323 logging.debug(" - [%s] %s : %s", key, value, args.cfgBarrelSels)
324 if value == "cfgMuonSels" and args.cfgMuonSels:
325 multiConfigurableSet(config, key, value, args.cfgMuonSels, args.onlySelect)
326 logging.debug(" - [%s] %s : %s", key, value, args.cfgMuonSels)
327
328 # PID Selections
329 if (value in pidParameters) and args.pid and key != "tof-pid":
330 if value in args.pid:
331 value2 = "1"
332 config[key][value] = value2
333 logging.debug(" - [%s] %s : %s", key, value, value2)
334 elif args.onlySelect == "true":
335 value2 = "-1"
336 config[key][value] = value2
337 logging.debug(" - [%s] %s : %s", key, value, value2)
338
339 # analysis-qvector selections
340 if value == "cfgCutPtMin" and args.cfgCutPtMin:
341 config[key][value] = args.cfgCutPtMin
342 logging.debug(" - [%s] %s : %s", key, value, args.cfgCutPtMin)
343 if value == "cfgCutPtMax" and args.cfgCutPtMax:
344 config[key][value] = args.cfgCutPtMax
345 logging.debug(" - [%s] %s : %s", key, value, args.cfgCutPtMax)
346 if value == "cfgCutEta" and args.cfgCutEta:
347 config[key][value] = args.cfgCutEta
348 logging.debug(" - [%s] %s : %s", key, value, args.cfgCutEta)
349 if value == "cfgEtaLimit" and args.cfgEtaLimit:
350 config[key][value] = args.cfgEtaLimit
351 logging.debug(" - [%s] %s : %s", key, value, args.cfgEtaLimit)
352 if value == "cfgNPow" and args.cfgNPow:
353 config[key][value] = args.cfgNPow
354 logging.debug(" - [%s] %s : %s", key, value, args.cfgNPow)
355 if value == "cfgEfficiency" and args.cfgEfficiency:
356 config[key][value] = args.cfgEfficiency
357 logging.debug(" - [%s] %s : %s", key, value, args.cfgEfficiency)
358 if value == "cfgAcceptance" and args.cfgAcceptance:
359 config[key][value] = args.cfgAcceptance
360 logging.debug(" - [%s] %s : %s", key, value, args.cfgAcceptance)
361
362 # v0-selector
363 if value == "d_bz_input" and args.d_bz_input:
364 config[key][value] = args.d_bz_input
365 logging.debug(" - [%s] %s : %s", key, value, args.d_bz_input)
366 if value == "v0cospa" and args.v0cospa:
367 config[key][value] = args.v0cospa
368 logging.debug(" - [%s] %s : %s", key, value, args.v0cospa)
369 if value == "dcav0dau" and args.dcav0dau:
370 config[key][value] = args.dcav0dau
371 logging.debug(" - [%s] %s : %s", key, value, args.dcav0dau)
372 if value == "v0Rmin" and args.v0Rmin:
373 config[key][value] = args.v0Rmin
374 logging.debug(" - [%s] %s : %s", key, value, args.v0Rmin)
375 if value == "v0Rmax" and args.v0Rmax:
376 config[key][value] = args.v0Rmax
377 logging.debug(" - [%s] %s : %s", key, value, args.v0Rmax)
378 if value == "dcamin" and args.dcamin:
379 config[key][value] = args.dcamin
380 logging.debug(" - [%s] %s : %s", key, value, args.dcamin)
381 if value == "dcamax" and args.dcamax:
382 config[key][value] = args.dcamax
383 logging.debug(" - [%s] %s : %s", key, value, args.dcamax)
384 if value == "mincrossedrows" and args.mincrossedrows:
385 config[key][value] = args.mincrossedrows
386 logging.debug(" - [%s] %s : %s", key, value, args.mincrossedrows)
387 if value == "maxchi2tpc" and args.maxchi2tpc:
388 config[key][value] = args.maxchi2tpc
389 logging.debug(" - [%s] %s : %s", key, value, args.maxchi2tpc)
390
391 # centrality-table
392 if (value in centralityTableParameters) and args.est:
393 if value in args.est:
394 value2 = "1"
395 config[key][value] = value2
396 logging.debug(" - [%s] %s : %s", key, value, value2)
397 elif args.onlySelect == "true":
398 value2 = "-1"
399 config[key][value] = value2
400 logging.debug(" - [%s] %s : %s", key, value, value2)
401
402 # table-maker/table-maker-m-c cfg selections
403 if value == "cfgEventCuts" and args.cfgEventCuts:
404 multiConfigurableSet(config, key, value, args.cfgEventCuts, args.onlySelect)
405 logging.debug(" - [%s] %s : %s", key, value, args.cfgEventCuts)
406 if value == "cfgBarrelTrackCuts" and args.cfgBarrelTrackCuts:
407 multiConfigurableSet(config, key, value, args.cfgBarrelTrackCuts, args.onlySelect)
408 logging.debug(" - [%s] %s : %s", key, value, args.cfgBarrelTrackCuts)
409 if value == "cfgMuonCuts" and args.cfgMuonCuts:
410 multiConfigurableSet(config, key, value, args.cfgMuonCuts, args.onlySelect)
411 logging.debug(" - [%s] %s : %s", key, value, args.cfgMuonCuts)
412 if value == "cfgBarrelLowPt" and args.cfgBarrelLowPt:
413 config[key][value] = args.cfgBarrelLowPt
414 logging.debug(" - [%s] %s : %s", key, value, args.cfgBarrelLowPt)
415 if value == "cfgMuonLowPt" and args.cfgMuonLowPt:
416 config[key][value] = args.cfgMuonLowPt
417 logging.debug(" - [%s] %s : %s", key, value, args.cfgMuonLowPt)
418 if value == "cfgNoQA" and args.cfgNoQA:
419 config[key][value] = args.cfgNoQA
420 logging.debug(" - [%s] %s : %s", key, value, args.cfgNoQA)
421 if value == "cfgDetailedQA" and args.cfgDetailedQA:
422 config[key][value] = args.cfgDetailedQA
423 logging.debug(" - [%s] %s : %s", key, value, args.cfgDetailedQA)
424 if value == "cfgMinTpcSignal" and args.cfgMinTpcSignal:
425 config[key][value] = args.cfgMinTpcSignal
426 logging.debug(" - [%s] %s : %s", key, value, args.cfgMinTpcSignal)
427 if value == "cfgMaxTpcSignal" and args.cfgMaxTpcSignal:
428 config[key][value] = args.cfgMaxTpcSignal
429 logging.debug(" - [%s] %s : %s", key, value, args.cfgMaxTpcSignal)
430
431 # d-q-muons-selection
432 if value == "cfgMuonsCuts" and args.cfgMuonsCuts:
433 multiConfigurableSet(config, key, value, args.cfgMuonsCuts, args.onlySelect)
434 logging.debug(" - [%s] %s : %s", key, value, args.cfgMuonsCuts)
435
436 # event-selection-task
437 if value == "syst" and args.syst:
438 config[key][value] = args.syst
439 logging.debug(" - [%s] %s : %s", key, value, args.syst)
440 if value == "muonSelection" and args.muonSelection:
441 config[key][value] = args.muonSelection
442 logging.debug(" - [%s] %s : %s", key, value, args.muonSelection)
443 if value == "customDeltaBC" and args.customDeltaBC:
444 config[key][value] = args.customDeltaBC
445 logging.debug(" - [%s] %s : %s", key, value, args.customDeltaBC)
446
447 # multiplicity-table
448 if value == "doVertexZeq" and args.isVertexZeq:
449 if args.isVertexZeq == "true":
450 config[key][value] = "1"
451 config[key]["doDummyZeq"] = "0"
452 logging.debug(" - %s %s : 1", key, value)
453 logging.debug(" - [%s] doDummyZeq : 0", key)
454 if args.isVertexZeq == "false":
455 config[key][value] = "0"
456 config[key]["doDummyZeq"] = "1"
457 logging.debug(" - %s %s : 0", key, value)
458 logging.debug(" - [%s] doDummyZeq : 1", key)
459
460 # tof-pid, tof-pid-full
461 if value == "processWSlice" and args.isWSlice:
462 if args.isWSlice == "true":
463 config[key][value] = "true"
464 config[key]["processWoSlice"] = "false"
465 logging.debug(" - %s %s : true", key, value)
466 logging.debug(" - [%s] processWoSlice : false", key)
467 if args.isWSlice == "false":
468 config[key][value] = "false"
469 config[key]["processWoSlice"] = "true"
470 logging.debug(" - %s %s : false", key, value)
471 logging.debug(" - [%s] processWoSlice : true", key)
472
473 # tof-pid-beta
474 if value == "tof-expreso" and args.tof_expreso:
475 config[key][value] = args.tof_expreso
476 logging.debug(" - [%s] %s : %s", key, value, args.tof_expreso)
477
478 # tof-event-time
479 if (value in ft0Parameters) and args.FT0 and key == "tof-event-time":
480 if value == args.FT0:
481 value2 = "true"
482 config[key][value] = value2
483 logging.debug(" - [%s] %s : %s", key, value, value2)
484 elif value != args.FT0:
485 value2 = "false"
486 config[key][value] = value2
487 logging.debug(" - [%s] %s : %s", key, value, value2)
488
489 # all d-q tasks and selections
490 if (value == "cfgWithQA" or value == "cfgQA") and args.cfgWithQA:
491 config[key][value] = args.cfgWithQA
492 logging.debug(" - [%s] %s : %s", key, value, args.cfgWithQA)
493
494 # track-propagation
495 if args.isCovariance:
496 if (value == "processStandard" or value == "processCovariance") and args.isCovariance == "false":
497 config[key]["processStandard"] = "true"
498 config[key]["processCovariance"] = "false"
499 logging.debug(" - [%s] processStandart : true", key)
500 logging.debug(" - [%s] processCovariance : false", key)
501 if (value == "processStandard" or value == "processCovariance") and args.isCovariance == "true":
502 config[key]["processStandard"] = "false"
503 config[key]["processCovariance"] = "true"
504 logging.debug(" - [%s] processStandart : false", key)
505 logging.debug(" - [%s] processCovariance : true", key)
506
507 # track-selection
508 if args.itsMatching:
509 config[key][value] = args.itsMatching
510 logging.debug(" - [%s] %s : %s", key, value, args.itsMatching)
511
512# Transactions
513centTranscation(config, args.process, args.syst, centSearch)
514filterSelsTranscation(args.cfgBarrelSels, args.cfgMuonSels, args.cfgBarrelTrackCuts, args.cfgMuonsCuts, configuredCommands)
515aodFileChecker(args.aod)
516# trackPropTransaction(args.add_track_prop, barrelDeps)
517
518# Regarding to perfomance issues in argcomplete package, we should import later
519from extramodules.getTTrees import getTTrees
520
521# Converter Management
522if args.aod is not None:
523 ttreeList = getTTrees(args.aod)
524else:
525 ttreeList = config["internal-dpl-aod-reader"]["aod-file"]
526
527converterManager(ttreeList, commonDeps)
528trackPropChecker(commonDeps, barrelDeps)
529
530
533
534# Write the updated configuration file into a temporary file
535updatedConfigFileName = "tempConfigTableMaker.json"
536
537with open(updatedConfigFileName, "w") as outputFile:
538 json.dump(config, outputFile, indent = 2)
539
540# Check which dependencies need to be run
541depsToRun = {}
542for dep in commonDeps:
543 depsToRun[dep] = 1
544
545for processFunc in specificDeps.keys():
546 if processFunc not in config[taskNameInConfig].keys():
547 continue
548 if config[taskNameInConfig][processFunc] == "true":
549 if "processFull" in processFunc or "processBarrel" in processFunc:
550 for dep in barrelDeps:
551 depsToRun[dep] = 1
552 for dep in specificDeps[processFunc]:
553 depsToRun[dep] = 1
554
555# Check which tables are required in the output
556tablesToProduce = {}
557for table in commonTables:
558 tablesToProduce[table] = 1
559
560if runOverMC:
561 tablesToProduce["ReducedMCEvents"] = 1
562 tablesToProduce["ReducedMCEventLabels"] = 1
563
564for processFunc in specificDeps.keys():
565 if processFunc not in config[taskNameInConfig].keys():
566 continue
567 if config[taskNameInConfig][processFunc] == "true":
568 logging.info("processFunc ========")
569 logging.info("%s", processFunc)
570 if "processFull" in processFunc or "processBarrel" in processFunc:
571 logging.info("common barrel tables==========")
572 for table in barrelCommonTables:
573 logging.info("%s", table)
574 tablesToProduce[table] = 1
575 if runOverMC:
576 tablesToProduce["ReducedTracksBarrelLabels"] = 1
577 if "processFull" in processFunc or "processMuon" in processFunc:
578 logging.info("common muon tables==========")
579 for table in muonCommonTables:
580 logging.info("%s", table)
581 tablesToProduce[table] = 1
582 if runOverMC:
583 tablesToProduce["ReducedMuonsLabels"] = 1
584 if runOverMC:
585 tablesToProduce["ReducedMCTracks"] = 1
586 logging.info("specific tables==========")
587 for table in specificTables[processFunc]:
588 logging.info("%s", table)
589 tablesToProduce[table] = 1
590
591readerConfigFileName = "aodReaderTempConfig.json"
592writerConfigFileName = "aodWriterTempConfig.json"
593
594# Generate the aod-writer output descriptor json file
595outputDescriptors(tablesToProduce, tables)
596inputDescriptors(tablesToProduce, tables)
597
598commandToRun = (
599 taskNameInCommandLine + " --configuration json://" + updatedConfigFileName +
600 " --severity error --shm-segment-size 12000000000 --aod-writer-json " + writerConfigFileName + " -b"
601 )
602if args.aod_memory_rate_limit:
603 commandToRun = (
604 taskNameInCommandLine + " --configuration json://" + updatedConfigFileName +
605 " --severity error --shm-segment-size 12000000000 --aod-memory-rate-limit " + args.aod_memory_rate_limit + " --aod-writer-json " +
606 writerConfigFileName + " -b"
607 )
608
609for dep in depsToRun.keys():
610 commandToRun += " | " + dep + " --configuration json://" + updatedConfigFileName + " -b"
611 logging.debug("%s added your workflow", dep)
612"""
613if args.add_mc_conv:
614 logging.debug("o2-analysis-mc-converter added your workflow")
615 commandToRun += (" | o2-analysis-mc-converter --configuration json://" + updatedConfigFileName + " -b")
616
617if args.add_fdd_conv:
618 commandToRun += (" | o2-analysis-fdd-converter --configuration json://" + updatedConfigFileName + " -b")
619 logging.debug("o2-analysis-fdd-converter added your workflow")
620
621if args.add_track_prop:
622 commandToRun += (" | o2-analysis-track-propagation --configuration json://" + updatedConfigFileName + " -b")
623 logging.debug("o2-analysis-track-propagation added your workflow")
624"""
625
626print("====================================================================================================================")
627logging.info("Command to run:")
628logging.info(commandToRun)
629print("====================================================================================================================")
630logging.info("Tables to produce:")
631logging.info(tablesToProduce.keys())
632print("====================================================================================================================")
633
634# Listing Added Commands
635dispArgs(configuredCommands)
636
637os.system(commandToRun)
638
639runPycacheRemover()