ATLAS Offline Software
Loading...
Searching...
No Matches
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
8
9// EDM include(s):
11
13#include "AsgTools/ToolStore.h"
15
16// Global accessors and decorators
17static const SG::Accessor<unsigned int> acc_tileok("TileStatus");
18static const SG::Accessor<float> acc_ptraw("Ptraw");
19
20using namespace CP;
21
22JetTileCorrectionAlg::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
33
34
36 ATH_MSG_INFO ("Initializing " << name() << "...");
37
38 return StatusCode::SUCCESS;
39}
40
42 ATH_MSG_INFO ("First execute " << name() << "...");
43
44 ATH_CHECK( m_jtcTool.retrieve() );
45
46 return StatusCode::SUCCESS;
47}
48
49
51
52 ATH_MSG_INFO ("Finalizing " << name() << "...");
53
54 return StatusCode::SUCCESS;
55}
56
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
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Helper class to provide type-safe access to aux data.
static const SG::Accessor< unsigned int > acc_tileok("TileStatus")
static const SG::Accessor< float > acc_ptraw("Ptraw")
AthAnalysisAlgorithm(const std::string &name)
Constructor taking just a name.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Return value from object correction CP tools.
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
virtual StatusCode initialize()
virtual StatusCode firstExecute()
Function called when first execute is encountered user can read event information with evtStore()
JetTileCorrectionAlg(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandle< IJetTileCorrectionTool > m_jtcTool
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
Helper class to provide type-safe access to aux data.
Select isolated Photons, Electrons and Muons.
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".