Skip to content

Commit ba6a368

Browse files
njacaziochiarazampolli
authored andcommitted
Align to recent changes and extension
1 parent 9d719fd commit ba6a368

File tree

4 files changed

+161
-18
lines changed

4 files changed

+161
-18
lines changed

MC/analysis_testing/analysis_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
# This script performs an analysis task (given as first argument)
44
# in a directory (produced) where a merged AO2D.root was produced

MC/analysis_testing/o2dpg_analysis_test_workflow.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# pass name
3232
# --period-name PERIOD_NAME
3333
# prodcution tag
34-
# --config CONFIG overwrite thee default config JSON. Pass as json://<path/to/file>
34+
# --config CONFIG overwrite the default config JSON. Pass as </path/to/file>, will be automatically configured to json://
3535
# --only-analyses [ONLY_ANALYSES [ONLY_ANALYSES ...]]
3636
# filter only on these analyses
3737
# --merged-task add merged analysis task (one pipe for all) with name "MergedAnalyses"
@@ -67,7 +67,7 @@
6767
import importlib.util
6868
import argparse
6969
from os import environ, makedirs
70-
from os.path import join, exists, abspath, expanduser
70+
from os.path import join, exists, abspath, expanduser, normpath
7171

7272
# make sure O2DPG + O2 is loaded
7373
O2DPG_ROOT=environ.get('O2DPG_ROOT')
@@ -95,8 +95,8 @@
9595
ANALYSIS_VALID_MC = "mc"
9696
ANALYSIS_VALID_DATA = "data"
9797

98-
ANALYSIS_CONFIGS = {ANALYSIS_VALID_MC: "json://${O2DPG_ROOT}/MC/config/analysis_testing/json/analysis-testing-mc.json",
99-
ANALYSIS_VALID_DATA: "json://${O2DPG_ROOT}/MC/config/analysis_testing/json/analysis-testing-data.json"}
98+
ANALYSIS_CONFIGS = {ANALYSIS_VALID_MC: "${O2DPG_ROOT}/MC/config/analysis_testing/json/analysis-testing-mc.json",
99+
ANALYSIS_VALID_DATA: "${O2DPG_ROOT}/MC/config/analysis_testing/json/analysis-testing-data.json"}
100100

101101
# collect all analyses
102102
ANALYSES = []
@@ -114,7 +114,12 @@
114114
analysis_EventTrackQA = {"name": "EventTrackQA",
115115
"expected_output": ["AnalysisResults.root"],
116116
"valid_for": [ANALYSIS_VALID_MC, ANALYSIS_VALID_DATA],
117-
"cmd": "o2-analysis-timestamp {CONFIG} | o2-analysis-track-propagation {CONFIG} | o2-analysis-trackselection {CONFIG} | o2-analysis-event-selection {CONFIG} | o2-analysis-pid-tof-base {CONFIG} | o2-analysis-qa-event-track {CONFIG} {AOD}"}
117+
"cmd": ["o2-analysis-timestamp",
118+
"o2-analysis-track-propagation",
119+
"o2-analysis-trackselection",
120+
"o2-analysis-multiplicity-table",
121+
"o2-analysis-event-selection",
122+
"o2-analysis-qa-event-track"]}
118123
ANALYSES.append(analysis_EventTrackQA)
119124
analysis_K0STrackingEfficiencyQA = {"name": "K0STrackingEfficiencyQA",
120125
"expected_output": ["AnalysisResults.root"],
@@ -325,9 +330,17 @@ def add_analysis_tasks(workflow, input_aod="./AO2D.root", output_dir="./Analysis
325330
input_aod = f"@{input_aod}"
326331
data_or_mc = ANALYSIS_VALID_MC if is_mc else ANALYSIS_VALID_DATA
327332
configuration = ANALYSIS_CONFIGS[data_or_mc] if config is None else config
333+
configuration = configuration.replace("json://", "")
334+
configuration = abspath(normpath(configuration))
335+
configuration = f"json://{configuration}"
328336
for ana in ANALYSES:
329-
if data_or_mc in ana["valid_for"] and (not analyses_only or (ana["name"] in analyses_only)):
330-
workflow.append(create_ana_task(ana["name"], ana["cmd"].format(CONFIG=f"--configuration {configuration}", AOD=f"--aod-file {input_aod}"), output_dir, needs=needs, is_mc=is_mc))
337+
if data_or_mc in ana["valid_for"] and (not analyses_only or (ana["name"] in analyses_only)):
338+
if type(ana["cmd"]) is list:
339+
piped_analysis = f" --configuration {configuration} | ".join(ana["cmd"])
340+
piped_analysis += f" --configuration {configuration} --aod-file {input_aod}"
341+
workflow.append(create_ana_task(ana["name"], piped_analysis, output_dir, needs=needs, is_mc=is_mc))
342+
else:
343+
workflow.append(create_ana_task(ana["name"], ana["cmd"].format(CONFIG=f"--configuration {configuration}", AOD=f"--aod-file {input_aod}"), output_dir, needs=needs, is_mc=is_mc))
331344
continue
332345
print(f"Analysis {ana['name']} not added since not compatible with isMC={is_mc} and filetred analyses {analyses_only}")
333346
if add_merged_task:
@@ -400,7 +413,7 @@ def run(args):
400413

401414
def main():
402415
"""entry point when run directly from command line"""
403-
parser = argparse.ArgumentParser(description='Create analysi test workflow')
416+
parser = argparse.ArgumentParser(description='Create analysis test workflow')
404417
parser.add_argument("-f", "--input-file", dest="input_file", default="./AO2D.root", help="full path to the AO2D input", required=True)
405418
parser.add_argument("-a", "--analysis-dir", dest="analysis_dir", default="./Analysis", help="the analysis output and working directory")
406419
parser.add_argument("-o", "--output", default="workflow_analysis_test.json", help="the workflow file name")
@@ -409,7 +422,7 @@ def main():
409422
parser.add_argument("--run-number", dest="run_number", type=int, default=300000, help="the run number")
410423
parser.add_argument("--pass-name", dest="pass_name", help="pass name")
411424
parser.add_argument("--period-name", dest="period_name", help="period name")
412-
parser.add_argument("--config", help="overwrite the default config JSON. Pass as json://</path/to/file>")
425+
parser.add_argument("--config", help="overwrite the default config JSON. Pass as </path/to/file>, will be automatically configured to json://")
413426
parser.add_argument("--only-analyses", dest="only_analyses", nargs="*", help="filter only on these analyses")
414427
parser.add_argument("--merged-task", dest="merged_task", action="store_true", help="add merged analysis task (one pipe for all) with name \"MergedAnalyses\"")
415428
parser.set_defaults(func=run)

MC/config/analysis_testing/json/analysis-testing-data.json

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,83 @@
6262
"processRun3": "true"
6363
},
6464
"qa-event-track": {
65-
"isMC": "false",
6665
"isRun3": "true",
66+
"selectGoodEvents": "true",
67+
"selectMaxVtxZ": "100",
68+
"targetNumberOfEvents": "10000000",
69+
"fractionOfSampledEvents": "1",
70+
"trackSelection": "1",
71+
"selectCharge": "0",
72+
"selectPrim": "false",
73+
"selectSec": "false",
74+
"selectPID": "0",
75+
"minPt": "-10",
76+
"maxPt": "1e+10",
77+
"minEta": "-2",
78+
"maxEta": "2",
79+
"minPhi": "-1",
80+
"maxPhi": "10",
81+
"binsPt": {
82+
"values": [
83+
"0",
84+
"0",
85+
"0.10000000000000001",
86+
"0.20000000000000001",
87+
"0.29999999999999999",
88+
"0.40000000000000002",
89+
"0.5",
90+
"0.59999999999999998",
91+
"0.69999999999999996",
92+
"0.80000000000000004",
93+
"0.90000000000000002",
94+
"1",
95+
"1.1000000000000001",
96+
"1.2",
97+
"1.3",
98+
"1.3999999999999999",
99+
"1.5",
100+
"2",
101+
"5",
102+
"10",
103+
"20",
104+
"50"
105+
]
106+
},
107+
"binsVertexPosZ": {
108+
"values": [
109+
"100",
110+
"-20",
111+
"20"
112+
]
113+
},
114+
"binsVertexPosXY": {
115+
"values": [
116+
"500",
117+
"-1",
118+
"1"
119+
]
120+
},
121+
"binsTrackMultiplcity": {
122+
"values": [
123+
"200",
124+
"0",
125+
"200"
126+
]
127+
},
67128
"processData": "true",
68-
"processMC": "false"
129+
"processDataIU": "false",
130+
"processDataIUFiltered": "false",
131+
"processMC": "false",
132+
"processTableData": "false",
133+
"processTableMC": "false"
69134
},
70135
"track-propagation": {
71136
"ccdb-url": "http:\/\/alice-ccdb.cern.ch",
72137
"lutPath": "GLO\/Param\/MatLUT",
73138
"geoPath": "GLO\/Config\/GeometryAligned",
74-
"grpPath": "GLO\/GRP\/GRP",
139+
"grpmagPath": "GLO\/Config\/GRPMagField",
75140
"mVtxPath": "GLO\/Calib\/MeanVertex",
76141
"processStandard": "false",
77142
"processCovariance": "true"
78143
}
79-
}
144+
}

MC/config/analysis_testing/json/analysis-testing-mc.json

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,81 @@
249249
"processOnlyBCs": "true"
250250
},
251251
"qa-event-track": {
252-
"isMC": "true",
253252
"isRun3": "true",
254-
"processData": "false",
255-
"processMC": "true"
253+
"selectGoodEvents": "true",
254+
"selectMaxVtxZ": "100",
255+
"targetNumberOfEvents": "10000000",
256+
"fractionOfSampledEvents": "1",
257+
"trackSelection": "1",
258+
"selectCharge": "0",
259+
"selectPrim": "false",
260+
"selectSec": "false",
261+
"selectPID": "0",
262+
"minPt": "-10",
263+
"maxPt": "1e+10",
264+
"minEta": "-2",
265+
"maxEta": "2",
266+
"minPhi": "-1",
267+
"maxPhi": "10",
268+
"binsPt": {
269+
"values": [
270+
"0",
271+
"0",
272+
"0.10000000000000001",
273+
"0.20000000000000001",
274+
"0.29999999999999999",
275+
"0.40000000000000002",
276+
"0.5",
277+
"0.59999999999999998",
278+
"0.69999999999999996",
279+
"0.80000000000000004",
280+
"0.90000000000000002",
281+
"1",
282+
"1.1000000000000001",
283+
"1.2",
284+
"1.3",
285+
"1.3999999999999999",
286+
"1.5",
287+
"2",
288+
"5",
289+
"10",
290+
"20",
291+
"50"
292+
]
293+
},
294+
"binsVertexPosZ": {
295+
"values": [
296+
"100",
297+
"-20",
298+
"20"
299+
]
300+
},
301+
"binsVertexPosXY": {
302+
"values": [
303+
"500",
304+
"-1",
305+
"1"
306+
]
307+
},
308+
"binsTrackMultiplcity": {
309+
"values": [
310+
"200",
311+
"0",
312+
"200"
313+
]
314+
},
315+
"processData": "true",
316+
"processDataIU": "false",
317+
"processDataIUFiltered": "false",
318+
"processMC": "true",
319+
"processTableData": "false",
320+
"processTableMC": "false"
256321
},
257322
"track-propagation": {
258323
"ccdb-url": "http:\/\/alice-ccdb.cern.ch",
259324
"lutPath": "GLO\/Param\/MatLUT",
260325
"geoPath": "GLO\/Config\/GeometryAligned",
261-
"grpPath": "GLO\/GRP\/GRP",
326+
"grpmagPath": "GLO\/Config\/GRPMagField",
262327
"mVtxPath": "GLO\/Calib\/MeanVertex",
263328
"processStandard": "false",
264329
"processCovariance": "true"

0 commit comments

Comments
 (0)