ATLAS Offline Software
SubjetMakerTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include "fastjet/ClusterSequence.hh"
8 
9 SubjetMakerTool::SubjetMakerTool(const std::string& name) :
11 {
12  declareProperty("type", m_type = "AntiKt");
13  declareProperty("R", m_R = 0.2);
14  declareProperty("PtCut", m_minPt = 20e3);
15 }
16 
18  if(!checkForConstituents(jet)) return 1;
19 
20  std::vector<float> s_e;
21  std::vector<float> s_px;
22  std::vector<float> s_py;
23  std::vector<float> s_pz;
24 
25  std::vector<fastjet::PseudoJet> constit_pseudojets = jet::JetConstituentFiller::constituentPseudoJets(jet);
26  fastjet::PseudoJet pjet = fastjet::join(constit_pseudojets);
27 
28  fastjet::JetAlgorithm jetalg = fastjet::antikt_algorithm;
29  if (m_type == "AntiKt") {
31  } else if (m_type == "Kt") {
32  jetalg = fastjet::kt_algorithm;
33  } else if (m_type == "CamKt") {
35  }
36 
37  fastjet::JetDefinition microjet_def(jetalg, m_R);
38  fastjet::ClusterSequence microjet_cs(pjet.constituents(), microjet_def);
39  std::vector<fastjet::PseudoJet> microjets = fastjet::sorted_by_pt(microjet_cs.inclusive_jets(m_minPt));
40  for (size_t z = 0; z < microjets.size(); ++z) {
41  s_e.push_back(microjets[z].e());
42  s_px.push_back(microjets[z].px());
43  s_py.push_back(microjets[z].py());
44  s_pz.push_back(microjets[z].pz());
45  }
46 
47  std::stringstream ss;
48  ss.str("");
49  ss << "Subjet" << m_type << (int) (m_R*100) << "_e";
50  jet.setAttribute(ss.str().c_str(), s_e);
51  ss.str("");
52  ss << "Subjet" << m_type << (int) (m_R*100) << "_px";
53  jet.setAttribute(ss.str().c_str(), s_px);
54  ss.str("");
55  ss << "Subjet" << m_type << (int) (m_R*100) << "_py";
56  jet.setAttribute(ss.str().c_str(), s_py);
57  ss.str("");
58  ss << "Subjet" << m_type << (int) (m_R*100) << "_pz";
59  jet.setAttribute(ss.str().c_str(), s_pz);
60 
61  return 0;
62 }
test_pyathena.px
px
Definition: test_pyathena.py:18
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
xAOD::JetAlgorithmType::kt_algorithm
@ kt_algorithm
Definition: JetContainerInfo.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
SubjetMakerTool::m_R
float m_R
Definition: SubjetMakerTool.h:19
SubjetMakerTool::m_type
std::string m_type
Definition: SubjetMakerTool.h:18
JetConstituentFiller.h
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
jet::ClusterSequence
fastjet::ClusterSequence ClusterSequence
Definition: ClusterSequence.h:21
z
#define z
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
SubjetMakerTool::m_minPt
float m_minPt
Definition: SubjetMakerTool.h:20
JetSubStructureMomentToolsBase::checkForConstituents
bool checkForConstituents(const xAOD::Jet &jet) const
Definition: JetSubStructureMomentToolsBase.h:33
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Amg::py
@ py
Definition: GeoPrimitives.h:39
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
jet::JetConstituentFiller::constituentPseudoJets
static PseudoJetVector constituentPseudoJets(const xAOD::Jet &jet, bool ignoreGhosts=true, bool requireJetStructure=false)
Returns the jet's constituents as a vector of PseudoJet if ignoreGhosts==true, ghost constituents are...
Definition: JetConstituentFiller.cxx:164
xAOD::JetAlgorithmType::cambridge_algorithm
@ cambridge_algorithm
Definition: JetContainerInfo.h:32
SubjetMakerTool::SubjetMakerTool
SubjetMakerTool(const std::string &name)
Definition: SubjetMakerTool.cxx:9
xAOD::JetAlgorithmType::antikt_algorithm
@ antikt_algorithm
Definition: JetContainerInfo.h:33
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
JetSubStructureMomentToolsBase
Definition: JetSubStructureMomentToolsBase.h:18
SubjetMakerTool.h
SubjetMakerTool::modifyJet
int modifyJet(xAOD::Jet &jet) const
Modify a single jet. This is obsolete and set to be removed.
Definition: SubjetMakerTool.cxx:17