ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
PATJobTransforms
python
AODtoNTUP_PILEUP_Skeleton.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3
import
sys
4
from
PyJobTransforms.CommonRunArgsToFlags
import
commonRunArgsToFlags
5
from
PyJobTransforms.TransformUtils
import
processPreExec, processPreInclude, processPostExec, processPostInclude
6
7
# force no legacy job properties
8
from
AthenaCommon
import
JobProperties
9
JobProperties.jobPropertiesDisallowed =
True
10
11
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
12
from
AthenaConfiguration.ComponentFactory
import
CompFactory
13
14
15
def
PRWOutputCfg
(flags, output_name="NTUP_PILEUP"):
16
from
MuonConfig.MuonConfigUtils
import
setupHistSvcCfg
17
return
setupHistSvcCfg(flags, outFile =flags.Output.HISTFileName, outStream = output_name)
18
19
20
def
PileupReweightingProviderCfg
(flags, **kwargs):
21
cfg = ComponentAccumulator()
22
kwargs.setdefault(
"ConfigOutputStream"
,
"NTUP_PILEUP"
)
23
from
AsgAnalysisAlgorithms.PileupReweightingAlgConfig
import
PileupReweightingProviderToolCfg
24
kwargs.setdefault(
"Tool"
, cfg.addPublicTool(cfg.popToolsAndMerge(PileupReweightingProviderToolCfg(flags))))
25
cfg.addEventAlgo(CompFactory.CP.PileupReweightingProvider(**kwargs))
26
return
cfg
27
28
29
def
PRWSteeringCfg
(flags):
30
cfg = ComponentAccumulator()
31
cfg.merge(
PileupReweightingProviderCfg
(flags))
32
33
#include("AthAnalysisBaseComps/SuppressLogging.py") #Optional include to suppress as much athena output as possible
34
#https://gitlab.cern.ch/atlas/athena/-/blob/release/23.0.20/Control/AthAnalysisBaseComps/share/SuppressLogging.py
35
cfg.merge(
PRWOutputCfg
(flags))
36
return
cfg
37
38
39
def
fromRunArgs
(runArgs):
40
from
AthenaCommon.Logging
import
logging
41
log = logging.getLogger(
'PRWConfig_tf'
)
42
log.info(
'****************** STARTING AODtoNTUP_PILEUP *****************'
)
43
44
log.info(
'**** Transformation run arguments'
)
45
log.info(str(runArgs))
46
47
log.info(
'**** Setting-up configuration flags'
)
48
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
49
flags = initConfigFlags()
50
51
commonRunArgsToFlags(runArgs, flags)
52
53
if
hasattr(runArgs,
'inputAODFile'
):
54
flags.Input.Files = runArgs.inputAODFile
55
else
:
56
raise
RuntimeError(
'No input AOD file defined'
)
57
58
if
hasattr(runArgs,
'outputNTUP_PILEUPFile'
):
59
flags.Output.HISTFileName = runArgs.outputNTUP_PILEUPFile
# FIXME Add a separate output file type flag??
60
else
:
61
log.warning(
'No output file set'
)
62
flags.Output.HISTFileName =
'output.NTUP_PILEUP.root'
# FIXME Add a separate output file type flag??
63
64
# Pre-include
65
processPreInclude(runArgs, flags)
66
67
# Pre-exec
68
processPreExec(runArgs, flags)
69
70
# To respect --athenaopts
71
flags.fillFromArgs()
72
73
# Lock flags
74
flags.lock()
75
76
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
77
cfg = MainServicesCfg(flags)
78
79
from
AthenaPoolCnvSvc.PoolReadConfig
import
PoolReadCfg
80
cfg.merge(PoolReadCfg(flags))
81
82
cfg.merge(
PRWSteeringCfg
(flags))
83
84
# Post-include
85
processPostInclude(runArgs, flags, cfg)
86
87
# Post-exec
88
processPostExec(runArgs, flags, cfg)
89
90
import
time
91
tic = time.time()
92
# Run the final accumulator
93
sc = cfg.run()
94
log.info(
"Ran PRWConfig_tf in "
+ str(time.time()-tic) +
" seconds"
)
95
96
sys.exit(
not
sc.isSuccess())
python.AODtoNTUP_PILEUP_Skeleton.PRWOutputCfg
PRWOutputCfg(flags, output_name="NTUP_PILEUP")
Definition
AODtoNTUP_PILEUP_Skeleton.py:15
python.AODtoNTUP_PILEUP_Skeleton.PileupReweightingProviderCfg
PileupReweightingProviderCfg(flags, **kwargs)
Definition
AODtoNTUP_PILEUP_Skeleton.py:20
python.AODtoNTUP_PILEUP_Skeleton.fromRunArgs
fromRunArgs(runArgs)
Definition
AODtoNTUP_PILEUP_Skeleton.py:39
python.AODtoNTUP_PILEUP_Skeleton.PRWSteeringCfg
PRWSteeringCfg(flags)
Definition
AODtoNTUP_PILEUP_Skeleton.py:29
Generated on
for ATLAS Offline Software by
1.17.0