ATLAS Offline Software
Loading...
Searching...
No Matches
configureRecoForPFlow.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3
4#This function adds data to the output AOD which are needed for pflow CP study workflows.
5#Currently it only adds data required to run jet finding from the AOD.
6#If the needed data is not produced in the main reco job, we also configure
7#it here to run.
9
10 cfg = ComponentAccumulator()
11
12 from CaloRec.CaloFwdTopoTowerConfig import CaloFwdTopoTowerCfg
13 cfg.merge(CaloFwdTopoTowerCfg(cfgFlags,CaloTopoClusterContainerKey="CaloCalTopoClusters"))
14
15 from OutputStreamAthenaPool.OutputStreamConfig import addToAOD
16 toAOD = [ "CaloClusterContainer#CaloCalFwdTopoTowers", "CaloClusterContainer#CaloCalFwdTopoTowersAux."]
17 toAOD += ["xAOD::TruthEventContainer#TruthEvents", "xAOD::TruthEventAuxContainer#TruthEventsAux."]
18 toAOD += [ "xAOD::VertexContainer#PrimaryVertices","xAOD::VertexAuxContainer#PrimaryVerticesAux." ]
19 toAOD += ["xAOD::MuonSegmentContainer#MuonSegments", "xAOD::MuonSegmentAuxContainer#MuonSegmentsAux."]
20 toAOD += [ "xAOD::TruthParticleContainer#TruthParticles","xAOD::TruthParticleAuxContainer#TruthParticlesAux." ]
21
22 cfg.merge(addToAOD(cfgFlags, toAOD))
23
24 return cfg
25
27
28 cfg = ComponentAccumulator()
29
30 from AthenaConfiguration.Enums import MetadataCategory
31 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
32
33 cfg.merge(
34 SetupMetaDataForStreamCfg(
35 cfgFlags,
36 "AOD",
37 createMetadata=[
38 MetadataCategory.ByteStreamMetaData,
39 MetadataCategory.LumiBlockMetaData,
40 MetadataCategory.TruthMetaData,
41 MetadataCategory.IOVMetaData,
42 ],
43 )
44 )
45
46 return cfg
47
49
50 #Given we rebuild topoclusters from the ESD, we should also redo the matching between topoclusters and muon clusters.
51 #The resulting links are used to create the global GPF muon-FE links.
52 from AthenaConfiguration.ComponentFactory import CompFactory
53 cfg = ComponentAccumulator()
54 cfg.addEventAlgo(CompFactory.ClusterMatching.CaloClusterMatchLinkAlg("MuonTCLinks", ClustersToDecorate="MuonClusterCollection"))
55
56 from JetRecConfig.JetRecConfig import JetRecCfg
57 from JetRecConfig.StandardSmallRJets import AntiKt4EMPFlow, AntiKt4LCTopo
58 cfg.merge( JetRecCfg(cfgFlags,AntiKt4EMPFlow) )
59 cfg.merge( JetRecCfg(cfgFlags,AntiKt4LCTopo) )
60
61 #Now do MET config
62
63 #The MET soft term needs the EM and LC origin topoclusters.
64 #Since we rebuilt the topoclusters, we must also rebuild these.
65 from JetRecConfig.JetRecConfig import JetInputCfg
66 from JetRecConfig.StandardJetConstits import stdConstitDic as cst
67 cfg.merge(JetInputCfg(cfgFlags,cst.EMTopoOrigin))
68 cfg.merge(JetInputCfg(cfgFlags,cst.LCTopoOrigin))
69
70 from eflowRec.PFCfg import PFGlobalFlowElementLinkingCfg
71 cfg.merge(PFGlobalFlowElementLinkingCfg(cfgFlags))
72
73 from tauRec.TauConfig import TauReconstructionCfg
74 cfg.merge(TauReconstructionCfg(cfgFlags))
75
76 from eflowRec.PFTauRemaps import PFTauRemaps
77 tauRemaps = PFTauRemaps()
78 for mapping in tauRemaps:
79 cfg.merge(mapping)
80
81 #Now build the pflow MET association map and then add the METMaker algorithm
82 from METReconstruction.METAssociatorCfg import METAssociatorCfg
83 cfg.merge(METAssociatorCfg(cfgFlags, 'AntiKt4EMPFlow'))
84
85 from METUtilities.METMakerConfig import getMETMakerAlg
86 metCA=ComponentAccumulator()
87 metCA.addEventAlgo(getMETMakerAlg('AntiKt4EMPFlow'))
88 cfg.merge(metCA)
89
90 #Add metadata data to xAOD such that we can run workflows such as creating physval.root
91 # from the output AOD or making ntuples from the output AOD
92 cfg.merge( configureMetaDataForPFlowCfg(cfgFlags) )
93
94 return cfg
95
addContainersForPFlowCPStudiesCfg(cfgFlags)