ATLAS Offline Software
PFRunESDtoAOD_TruthCheating_mc20e.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 
3 if __name__=="__main__":
4 
5  from AthenaConfiguration.AllConfigFlags import initConfigFlags
6  cfgFlags = initConfigFlags()
7 
8  cfgFlags.Concurrency.NumThreads=1
9  cfgFlags.Exec.MaxEvents=100
10  cfgFlags.Input.isMC=True
11  cfgFlags.Input.Files= ["/Users/markhodgkinson/dataFiles/mc21_13p6TeV/ESDFiles/mc21_13p6TeV.601589.PhPy8EG_A14_ttbar_hdamp258p75_nonallhadron.recon.ESD.e8485_s3986_r14060/mc21_13p6TeV.601589.PhPy8EG_A14_ttbar_hdamp258p75_nonallhadron.recon.ESD.e8485_s3986_r14060.100Events.pool.root"]
12  cfgFlags.IOVDb.GlobalTag = "OFLCOND-MC21-SDR-RUN3-10"
13  cfgFlags.Output.AODFileName="output_AOD.root"
14  cfgFlags.Output.doWriteAOD=True
15  cfgFlags.Calo.TopoCluster.addCPData=True
16  cfgFlags.Calo.TopoCluster.doTopoClusterLocalCalib=True
17  cfgFlags.Calo.TopoCluster.addCalibrationHitDecoration=True
18  cfgFlags.PF.addCPData=True
19  cfgFlags.PF.useTruthForChargedShowerSubtraction=True
20  cfgFlags.PF.useTruthCheating=True
21  cfgFlags.PF.useTrackClusterTruthMatching=True
22  cfgFlags.Tau.doDiTauRec = False #does not run from ESD - tries to use aux variables which do not exist
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()
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  cfg.getEventAlgo("PFlowCellCPDataDecoratorAlgorithm").PFOWriteDecorHandleKey_CellCPData="GlobalChargedParticleFlowObjects.cellCPData"
51  cfg.getEventAlgo("PFlowCellCPDataDecoratorAlgorithm").NeutralPFOReadHandleKey="GlobalNeutralParticleFlowObjects"
52 
53  from JetRecConfig.JetConfigFlags import jetInternalFlags
54  jetInternalFlags.isRecoJob = True
55 
56  from JetRecConfig.StandardSmallRJets import AntiKt4Truth
57  from JetRecConfig.JetRecConfig import JetRecCfg
58  cfg.merge(JetRecCfg(cfgFlags,AntiKt4Truth))
59 
60  from OutputStreamAthenaPool.OutputStreamConfig import addToAOD
61  toESDAndAOD = [ "xAOD::JetContainer#AntiKt4EMPFlowJets","xAOD::JetAuxContainer#AntiKt4EMPFlowJetsAux.-PseudoJet" ]
62  toESDAndAOD += [ "xAOD::JetContainer#AntiKt4EMTopoJets","xAOD::JetAuxContainer#AntiKt4EMTopoJetsAux.-PseudoJet" ]
63  toESDAndAOD += [ "xAOD::JetContainer#AntiKt4TruthJets","xAOD::JetAuxContainer#AntiKt4TruthJetsAux.-PseudoJet" ]
64  toESDAndAOD += [ "xAOD::TruthParticleContainer#TruthParticles","xAOD::TruthParticleAuxContainer#TruthParticlesAux." ]
65  toESDAndAOD += [ "xAOD::FlowElementContainer#GlobalChargedParticleFlowObjects","xAOD::FlowElementAuxContainer#GlobalChargedParticleFlowObjectsAux." ]
66  toESDAndAOD += [ "xAOD::FlowElementContainer#GlobalNeutralParticleFlowObjects","xAOD::FlowElementAuxContainer#GlobalNeutralParticleFlowObjectsAux." ]
67  toESDAndAOD += [ "xAOD::FlowElementContainer#CHSGChargedParticleFlowObjects","xAOD::ShallowAuxContainer#CHSGChargedParticleFlowObjectsAux." ]
68  toESDAndAOD += [ "xAOD::FlowElementContainer#CHSGNeutralParticleFlowObjects","xAOD::ShallowAuxContainer#CHSGNeutralParticleFlowObjectsAux." ]
69  toESDAndAOD += [ "xAOD::VertexContainer#PrimaryVertices","xAOD::VertexAuxContainer#PrimaryVerticesAux." ]
70  toESDAndAOD += [ "xAOD::EventShape#Kt4EMPFlowEventShape","xAOD::EventShapeAuxInfo#Kt4EMPFlowEventShapeAux." ]
71  toESDAndAOD += [ "xAOD::EventShape#Kt4EMTopoOriginEventShape","xAOD::EventShapeAuxInfo#Kt4EMTopoOriginEventShapeAux." ]
72 
73  cfg.merge(addToAOD(cfgFlags,toESDAndAOD))
74 
75  #Given we rebuild topoclusters from the ESD, we should also redo the matching between topoclusters and muon clusters.
76  #The resulting links are used to create the global GPF muon-FE links.
77  from AthenaConfiguration.ComponentFactory import CompFactory
78  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
80  result.addEventAlgo(CompFactory.ClusterMatching.CaloClusterMatchLinkAlg("MuonTCLinks", ClustersToDecorate="MuonClusterCollection"))
81  cfg.merge(result)
82 
83  cfg.run()
PFRun3Config.PFFullCfg
def PFFullCfg(inputFlags, runTauReco=False, **kwargs)
Definition: PFRun3Config.py:8
configureRecoForPFlow.configureRecoForPFlowCfg
def configureRecoForPFlowCfg(cfgFlags)
Definition: configureRecoForPFlow.py:3
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.JetRecConfig.JetRecCfg
def JetRecCfg(flags, jetdef, returnConfiguredDef=False)
Top level functions returning ComponentAccumulator out of JetDefinition.
Definition: JetRecConfig.py:36
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
PFlowCalibHitDecoratorCfg
Definition: PFlowCalibHitDecoratorCfg.py:1
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:142
CaloCalibHitDecoratorCfg
Definition: CaloCalibHitDecoratorCfg.py:1
PFRun3Remaps.ListRemaps
def ListRemaps()
Definition: PFRun3Remaps.py:3
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69