ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
xAOD
xAODTruthCnv
python
TruthPrintersConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3
# Core import(s).
4
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
5
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
6
from
AthenaConfiguration.ComponentFactory
import
CompFactory
7
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
8
9
# I/O import(s).
10
from
AthenaPoolCnvSvc.PoolReadConfig
import
PoolReadCfg
11
12
# Local import(s).
13
from
xAODTruthCnv.TruthFixersConfig
import
TruthParticleFixerAlgCfg, \
14
TruthVertexFixerAlgCfg
15
16
# System import(s).
17
import
os
18
import
sys
19
20
21
def
TruthParticlePrinterAlgCfg
(flags, name="TruthParticlePrinter", **kwargs):
22
'''Configure the TruthParticlePrinterAlg algorithm.
23
'''
24
# Create an accumulator to hold the configuration.
25
result = ComponentAccumulator()
26
# Create the algorithm.
27
alg = CompFactory.xAODReader.TruthParticlePrinterAlg(name, **kwargs)
28
result.addEventAlgo(alg)
29
# Return the result to the caller.
30
return
result
31
32
33
def
TruthVertexPrinterAlgCfg
(flags, name="TruthVertexPrinter", **kwargs):
34
'''Configure the TruthVertexPrinterAlg algorithm.
35
'''
36
# Create an accumulator to hold the configuration.
37
result = ComponentAccumulator()
38
# Create the algorithm.
39
alg = CompFactory.xAODReader.TruthVertexPrinterAlg(name, **kwargs)
40
result.addEventAlgo(alg)
41
# Return the result to the caller.
42
return
result
43
44
45
if
__name__ ==
'__main__'
:
46
47
# Set up the job's flags.
48
flags = initConfigFlags()
49
flags.Exec.MaxEvents = 10
50
flags.Input.Files = [
51
"%s/ASG/DAOD_PHYS/p6697/mc23_13p6TeV.601229.PhPy8EG_A14_ttbar_hdamp258p75_SingleLep.deriv.DAOD_PHYS.e8514_e8528_s4162_s4114_r15540_r15516_p6697/DAOD_PHYS.43700597._000577.pool.root.1"
%
52
os.environ.get(
'ATLAS_REFERENCE_DATA'
,
53
'/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art'
)]
54
flags.fillFromArgs()
55
flags.lock()
56
57
# Set up the main services.
58
acc = MainServicesCfg(flags)
59
60
# Set up the input file reading.
61
acc.merge(PoolReadCfg(flags))
62
63
# Fix the reading of the truth collections that we are going to print.
64
acc.merge(TruthParticleFixerAlgCfg(flags, name=
'TruthElectronsFixer'
,
65
container=
'TruthElectrons'
,
66
ParticleLinks=[
'parentLinks'
,
'childLinks'
]))
67
acc.merge(TruthParticleFixerAlgCfg(flags, name=
'TruthMuonsFixer'
,
68
container=
'TruthMuons'
,
69
ParticleLinks=[
'parentLinks'
,
'childLinks'
]))
70
acc.merge(TruthVertexFixerAlgCfg(flags, name=
'PrimaryVertexFixer'
,
71
container=
'TruthPrimaryVertices'
))
72
73
# Set up the truth printing algorithm(s).
74
acc.merge(
TruthParticlePrinterAlgCfg
(
75
flags, name=
'TruthElectronsPrinter'
, Container=
'TruthElectrons'
))
76
acc.merge(
TruthParticlePrinterAlgCfg
(
77
flags, name=
'TruthMuonsPrinter'
, Container=
'TruthMuons'
))
78
acc.merge(
TruthVertexPrinterAlgCfg
(
79
flags, name=
'PrimaryVertexPrinter'
, Container=
'TruthPrimaryVertices'
))
80
81
# Run the configuration.
82
sys.exit(acc.run().isFailure())
TruthPrintersConfig.TruthVertexPrinterAlgCfg
TruthVertexPrinterAlgCfg(flags, name="TruthVertexPrinter", **kwargs)
Definition
TruthPrintersConfig.py:33
TruthPrintersConfig.TruthParticlePrinterAlgCfg
TruthParticlePrinterAlgCfg(flags, name="TruthParticlePrinter", **kwargs)
Definition
TruthPrintersConfig.py:21
Generated on
for ATLAS Offline Software by
1.17.0