ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetAnalysisTools
JetTileCorrection
src
JetTileCorrectionAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// JetTileCorrection includes
6
#include "
JetTileCorrectionAlg.h
"
7
#include "
JetTileCorrection/JetTileCorrectionTool.h
"
8
9
// EDM include(s):
10
#include "
xAODJet/JetContainer.h
"
11
12
#include "
PathResolver/PathResolver.h
"
13
#include "
AsgTools/ToolStore.h
"
14
#include "
AthContainers/Accessor.h
"
15
16
// Global accessors and decorators
17
static
const
SG::Accessor<unsigned int>
acc_tileok
(
"TileStatus"
);
18
static
const
SG::Accessor<float>
acc_ptraw
(
"Ptraw"
);
19
20
using namespace
CP
;
21
22
JetTileCorrectionAlg::JetTileCorrectionAlg
(
const
std::string&
name
, ISvcLocator* pSvcLocator )
23
:
AthAnalysisAlgorithm
(
name
, pSvcLocator )
24
,
m_jtcTool
(
"CP::JetTileCorrectionTool/JetTileCorrectionTool"
, this )
25
{
26
27
declareProperty
(
"JetContainer"
,
m_jetKey
=
"AntiKt4EMTopoJets"
);
28
declareProperty
(
"JetTileCorrectionTool"
,
m_jtcTool
);
29
}
30
31
32
JetTileCorrectionAlg::~JetTileCorrectionAlg
() =
default
;
33
34
35
StatusCode
JetTileCorrectionAlg::initialize
() {
36
ATH_MSG_INFO
(
"Initializing "
<<
name
() <<
"..."
);
37
38
return
StatusCode::SUCCESS;
39
}
40
41
StatusCode
JetTileCorrectionAlg::firstExecute
() {
42
ATH_MSG_INFO
(
"First execute "
<<
name
() <<
"..."
);
43
44
ATH_CHECK
(
m_jtcTool
.retrieve() );
45
46
return
StatusCode::SUCCESS;
47
}
48
49
50
StatusCode
JetTileCorrectionAlg::finalize
() {
51
52
ATH_MSG_INFO
(
"Finalizing "
<<
name
() <<
"..."
);
53
54
return
StatusCode::SUCCESS;
55
}
56
57
StatusCode
JetTileCorrectionAlg::execute
(
const
EventContext&
/*ctx*/
) {
58
ATH_MSG_DEBUG
(
"Executing "
<<
name
() <<
"..."
);
59
60
// Retrieve the jets:
61
const
xAOD::JetContainer
* jets =
nullptr
;
62
ATH_CHECK
(
evtStore
()->retrieve( jets,
m_jetKey
) );
63
64
ATH_MSG_INFO
(
"--------------------"
);
65
ATH_MSG_INFO
(
"Number of jets: "
<< jets->size() );
66
67
// Loop over them:
68
xAOD::JetContainer::const_iterator
jet_itr = jets->begin();
69
xAOD::JetContainer::const_iterator
jet_end = jets->end();
70
for
( ; jet_itr != jet_end; ++jet_itr ){
71
72
//if ((*jet_itr)->pt() < 20000. || fabs((*jet_itr)->eta()) > 2.8) continue;
73
74
// copy constant objects to non-constant
75
xAOD::Jet
*
jet
=
nullptr
;
76
jet
=
new
xAOD::Jet
();
77
jet
->makePrivateStore( **jet_itr );
78
79
//--- apply tile dead module correction
80
CP::CorrectionCode
retCode =
m_jtcTool
->applyCorrection(*
jet
);
81
82
if
( retCode ==
CP::CorrectionCode::OutOfValidityRange
){
83
ATH_MSG_VERBOSE
(
"No valid pt/eta range. No correction applied."
);
84
}
85
else
if
( retCode !=
CP::CorrectionCode::Ok
){
86
ATH_MSG_ERROR
(
"Failed to apply JetTileCorrection!"
);
87
//return StatusCode::FAILURE;
88
}
89
90
unsigned
int
j_status =
acc_tileok
(*
jet
);
91
std::string str_status=
""
;
92
93
if
(j_status == (
unsigned
int
)
JTC::TS::GOOD
)
94
str_status =
"NotAffected"
;
95
else
if
(j_status == (
unsigned
int
)
JTC::TS::EDGE
)
96
str_status =
"EdgeAffected"
;
97
else
if
(j_status == (
unsigned
int
)
JTC::TS::CORE
)
98
str_status =
"CoreAffected"
;
99
else
100
str_status =
"Unknown"
;
101
102
ATH_MSG_INFO
(
"Jet status : "
<< str_status <<
", Pt raw = "
<<
acc_ptraw
(*
jet
)*0.001 <<
" GeV, Pt corrected = "
<<
jet
->pt()*0.001 <<
" GeV"
);
103
}
104
ATH_MSG_INFO
(
"--------------------\n"
);
105
106
return
StatusCode::SUCCESS;
107
}
108
109
110
111
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
Accessor.h
Helper class to provide type-safe access to aux data.
JetContainer.h
acc_tileok
static const SG::Accessor< unsigned int > acc_tileok("TileStatus")
acc_ptraw
static const SG::Accessor< float > acc_ptraw("Ptraw")
JetTileCorrectionAlg.h
JetTileCorrectionTool.h
PathResolver.h
ToolStore.h
AthAnalysisAlgorithm::AthAnalysisAlgorithm
AthAnalysisAlgorithm(const std::string &name)
Constructor taking just a name.
Definition
AthAnalysisAlgorithm.cxx:19
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
CP::CorrectionCode
Return value from object correction CP tools.
Definition
CorrectionCode.h:31
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition
CorrectionCode.h:37
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition
CorrectionCode.h:38
CP::JetTileCorrectionAlg::~JetTileCorrectionAlg
virtual ~JetTileCorrectionAlg()
CP::JetTileCorrectionAlg::execute
virtual StatusCode execute(const EventContext &ctx)
Execute method.
Definition
JetTileCorrectionAlg.cxx:57
CP::JetTileCorrectionAlg::initialize
virtual StatusCode initialize()
Definition
JetTileCorrectionAlg.cxx:35
CP::JetTileCorrectionAlg::m_jetKey
std::string m_jetKey
Definition
JetTileCorrectionAlg.h:28
CP::JetTileCorrectionAlg::finalize
virtual StatusCode finalize()
Definition
JetTileCorrectionAlg.cxx:50
CP::JetTileCorrectionAlg::firstExecute
virtual StatusCode firstExecute()
Function called when first execute is encountered user can read event information with evtStore().
Definition
JetTileCorrectionAlg.cxx:41
CP::JetTileCorrectionAlg::JetTileCorrectionAlg
JetTileCorrectionAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
JetTileCorrectionAlg.cxx:22
CP::JetTileCorrectionAlg::m_jtcTool
ToolHandle< IJetTileCorrectionTool > m_jtcTool
Definition
JetTileCorrectionAlg.h:30
DataVector< xAOD::Jet_v1 >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition
Control/AthContainers/AthContainers/Accessor.h:68
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
JTC::TS::GOOD
@ GOOD
Definition
IJetTileCorrectionTool.h:27
JTC::TS::EDGE
@ EDGE
Definition
IJetTileCorrectionTool.h:27
JTC::TS::CORE
@ CORE
Definition
IJetTileCorrectionTool.h:27
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0