ATLAS Offline Software
Loading...
Searching...
No Matches
HION7.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2# HION7.py
3
4from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5from AthenaConfiguration.ComponentFactory import CompFactory
6from AthenaConfiguration.Enums import MetadataCategory
7from AthenaCommon.CFElements import seqAND
8
9
12
13 """Configure the physics augmentation for HION7"""
14 acc = ComponentAccumulator()
15
16 # MC truth
17 if flags.Input.isMC:
18 from DerivationFrameworkMCTruth.MCTruthCommonConfig import (
19 AddStandardTruthContentsCfg,
20 AddHFAndDownstreamParticlesCfg,
21 AddMiniTruthCollectionLinksCfg,
22 AddPVCollectionCfg)
23 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthCollectionMakerCfg
24 PhysCommonTruthCharmTool = acc.getPrimaryAndMerge(TruthCollectionMakerCfg(
25 flags,
26 name = "PhysCommonTruthCharmTool",
27 NewCollectionName = "TruthCharm",
28 KeepNavigationInfo = False,
29 ParticleSelectionString = "(abs(TruthParticles.pdgId) == 4)",
30 Do_Compress = True))
31 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
32 acc.addEventAlgo(CommonAugmentation("PhysCommonTruthCharmKernel",AugmentationTools=[PhysCommonTruthCharmTool]))
33 acc.merge(AddHFAndDownstreamParticlesCfg(flags))
34 acc.merge(AddStandardTruthContentsCfg(
35 flags,
36 navInputCollections =["TruthElectrons",
37 "TruthMuons",
38 "TruthPhotons",
39 "TruthTaus",
40 "TruthNeutrinos",
41 "TruthBSM",
42 "TruthBottom",
43 "TruthTop",
44 "TruthBoson",
45 "TruthCharm",
46 "TruthHFWithDecayParticles"]))
47 # Re-point links on reco objects
48 acc.merge(AddMiniTruthCollectionLinksCfg(flags))
49 acc.merge(AddPVCollectionCfg(flags))
50 # InDet, Muon, Egamma common augmentations
51 from DerivationFrameworkInDet.InDetCommonConfig import InDetCommonCfg
52 from DerivationFrameworkMuons.MuonsCommonConfig import MuonsCommonCfg
53 from DerivationFrameworkEGamma.EGammaCommonConfig import EGammaCommonCfg
54 acc.merge(InDetCommonCfg(flags,
55 DoVertexFinding = flags.Tracking.doVertexFinding,
56 AddPseudoTracks = flags.Tracking.doPseudoTracking,
57 DecoLRTTTVA = False,
58 DoR3LargeD0 = flags.Tracking.doLargeD0,
59 StoreSeparateLargeD0Container = flags.Tracking.storeSeparateLargeD0Container,
60 MergeLRT = False))
61 acc.merge(MuonsCommonCfg(flags))
62 acc.merge(EGammaCommonCfg(flags))
63
64 return acc
65
66def getDFJets(flags):
67 """ Create updated version of AntiKt*HIJets"""
68 acc = ComponentAccumulator()
69
70 JetColl = flags.HeavyIon.HIJetPrefix
71 from HIJetRec.HIJetRecConfigCA import HIJetRecCfg
72 acc.merge(HIJetRecCfg(flags))
73 if flags.HeavyIon.doHIBTagging:
74 from BTagging.FlavorTaggingConfig import FlavorTaggingCfg
75 acc.merge(FlavorTaggingCfg(flags, JetColl+"AntiKt4HIJets"))
76 from BTagging.TrackLeptonConfig import TrackLeptonDecorationCfg
77 acc.merge(TrackLeptonDecorationCfg(flags))
78
79 return acc
80
81
82
85 """Configure the example skimming tool"""
86 acc = ComponentAccumulator()
87 JetColl = flags.HeavyIon.HIJetPrefix
88 ExtraData = []
89 ExtraData += ['xAOD::JetContainer/'+JetColl+'AntiKt2HIJets']
90 ExtraData += ['xAOD::JetContainer/'+JetColl+'AntiKt4HIJets']
91
92 acc.addSequence( seqAND("HION7Sequence") )
93 acc.getSequence("HION7Sequence").ExtraDataForDynamicConsumers = ExtraData
94 acc.getSequence("HION7Sequence").ProcessDynamicDataDependencies = True
95
96 expression = ""
97 #Trigger selection
98 from DerivationFrameworkHI import ListTriggers
99 from CoolConvUtilities.ParticleTypeUtil import getTypeForRun
100 info=getTypeForRun(flags.Input.RunNumbers[0])
101 isSmallSystem = False
102 if (info.getBeam1Type() < 11) or (info.getBeam2Type() < 11):
103 isSmallSystem = True
104 if not flags.Input.isMC:
105 print('project: ', flags.Input.ProjectName,', isSmallSystem: ', isSmallSystem)
106 TriggerDict = ListTriggers.GetTriggers(flags.Input.ProjectName, isSmallSystem)
107 for i, key in enumerate(TriggerDict):
108 expression = expression + '(' + key + ' && count('+JetColl+'AntiKt4HIJets.pt >' + str(TriggerDict[key]) + '*GeV) >=1 ) ' + '|| (' + key + ' && count('+JetColl+'AntiKt2HIJets.pt >' + str(TriggerDict[key]) + '*GeV) >=1 ) '
109 if not i == len(TriggerDict) - 1:
110 expression = expression + ' || '
111 else:
112 expression = expression + 'count('+JetColl+'AntiKt2HIJets.pt > 15000) > 1 || count('+JetColl+'AntiKt4HIJets.pt > 15000) > 1'
113
114 from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg
115 tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
116 acc.addPublicTool(CompFactory.DerivationFramework.xAODStringSkimmingTool(name = "HION7StringSkimmingTool",
117 expression = expression,
118 TrigDecisionTool=tdt),
119 primary = True)
120
121 return(acc)
122
124 """Configure the example augmentation tool"""
125 acc = ComponentAccumulator()
126
127 # Configure the augmentation tool
128 # This adds FCalEtA, FCalEtC, ...
129 doTopoClus = True
130 caloClusterKey = "CaloCalTopoClusters"
131 from AthenaConfiguration.Enums import HIMode
132 if flags.Reco.HIMode == HIMode.HI:
133 doTopoClus = False
134 caloClusterKey = ""
135
136 augmentation_tool = CompFactory.DerivationFramework.HIGlobalAugmentationTool(name="HION7AugmentationTool",
137 nHarmonic=5, # to capture higher-order harmonics for anisotropic flow
138 doTopoClusDec = doTopoClus,
139 CaloClusterKey = caloClusterKey
140 )
141 acc.addPublicTool(augmentation_tool, primary=True)
142
143 return acc
144
145
147 """Configure the example augmentation tool"""
148 acc = ComponentAccumulator()
149
150 # Configure the augmentation tool
151 # This adds FCalEtA, FCalEtC, ...
152 jvtTool = CompFactory.JetVertexTaggerTool(name="JVTToolEMTopo",
153 JetContainer="AntiKt4EMTopoJets")
154
155
156 augmentation_tool = CompFactory.DerivationFramework.HIJetAugmentationTool(name="HION7JetAugmentationTool",
157 DeltaRJetMatching = 0.3,
158 HIJetContainerKey="DFAntiKt4HIJets",
159 CaloJetContainerKey = "AntiKt4EMTopoJets",
160 JVTToolEMTopo = jvtTool
161 )
162 acc.addPublicTool(jvtTool)
163 acc.addPublicTool(augmentation_tool, primary=True)
164
165 return acc
166
167
168
169
170def HION7KernelCfg(flags, name='HION7Kernel', **kwargs):
171 """Configure the derivation framework driving algorithm (kernel)"""
172 acc = ComponentAccumulator()
173
174 acc.merge(PhysAugmentationsHION7Cfg(flags))
175
177 from CoolConvUtilities.ParticleTypeUtil import getTypeForRun
178 info=getTypeForRun(flags.Input.RunNumbers[0])
179 isSmallSystem = False
180 if (info.getBeam1Type() < 11) or (info.getBeam2Type() < 11):
181 isSmallSystem = True
182 pTCut = 20
183 if isSmallSystem:
184 pTCut = 15
185
186 JetColl = flags.HeavyIon.HIJetPrefix
187
188 from DerivationFrameworkInDet.InDetToolsConfig import TrackParticleThinningCfg,JetTrackParticleThinningCfg
189
190 minTrackPt = flags.HeavyIon.MinTrackPt
191 track_thinning_expression = "InDetTrackParticles.pt > "+str(minTrackPt)+"*GeV"
192 TrackParticleThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
193 flags,
194 name = "PHYSTrackParticleThinningTool",
195 StreamName = kwargs['StreamName'],
196 SelectionString = track_thinning_expression,
197 InDetTrackParticlesKey = "InDetTrackParticles"))
198
199 AntiKt2HIJetsThinningTool = acc.getPrimaryAndMerge(JetTrackParticleThinningCfg(
200 flags,
201 name = "AntiKt2HIJetsThinningTool",
202 StreamName = kwargs['StreamName'],
203 JetKey = JetColl+"AntiKt2HIJets",
204 SelectionString = JetColl+"AntiKt2HIJets.pt > "+ str(pTCut) +"*GeV",
205 InDetTrackParticlesKey = "InDetTrackParticles"))
206
207 AntiKt4HIJetsThinningTool = acc.getPrimaryAndMerge(JetTrackParticleThinningCfg(
208 flags,
209 name = "AntiKt4HIJetsThinningTool",
210 StreamName = kwargs['StreamName'],
211 JetKey = JetColl+"AntiKt4HIJets",
212 SelectionString = JetColl+"AntiKt4HIJets.pt > "+ str(pTCut) +"*GeV",
213 InDetTrackParticlesKey = "InDetTrackParticles"))
214
215 thinningTools = [TrackParticleThinningTool,
216 AntiKt2HIJetsThinningTool,
217 AntiKt4HIJetsThinningTool]
218 if flags.Input.isMC:
219 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import GenericTruthThinningCfg
220 truth_thinning_expression = "(TruthParticles.status==1) && (TruthParticles.pt > "+str(minTrackPt-0.2)+"*GeV) && (abs(TruthParticles.eta) < 2.7)"
221 TruthParticleThinningTool = acc.getPrimaryAndMerge(GenericTruthThinningCfg(flags,
222 name="TruthParticleThinningTool",
223 StreamName=kwargs['StreamName'],
224 ParticleSelectionString = truth_thinning_expression
225 )
226 )
227 thinningTools += [TruthParticleThinningTool]
228
229
230 skimmingTool = acc.getPrimaryAndMerge(HION7SkimmingToolCfg(flags))
231 globalAugmentationTool = acc.getPrimaryAndMerge(HION7GlobalAugmentationToolCfg(flags))
232 jetAugmentationTool = acc.getPrimaryAndMerge(HION7JetAugmentationToolCfg(flags))
233 augmentationTool=[globalAugmentationTool,jetAugmentationTool]
234
235 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(name,ThinningTools = thinningTools, SkimmingTools = [skimmingTool], AugmentationTools=augmentationTool),sequenceName="HION7Sequence")
236
237 return acc
238
239
240def HION7Cfg(flags):
241
242 acc = ComponentAccumulator()
243
244 JetColl = flags.HeavyIon.HIJetPrefix
245 acc.merge(getDFJets(flags))
246
247 acc.merge(HION7KernelCfg(flags, name="HION7Kernel",StreamName = "StreamDAOD_HION7"))
248
249 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
250 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
251 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
252 from DerivationFrameworkHI import ListSlimming
253
254
256 HION7SlimmingHelper = SlimmingHelper("HION7SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
257 HION7SlimmingHelper.SmartCollections = ListSlimming.HION7SmartCollections()
258 AllVars = ListSlimming.HION7AllVarContent()
259 AllVars += ListSlimming.HION7ExtraContainersTrigger()
260 ExtraVars = ListSlimming.HION7BasicJetVars(JetColl)
261 from DerivationFrameworkFlavourTag import FtagBaseContent
262 if flags.Input.isMC:
263 AllVars += ListSlimming.HION7AllVarTruthContent()
264 if flags.HeavyIon.doHIBTagging:
265 FtagBaseContent.add_truth_to_SlimmingHelper(HION7SlimmingHelper)
266 if flags.HeavyIon.doHIBTagging:
267 from DerivationFrameworkFlavourTag.FtagBaseContent import addCommonAugmentation
268 addCommonAugmentation(flags, acc, HION7SlimmingHelper, JetColl+"AntiKt4HIJets")
269 AllVars += ListSlimming.HION7AllVarFromFTAG1()
270 # update AppendToDictionary
271 extra_AppendToDictionary = {}
272 FtagBaseContent.update_AppendToDictionary_in_SlimmingHelper(HION7SlimmingHelper, flags, extra_AppendToDictionary)
273 # Add ExtraVariables
274 ExtraVars += ListSlimming.HION7ExtraVarForBtag(JetColl)
275 FtagBaseContent.add_ExtraVariables_to_SlimmingHelper(HION7SlimmingHelper, flags)
276
277 HION7SlimmingHelper.ExtraVariables = ExtraVars
278 HION7SlimmingHelper.AllVariables = AllVars
279
280 HION7ItemList = HION7SlimmingHelper.GetItemList()
281 HIJetRemovedBranches=ListSlimming.makeHIJetRemovedBranchList()
282 jet_var_str = '.-'.join ([''] + HIJetRemovedBranches)
283 jetRlist = flags.HeavyIon.Jet.RValues #Default [0.2,0.4]
284 for jetR in jetRlist:
285 output = ["xAOD::JetContainer#"+JetColl+"AntiKt"+str(jetR)+"HIJets",
286 "xAOD::JetAuxContainer#"+JetColl+"AntiKt"+str(jetR)+"HIJetsAux.-PseudoJet"+jet_var_str]
287 HION7ItemList += output
288
289 acc.merge(OutputStreamCfg(flags, "DAOD_HION7", ItemList=HION7ItemList, AcceptAlgs=["HION7Kernel"]))
290 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_HION7", AcceptAlgs=["HION7Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
291
292 return acc
void print(char *figname, TCanvas *c1)
HION7JetAugmentationToolCfg(flags)
Definition HION7.py:146
getDFJets(flags)
Definition HION7.py:66
HION7GlobalAugmentationToolCfg(flags)
Definition HION7.py:123
HION7SkimmingToolCfg(flags)
Skiming.
Definition HION7.py:84
PhysAugmentationsHION7Cfg(flags)
in place of common PhysCommonAugmentations:
Definition HION7.py:11
HION7Cfg(flags)
Definition HION7.py:240
HION7KernelCfg(flags, name='HION7Kernel', **kwargs)
Definition HION7.py:170