ATLAS Offline Software
UFOAccumulator_constits.py
Go to the documentation of this file.
1 #Matt A's custom python accumulator for R22
2 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 #Trigger xAODType.ObjectType dict entry loading
7 import cppyy
8 try:
9  cppyy.load_library('libxAODBaseObjectTypeDict')
10 except Exception:
11  pass
12 from ROOT import xAODType
13 xAODType.ObjectType
14 
15 
16 def config_CHS_CSSK_merged(inputFlags,**kwargs):
17  #
18  import cppyy
19  try:
20  cppyy.load_library('libxAODBaseObjectTypeDict')
21  except Exception:
22  pass
23  from ROOT import xAODType
24  xAODType.ObjectType
25 
26  output_CA=ComponentAccumulator()
27  StoreGateSvc=CompFactory.StoreGateSvc
28  output_CA.addService(StoreGateSvc("DetectorStore"))
29 
30  from JetRecConfig.JetRecConfig import JetInputCfg
31  from JetRecConfig.StandardJetConstits import stdConstitDic as cst
32 
33 
34  output_CA.merge(JetInputCfg(inputFlags, cst.EMPFlowCSSK))
35  return output_CA
36 
37 
38 
39 
40 
41 
42 def UFOConfig(flags, **kwargs):
43  # Configure UFO reconstruction algorithm instead of TCC
44  UFO_CA=ComponentAccumulator()
45  #add Storegate
46  StoreGateSvc=CompFactory.StoreGateSvc
47 
48  UFO_CA.addService(StoreGateSvc("DetectorStore"))
49  from TrackCaloClusterRecTools.TrackCaloClusterConfig import runUFOReconstruction
50  from JetRecConfig.StandardJetConstits import stdConstitDic as cst
51  constituents=cst.GPFlowCSSK
52  inputFEcontainer="CSSKGParticleFlowObjects"
53 
54  UFO_reco=runUFOReconstruction(flags,constits=constituents,inputFEcontainerkey=inputFEcontainer)
55  UFO_CA.merge(UFO_reco)
56 
57  return UFO_CA
58 
59 
60 
61 if __name__=="__main__":
62  from AthenaConfiguration.AllConfigFlags import initConfigFlags
63  flags = initConfigFlags()
64  flags.Input.isMC=True
65 
66  # flags.Input.Format="AOD"
67 
68  # flags.Input.Files=["/scratch/anthony/TEST_AOD/TCC/mc16_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.recon.AOD.e6337_s3126_r10724/mc16_13TeV/AOD.14795494._007454.pool.root.1"]
69  # flags.Input.Files=["/scratch/anthony/TEST_AOD/TCC/valid1_test/valid1/AOD.24855256._000001.pool.root.1"]
70  flags.Input.Files=["myAOD.root"]
71  flags.Output.AODFileName="output_UFO_DAOD.root"
72  flags.Exec.MaxEvents=20
73  flags.Output.doWriteAOD=True
74  #flags.Common.ProductionStep=0 # I think this is default
75  flags.dump()
76  flags.lock()
77 
78 
79  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
80  cfg=MainServicesCfg(flags)
81 
82  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
83  inputList=["xAOD::TrackParticleContainer#InDetTrackParticles", "xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux."]
84  inputList.append("xAOD::FlowElementContainer#JetETMissChargedParticleFlowObjects")
85  inputList.append("xAOD::FlowElementContainer#JetETMissNeutralParticleFlowObjects")
86  inputList.append("xAOD::FlowElementAuxContainer#JetETMissNeutralParticleFlowObjectsAux.")
87  inputList.append("xAOD::FlowElementAuxContainer#JetETMissChargedParticleFlowObjectsAux.")
88  inputList.append("xAOD::FlowElementContainer#TrackCaloClustersCharged")
89  inputList.append("xAOD::FlowElementAuxContainer#TrackCaloClustersChargedAux.")
90  inputList.append("xAOD::FlowElementContainer#TrackCaloClustersNeutral")
91  inputList.append("xAOD::FlowElementAuxContainer#TrackCaloClustersNeutralAux.")
92  inputList.append("xAOD::FlowElementContainer#UFO*")
93  inputList.append("xAOD::FlowElementAuxContainer#UFO*")
94  inputList.append("xAOD::FlowElementContainer#CHS*")
95  inputList.append("xAOD::FlowElementAuxContainer#CHS*")
96  inputList.append("xAOD::FlowElementContainer#CSSK*")
97  inputList.append("xAOD::FlowElementAuxContainer#CSSK*")
98  inputList.append("xAOD::FlowElementContainer#*")
99  inputList.append("xAOD::FlowElementAuxContainer#*")
100  inputList.append("xAOD::MuonContainer#Muons")
101  inputList.append("xAOD::MuonAuxContainer#*")
102  inputList.append("xAOD::PhotonContainer#Photons")
103  inputList.append("xAOD::PhotonAuxContainer#*")
104  inputList.append("xAOD::ElectronContainer#Electrons")
105  inputList.append("xAOD::ElectronAuxContainer#*")
106  inputList.append("xAOD::TauJetContainer#*")
107  inputList.append("xAOD::TauJetAuxContainer#*")
108 
109 
110  cfg.merge(OutputStreamCfg(flags,"AOD",ItemList=inputList))
111 
112  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
113 
114 
115  cfg.merge(PoolReadCfg(flags))
116 
117  cfg.merge(config_CHS_CSSK_merged(flags))
118 
119  cfg.merge(UFOConfig(flags))
120 
121  cfg.printConfig()
122 
123  cfg.run()
124 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
TrackCaloClusterConfig.runUFOReconstruction
def runUFOReconstruction(flags, constits, caloClusterName="CaloCalTopoClusters", detectorEtaName="default", assocPostfix="UFO", inputFEcontainerkey="")
Definition: TrackCaloClusterConfig.py:146
UFOAccumulator_constits.config_CHS_CSSK_merged
def config_CHS_CSSK_merged(inputFlags, **kwargs)
Definition: UFOAccumulator_constits.py:16
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
UFOAccumulator_constits.UFOConfig
def UFOConfig(flags, **kwargs)
Definition: UFOAccumulator_constits.py:42
JetRecAlgTestCfg.JetInputCfg
def JetInputCfg(flags)
Definition: JetRecAlgTestCfg.py:44
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69