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