ATLAS Offline Software
Loading...
Searching...
No Matches
HFClassificationCommonConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2
3
9
10from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11from AthenaConfiguration.ComponentFactory import CompFactory
12from DerivationFrameworkMCTruth.HFDSIDList import DSIDList
13
14def DFCommonMatchingToolCfg(flags, variation, **kwargs):
15
16
19
20 acc = ComponentAccumulator()
21 acc.flagPerfmonDomain('Truth')
22 # Configure the tool that matches each truth particle to the closest jet.
23 # Parameters:
24 # -m_jetPtCut: Cut on the pt of the jets.
25 # -m_jetEtaCut: Cut on the eta of the jets.
26 # -m_drCut: Upper limit for the delta R between the particle and the jet to perform the matching.
27 kwargs.setdefault("jetPtCut", 15000.)
28 kwargs.setdefault("jetEtaCut", 2.5)
29 kwargs.setdefault("drCut", 0.3)
30 acc.setPrivateTools(CompFactory.DerivationFramework.JetMatchingTool(name='DFCommonJetMatchingTool'+variation, **kwargs))
31 return acc
32
33
34def DFCommonMatchingToolJ20Cfg(flags, **kwargs):
35 kwargs.setdefault("jetPtCut", 20000.)
36
37 return DFCommonMatchingToolCfg(flags, "J20", **kwargs)
38
39
40def DFCommonMatchingToolJ25Cfg(flags, **kwargs):
41 kwargs.setdefault("jetPtCut", 25000.)
42
43 return DFCommonMatchingToolCfg(flags, "J25", **kwargs)
44
45
47 acc = ComponentAccumulator()
48 acc.flagPerfmonDomain('Truth')
49
52
53 # Configure the tool that determines the origin of the HF hadrons.
54 # Parameters:
55 # -DSID: DSID of the sample that is being processed.
56 kwargs.setdefault("DSID", int(flags.Input.MCChannelNumber))
57 acc.setPrivateTools(CompFactory.DerivationFramework.HadronOriginClassifier(name='DFCommonHadronOriginClassifier', **kwargs))
58 return acc
59
60
61def DFCommonClassifyAndCalculateHFToolCfg(flags, variation, **kwargs):
62 acc = ComponentAccumulator()
63 acc.flagPerfmonDomain('Truth')
64
67
68 # Configure the tool that computes the HF Classification.
69 # Parameters:
70 # -m_jetPtCut: Cut on the pt of the jets.
71 # -m_jetEtaCut: Cut on the eta of the jets.
72 # -m_leadingBHadronPtCut: Cut on the pt of the leading B-hadron.
73 # -m_leadingCHadronPtCut: Cut on the pt of the leading C-hadron.
74 # -m_leadingHadronPtRatioCut: Cut on the ratio between the pt of the leading hadron and the pt of its associated jet.
75 kwargs.setdefault("jetPtCut", 15000.)
76 kwargs.setdefault("jetEtaCut", 2.5)
77 kwargs.setdefault("leadingBHadronPtCut", 5000.)
78 kwargs.setdefault("leadingCHadronPtCut", 5000.)
79 kwargs.setdefault("leadingHadronPtRatioCut", -1)
80 acc.setPrivateTools(CompFactory.DerivationFramework.ClassifyAndCalculateHFTool(name='DFCommonClassifyAndCalculateHFTool'+variation, **kwargs))
81 return acc
82
83
85 kwargs.setdefault("jetPtCut", 20000.)
86 kwargs.setdefault("leadingCHadronPtCut", 5000.)
87
88 return DFCommonClassifyAndCalculateHFToolCfg(flags, "C5J20", **kwargs)
89
90
92 kwargs.setdefault("jetPtCut", 25000.)
93 kwargs.setdefault("leadingCHadronPtCut", 5000.)
94
95 return DFCommonClassifyAndCalculateHFToolCfg(flags, "C5J25", **kwargs)
96
97
99 kwargs.setdefault("jetPtCut", 20000.)
100 kwargs.setdefault("leadingCHadronPtCut", 15000.)
101
102 return DFCommonClassifyAndCalculateHFToolCfg(flags, "C15J20", **kwargs)
103
104
106 kwargs.setdefault("jetPtCut", 25000.)
107 kwargs.setdefault("leadingCHadronPtCut", 15000.)
108
109 return DFCommonClassifyAndCalculateHFToolCfg(flags, "C15J25", **kwargs)
110
111
112def ClassifyAndCalculateHFAugmentationCfg(flags, mc_channel_number, variation, **kwargs):
113
114 """Configure and add the tools to compute and add the HF classifier in the derivation"""
115
116 acc = ComponentAccumulator()
117 acc.flagPerfmonDomain('Truth')
118 ClassifyAndCalculateHFAugmentationTool = CompFactory.DerivationFramework.ClassifyAndCalculateHFAugmentation(name = "DFCommonClassifyAndCalculateHFAugmentation"+variation)
119
120
123
124 # Configure the tool that adds the HF Classification in the derivation file.
125 # Parameters:
126 # -ClassifyAndComputeHFtool: It computes the HF classifier.
127 # -HadronOriginClassifierTool: It determines the origin of the HF hadrons.
128 # -ClassifyAndComputeHFtool: It matches the hadrons with the jets.
129 # Tools:
130 # -jetCollectionName: It contains the name of the jets container.
131 # -TruthParticleContainerName: It contains the name of the truth particles container.
132 # -hfDecorationName: It contains the name used to save the HF classifier.
133 # -SimplehfDecorationName: It contains the name used to save the simple HF classifier.
134
135 ClassifyAndCalculateHFAugmentationTool.jetCollectionName = "AntiKt4TruthDressedWZJets"
136 ClassifyAndCalculateHFAugmentationTool.TruthParticleContainerName = "TruthParticles"
137 ClassifyAndCalculateHFAugmentationTool.hfDecorationName = "HF_Classification"+variation
138 ClassifyAndCalculateHFAugmentationTool.SimplehfDecorationName = "HF_SimpleClassification"+variation
139 ClassifyAndCalculateHFAugmentationTool.HadronOriginIDDecorationName = "HFHadronOriginID"+variation
140 ClassifyAndCalculateHFAugmentationTool.HadronOriginClassifierTool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonHadronOriginClassifierCfg(flags)))
141
142 acc.setPrivateTools(ClassifyAndCalculateHFAugmentationTool)
143 return acc
144
145
146#Configuration of the tools to compute the HF Classification of the ttbar+jets events.
148
149 """HF Classification configuration."""
150
151 acc = ComponentAccumulator()
152 acc.flagPerfmonDomain('Truth')
153 #Check the the DSID of the considered sample is in the list of ttbar samples.
154 mc_channel_number = int(flags.Input.MCChannelNumber)
155 if mc_channel_number > 0:
156 if mc_channel_number in DSIDList:
157 #In this case, the DSID is in the list so configure the tools.
158 #Configure the tool that adds the HF Classification in the derivation file.
159 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
160
161 ClassifyAndCalculateHFAugmentationTool = acc.popToolsAndMerge(ClassifyAndCalculateHFAugmentationCfg(flags, mc_channel_number, ""))
162 ClassifyAndCalculateHFAugmentationTool.ClassifyAndComputeHFtool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonClassifyAndCalculateHFToolCfg(flags, "")))
163 ClassifyAndCalculateHFAugmentationTool.JetMatchingTool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonMatchingToolCfg(flags, "")))
164 acc.addEventAlgo(CommonAugmentation(name = "HFClassificationCommonKernel",
165 AugmentationTools = [acc.addPublicTool(ClassifyAndCalculateHFAugmentationTool)]))
166
167 ClassifyAndCalculateHFAugmentationToolC5J20 = acc.popToolsAndMerge(ClassifyAndCalculateHFAugmentationCfg(flags, mc_channel_number, "C5J20"))
168 ClassifyAndCalculateHFAugmentationToolC5J20.ClassifyAndComputeHFtool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonClassifyAndCalculateHFToolC5J20Cfg(flags)))
169 ClassifyAndCalculateHFAugmentationToolC5J20.JetMatchingTool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonMatchingToolJ20Cfg(flags)))
170 acc.addEventAlgo(CommonAugmentation(name = "HFClassificationCommonKernelC5J20",
171 AugmentationTools = [acc.addPublicTool(ClassifyAndCalculateHFAugmentationToolC5J20)]))
172
173 ClassifyAndCalculateHFAugmentationToolC5J25 = acc.popToolsAndMerge(ClassifyAndCalculateHFAugmentationCfg(flags, mc_channel_number, "C5J25"))
174 ClassifyAndCalculateHFAugmentationToolC5J25.ClassifyAndComputeHFtool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonClassifyAndCalculateHFToolC5J25Cfg(flags)))
175 ClassifyAndCalculateHFAugmentationToolC5J25.JetMatchingTool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonMatchingToolJ25Cfg(flags)))
176 acc.addEventAlgo(CommonAugmentation(name = "HFClassificationCommonKernelC5J25",
177 AugmentationTools = [acc.addPublicTool(ClassifyAndCalculateHFAugmentationToolC5J25)]))
178
179 ClassifyAndCalculateHFAugmentationToolC15J20 = acc.popToolsAndMerge(ClassifyAndCalculateHFAugmentationCfg(flags, mc_channel_number, "C15J20"))
180 ClassifyAndCalculateHFAugmentationToolC15J20.ClassifyAndComputeHFtool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonClassifyAndCalculateHFToolC15J20Cfg(flags)))
181 ClassifyAndCalculateHFAugmentationToolC15J20.JetMatchingTool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonMatchingToolJ20Cfg(flags)))
182 acc.addEventAlgo(CommonAugmentation(name = "HFClassificationCommonKernelC15J20",
183 AugmentationTools = [acc.addPublicTool(ClassifyAndCalculateHFAugmentationToolC15J20)]))
184
185 ClassifyAndCalculateHFAugmentationToolC15J25 = acc.popToolsAndMerge(ClassifyAndCalculateHFAugmentationCfg(flags, mc_channel_number, "C15J25"))
186 ClassifyAndCalculateHFAugmentationToolC15J25.ClassifyAndComputeHFtool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonClassifyAndCalculateHFToolC15J25Cfg(flags)))
187 ClassifyAndCalculateHFAugmentationToolC15J25.JetMatchingTool = acc.addPublicTool(acc.popToolsAndMerge(DFCommonMatchingToolJ25Cfg(flags)))
188 acc.addEventAlgo(CommonAugmentation(name = "HFClassificationCommonKernelC15J25",
189 AugmentationTools = [acc.addPublicTool(ClassifyAndCalculateHFAugmentationToolC15J25)]))
190
191 return acc
DFCommonMatchingToolCfg(flags, variation, **kwargs)
DFCommonClassifyAndCalculateHFToolCfg(flags, variation, **kwargs)
ClassifyAndCalculateHFAugmentationCfg(flags, mc_channel_number, variation, **kwargs)