ATLAS Offline Software
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 
10 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11 from AthenaConfiguration.ComponentFactory import CompFactory
12 from DerivationFrameworkMCTruth.HFDSIDList import DSIDList
13 
14 
15 def ClassifyAndCalculateHFAugmentationCfg(flags, mc_channel_number):
16 
17  """Configure and add the tools to compute and add the HF classifier in the derivation"""
18 
19  acc = ComponentAccumulator()
20 
21 
24 
25  # Configure the tool that matches each truth particle to the closest jet.
26  # Parameters:
27  # -m_jetPtCut: Cut on the pt of the jets.
28  # -m_jetEtaCut: Cut on the eta of the jets.
29  # -m_drCut: Upper limit for the delta R between the particle and the jet to perform the matching.
30 
31  JetMatchingTool = CompFactory.DerivationFramework.JetMatchingTool(name='DFCommonJetMatchingTool')
32 
33  JetMatchingTool.jetPtCut = 15000.
34  JetMatchingTool.jetEtaCut = 2.5
35  JetMatchingTool.drCut = 0.3
36 
37  # Add the tool as a public tool.
38 
39  acc.addPublicTool(JetMatchingTool, primary=True)
40 
41 
44 
45  # Configure the tool that determines the origin of the HF hadrons.
46  # Parameters:
47  # -DSID: DSID of the sample that is being processed.
48 
49  HadronOriginClassifierTool = CompFactory.DerivationFramework.HadronOriginClassifier(name='DFCommonHadronOriginClassifier')
50  HadronOriginClassifierTool.DSID = mc_channel_number
51 
52  # Add the tool as a public tool.
53 
54  acc.addPublicTool(HadronOriginClassifierTool, primary=True)
55 
56 
59 
60  # Configure the tool that computes the HF Classification.
61  # Parameters:
62  # -m_jetPtCut: Cut on the pt of the jets.
63  # -m_jetEtaCut: Cut on the eta of the jets.
64  # -m_leadingHadronPtCut: Cut on the pt of the leading hadron.
65  # -m_leadingHadronPtRatioCut: Cut on the ratio between the pt of the leading hadron and the pt of its associated jet.
66 
67  ClassifyAndCalculateHFTool = CompFactory.DerivationFramework.ClassifyAndCalculateHFTool(name='DFCommonClassifyAndCalculateHFTool')
68 
69  ClassifyAndCalculateHFTool.jetPtCut = 15000.
70  ClassifyAndCalculateHFTool.jetEtaCut = 2.5
71  ClassifyAndCalculateHFTool.leadingHadronPtCut = 5000.
72  ClassifyAndCalculateHFTool.leadingHadronPtRatioCut = -1
73 
74  # Add the tool as a public tool.
75 
76  acc.addPublicTool(ClassifyAndCalculateHFTool, primary=True)
77 
78 
81 
82  # Configure the tool that adds the HF Classification in the derivation file.
83  # Parameters:
84  # -ClassifyAndComputeHFtool: It computes the HF classifier.
85  # -HadronOriginClassifierTool: It determines the origin of the HF hadrons.
86  # -ClassifyAndComputeHFtool: It matches the hadrons with the jets.
87  # Tools:
88  # -jetCollectionName: It contains the name of the jets container.
89  # -TruthParticleContainerName: It contains the name of the truth particles container.
90  # -hfDecorationName: It contains the name used to save the HF classifier.
91  # -SimplehfDecorationName: It contains the name used to save the simple HF classifier.
92 
93  ClassifyAndCalculateHFAugmentation = CompFactory.DerivationFramework.ClassifyAndCalculateHFAugmentation(name = "DFCommonClassifyAndCalculateHFAugmentation")
94 
95  ClassifyAndCalculateHFAugmentation.jetCollectionName = "AntiKt4TruthWZJets"
96  ClassifyAndCalculateHFAugmentation.TruthParticleContainerName = "TruthParticles"
97  ClassifyAndCalculateHFAugmentation.hfDecorationName = "HF_Classification"
98  ClassifyAndCalculateHFAugmentation.SimplehfDecorationName = "HF_SimpleClassification"
99 
100  ClassifyAndCalculateHFAugmentation.ClassifyAndComputeHFtool = ClassifyAndCalculateHFTool
101  ClassifyAndCalculateHFAugmentation.HadronOriginClassifierTool = HadronOriginClassifierTool
102  ClassifyAndCalculateHFAugmentation.JetMatchingTool = JetMatchingTool
103 
104  # Add the augmentation too as public tool.
105 
106  acc.addPublicTool(ClassifyAndCalculateHFAugmentation, primary = True)
107 
108  # Return the tools.
109 
110  return acc
111 
112 #Configuration of the tools to compute the HF Classification of the ttbar+jets events.
113 
115 
116  """HF Classification configuration."""
117 
118  acc = ComponentAccumulator()
119 
120  #Check the the DSID of the considered sample is in the list of ttbar samples.
121 
122  mc_channel_number = int(flags.Input.MCChannelNumber)
123 
124  if mc_channel_number > 0:
125 
126  if mc_channel_number in DSIDList:
127 
128  #In this case, the DSID is in the list so configure the tools.
129  #Configure the tool that adds the HF Classification in the derivation file.
130 
131  DFCommonClassifyAndCalculateHFAugmentation = acc.getPrimaryAndMerge(ClassifyAndCalculateHFAugmentationCfg(flags, mc_channel_number))
132 
133  CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
134  acc.addEventAlgo(CommonAugmentation(name = "HFClassificationCommonKernel",
135  AugmentationTools = [DFCommonClassifyAndCalculateHFAugmentation]))
136 
137  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.HFClassificationCommonConfig.ClassifyAndCalculateHFAugmentationCfg
def ClassifyAndCalculateHFAugmentationCfg(flags, mc_channel_number)
Definition: HFClassificationCommonConfig.py:15
python.HFClassificationCommonConfig.HFClassificationCommonCfg
def HFClassificationCommonCfg(flags)
Definition: HFClassificationCommonConfig.py:114