Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FastJetAlgo.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FastJetAlgo.h
1 #ifndef JETBASE_FASTJETALGO_H
2 #define JETBASE_FASTJETALGO_H
3 
4 #include "Jet.h"
5 #include "JetAlgo.h"
6 #include "FastJetOptions.h"
7 
8 #include <fastjet/PseudoJet.hh>
9 #include <fastjet/JetDefinition.hh>
10 
11 #include <cmath> // for NAN
12 #include <climits> // for NAN
13 #include <iostream> // for cout, ostream
14 #include <vector> // for vector
15 
16 
17 namespace fastjet {
18  class PseudoJet;
19  class GridMedianBackgroundEstimator;
20  class SelectorPtMax;
21  namespace contrib {
22  class ConstituentSubtractor;
23  }
24 }
25 
26 class JetContainer;
27 
28 class FastJetAlgo : public JetAlgo
29 {
30  public:
32  ~FastJetAlgo() override {}
33 
34  void identify(std::ostream& os = std::cout) override;
35  Jet::ALGO get_algo() override { return m_opt.algo; }
36 
37  //----------------------------------------------------------------------
38  // Legacy code interface. It is better to use FastJetOptions, but
39  // there is no harm is using these, as well.
40  //----------------------------------------------------------------------
41  FastJetAlgo(Jet::ALGO algo, float par, int verbosity=0) :
42  FastJetAlgo({{algo, JET_R,par,VERBOSITY, static_cast<float>(verbosity)}})
43  {}
44  void set_do_SoftDrop (bool do_SD) { m_opt.doSoftDrop = do_SD; }
45  void set_SoftDrop_beta (float beta) { m_opt.SD_beta = beta; }
46  void set_SoftDrop_zcut (float zcut) { m_opt.SD_zcut = zcut; }
47  //--end-legacy-code-interface-------------------------------------------
48 
49  std::vector<Jet*> get_jets(std::vector<Jet*> particles) override;
50  void cluster_and_fill(std::vector<Jet*>& part_in, JetContainer* jets_out) override;
51 
52  private:
54  bool m_first_cluster_call { true };
55 
56  // for convenience save indices of the zg, Rg, mu, and area for jets in the JetContainer
57  Jet::PROPERTY m_zg_index { Jet::PROPERTY::no_property };
58  Jet::PROPERTY m_Rg_index { Jet::PROPERTY::no_property };
59  Jet::PROPERTY m_mu_index { Jet::PROPERTY::no_property };
60  Jet::PROPERTY m_area_index { Jet::PROPERTY::no_property };
61 
62  // Internal processes
63  std::vector<fastjet::PseudoJet> jets_to_pseudojets(std::vector<Jet*>& particles);
64  std::vector<fastjet::PseudoJet> cluster_jets(std::vector<fastjet::PseudoJet>& constituents);
65  std::vector<fastjet::PseudoJet> cluster_area_jets(std::vector<fastjet::PseudoJet>& constituents);
66  float calc_rhomeddens(std::vector<fastjet::PseudoJet>& constituents);
67  fastjet::JetDefinition get_fastjet_definition();
68  fastjet::Selector get_selector();
69  void first_call_init(JetContainer*_=nullptr);
70 
71  // private members
72  fastjet::contrib::ConstituentSubtractor* cs_subtractor = nullptr;
73  fastjet::GridMedianBackgroundEstimator* cs_bge_rho = nullptr;
74  fastjet::Selector* cs_sel_max_pt = nullptr;
75 
76 
77  fastjet::ClusterSequence* m_cluseq {nullptr};
78  fastjet::ClusterSequence* m_cluseqarea {nullptr};
79 };
80 
81 #endif