O2-DQ User Interface 1.0.0
Loading...
Searching...
No Matches
eventSelection.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
17# Orginal Task: https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/eventSelection.cxx
18
19import argparse
20
21from argcomplete.completers import ChoicesCompleter
22
23
24class EventSelectionTask(object):
25
26 """
27 Class for Interface -> eventSelection.cxx Task -> Configurable, Process Functions
28
29 Args:
30 object (parser_args() object): eventSelection.cxx Interface
31 """
32
33 def __init__(self, parserEventSelectionTask = argparse.ArgumentParser(add_help = False)):
34 super(EventSelectionTask, self).__init__()
35 self.parserEventSelectionTask = parserEventSelectionTask
36
37 def addArguments(self):
38 """
39 This function allows to add arguments for parser_args() function
40 """
41
42 # Predefined Selections
43 collisionSystemSelections = ["PbPb", "pp", "pPb", "Pbp", "XeXe"]
44 eventMuonSelections = ["0", "1", "2"]
45
46 # Interface
47 groupEventSelection = self.parserEventSelectionTask.add_argument_group(title = "Data processor options: event-selection-task")
48 groupEventSelection.add_argument(
49 "--syst", help = "Collision System Selection ex. pp", action = "store", type = str, choices = (collisionSystemSelections),
50 ).completer = ChoicesCompleter(collisionSystemSelections)
51 groupEventSelection.add_argument(
52 "--muonSelection", help = "0 - barrel, 1 - muon selection with pileup cuts, 2 - muon selection without pileup cuts",
53 action = "store", type = str, choices = (eventMuonSelections),
54 ).completer = ChoicesCompleter(eventMuonSelections)
55 groupEventSelection.add_argument(
56 "--customDeltaBC", help = "custom BC delta for FIT-collision matching", action = "store", type = str,
57 )
58
59 def parseArgs(self):
60 """
61 This function allows to save the obtained arguments to the parser_args() function
62
63 Returns:
64 Namespace: returns parse_args()
65 """
66
67 return self.parserEventSelectionTask.parse_args()
def __init__(self, parserEventSelectionTask=argparse.ArgumentParser(add_help=False))