ATLAS Offline Software
PATTransformUtils.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 
4 
5 # Get the base logger for the transforms and extend it for us
6 from PyJobTransforms.trfLogger import msg
7 msg = msg.getChild(__name__)
8 
9 import PyJobTransforms.trfArgClasses as trfArgClasses
10 
11 from PyJobTransforms.trfArgs import getExtraDPDList
12 from PyJobTransforms.trfExe import NTUPMergeExecutor, POOLMergeExecutor
13 
14 
16  # Better to somehow auto-import this from PhysicsAnalysis/PhysicsValidation/PhysValMonitoring
17  parser.defineArgGroup('Validation Files', 'Physics validation file options')
18  parser.add_argument('--outputNTUP_PHYSVALFile',
20  help='Output physics validation file', group='Validation Files')
21 
23  # Better to somehow auto-import this from PhysicsAnalysis/PhysicsValidation/PhysValMonitoring
24  parser.defineArgGroup('Validation Files', 'Physics validation file options')
25  parser.add_argument('--inputNTUP_PHYSVALFile',
27  help='Input physics validation file', group='Validation Files', nargs='+')
28  parser.add_argument('--outputNTUP_PHYSVAL_MRGFile',
30  help='Output merged physics validation file', group='Validation Files')
31 
32 def addNTUPMergeSubsteps(executorSet):
33  # Ye olde NTUPs
34  try:
35  # Physics Validation NTUP
36  executorSet.add(NTUPMergeExecutor(name='NTUPLEMergePHYSVAL', exe='hadd', inData=['NTUP_PHYSVAL'], outData=['NTUP_PHYSVAL_MRG0'], exeArgs=[]))
37  #add post processing for some Pull histograms in ID track monitoring
38  executorSet.add(NTUPMergeExecutor(name='NTUPLEMergePHYSVALPostProc', exe='postProcessIDPVMHistos', inData=['NTUP_PHYSVAL_MRG0'], outData=['NTUP_PHYSVAL_MRG'], exeArgs=[]))
39  # Extra Tier-0 NTUPs
40  extraNTUPs = getExtraDPDList(NTUPOnly = True)
41  for ntup in extraNTUPs:
42  executorSet.add(NTUPMergeExecutor(name='NTUPLEMerge'+ntup.name.replace('_',''), exe='hadd', inData=[ntup.name], outData=[ntup.name+'_MRG'], exeArgs=[]))
43  except ImportError as e:
44  msg.warning("Failed to get D3PD lists - probably D3PDs are broken in this release: {0}".format(e))
45 
46 
47 
48 def addDAODArguments(parser, mergerTrf=True):
49  DAODTypes = knownDAODTypes()
50  if mergerTrf:
51  parser.defineArgGroup('Input DAOD', 'Input DAOD files to be merged')
52  parser.defineArgGroup('Output DAOD', 'Output merged DAOD files')
53  for DAOD in DAODTypes:
54  parser.add_argument("--input" + DAOD + "File", nargs="+",
55  type=trfArgClasses.argFactory(trfArgClasses.argPOOLFile, io="input", type="AOD", subtype=DAOD),
56  help="Input DAOD file of " + DAOD + " derivation", group="Input DAOD")
57  parser.add_argument("--output" + DAOD + "_MRGFile",
58  type=trfArgClasses.argFactory(trfArgClasses.argPOOLFile, io="output", type="AOD", subtype=DAOD),
59  help="Output merged DAOD file of " + DAOD + " derivation", group="Output DAOD")
60  else:
61  parser.defineArgGroup('Output DAOD', 'Output derivation DAOD files')
62  for DAOD in DAODTypes:
63  parser.add_argument("--output" + DAOD + "File",
64  type=trfArgClasses.argFactory(trfArgClasses.argPOOLFile, io="output", type="AOD", subtype=DAOD),
65  help="Output DAOD file of " + DAOD + " derivation", group="Output DAOD")
66 
67 
68 def addDAODMergerSubsteps(executorSet):
69  DAODTypes = knownDAODTypes()
70  for DAOD in DAODTypes:
71  executorSet.add(POOLMergeExecutor(name = DAOD.removeprefix("DAOD_") + 'Merge', inData = [DAOD], outData = [DAOD+'_MRG']))
72 
74  DAODTypes = []
75  try:
76  from DerivationFrameworkCore.DerivationFrameworkProdFlags import listAODtoDPD
77  DAODTypes = [ name.lstrip("Stream") for name in listAODtoDPD ]
78  except ImportError:
79  msg.warning("Could not import DAOD subtypes from DerivationFramework.DerivationFrameworkCore")
80  return DAODTypes
python.PATTransformUtils.addDAODArguments
def addDAODArguments(parser, mergerTrf=True)
Import list of known DAODs from the derivation framework and.
Definition: PATTransformUtils.py:48
python.trfArgClasses.argPOOLFile
POOL file class.
Definition: trfArgClasses.py:1425
vtune_athena.format
format
Definition: vtune_athena.py:14
python.trfArgClasses.argNTUPFile
NTUP (plain ROOT) file class.
Definition: trfArgClasses.py:1679
python.trfArgs.getExtraDPDList
def getExtraDPDList(NTUPOnly=False)
Definition: trfArgs.py:400
PyJobTransforms.trfArgClasses
Transform argument class definitions.
python.PATTransformUtils.addPhysValidationFiles
def addPhysValidationFiles(parser)
Definition: PATTransformUtils.py:15
python.PATTransformUtils.addNTUPMergeSubsteps
def addNTUPMergeSubsteps(executorSet)
Definition: PATTransformUtils.py:32
python.trfArgClasses.argFactory
Factory class used to generate argument class instances for argparse.
Definition: trfArgClasses.py:31
python.PATTransformUtils.addPhysValidationMergeFiles
def addPhysValidationMergeFiles(parser)
Definition: PATTransformUtils.py:22
PyJobTransforms.trfExe
Transform execution functions.
PyJobTransforms.trfLogger
Logging configuration for ATLAS job transforms.
python.PATTransformUtils.knownDAODTypes
def knownDAODTypes()
Definition: PATTransformUtils.py:73
python.PATTransformUtils.addDAODMergerSubsteps
def addDAODMergerSubsteps(executorSet)
Definition: PATTransformUtils.py:68