ATLAS Offline Software
Loading...
Searching...
No Matches
TruthD2Decorator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Author: Robert Les (robert.les@cern.ch)
6
9#include <vector>
10#include <string>
11#include <cmath>
12#include <array>
13
14namespace DerivationFramework {
15
17 {
18 ATH_CHECK(m_jetContainerKey.initialize());
19 ATH_CHECK(m_decorationName.initialize());
20
21 return StatusCode::SUCCESS;
22 }
23
24
25 StatusCode TruthD2Decorator::addBranches(const EventContext& ctx) const
26 {
27 // Event context
28
29 // Set up the decorators
31
32 // Get the Large-R jet Container
34
35 if(!largeRjets.isValid()) {
36 ATH_MSG_ERROR ("Couldn't retrieve JetContainer with key " << m_jetContainerKey.key());
37 return StatusCode::FAILURE;
38 }
39
40 // loop over jet collection
41 const std::array<std::string,3> ECF{"ECF1","ECF2","ECF3"};
42 for( const auto *jet: *largeRjets){
43 //get ECF
44 float ecf1 = jet->getAttribute<float>(ECF[0]);
45 float ecf2 = jet->getAttribute<float>(ECF[1]);
46 float ecf3 = jet->getAttribute<float>(ECF[2]);
47
48 //calculate D2 and decorate
49 float D2=-999;
50 if(std::abs(ecf2)>1e-8)
51 D2=ecf3 * std::pow(ecf1, 3.0) / std::pow(ecf2, 3.0);
52 decoratorD2(*jet) = D2;
53 }
54
55 return StatusCode::SUCCESS;
56 }
57}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Handle class for adding a decoration to an object.
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerKey
virtual StatusCode initialize() override final
virtual StatusCode addBranches(const EventContext &ctx) const override final
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decorationName
virtual bool isValid() override final
Can the handle be successfully dereferenced?
THE reconstruction tool.