ATLAS Offline Software
Loading...
Searching...
No Matches
ReclusteredJetCalibrationAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8//
9// includes
10//
11
14
15//
16// method implementations
17//
18
19namespace CP
20{
21
22 StatusCode ReclusteredJetCalibrationAlg ::
23 initialize ()
24 {
27
28 ANA_CHECK (m_systematicsList.initialize());
29 return StatusCode::SUCCESS;
30 }
31
32
33
34 StatusCode ReclusteredJetCalibrationAlg ::
35 execute (const EventContext &ctx) const
36 {
37 (void) ctx;
38 for (const auto& sys : m_systematicsList.systematicsVector())
39 {
40 // container we read in
41 xAOD::JetContainer *reclusteredJets = nullptr;
42 ATH_CHECK(m_reclusteredJetHandle.getCopy(reclusteredJets, sys));
43
44 const xAOD::JetContainer *smallRJets = nullptr;
45 ATH_CHECK(m_smallRJetHandle.retrieve(smallRJets, sys));
46
47 // loop over jets
48 for (xAOD::Jet *jet : *reclusteredJets)
49 {
50 const std::vector< ElementLink< xAOD::IParticleContainer > >& element_links = jet->constituentLinks();
51
52 xAOD::JetFourMom_t calibP4;
53 calibP4.SetPxPyPzE(0,0,0,0);
54 for (const auto& element_link: element_links){
55 if (! element_link.isValid() ) {
56 ATH_MSG_WARNING("Subjet element link invalid !!!!");
57 continue;
58 }
59 const auto subjet = *element_link;
60 int index = subjet->index();
61 const xAOD::Jet* subjetCal = smallRJets->at(index);
62 calibP4 += subjetCal->jetP4();
63 }
64 // Set calibrated P4
65 jet->setAttribute<xAOD::JetFourMom_t>("JetManualCalibScaleMomentum",calibP4);
66 jet->setJetP4( calibP4 );
67 }
68 }
69
70 return StatusCode::SUCCESS;
71 }
72}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
DataVector adapter that acts like it holds const pointers.
#define ANA_CHECK(EXP)
check whether the given expression was successful
SysCopyHandle< xAOD::JetContainer > m_reclusteredJetHandle
the jet collection we run on
SysReadHandle< xAOD::JetContainer > m_smallRJetHandle
SysListHandle m_systematicsList
the systematics list we run
const T * at(size_type n) const
Access an element, as an rvalue.
JetFourMom_t jetP4() const
The full 4-momentum of the particle : internal jet type.
Definition Jet_v1.cxx:76
Select isolated Photons, Electrons and Muons.
Definition index.py:1
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition JetTypes.h:17