ATLAS Offline Software
Loading...
Searching...
No Matches
ScaleFactors.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7namespace BJT{
8
9 ScaleFactors::ScaleFactors(const std::string& name) :
10 asg::AsgTool(name)
11 {}
12
14
15 ATH_MSG_INFO("Initializing ScaleFactors tool");
16
17 // retrive helper tools
22
23 // print decoration name and validity range info
24 ATH_MSG_INFO("Scale Factors tool initialized");
25 ATH_MSG_INFO(" jet container : " << m_jetsKey.key());
26 ATH_MSG_INFO(" pT cut low : " << m_jetPtMin);
27 ATH_MSG_INFO(" pT cut high : " << m_jetPtMax);
28 ATH_MSG_INFO(" eta cut high : " << m_jetEtaMax);
29
31 ATH_MSG_INFO("Additional decorators that will be attached to jet :");
32
33 ATH_CHECK(m_jetsKey.initialize());
34
35 ATH_CHECK(m_accTaggedKey.initialize());
36 ATH_CHECK(m_decEfficiencyKey.initialize());
37 ATH_CHECK(m_decInefficiencyKey.initialize());
38
39 ATH_MSG_INFO(" " << m_accTaggedKey.key() << " : pass tagging criteria");
40 ATH_MSG_INFO(" " << m_decEfficiencyKey.key() << " : Efficiency correction");
41 ATH_MSG_INFO(" " << m_decInefficiencyKey.key() << " : Inefficiency correction");
42
43 return StatusCode::SUCCESS;
44
45 }
46
47 StatusCode ScaleFactors::decorate(const xAOD::JetContainer& jets) const {
48
49 ATH_MSG_DEBUG("Obtaining tagger scale factors result");
50
54
57
58 // loop over jets
59 for(const xAOD::Jet* jet : jets){
60
62 static const SG::AuxElement::ConstAccessor<int> truth_label_acc(m_truthLabelName);
63 int truth_label = truth_label_acc(*jet);
64
66 bool pass_taggerWP = accTagged(*jet);
67
70 ATH_MSG_DEBUG("jet pT: " << jet -> pt());
71 ATH_MSG_DEBUG("jet eta: " << jet -> eta());
72 ATH_MSG_DEBUG("jet truth label: " << truth_label);
73 ATH_MSG_DEBUG("jet pass tagger WP: " << pass_taggerWP);
74
75 float efficiency (-1.), inefficiency (-1.);
76
77 if(pass_taggerWP){
78 if(truth_label >= 1 && truth_label <= 5)
79 efficiency = m_histTool2D_quark_eff -> getValue(*jet, jc);
80 else if(truth_label == 21)
81 inefficiency = m_histTool2D_gluon_ineff -> getValue(*jet, jc);
82 }
83 else{
84 if(truth_label >= 1 && truth_label <= 5)
85 inefficiency = m_histTool2D_quark_ineff -> getValue(*jet, jc);
86 else if(truth_label == 21)
87 efficiency = m_histTool2D_gluon_eff -> getValue(*jet, jc);
88 }
89
90 ATH_MSG_DEBUG("efficiency: " << efficiency);
91 ATH_MSG_DEBUG("inefficiency: " << inefficiency);
92
94 decEfficiency(*jet) = efficiency;
95 decInefficiency(*jet) = inefficiency;
96
97 } // end loop over jets
98
99 return StatusCode::SUCCESS;
100
101 }
102
103}
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate jet container with tagging info.
ToolHandle< JetHelper::IVarTool > m_histTool2D_gluon_eff
SG::ReadDecorHandleKey< xAOD::JetContainer > m_accTaggedKey
virtual StatusCode initialize() override
Run once at the start of the job to setup everything.
Gaudi::Property< float > m_jetPtMin
ToolHandle< JetHelper::IVarTool > m_histTool2D_quark_eff
helper histogram tool ToDo: once W and top available should make this more generic and configurable
ToolHandle< JetHelper::IVarTool > m_histTool2D_quark_ineff
ToolHandle< JetHelper::IVarTool > m_histTool2D_gluon_ineff
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decEfficiencyKey
WriteDecorHandle keys.
SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey
ReadDecorHandle keys.
Gaudi::Property< float > m_jetPtMax
ScaleFactors(const std::string &name)
Constructor.
Gaudi::Property< std::string > m_truthLabelName
input parameters
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decInefficiencyKey
Gaudi::Property< float > m_jetEtaMax
Class JetContext Designed to read AOD information related to the event, N vertices,...
Definition JetContext.h:24
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570
Handle class for reading a decoration on an object.
Handle class for adding a decoration to an object.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition qgTagger.h:19
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".