ATLAS Offline Software
Loading...
Searching...
No Matches
TruthD2Decorator.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// Author: Robert Les (robert.les@cern.ch)
6
9#include <vector>
10#include <string>
11
12namespace DerivationFramework {
13
15 {
16 ATH_CHECK(m_jetContainerKey.initialize());
17 ATH_CHECK(m_decorationName.initialize());
18
19 return StatusCode::SUCCESS;
20 }
21
22
23 StatusCode TruthD2Decorator::addBranches(const EventContext& ctx) const
24 {
25 // Event context
26
27 // Set up the decorators
29
30 // Get the Large-R jet Container
32
33 if(!largeRjets.isValid()) {
34 ATH_MSG_ERROR ("Couldn't retrieve JetContainer with key " << m_jetContainerKey.key());
35 return StatusCode::FAILURE;
36 }
37
38 // loop over jet collection
39 for( const auto *jet: *largeRjets){
40 //get ECF
41 float ecf1 = jet->getAttribute<float>("ECF1");
42 float ecf2 = jet->getAttribute<float>("ECF2");
43 float ecf3 = jet->getAttribute<float>("ECF3");
44
45 //calculate D2 and decorate
46 float D2=-999;
47 if(std::abs(ecf2)>1e-8)
48 D2=ecf3 * std::pow(ecf1, 3.0) / std::pow(ecf2, 3.0);
49 decoratorD2(*jet) = D2;
50 }
51
52 return StatusCode::SUCCESS;
53 }
54}
#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.