ATLAS Offline Software
SubjetFinder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "fastjet/ClusterSequence.hh"
7 #include "fastjet/JetDefinition.hh"
8 #include <iostream>
9 
10 #include "fastjet/EECambridgePlugin.hh"
11 
12 using namespace std;
13 using namespace JetSubStructureUtils;
14 
15 SubjetFinder::SubjetFinder(fastjet::JetAlgorithm fj_jetalg, float jet_radius, float pt_min, int exclusive_njets) :
16  m_fj_jetalg(fj_jetalg), m_jetrad(jet_radius), m_ptmin(pt_min), m_exclusivenjets(exclusive_njets)
17 {
18 }
19 
20 vector<fastjet::PseudoJet> SubjetFinder::result(const fastjet::PseudoJet &jet) const
21 {
22  vector<fastjet::PseudoJet> constit_pseudojets = jet.constituents();
23  vector<fastjet::PseudoJet> subjets;
24  if(constit_pseudojets.empty()) {
25  cout << "Warning in SubjetFinder: jet has no constituents" << endl;
26  return subjets;
27  }
28 
29  fastjet::ClusterSequence *clust_seq = nullptr;
30 
32  fastjet::JetDefinition jet_def = fastjet::JetDefinition(fastjet::ee_kt_algorithm);
33  clust_seq = new fastjet::ClusterSequence(constit_pseudojets, jet_def);
35  fastjet::JetDefinition jet_def = fastjet::JetDefinition(new fastjet::EECambridgePlugin(m_jetrad));
36  clust_seq = new fastjet::ClusterSequence(constit_pseudojets, jet_def);
37  }else{
38  fastjet::JetDefinition jet_def = fastjet::JetDefinition(m_fj_jetalg, m_jetrad, fastjet::E_scheme, fastjet::Best);
39  clust_seq = new fastjet::ClusterSequence(constit_pseudojets, jet_def);
40  }
41 
42  if(m_exclusivenjets < 0) { // Inclusive
43  subjets = fastjet::sorted_by_pt(clust_seq->inclusive_jets(m_ptmin));
44  }
45  else {
46  subjets = fastjet::sorted_by_pt(clust_seq->exclusive_jets_up_to(m_exclusivenjets));
47  }
48 
49  if(subjets.empty()) {
50  delete clust_seq;
51  }
52  else {
53  clust_seq->delete_self_when_unused();
54  }
55 
56  return subjets;
57 }
JetSubStructureUtils::SubjetFinder::m_ptmin
float m_ptmin
Definition: SubjetFinder.h:23
xAOD::JetAlgorithmType::ee_kt_algorithm
@ ee_kt_algorithm
Definition: JetContainerInfo.h:37
JetSubStructureUtils
Definition: Angularity.h:10
JetSubStructureUtils::SubjetFinder::m_exclusivenjets
int m_exclusivenjets
Definition: SubjetFinder.h:24
JetSubStructureUtils::SubjetFinder::m_fj_jetalg
fastjet::JetAlgorithm m_fj_jetalg
Definition: SubjetFinder.h:21
xAOD::JetAlgorithmType::plugin_algorithm
@ plugin_algorithm
Definition: JetContainerInfo.h:39
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
jet::ClusterSequence
fastjet::ClusterSequence ClusterSequence
Definition: ClusterSequence.h:21
SubjetFinder.h
JetSubStructureUtils::SubjetFinder::m_jetrad
float m_jetrad
Definition: SubjetFinder.h:22
JetSubStructureUtils::SubjetFinder::result
virtual std::vector< fastjet::PseudoJet > result(const fastjet::PseudoJet &jet) const
Definition: SubjetFinder.cxx:20