O2-DQ User Interface 1.0.0
Loading...
Searching...
No Matches
pidTPCTOFFull.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# Orginal Task For pidTPCFull.cxx: https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/PID/pidTPCFull.cxx
17# Orginal Task For pidTOFFull.cxx: https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/PID/pidTOFFull.cxx
18
19import argparse
20
21from extramodules.choicesCompleterList import ChoicesCompleterList
22from argcomplete.completers import ChoicesCompleter
23
24
25class TpcTofPidFull(object):
26
27 """
28 Class for Interface -> pidTPCFull.cxx and pidTOFFull.cxx Task -> Configurable, Process Functions
29
30 Args:
31 object (parser_args() object): pidTPCFull.cxx and pidTOFFull.cxx Interface
32 """
33
34 def __init__(self, parserTpcTofPidFull = argparse.ArgumentParser(add_help = False)):
35 super(TpcTofPidFull, self).__init__()
36 self.parserTpcTofPidFull = parserTpcTofPidFull
37
38 def addArguments(self):
39 """
40 This function allows to add arguments for parser_args() function
41 """
42
43 # Predefined Selections
44 pidSelections = {
45 "el":
46 "Produce PID information for the Electron mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)",
47 "mu":
48 "Produce PID information for the Muon mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)",
49 "pi":
50 "Produce PID information for the Pion mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)",
51 "ka":
52 "Produce PID information for the Kaon mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)",
53 "pr":
54 "Produce PID information for the Proton mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)",
55 "de":
56 "Produce PID information for the Deuterons mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)",
57 "tr":
58 "Produce PID information for the Triton mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)",
59 "he":
60 "Produce PID information for the Helium3 mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)",
61 "al":
62 "Produce PID information for the Alpha mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)",
63 }
64 pidSelectionsList = []
65 for k, v in pidSelections.items():
66 pidSelectionsList.append(k)
67
68 booleanSelections = ["true", "false"]
69
70 # Interface
71 groupPID = self.parserTpcTofPidFull.add_argument_group(title = "Data processor options: tpc-pid-full, tof-pid-full")
72 groupPID.add_argument(
73 "--pid", help = "Produce PID information for the <particle> mass hypothesis", action = "store", nargs = "*", type = str.lower,
74 metavar = "PID", choices = pidSelectionsList,
75 ).completer = ChoicesCompleterList(pidSelectionsList)
76
77 for key, value in pidSelections.items():
78 groupPID.add_argument(key, help = value, action = "none")
79
80 groupTofPid = self.parserTpcTofPidFull.add_argument_group(title = "Data processor options: tof-pid, tof-pid-full")
81 groupTofPid.add_argument(
82 "--isWSlice", help = "Process with track slices", action = "store", type = str.lower, choices = booleanSelections,
83 ).completer = ChoicesCompleter(booleanSelections)
84
85 def parseArgs(self):
86 """
87 This function allows to save the obtained arguments to the parser_args() function
88
89 Returns:
90 Namespace: returns parse_args()
91 """
92
93 return self.parserTpcTofPidFull.parse_args()
def __init__(self, parserTpcTofPidFull=argparse.ArgumentParser(add_help=False))