O2-DQ User Interface 1.0.0
Loading...
Searching...
No Matches
centralityTable.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: https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/centralityTable.cxx
17
18import argparse
19
20from extramodules.choicesCompleterList import ChoicesCompleterList
21
22
23class CentralityTable(object):
24
25 """
26 Class for Interface -> centralityTable.cxx Task -> Configurable, Process Functions
27
28 Args:
29 object (parser_args() object): centralityTable.cxx Interface
30 """
31
32 def __init__(self, parserCentralityTable = argparse.ArgumentParser(add_help = False)):
33 super(CentralityTable, self).__init__()
34 self.parserCentralityTable = parserCentralityTable
35 # self.parserB.register("action", "none", NoAction)
36 # self.parserB.register("action", "store_choice", ChoicesAction)
37
38 def addArguments(self):
39 """
40 This function allows to add arguments for parser_args() function
41 """
42
43 # Predefined Selections
44 centralityTableSelections = {
45 "Run2V0M": "Produces centrality percentiles using V0 multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)",
46 "Run2SPDtks":
47 "Produces Run2 centrality percentiles using SPD tracklets multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)",
48 "Run2SPDcls":
49 "Produces Run2 centrality percentiles using SPD clusters multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)",
50 "Run2CL0": "Produces Run2 centrality percentiles using CL0 multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)",
51 "Run2CL1": "Produces Run2 centrality percentiles using CL1 multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)",
52 "FV0A": "Produces centrality percentiles using FV0A multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)",
53 "FT0M": "Produces centrality percentiles using FT0 multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)",
54 "FDDM": "Produces centrality percentiles using FDD multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)",
55 "NTPV":
56 "Produces centrality percentiles using number of tracks contributing to the PV. -1: auto, 0: don't, 1: yes. Default: auto (-1)",
57 }
58 centralityTableSelectionsList = []
59 for k, v in centralityTableSelections.items():
60 centralityTableSelectionsList.append(k)
61
62 # Interface
63 groupCentralityTable = self.parserCentralityTable.add_argument_group(title = "Data processor options: centrality-table")
64 groupCentralityTable.add_argument(
65 "--est", help = "Produces centrality percentiles parameters", action = "store", nargs = "*", type = str, metavar = "EST",
66 choices = centralityTableSelectionsList,
67 ).completer = ChoicesCompleterList(centralityTableSelectionsList)
68
69 for key, value in centralityTableSelections.items():
70 groupCentralityTable.add_argument(key, help = value, action = "none")
71
72 def parseArgs(self):
73 """
74 This function allows to save the obtained arguments to the parser_args() function
75
76 Returns:
77 Namespace: returns parse_args()
78 """
79
80 return self.parserCentralityTable.parse_args()
def __init__(self, parserCentralityTable=argparse.ArgumentParser(add_help=False))