ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationTransformHelpers.py
Go to the documentation of this file.
1"""Main derivation transform configuration helpers
2
3Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4"""
5
6from PyJobTransforms.trfArgClasses import argFactory, argInt, argList, argNTUPFile, argPOOLFile, argSubstepBool, argString
7from PyJobTransforms.trfExe import athenaExecutor, reductionFrameworkExecutor
8
10 """Add common derivation command-line parser arguments."""
11 parser.defineArgGroup('Derivation', 'Derivation Options')
12 parser.add_argument('--formats', nargs='+',
13 type=argFactory(argList),
14 help='List of required D(2)AOD formats',
15 group='Derivation')
16 parser.add_argument('--augmentations', nargs='*',
17 type=argFactory(argList),
18 help='List of augmentations CHILD:PARENT',
19 group='Derivation')
20 parser.add_argument('--inputAODFile', nargs='+',
21 type=argFactory(argPOOLFile, io='input'),
22 help='Input AOD for DAOD building',
23 group='Derivation')
24 parser.add_argument('--inputDAOD_PHYSFile', nargs='+',
25 type=argFactory(argPOOLFile, io='input'),
26 help='Input DAOD_PHYS for D2AOD building',
27 group='Derivation')
28 parser.add_argument('--inputDAOD_PHYSLITEFile', nargs='+',
29 type=argFactory(argPOOLFile, io='input'),
30 help='Input DAOD_PHYSLITE for D2AOD building',
31 group='Derivation')
32 parser.add_argument('--inputEVNTFile', nargs='+',
33 type=argFactory(argPOOLFile, io='input'),
34 help='Input EVNT for DAOD_TRUTHX building',
35 group='Derivation')
36 parser.add_argument('--outputDAODFile', nargs='+',
37 type=argFactory(argPOOLFile, io='output'),
38 help='Output DAOD filename stub, DAOD_X will be prepended to it',
39 group='Derivation')
40 parser.add_argument('--outputD2AODFile', nargs='+',
41 type=argFactory(argPOOLFile, io='output'),
42 help='Output D2AOD filename stub, D2AOD_X will be prepended to it',
43 group='Derivation')
44 parser.add_argument('--passThrough',
45 type=argFactory(argSubstepBool, defaultSubstep = 'Derivation', runarg=True),
46 metavar='BOOL',
47 help='Disable all skimming and write every event',
48 group='Derivation')
49 parser.add_argument('--skimmingExpression',
50 type=argFactory(argString),
51 help='String defining skimming from command line, SKIM format only',
52 group='Derivation',
53 default='')
54 parser.add_argument('--skimmingContainers', nargs='+',
55 type=argFactory(argList),
56 help='List of containers used for skimming in the skimmingExpression, SKIM format only',
57 group='Derivation',
58 )
59 parser.add_argument('--n_folds_NF',
60 type=argFactory(argInt),
61 help='Number of folds to use for the photon shower shape correction with Normalizing Flows. '
62 'Must be >=1 and not exceed the NFolds value in the NF config file. '
63 'If not given, only 1 (with index 0) fold is used.',
64 group='Derivation')
65
67 """Add validation command-line parser arguments."""
68 parser.defineArgGroup('Physics Validation', 'Physics validation options')
69 parser.add_argument('--validationFlags', nargs='+',
70 type=argFactory(argList),
71 help='Physics validation histogram switches',
72 group='Physics Validation')
73 parser.add_argument('--inputDAOD_PHYSVALFile', nargs='+',
74 type=argFactory(argPOOLFile, io='input'),
75 help='Input DAOD_PHYSVAL for validation ntuples building',
76 group='Physics Validation')
77 parser.add_argument('--outputNTUP_PHYSVALFile',
78 type=argFactory(argNTUPFile, io='output'),
79 help='Output physics validation file',
80 group='Physics Validation')
81
82
83def addDerivationSubstep(executor_set):
84 # We use the existing DF executor which inherits from the athenaExecutor.
85 # It handles the composite output filenames and inserts them into the transform's dataDictionary.
86 # If this isn't done the file validation will run over the wrong file name.
87 executor = reductionFrameworkExecutor(name='Derivation',
88 skeletonCA='DerivationFrameworkConfiguration.DerivationSkeleton',
89 substep='DerivationFramework',
90 tryDropAndReload=False,
91 perfMonFile='ntuple.pmon.gz',
92 inData=['EVNT', 'AOD', 'DAOD_PHYS', 'DAOD_PHYSLITE'],
93 outData=['DAOD', 'D2AOD'])
94 executor_set.add(executor)
95
96
98 executor = athenaExecutor(name='PhysicsValidation',
99 skeletonCA='DerivationFrameworkConfiguration.PhysicsValidationSkeleton',
100 substep='PhysicsValidation',
101 tryDropAndReload=False,
102 perfMonFile='ntuple.pmon.gz',
103 inData=['DAOD_PHYSVAL'],
104 outData=['NTUP_PHYSVAL'])
105 executor_set.add(executor)
Transform argument class definitions.
Transform execution functions.