ATLAS Offline Software
CenterOfMassShapesTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 
11 #include <string>
12 
13 
16 {
17 }
18 
20  if(m_jetContainerName.empty()){
21  ATH_MSG_ERROR("NSubjettinessTool needs to have its input jet container name configured!");
22  return StatusCode::FAILURE;
23  }
24 
27 
28  for(unsigned int i=0; i<5; i++)
29  m_FoxWolfram_Keys.emplace_back(m_jetContainerName + "." + m_prefix +
30  "FoxWolfram" + std::to_string(i));
31 
34 
37  ATH_CHECK(m_FoxWolfram_Keys.initialize());
40 
41  return StatusCode::SUCCESS;
42 }
43 
47 
48  std::vector<SG::WriteDecorHandle<xAOD::JetContainer, float>> wdhs_FoxWolfram;
49  for(const auto& key : m_FoxWolfram_Keys)
50  wdhs_FoxWolfram.emplace_back(key);
51 
54 
55  for(const xAOD::Jet* injet : jets){
56 
57  fastjet::PseudoJet jet;
58  bool decorate = SetupDecoration(jet, *injet);
59 
60  std::map<std::string, double> res_t, res_fox, res_s;
61 
62  res_t["ThrustMin"] = -999;
63  res_t["ThrustMaj"] = -999;
64  res_fox["FoxWolfram0"] = -999;
65  res_fox["FoxWolfram1"] = -999;
66  res_fox["FoxWolfram2"] = -999;
67  res_fox["FoxWolfram3"] = -999;
68  res_fox["FoxWolfram4"] = -999;
69  res_s["Sphericity"] = -999;
70  res_s["Aplanarity"] = -999;
71 
72  if (decorate) {
76  res_t = t.result(jet);
77  res_fox = foxwolfram.result(jet);
78  res_s = sphericity.result(jet);
79  }
80 
81  wdh_ThrustMin(*injet) = res_t["ThrustMin"];
82  wdh_ThrustMaj(*injet) = res_t["ThrustMaj"];
83 
84  for(unsigned int i=0; i<5; i++)
85  wdhs_FoxWolfram[i](*injet) = res_fox["FoxWolfram"+std::to_string(i)];
86 
87  wdh_Sphericity(*injet) = res_s["Sphericity"];
88  wdh_Aplanarity(*injet) = res_s["Aplanarity"];
89  }
90 
91  return StatusCode::SUCCESS;
92 }
93 
JetSubStructureUtils::FoxWolfram
Definition: Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/FoxWolfram.h:11
JetSubStructureUtils::Thrust
Definition: Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/Thrust.h:11
defineDB.jets
jets
Definition: JetTagCalibration/share/defineDB.py:24
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
CenterOfMassShapesTool::m_Sphericity_Key
SG::WriteDecorHandleKey< xAOD::JetContainer > m_Sphericity_Key
Definition: CenterOfMassShapesTool.h:38
python.DecoratorFactory.decorate
def decorate(hto4l_controller, decorator, **kwargs)
Definition: Hto4lControl/python/DecoratorFactory.py:5
CenterOfMassShapesTool::modify
StatusCode modify(xAOD::JetContainer &jets) const override
Loop over calls to modifyJet.
Definition: CenterOfMassShapesTool.cxx:44
Thrust.h
JetSubStructureUtils::SphericityTensor::result
virtual std::map< std::string, double > result(const fastjet::PseudoJet &jet) const
Definition: SphericityTensor.cxx:15
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CenterOfMassShapesTool::m_FoxWolfram_Keys
SG::WriteDecorHandleKeyArray< xAOD::JetContainer > m_FoxWolfram_Keys
Definition: CenterOfMassShapesTool.h:35
CenterOfMassShapesTool::m_ThrustMaj_Key
SG::WriteDecorHandleKey< xAOD::JetContainer > m_ThrustMaj_Key
Definition: CenterOfMassShapesTool.h:32
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
WriteDecorHandle.h
Handle class for adding a decoration to an object.
JetSubStructureMomentToolsBase::m_prefix
std::string m_prefix
Definition: JetSubStructureMomentToolsBase.h:30
JetSubStructureMomentToolsBase::SetupDecoration
bool SetupDecoration(fastjet::PseudoJet &pseudojet, const xAOD::Jet &jet, bool requireJetStructure=false) const
Definition: JetSubStructureMomentToolsBase.cxx:30
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
SphericityTensor.h
CenterOfMassShapesTool::CenterOfMassShapesTool
CenterOfMassShapesTool(const std::string &name)
Definition: CenterOfMassShapesTool.cxx:14
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
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.
JetSubStructureUtils::SphericityTensor
Definition: SphericityTensor.h:11
FoxWolfram.h
CenterOfMassShapesTool::m_Aplanarity_Key
SG::WriteDecorHandleKey< xAOD::JetContainer > m_Aplanarity_Key
Definition: CenterOfMassShapesTool.h:40
JetSubStructureMomentToolsBase
Definition: JetSubStructureMomentToolsBase.h:18
CenterOfMassShapesTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: CenterOfMassShapesTool.cxx:19
CenterOfMassShapesTool::m_ThrustMin_Key
SG::WriteDecorHandleKey< xAOD::JetContainer > m_ThrustMin_Key
Definition: CenterOfMassShapesTool.h:30
JetSubStructureUtils::FoxWolfram::result
virtual std::map< std::string, double > result(const fastjet::PseudoJet &jet) const
Definition: Reconstruction/Jet/JetSubStructureUtils/Root/FoxWolfram.cxx:12
CenterOfMassShapesTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: CenterOfMassShapesTool.h:27
CenterOfMassShapesTool.h
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37