ATLAS Offline Software
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 
12 namespace DerivationFramework {
13 
15  {
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 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
DerivationFramework::TruthD2Decorator::m_jetContainerKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerKey
Definition: TruthD2Decorator.h:28
DerivationFramework::TruthD2Decorator::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Definition: TruthD2Decorator.cxx:23
TruthD2Decorator.h
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
DerivationFramework::TruthD2Decorator::m_decorationName
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decorationName
Definition: TruthD2Decorator.h:30
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DerivationFramework::TruthD2Decorator::initialize
virtual StatusCode initialize() override final
Definition: TruthD2Decorator.cxx:14
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15