ATLAS Offline Software
Loading...
Searching...
No Matches
NTUPMerge_tf.py
Go to the documentation of this file.
1#! /usr/bin/env python
2
3# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4
5
6
7import sys
8import time
9
10# Setup core logging here
11from PyJobTransforms.trfLogger import msg
12msg.info('logging set in %s', sys.argv[0])
13
14from PyJobTransforms.transform import transform
15from PyJobTransforms.trfArgs import addExtraDPDTypes
16from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace
17from PATJobTransforms.PATTransformUtils import addNTUPMergeSubsteps, addPhysValidationMergeFiles
18
19@stdTrfExceptionHandler
20@sigUsrStackTrace
21def main():
22 msg.info('This is %s', sys.argv[0])
23 if sys.argv[1:] == []:
24 msg.info("%s stopped at %s, no input parameters given", sys.argv[0], time.asctime())
25
26 trf = getTransform()
27 trf.parseCmdLineArgs(sys.argv[1:])
28 trf.execute()
29 trf.generateReport()
30
31 msg.info("%s stopped at %s, tf exit code %d", sys.argv[0], time.asctime(), trf.exitCode)
32 sys.exit(trf.exitCode)
33
35 msg.debug("in getTransform...")
36
37 # get the default executor list
38 executorSet = set()
39 # instantiate a transform with no steps
40 trf = transform(executor = executorSet, description = 'ATLAS NTUPLE merge and post-processing transform')
41
42 # add custom merge and post-processing steering parameters for PhysVal
43 addPhysValidationMergeFiles(trf.parser)
44
45 # additional formats
46 addExtraDPDTypes(trf.parser, transform=trf, NTUPMergerArgs = True)
47
48 args = trf.parser.parse_args()
49 msg.debug("args:", args)
50
51 # executor steps
52 mergeStepSet = set()
53
54 # Check the user's optional parameters
55 # NOTE: we need to first check if the arg is present,
56 # then we get the value. When not specified, in fact,
57 # the optional args are not present in the list of
58 # args. Also, if we only check its existence,
59 # we don't get its value when set with set()
60 skipPP = args.skipPostProcessing if 'skipPostProcessing' in args else False
61
62 # add to the transform the merge and
63 # post-processing steps conditionally
64 # based on user's input
65 addNTUPMergeSubsteps(mergeStepSet, skip_post_processing = skipPP)
66
67 trf.appendToExecutorSet(list(mergeStepSet))
68
69 return trf
70
71if __name__ == '__main__':
72 main()
73
STL class.
Main package for new style ATLAS job transforms.
Logging configuration for ATLAS job transforms.