25from extramodules.converterManager
import converterManager
26from extramodules.debugSettings
import debugSettings
28from extramodules.monitoring
import dispArgs
29from extramodules.dqTranscations
import aodFileChecker, forgettedArgsChecker, jsonTypeChecker, mainTaskChecker, trackPropChecker
30from extramodules.pycacheRemover
import runPycacheRemover
32from dqtasks.v0selector
import V0selector
38centralityTableParameters = [
39 "estRun2V0M",
"estRun2SPDtks",
"estRun2SPDcls",
"estRun2CL0",
"estRun2CL1",
"estFV0A",
"estFT0M",
"estFDDM",
"estNTPV"
43ft0Parameters = [
"processFT0",
"processNoFT0",
"processOnlyFT0",
"processRun2"]
45pidParameters = [
"pid-el",
"pid-mu",
"pid-pi",
"pid-ka",
"pid-pr",
"pid-de",
"pid-tr",
"pid-he",
"pid-al"]
54 "o2-analysis-timestamp",
"o2-analysis-event-selection",
"o2-analysis-multiplicity-table",
"o2-analysis-trackselection",
55 "o2-analysis-trackextension",
"o2-analysis-pid-tof-base",
"o2-analysis-pid-tof",
"o2-analysis-pid-tof-full",
"o2-analysis-pid-tof-beta",
56 "o2-analysis-pid-tpc-full"
60initArgs = V0selector()
64args = initArgs.parseArgs()
65configuredCommands = vars(args)
70forgettedArgsChecker(configuredCommands)
77if args.pid
is not None:
79 args.pid = [prefix_pid + sub
for sub
in args.pid]
82if args.FT0
is not None:
83 prefix_process =
"process"
84 args.FT0 = prefix_process + args.FT0
90with open(args.cfgFileName)
as configFile:
91 config = json.load(configFile)
93jsonTypeChecker(args.cfgFileName)
95taskNameInConfig =
"v0-selector"
96taskNameInCommandLine =
"o2-analysis-dq-v0-selector"
98mainTaskChecker(config, taskNameInConfig)
104logging.info(
"Only Select Configured as %s", args.onlySelect)
105if args.onlySelect ==
"true":
106 logging.info(
"INTERFACE MODE : JSON Overrider")
107if args.onlySelect ==
"false":
108 logging.info(
"INTERFACE MODE : JSON Additional")
110for key, value
in config.items():
111 if isinstance(value, dict):
112 for value, value2
in value.items():
115 if value ==
"aod-file" and args.aod:
116 config[key][value] = args.aod
117 logging.debug(
" - [%s] %s : %s", key, value, args.aod)
119 if value ==
"cfgWithQA" and args.cfgWithQA:
120 config[key][value] = args.cfgWithQA
121 logging.debug(
" - [%s] %s : %s", key, value, args.cfgWithQA)
124 if (value
in pidParameters)
and args.pid
and key !=
"tof-pid":
125 if value
in args.pid:
127 config[key][value] = value2
128 logging.debug(
" - [%s] %s : %s", key, value, value2)
129 elif args.onlySelect ==
"true":
131 config[key][value] = value2
132 logging.debug(
" - [%s] %s : %s", key, value, value2)
135 if value ==
"syst" and args.syst:
136 config[key][value] = args.syst
137 logging.debug(
" - [%s] %s : %s", key, value, args.syst)
138 if value ==
"muonSelection" and args.muonSelection:
139 config[key][value] = args.muonSelection
140 logging.debug(
" - [%s] %s : %s", key, value, args.muonSelection)
141 if value ==
"customDeltaBC" and args.customDeltaBC:
142 config[key][value] = args.customDeltaBC
143 logging.debug(
" - [%s] %s : %s", key, value, args.customDeltaBC)
146 if value ==
"d_bz_input" and args.d_bz_input:
147 config[key][value] = args.d_bz_input
148 logging.debug(
" - [%s] %s : %s", key, value, args.d_bz_input)
149 if value ==
"v0cospa" and args.v0cospa:
150 config[key][value] = args.v0cospa
151 logging.debug(
" - [%s] %s : %s", key, value, args.v0cospa)
152 if value ==
"dcav0dau" and args.dcav0dau:
153 config[key][value] = args.dcav0dau
154 logging.debug(
" - [%s] %s : %s", key, value, args.dcav0dau)
155 if value ==
"v0Rmin" and args.v0Rmin:
156 config[key][value] = args.v0Rmin
157 logging.debug(
" - [%s] %s : %s", key, value, args.v0Rmin)
158 if value ==
"v0Rmax" and args.v0Rmax:
159 config[key][value] = args.v0Rmax
160 logging.debug(
" - [%s] %s : %s", key, value, args.v0Rmax)
161 if value ==
"dcamin" and args.dcamin:
162 config[key][value] = args.dcamin
163 logging.debug(
" - [%s] %s : %s", key, value, args.dcamin)
164 if value ==
"dcamax" and args.dcamax:
165 config[key][value] = args.dcamax
166 logging.debug(
" - [%s] %s : %s", key, value, args.dcamax)
167 if value ==
"mincrossedrows" and args.mincrossedrows:
168 config[key][value] = args.mincrossedrows
169 logging.debug(
" - [%s] %s : %s", key, value, args.mincrossedrows)
170 if value ==
"maxchi2tpc" and args.maxchi2tpc:
171 config[key][value] = args.maxchi2tpc
172 logging.debug(
" - [%s] %s : %s", key, value, args.maxchi2tpc)
175 if (value
in centralityTableParameters)
and args.est:
176 if value
in args.est:
178 config[key][value] = value2
179 logging.debug(
" - [%s] %s : %s", key, value, value2)
180 elif args.onlySelect ==
"true":
182 config[key][value] = value2
183 logging.debug(
" - [%s] %s : %s", key, value, value2)
186 if value ==
"doVertexZeq" and args.isVertexZeq:
187 if args.isVertexZeq ==
"true":
188 config[key][value] =
"1"
189 config[key][
"doDummyZeq"] =
"0"
190 logging.debug(
" - %s %s : 1", key, value)
191 logging.debug(
" - [%s] doDummyZeq : 0", key)
192 if args.isVertexZeq ==
"false":
193 config[key][value] =
"0"
194 config[key][
"doDummyZeq"] =
"1"
195 logging.debug(
" - %s %s : 0", key, value)
196 logging.debug(
" - [%s] doDummyZeq : 1", key)
199 if value ==
"processWSlice" and args.isWSlice:
200 if args.isWSlice ==
"true":
201 config[key][value] =
"true"
202 config[key][
"processWoSlice"] =
"false"
203 logging.debug(
" - %s %s : true", key, value)
204 logging.debug(
" - [%s] processWoSlice : false", key)
205 if args.isWSlice ==
"false":
206 config[key][value] =
"false"
207 config[key][
"processWoSlice"] =
"true"
208 logging.debug(
" - %s %s : false", key, value)
209 logging.debug(
" - [%s] processWoSlice : true", key)
212 if value ==
"tof-expreso" and args.tof_expreso:
213 config[key][value] = args.tof_expreso
214 logging.debug(
" - [%s] %s : %s", key, value, args.tof_expreso)
217 if (value
in ft0Parameters)
and args.FT0
and key ==
"tof-event-time":
218 if value == args.FT0:
220 config[key][value] = value2
221 logging.debug(
" - [%s] %s : %s", key, value, value2)
222 elif value
is not args.FT0:
224 config[key][value] = value2
225 logging.debug(
" - [%s] %s : %s", key, value, value2)
229 config[key][value] = args.itsMatching
230 logging.debug(
" - [%s] %s : %s", key, value, args.itsMatching)
232aodFileChecker(args.aod)
236from extramodules.getTTrees
import getTTrees
239if args.aod
is not None:
242 ttreeList = config[
"internal-dpl-aod-reader"][
"aod-file"]
245trackPropChecker(commonDeps, commonDeps)
252updatedConfigFileName =
"tempConfigV0Selector.json"
254with open(updatedConfigFileName,
"w")
as outputFile:
255 json.dump(config, outputFile, indent = 2)
259for dep
in commonDeps:
263 taskNameInCommandLine +
" --configuration json://" + updatedConfigFileName +
" --severity error --shm-segment-size 12000000000 -b"
265for dep
in depsToRun.keys():
266 commandToRun +=
" | " + dep +
" --configuration json://" + updatedConfigFileName +
" -b"
267 logging.debug(
"%s added your workflow", dep)
270 logging.debug("o2-analysis-mc-converter added your workflow")
271 commandToRun += (
" | o2-analysis-mc-converter --configuration json://" + updatedConfigFileName +
" -b")
274 commandToRun += (
" | o2-analysis-fdd-converter --configuration json://" + updatedConfigFileName +
" -b")
275 logging.debug(
"o2-analysis-fdd-converter added your workflow")
277if args.add_track_prop:
278 commandToRun += (
" | o2-analysis-track-propagation --configuration json://" + updatedConfigFileName +
" -b")
279 logging.debug(
"o2-analysis-track-propagation added your workflow")
281if args.add_weakdecay_ind:
282 commandToRun += (
" | o2-analysis-weak-decay-indices --configuration json://" + updatedConfigFileName +
" -b")
283 logging.debug(
"o2-analysis-weak-decay-indices added your workflow")
286print("====================================================================================================================")
287logging.info("Command to run:")
288logging.info(commandToRun)
289print("====================================================================================================================")
291# Listing Added Commands
292dispArgs(configuredCommands)
294os.system(commandToRun)