ATLAS Offline Software
Loading...
Searching...
No Matches
PFRunESDtoAOD_WithJetsTausMET_TruthCheating_mc21_13p6TeV.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3if __name__=="__main__":
4
5 from AthenaConfiguration.AllConfigFlags import initConfigFlags
6 cfgFlags = initConfigFlags()
7
8 cfgFlags.Concurrency.NumThreads=1
9 cfgFlags.Input.isMC=True
10 cfgFlags.Input.Files= ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PFlowTests/mc21_13p6TeV/mc21_13p6TeV.601589.PhPy8EG_A14_ttbar_hdamp258p75_nonallhadron.recon.ESD.e8485_s3986_r14060/ESD_100Events.pool.root"]
11 cfgFlags.IOVDb.GlobalTag = "OFLCOND-MC21-SDR-RUN3-10"
12 cfgFlags.Output.AODFileName="output_AOD.root"
13 cfgFlags.Output.doWriteAOD=True
14 cfgFlags.Calo.TopoCluster.addCPData=True
15 cfgFlags.Calo.TopoCluster.doTopoClusterLocalCalib=True
16 cfgFlags.Calo.TopoCluster.addCalibrationHitDecoration=True
17 cfgFlags.PF.addCPData=True
18 cfgFlags.PF.useTruthForChargedShowerSubtraction=True
19 cfgFlags.PF.useTruthCheating=True
20 cfgFlags.PF.useTrackClusterTruthMatching=True
21 cfgFlags.DiTau.doDiTauRec = False #does not run from ESD - tries to use aux variables which do not exist
22 cfgFlags.fillFromArgs()
23 cfgFlags.lock()
24
25 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
26 cfg=MainServicesCfg(cfgFlags)
27
28 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
29 cfg.merge(PoolReadCfg(cfgFlags))
30 from eflowRec.PFRun3Config import PFFullCfg
31 cfg.merge(PFFullCfg(cfgFlags,runTauReco=True))
32
33 from eflowRec.PFRun3Remaps import ListRemaps
34
35 list_remaps=ListRemaps(cfg, 'AOD')
36 for mapping in list_remaps:
37 cfg.merge(mapping)
38
39 from CaloCalibHitRec.CaloCalibHitDecoratorCfg import CaloCalibHitDecoratorCfg
40 #switch this to use uncalibrated topoclusters which eflowRec will use.
41 cfg.merge(CaloCalibHitDecoratorCfg(cfgFlags,name="CaloCalibHitDecoratorEMAlgorithm",CaloClusterWriteDecorHandleKey_NLeadingTruthParticles="CaloTopoClusters.calclus_NLeadingTruthParticleBarcodeEnergyPairs"))
42
43 from PFlowUtils.configureRecoForPFlow import configureRecoForPFlowCfg
44 cfg.merge(configureRecoForPFlowCfg(cfgFlags))
45
46 from PFlowUtils.PFlowCalibHitDecoratorCfg import PFlowCalibHitDecoratorCfg
47 cfg.merge(PFlowCalibHitDecoratorCfg(cfgFlags)) #
48
49 cfg.getEventAlgo("PFlowCalibPFODecoratorAlgorithm").PFOWriteDecorHandleKey_NLeadingTruthParticles="GlobalNeutralParticleFlowObjects.calpfo_NLeadingTruthParticleBarcodeEnergyPairs"
50
51 from JetRecConfig.StandardSmallRJets import AntiKt4Truth
52 from JetRecConfig.JetRecConfig import JetRecCfg
53 cfg.merge(JetRecCfg(cfgFlags,AntiKt4Truth))
54
55 from OutputStreamAthenaPool.OutputStreamConfig import addToAOD
56 toESDAndAOD = [ "xAOD::JetContainer#AntiKt4EMPFlowJets","xAOD::JetAuxContainer#AntiKt4EMPFlowJetsAux.-PseudoJet" ]
57 toESDAndAOD += [ "xAOD::JetContainer#AntiKt4EMTopoJets","xAOD::JetAuxContainer#AntiKt4EMTopoJetsAux.-PseudoJet" ]
58 toESDAndAOD += [ "xAOD::JetContainer#AntiKt4TruthJets","xAOD::JetAuxContainer#AntiKt4TruthJetsAux.-PseudoJet" ]
59 toESDAndAOD += [ "xAOD::TruthParticleContainer#TruthParticles","xAOD::TruthParticleAuxContainer#TruthParticlesAux." ]
60 toESDAndAOD += [ "xAOD::FlowElementContainer#GlobalChargedParticleFlowObjects","xAOD::FlowElementAuxContainer#GlobalChargedParticleFlowObjectsAux." ]
61 toESDAndAOD += [ "xAOD::FlowElementContainer#GlobalNeutralParticleFlowObjects","xAOD::FlowElementAuxContainer#GlobalNeutralParticleFlowObjectsAux." ]
62 toESDAndAOD += [ "xAOD::FlowElementContainer#CHSGChargedParticleFlowObjects","xAOD::ShallowAuxContainer#CHSGChargedParticleFlowObjectsAux." ]
63 toESDAndAOD += [ "xAOD::FlowElementContainer#CHSGNeutralParticleFlowObjects","xAOD::ShallowAuxContainer#CHSGNeutralParticleFlowObjectsAux." ]
64 toESDAndAOD += [ "xAOD::VertexContainer#PrimaryVertices","xAOD::VertexAuxContainer#PrimaryVerticesAux." ]
65 toESDAndAOD += [ "xAOD::EventShape#Kt4EMPFlowEventShape","xAOD::EventShapeAuxInfo#Kt4EMPFlowEventShapeAux." ]
66 toESDAndAOD += [ "xAOD::EventShape#Kt4EMTopoOriginEventShape","xAOD::EventShapeAuxInfo#Kt4EMTopoOriginEventShapeAux." ]
67
68 cfg.merge(addToAOD(cfgFlags,toESDAndAOD))
69
70 #Given we rebuild topoclusters from the ESD, we should also redo the matching between topoclusters and muon clusters.
71 #The resulting links are used to create the global GPF muon-FE links.
72 from AthenaConfiguration.ComponentFactory import CompFactory
73 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
74 result = ComponentAccumulator()
75 result.addEventAlgo(CompFactory.ClusterMatching.CaloClusterMatchLinkAlg("MuonTCLinks", ClustersToDecorate="MuonClusterCollection"))
76 cfg.merge(result)
77
78 cfg.run()