ATLAS Offline Software
Loading...
Searching...
No Matches
run_AODTCCLinking.py
Go to the documentation of this file.
1#Matt A's custom python accumulator for R22
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6
7def MyAlgConfigNeutral(inputFlags,**kwargs,):
8 # this is based on the PFRun3Config, so parts of it are gonna be used as is
9 result=ComponentAccumulator()
10
11 StoreGateSvc=CompFactory.StoreGateSvc
12
13 result.addService(StoreGateSvc("DetectorStore"))
14
15
16 from TrackCaloClusterRecTools.TrackCaloClusterConfig import runTCCReconstruction
17 TCCReco=runTCCReconstruction(inputFlags, outputTCCName="TrackCaloClusters",doNeutral=True,doCharged=False,doCombined=False)
18 result.merge(TCCReco)
19
20 StoreGateSvc.Dump = True
21 return result
22
23
24
25
26def MyAlgConfigCharged(inputFlags,**kwargs,):
27 # this is based on the PFRun3Config, so parts of it are gonna be used as is
28 result=ComponentAccumulator()
29
30 StoreGateSvc=CompFactory.StoreGateSvc
31
32 result.addService(StoreGateSvc("DetectorStore"))
33
34
35
36 from TrackCaloClusterRecTools.TrackCaloClusterConfig import runTCCReconstruction
37 TCCReco=runTCCReconstruction(inputFlags, outputTCCName="TrackCaloClusters",doNeutral=False,doCharged=True,doCombined=False)
38 result.merge(TCCReco)
39
40 StoreGateSvc.Dump = True
41 return result
42
43
44def LinkerAlgConfig(inputFlags,**kwargs):
45 #link El/Phot/Muon to TrackCaloClusters
46 CA=ComponentAccumulator()
47 StoreGateSvc=CompFactory.StoreGateSvc
48 CA.addService(StoreGateSvc("DetectorStore"))
49
50 from eflowRec.PFCfg import getEGamFlowElementAssocAlgorithm
51 from eflowRec.PFCfg import getMuonFlowElementAssocAlgorithm
52
53 CA.addEventAlgo(getEGamFlowElementAssocAlgorithm(inputFlags,AODTest=False,doTCC=True))
54 CA.addEventAlgo(getMuonFlowElementAssocAlgorithm(inputFlags,LinkNeutralFEClusters=False,useMuonTopoClusters=True,AODTest=False,doTCC=True))
55
56
57 return CA
58
59
60def TauLinkerConfig(inputFlags, **kwargs):
61 #separate linker, can merge to main one for no loss of generality
62 TauLinkerCA=ComponentAccumulator()
63 # add Storegate
64 StoreGateSvc=CompFactory.StoreGateSvc
65 TauLinkerCA.addService(StoreGateSvc("DetectorStore"))
66
67 from eflowRec.PFCfg import getTauFlowElementAssocAlgorithm
68 TauLinkerCA.addEventAlgo(getTauFlowElementAssocAlgorithm(inputFlags,doTCC=True))
69 return TauLinkerCA
70
71
72
73if __name__=="__main__":
74 from AthenaConfiguration.AllConfigFlags import initConfigFlags
75 from AthenaConfiguration.Enums import Format
76 cfgFlags = initConfigFlags()
77 cfgFlags.Input.isMC=True
78 cfgFlags.Input.Format=Format.POOL
79
80 cfgFlags.Input.Files=["/scratch/anthony/GPF_CODE/TCC_STUDIES/CustomAlg/myAOD.root"]
81 cfgFlags.Output.AODFileName="/scratch/anthony/GPF_CODE/TCC_STUDIES/CustomAlg/output_AOD.root"
82 cfgFlags.Exec.MaxEvents=20
83 cfgFlags.Output.doWriteAOD=True
84 cfgFlags.Common.ProductionStep=""
85 cfgFlags.dump()
86 cfgFlags.lock()
87
88
89 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
90 cfg=MainServicesCfg(cfgFlags)
91
92 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
93 inputList=["xAOD::TrackParticleContainer#InDetTrackParticles", "xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux."]
94 inputList.append("xAOD::FlowElementContainer#JetETMissChargedParticleFlowObjects")
95 inputList.append("xAOD::FlowElementContainer#JetETMissNeutralParticleFlowObjects")
96 inputList.append("xAOD::FlowElementAuxContainer#JetETMissNeutralParticleFlowObjectsAux.")
97 inputList.append("xAOD::FlowElementAuxContainer#JetETMissChargedParticleFlowObjectsAux.")
98 inputList.append("xAOD::FlowElementContainer#TrackCaloClustersCharged")
99 inputList.append("xAOD::FlowElementAuxContainer#TrackCaloClustersChargedAux.")
100 inputList.append("xAOD::FlowElementContainer#TrackCaloClustersNeutral")
101 inputList.append("xAOD::FlowElementAuxContainer#TrackCaloClustersNeutralAux.")
102
103 inputList.append("xAOD::MuonContainer#Muons")
104 inputList.append("xAOD::MuonAuxContainer#*")
105 inputList.append("xAOD::PhotonContainer#Photons")
106 inputList.append("xAOD::PhotonAuxContainer#*")
107 inputList.append("xAOD::ElectronContainer#Electrons")
108 inputList.append("xAOD::ElectronAuxContainer#*")
109 inputList.append("xAOD::TauJetContainer#*")
110 inputList.append("xAOD::TauJetAuxContainer#*")
111
112
113 cfg.merge(OutputStreamCfg(cfgFlags,"AOD",ItemList=inputList))
114
115 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
116
117
118 cfg.merge(PoolReadCfg(cfgFlags))
119 cfg.merge(MyAlgConfigNeutral(cfgFlags))
120 cfg.merge(MyAlgConfigCharged(cfgFlags))
121 cfg.merge(LinkerAlgConfig(cfgFlags)) # El/Phot/Muon linkers
122 #cfg.merge(TauLinkerConfig(cfgFlags)) # Doesn't yet work because of "passTauThinning" attrib not saved at AOD
123 print("MASTER CA CONFIG")
124 print(cfg)
125 cfg.printConfig()
126
127 cfg.run()
128
void print(char *figname, TCanvas *c1)
The Athena Transient Store API.
TauLinkerConfig(inputFlags, **kwargs)
MyAlgConfigNeutral(inputFlags, **kwargs)
LinkerAlgConfig(inputFlags, **kwargs)
MyAlgConfigCharged(inputFlags, **kwargs)