24from urllib.request
import Request, urlopen
28from argcomplete.completers
import ChoicesCompleter
29from commondeps.dplAodReader
import DplAodReader
30from extramodules.choicesCompleterList
import ChoicesCompleterList
32from extramodules.actionHandler
import NoAction
33from extramodules.actionHandler
import ChoicesAction
34from extramodules.dqLibGetter
import DQLibGetter
35from extramodules.helperOptions
import HelperOptions
41 Class for Interface -> dqEfficiency.cxx Task -> Configurable, Process Functions
44 object (parser_args object): dqEfficiency.cxx Interface
48 self, parserDQEfficiency = argparse.ArgumentParser(
49 formatter_class = argparse.ArgumentDefaultsHelpFormatter,
50 description =
"Example Usage: ./runDQEfficiency.py <yourConfig.json> --arg value "
51 ), helperOptions = HelperOptions(), dplAodReader = DplAodReader()
62 This function allows to add arguments for parser_args() function
67 readerPath =
"configs/readerConfiguration_reducedEventMC.json"
68 writerPath =
"configs/writerConfiguration_dileptonMC.json"
70 analysisSelections = {
71 "eventSelection":
"Run event selection on DQ skimmed events",
72 "muonSelection":
"Run muon selection on DQ skimmed muons",
73 "trackSelection":
"Run barrel track selection on DQ skimmed tracks",
74 "sameEventPairing":
"Run same event pairing selection on DQ skimmed data",
75 "dileptonTrackDimuonMuonSelection":
"Run dimuon-muon pairing, using skimmed data",
76 "dileptonTrackDielectronKaonSelection":
"Run dielectron-kaon pairing, using skimmed data",
78 analysisSelectionsList = []
79 for k, v
in analysisSelections.items():
80 analysisSelectionsList.append(k)
82 sameEventPairingProcessSelections = {
83 "JpsiToEE":
"Run electron-electron pairing, with skimmed tracks",
84 "JpsiToMuMu":
"Run muon-muon pairing, with skimmed muons",
85 "JpsiToMuMuVertexing":
"Run muon-muon pairing and vertexing, with skimmed muons",
87 sameEventPairingProcessSelectionsList = []
88 for k, v
in sameEventPairingProcessSelections.items():
89 sameEventPairingProcessSelectionsList.append(k)
91 booleanSelections = [
"true",
"false"]
94 allAnalysisCuts, allMCSignals, allSels, allMixing = DQLibGetter.getAnalysisSelections(self)
100 title =
"Data processor options: analysis-event-selection, analysis-muon-selection, analysis-track-selection, analysis-dilepton-track"
102 groupAnalysisSelections.add_argument(
103 "--analysis", help =
"Skimmed process selections for MC Analysis", action =
"store", nargs =
"*", type = str,
104 metavar =
"ANALYSIS", choices = analysisSelectionsList,
105 ).completer = ChoicesCompleterList(analysisSelectionsList)
107 for key, value
in analysisSelections.items():
108 groupAnalysisSelections.add_argument(key, help = value, action =
"none")
112 title =
"Data processor options: analysis-same-event-pairing"
114 groupProcessSEPSelections.add_argument(
115 "--process", help =
"Skimmed process selections for analysis-same-event-pairing task", action =
"store", nargs =
"*",
116 type = str, metavar =
"PROCESS", choices = sameEventPairingProcessSelectionsList,
117 ).completer = ChoicesCompleterList(sameEventPairingProcessSelectionsList)
118 groupProcessSEPSelections.add_argument(
119 "--cfgBarrelMCRecSignals", help =
"Space separated list of MC signals (reconstructed)", nargs =
"*", action =
"store",
120 type = str, metavar =
"CFGBARRELMCRECSIGNALS", choices = allMCSignals,
121 ).completer = ChoicesCompleterList(allMCSignals)
122 groupProcessSEPSelections.add_argument(
123 "--cfgBarrelMCGenSignals", help =
"Space separated list of MC signals (generated)", nargs =
"*", action =
"store", type = str,
124 metavar =
"CFGBARRELMCGENSIGNALS", choices = allMCSignals,
125 ).completer = ChoicesCompleterList(allMCSignals)
126 groupProcessSEPSelections.add_argument(
127 "--cfgFlatTables", help =
"Produce a single flat tables with all relevant information of the pairs and single tracks",
128 action =
"store", type = str.lower, choices = booleanSelections,
129 ).completer = ChoicesCompleter(booleanSelections)
131 title =
"Choice List for analysis-same-event-pairing task Process options"
134 for key, value
in sameEventPairingProcessSelections.items():
135 groupProcess.add_argument(key, help = value, action =
"none")
139 title =
"Data processor options: analysis-event-selection, analysis-muon-selection, analysis-track-selection, analysis-event-mixing, analysis-dilepton-hadron"
141 groupQASelections.add_argument(
142 "--cfgQA", help =
"If true, fill QA histograms", action =
"store", type = str.lower, choices = (booleanSelections),
143 ).completer = ChoicesCompleter(booleanSelections)
146 groupAnalysisEventSelection = self.
parserDQEfficiency.add_argument_group(title =
"Data processor options: analysis-event-selection")
147 groupAnalysisEventSelection.add_argument(
148 "--cfgEventCuts", help =
"Space separated list of event cuts", nargs =
"*", action =
"store", type = str,
149 metavar =
"CFGEVENTCUTS", choices = allAnalysisCuts,
150 ).completer = ChoicesCompleterList(allAnalysisCuts)
153 groupAnalysisTrackSelection = self.
parserDQEfficiency.add_argument_group(title =
"Data processor options: analysis-track-selection")
154 groupAnalysisTrackSelection.add_argument(
155 "--cfgTrackCuts", help =
"Space separated list of barrel track cuts", nargs =
"*", action =
"store", type = str,
156 metavar =
"CFGTRACKCUTS", choices = allAnalysisCuts,
157 ).completer = ChoicesCompleterList(allAnalysisCuts)
158 groupAnalysisTrackSelection.add_argument(
159 "--cfgTrackMCSignals", help =
"Space separated list of MC signals", nargs =
"*", action =
"store", type = str,
160 metavar =
"CFGTRACKMCSIGNALS", choices = allMCSignals,
161 ).completer = ChoicesCompleterList(allMCSignals)
164 groupAnalysisMuonSelection = self.
parserDQEfficiency.add_argument_group(title =
"Data processor options: analysis-muon-selection")
165 groupAnalysisMuonSelection.add_argument(
166 "--cfgMuonCuts", help =
"Space separated list of muon cuts", nargs =
"*", action =
"store", type = str, metavar =
"CFGMUONCUTS",
167 choices = allAnalysisCuts,
168 ).completer = ChoicesCompleterList(allAnalysisCuts)
169 groupAnalysisMuonSelection.add_argument(
170 "--cfgMuonMCSignals", help =
"Space separated list of MC signals", nargs =
"*", action =
"store", type = str,
171 metavar =
"CFGMUONMCSIGNALS", choices = allMCSignals,
172 ).completer = ChoicesCompleterList(allMCSignals)
175 groupAnalysisDileptonTrack = self.
parserDQEfficiency.add_argument_group(title =
"Data processor options: analysis-dilepton-track")
176 groupAnalysisDileptonTrack.add_argument(
177 "--cfgLeptonCuts", help =
"Space separated list of barrel track cuts", nargs =
"*", action =
"store", type = str,
178 metavar =
"CFGLEPTONCUTS", choices = allAnalysisCuts,
179 ).completer = ChoicesCompleterList(allAnalysisCuts)
180 groupAnalysisDileptonTrack.add_argument(
181 "--cfgFillCandidateTable", help =
"Produce a single flat tables with all relevant information dilepton-track candidates",
182 action =
"store", type = str.lower, choices = booleanSelections,
183 ).completer = ChoicesCompleter(booleanSelections)
184 groupAnalysisDileptonTrack.add_argument(
185 "--cfgBarrelDileptonMCRecSignals", help =
"Space separated list of MC signals (reconstructed)", nargs =
"*", action =
"store",
186 type = str, metavar =
"CFGBARRELDILEPTONMCRECSIGNALS", choices = allMCSignals,
187 ).completer = ChoicesCompleterList(allMCSignals)
188 groupAnalysisDileptonTrack.add_argument(
189 "--cfgBarrelDileptonMCGenSignals", help =
"Space separated list of MC signals (generated)", nargs =
"*", action =
"store",
190 type = str, metavar =
"CFGBARRELDILEPTONMCRECSIGNALS", choices = allMCSignals,
191 ).completer = ChoicesCompleterList(allMCSignals)
195 title =
"Data processor options: internal-dpl-aod-reader, internal-dpl-aod-writer"
197 groupDPLReader.add_argument(
199 help =
"Reader config JSON with path. For Standart Analysis use as default, for dilepton analysis change to dilepton JSON config file",
200 action =
"store", default = readerPath, type = str
202 groupDPLReader.add_argument(
203 "--writer", help =
"Argument for producing dileptonAOD.root. Set false for disable", action =
"store", default = writerPath,
209 This function allows to save the obtained arguments to the parser_args() function
212 Namespace: returns parse_args()
220 This function allows to merge parser_args argument information from different classes
def __init__(self, parserDQEfficiency=argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description="Example Usage: ./runDQEfficiency.py <yourConfig.json> --arg value "), helperOptions=HelperOptions(), dplAodReader=DplAodReader())