ATLAS Offline Software
TruthD2Decorator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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  AthAlgTool(t,n,p)
22  {
23  declareInterface<DerivationFramework::IAugmentationTool>(this);
24 
25  }
26 
28  {
29 
30  ATH_CHECK(m_jetContainerKey.initialize());
31  m_decorationName = m_jetContainerKey.key()+".D2";
32  ATH_CHECK(m_decorationName.initialize());
33 
34  return StatusCode::SUCCESS;
35 
36  }
37 
38 
40  {
41 
42  // Event context
43  const EventContext& ctx = Gaudi::Hive::currentContext();
44 
45  // Set up the decorators
47 
48  // Get the Large-R jet Container
50 
51  if(!largeRjets.isValid()) {
52  ATH_MSG_ERROR ("Couldn't retrieve JetContainer with key " << m_jetContainerKey.key());
53  return StatusCode::FAILURE;
54  }
55 
56  // loop over jet collection
57  for( const auto *jet: *largeRjets){
58  //get ECF
59  float ecf1 = jet->getAttribute<float>("ECF1");
60  float ecf2 = jet->getAttribute<float>("ECF2");
61  float ecf3 = jet->getAttribute<float>("ECF3");
62 
63  //calculate D2 and decorate
64  float D2=-999;
65  if(fabs(ecf2)>1e-8)
66  D2=ecf3 * pow(ecf1, 3.0) / pow(ecf2, 3.0);
67  decoratorD2(*jet) = D2;
68  }
69 
70  return StatusCode::SUCCESS;
71  }
72 }
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:70
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
DerivationFramework::TruthD2Decorator::m_jetContainerKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerKey
Definition: TruthD2Decorator.h:30
DerivationFramework::TruthD2Decorator::initialize
StatusCode initialize()
Definition: TruthD2Decorator.cxx:27
TruthD2Decorator.h
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::TruthD2Decorator::m_decorationName
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decorationName
Definition: TruthD2Decorator.h:32
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
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::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
DerivationFramework::TruthD2Decorator::addBranches
virtual StatusCode addBranches() const
Pass the thinning service
Definition: TruthD2Decorator.cxx:39
AthAlgTool
Definition: AthAlgTool.h:26