25from extramodules.converterManager
import converterManager
26from extramodules.debugSettings
import debugSettings
28from extramodules.monitoring
import dispArgs
29from extramodules.dqTranscations
import aodFileChecker, forgettedArgsChecker, jsonTypeChecker, mainTaskChecker, trackPropChecker, trackPropTransaction
30from extramodules.configSetter
import multiConfigurableSet
31from extramodules.pycacheRemover
import runPycacheRemover
33from dqtasks.dqFlow
import AnalysisQvector
39centralityTableParameters = [
40 "estRun2V0M",
"estRun2SPDtks",
"estRun2SPDcls",
"estRun2CL0",
"estRun2CL1",
"estFV0A",
"estFT0M",
"estFDDM",
"estNTPV",
44ft0Parameters = [
"processFT0",
"processNoFT0",
"processOnlyFT0",
"processRun2"]
46pidParameters = [
"pid-el",
"pid-mu",
"pid-pi",
"pid-ka",
"pid-pr",
"pid-de",
"pid-tr",
"pid-he",
"pid-al",]
48booleanSelections = [
"true",
"false"]
57 "o2-analysis-timestamp",
"o2-analysis-event-selection",
"o2-analysis-multiplicity-table",
"o2-analysis-centrality-table",
58 "o2-analysis-trackselection",
"o2-analysis-trackextension",
"o2-analysis-pid-tof-base",
"o2-analysis-pid-tof-full",
59 "o2-analysis-pid-tof-beta",
"o2-analysis-pid-tpc-full",
63initArgs = AnalysisQvector()
67args = initArgs.parseArgs()
68configuredCommands = vars(args)
73forgettedArgsChecker(configuredCommands)
80if args.pid
is not None:
82 args.pid = [prefix_pid + sub
for sub
in args.pid]
85if args.est
is not None:
87 args.est = [prefix_est + sub
for sub
in args.est]
90if args.FT0
is not None:
91 prefix_process =
"process"
92 args.FT0 = prefix_process + args.FT0
98with open(args.cfgFileName)
as configFile:
99 config = json.load(configFile)
101jsonTypeChecker(args.cfgFileName)
103taskNameInConfig =
"analysis-qvector"
104taskNameInCommandLine =
"o2-analysis-dq-flow"
106mainTaskChecker(config, taskNameInConfig)
112logging.info(
"Only Select Configured as %s", args.onlySelect)
113if args.onlySelect ==
"true":
114 logging.info(
"INTERFACE MODE : JSON Overrider")
115if args.onlySelect ==
"false":
116 logging.info(
"INTERFACE MODE : JSON Additional")
118for key, value
in config.items():
119 if type(value) == type(config):
120 for value, value2
in value.items():
123 if value ==
"aod-file" and args.aod:
124 config[key][value] = args.aod
125 logging.debug(
" - [%s] %s : %s", key, value, args.aod)
128 if value ==
"cfgBarrelTrackCuts" and args.cfgBarrelTrackCuts:
129 multiConfigurableSet(config, key, value, args.cfgBarrelTrackCuts, args.onlySelect)
130 logging.debug(
" - [%s] %s : %s", key, value, args.cfgBarrelTrackCuts)
131 if value ==
"cfgMuonCuts" and args.cfgMuonCuts:
132 multiConfigurableSet(config, key, value, args.cfgMuonCuts, args.onlySelect)
133 logging.debug(
" - [%s] %s : %s", key, value, args.cfgMuonCuts)
134 if value ==
"cfgEventCuts" and args.cfgEventCuts:
135 multiConfigurableSet(config, key, value, args.cfgEventCuts, args.onlySelect)
136 logging.debug(
" - [%s] %s : %s", key, value, args.cfgEventCuts)
137 if value ==
"cfgWithQA" and args.cfgWithQA:
138 config[key][value] = args.cfgWithQA
139 logging.debug(
" - [%s] %s : %s", key, value, args.cfgWithQA)
140 if value ==
"cfgCutPtMin" and args.cfgCutPtMin:
141 config[key][value] = args.cfgCutPtMin
142 logging.debug(
" - [%s] %s : %s", key, value, args.cfgCutPtMin)
143 if value ==
"cfgCutPtMax" and args.cfgCutPtMax:
144 config[key][value] = args.cfgCutPtMax
145 logging.debug(
" - [%s] %s : %s", key, value, args.cfgCutPtMax)
146 if value ==
"cfgCutEta" and args.cfgCutEta:
147 config[key][value] = args.cfgCutEta
148 logging.debug(
" - [%s] %s : %s", key, value, args.cfgCutEta)
149 if value ==
"cfgEtaLimit" and args.cfgEtaLimit:
150 config[key][value] = args.cfgEtaLimit
151 logging.debug(
" - [%s] %s : %s", key, value, args.cfgEtaLimit)
152 if value ==
"cfgNPow" and args.cfgNPow:
153 config[key][value] = args.cfgNPow
154 logging.debug(
" - [%s] %s : %s", key, value, args.cfgNPow)
155 if value ==
"cfgEfficiency" and args.cfgEfficiency:
156 config[key][value] = args.cfgEfficiency
157 logging.debug(
" - [%s] %s : %s", key, value, args.cfgEfficiency)
158 if value ==
"cfgAcceptance" and args.cfgAcceptance:
159 config[key][value] = args.cfgAcceptance
160 logging.debug(
" - [%s] %s : %s", key, value, args.cfgAcceptance)
163 if (value
in pidParameters)
and args.pid
and key !=
"tof-pid":
164 if value
in args.pid:
166 config[key][value] = value2
167 logging.debug(
" - [%s] %s : %s", key, value, value2)
168 elif args.onlySelect ==
"true":
170 config[key][value] = value2
171 logging.debug(
" - [%s] %s : %s", key, value, value2)
174 if (value
in centralityTableParameters)
and args.est:
175 if value
in args.est:
177 config[key][value] = value2
178 logging.debug(
" - [%s] %s : %s", key, value, value2)
179 elif args.onlySelect ==
"true":
181 config[key][value] = value2
182 logging.debug(
" - [%s] %s : %s", key, value, value2)
185 if value ==
"syst" and args.syst:
186 config[key][value] = args.syst
187 logging.debug(
" - [%s] %s : %s", key, value, args.syst)
188 if value ==
"muonSelection" and args.muonSelection:
189 config[key][value] = args.muonSelection
190 logging.debug(
" - [%s] %s : %s", key, value, args.muonSelection)
191 if value ==
"customDeltaBC" and args.customDeltaBC:
192 config[key][value] = args.customDeltaBC
193 logging.debug(
" - [%s] %s : %s", key, value, args.customDeltaBC)
196 if value ==
"doVertexZeq" and args.isVertexZeq:
197 if args.isVertexZeq ==
"true":
198 config[key][value] =
"1"
199 config[key][
"doDummyZeq"] =
"0"
200 logging.debug(
" - %s %s : 1", key, value)
201 logging.debug(
" - [%s] doDummyZeq : 0", key)
202 if args.isVertexZeq ==
"false":
203 config[key][value] =
"0"
204 config[key][
"doDummyZeq"] =
"1"
205 logging.debug(
" - %s %s : 0", key, value)
206 logging.debug(
" - [%s] doDummyZeq : 1", key)
209 if value ==
"processWSlice" and args.isWSlice:
210 if args.isWSlice ==
"true":
211 config[key][value] =
"true"
212 config[key][
"processWoSlice"] =
"false"
213 logging.debug(
" - %s %s : true", key, value)
214 logging.debug(
" - [%s] processWoSlice : false", key)
215 if args.isWSlice ==
"false":
216 config[key][value] =
"false"
217 config[key][
"processWoSlice"] =
"true"
218 logging.debug(
" - %s %s : false", key, value)
219 logging.debug(
" - [%s] processWoSlice : true", key)
222 if value ==
"tof-expreso" and args.tof_expreso:
223 config[key][value] = args.tof_expreso
224 logging.debug(
" - [%s] %s : %s", key, value, args.tof_expreso)
227 if (value
in ft0Parameters)
and args.FT0
and key ==
"tof-event-time":
228 if value == args.FT0:
230 config[key][value] = value2
231 logging.debug(
" - [%s] %s : %s", key, value, value2)
232 elif value != args.FT0:
234 config[key][value] = value2
235 logging.debug(
" - [%s] %s : %s", key, value, value2)
239 config[key][value] = args.itsMatching
240 logging.debug(
" - [%s] %s : %s", key, value, args.itsMatching)
242aodFileChecker(args.aod)
246from extramodules.getTTrees
import getTTrees
249if args.aod
is not None:
252 ttreeList = config[
"internal-dpl-aod-reader"][
"aod-file"]
255trackPropChecker(commonDeps, commonDeps)
262updatedConfigFileName =
"tempConfigDQFlow.json"
263with open(updatedConfigFileName,
"w")
as outputFile:
264 json.dump(config, outputFile, indent = 2)
268for dep
in commonDeps:
272 taskNameInCommandLine +
" --configuration json://" + updatedConfigFileName +
" --severity error --shm-segment-size 12000000000 -b"
274for dep
in depsToRun.keys():
275 commandToRun +=
" | " + dep +
" --configuration json://" + updatedConfigFileName +
" -b"
276 logging.debug(
"%s added your workflow", dep)
279 logging.debug("o2-analysis-mc-converter added your workflow")
280 commandToRun += (
" | o2-analysis-mc-converter --configuration json://" + updatedConfigFileName +
" -b")
283 commandToRun += (
" | o2-analysis-fdd-converter --configuration json://" + updatedConfigFileName +
" -b")
284 logging.debug(
"o2-analysis-fdd-converter added your workflow")
286if args.add_track_prop:
287 commandToRun += (
" | o2-analysis-track-propagation --configuration json://" + updatedConfigFileName +
" -b")
288 logging.debug(
"o2-analysis-track-propagation added your workflow")
291print("====================================================================================================================")
292logging.info("Command to run:")
293logging.info(commandToRun)
294print("====================================================================================================================")
296# Listing Added Commands
297dispArgs(configuredCommands)
299os.system(commandToRun)