ATLAS Offline Software
PFRunESDtoAOD_WithJetsTausMET_TruthCheating_mc21_13p6TeV.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= ["/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.31373517._000035.pool.root.1"]
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 
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
75  result.addEventAlgo(CompFactory.ClusterMatching.CaloClusterMatchLinkAlg("MuonTCLinks", ClustersToDecorate="MuonClusterCollection"))
76  cfg.merge(result)
77 
78  cfg.run()
PFRun3Config.PFFullCfg
def PFFullCfg(inputFlags, runTauReco=False, **kwargs)
Definition: PFRun3Config.py:8
configureRecoForPFlow.configureRecoForPFlowCfg
def configureRecoForPFlowCfg(cfgFlags)
Definition: configureRecoForPFlow.py:26
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