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 
6 // TruthD2Decorator.cxx, (c) ATLAS Detector software
8 // Author: Robert Les (robert.les@cern.ch)
9 //
10 
13 #include <vector>
14 #include <string>
15 
16 namespace DerivationFramework {
17 
19  const std::string& n,
20  const IInterface* p) :
21  base_class(t,n,p)
22  {
23 
24  }
25 
27  {
31 
32  return StatusCode::SUCCESS;
33  }
34 
35 
37  {
38  // Event context
39  const EventContext& ctx = Gaudi::Hive::currentContext();
40 
41  // Set up the decorators
43 
44  // Get the Large-R jet Container
46 
47  if(!largeRjets.isValid()) {
48  ATH_MSG_ERROR ("Couldn't retrieve JetContainer with key " << m_jetContainerKey.key());
49  return StatusCode::FAILURE;
50  }
51 
52  // loop over jet collection
53  for( const auto *jet: *largeRjets){
54  //get ECF
55  float ecf1 = jet->getAttribute<float>("ECF1");
56  float ecf2 = jet->getAttribute<float>("ECF2");
57  float ecf3 = jet->getAttribute<float>("ECF3");
58 
59  //calculate D2 and decorate
60  float D2=-999;
61  if(std::abs(ecf2)>1e-8)
62  D2=ecf3 * std::pow(ecf1, 3.0) / std::pow(ecf2, 3.0);
63  decoratorD2(*jet) = D2;
64  }
65 
66  return StatusCode::SUCCESS;
67  }
68 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
DerivationFramework::TruthD2Decorator::TruthD2Decorator
TruthD2Decorator(const std::string &t, const std::string &n, const IInterface *p)
Definition: TruthD2Decorator.cxx:18
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
DerivationFramework::TruthD2Decorator::m_jetContainerKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerKey
Definition: TruthD2Decorator.h:30
DerivationFramework::TruthD2Decorator::initialize
StatusCode initialize()
Definition: TruthD2Decorator.cxx:26
TruthD2Decorator.h
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
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:32
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:727
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?
DerivationFramework::TruthD2Decorator::addBranches
virtual StatusCode addBranches() const
Definition: TruthD2Decorator.cxx:36
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