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