Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JetContainerv1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file JetContainerv1.h
1 #ifndef JETBASE_JetContainerv1__h
2 #define JETBASE_JetContainerv1__h
3 #include "JetContainer.h"
4 
5 #include "Jet.h"
6 
8 {
9 public:
10  // Manage class creation, copy, reset, destruction
12  ~JetContainerv1() override;
13  void identify(std::ostream& os=std::cout) const override;
14  explicit JetContainerv1(const JetContainer& jets);
16  void Reset() override;
17  TClonesArray* clone_data() const override
18  { return (TClonesArray*) m_clones->Clone(); };
19 
20  // status of jet contents
21  bool empty() const override { return m_njets==0; };
22  size_t size() const override { return m_njets; };
23 
24  // adding/access jets
25  Jet* add_jet() override; // Add a new jet to the TClonesArray and return the pointer
26  Jet* get_jet(unsigned int index) override; // Get get at location.
27  Jet* get_UncheckedAt(unsigned int index) override; // Get get at location.
28 
29  // convenience shortcuts of get_{jet,UncheckedAt}
30  inline Jet* operator()(int index) override { return get_jet(index); }; // synonym for get_jet()
31  inline Jet* operator[](int index) override { return get_UncheckedAt(index); }; // get jet, don't check for length
32  //
33  // ----------------------------------------------------------------------------------------
34  // Interface for adding properties to jets, and getting the index to those properties
35  // ----------------------------------------------------------------------------------------
36  // The optional properties in each Jet are stored in a vector of floats,
37  // e.g. { Rg_value, mg_value, area, .... }
38  // The JetContainer generates the jet and keeps a map of which properties in which location.
39  // Default values in the Jet Properties are set to NAN
40  // ----------------------------------------------------------------------------------------
41  std::map<Jet::PROPERTY, Jet::PROPERTY> property_indices() const override { return m_pindex; };
42  bool has_property(Jet::PROPERTY prop) const override { return m_pindex.find(prop) != m_pindex.end(); };
43  size_t size_properties() const override { return m_pindex.size(); };
44  size_t add_property(Jet::PROPERTY) override; // add property, if not already there, to jet prop vectors
45  size_t add_property(std::set<Jet::PROPERTY>) override; // same as above, convenience for other code using ::set
46  virtual Jet::PROPERTY property_index(Jet::PROPERTY) override; // get the propery index
47  void print_property_types(std::ostream& os = std::cout) const override; // print the order of properties in jet
48 
49 
50  // ---------------------------------------------------------------------------------------
51  // Add ability to loop over jets
52  // ---------------------------------------------------------------------------------------
53  // Use:
54  // ```
55  // for (jet : *jet_containter) {
56  // // jet will increment as Jet* through all jets
57  // ... }
58  // ```
59  Jet::IterJetTCA begin() override;
60  Jet::IterJetTCA end() override;
61  // ---------------------------------------------------------------------------------------
62 
63  // -legacy-set-parameters-----------------------------------------------------------------
64  void set_algo(Jet::ALGO algo) override { m_algo = algo; };
65  Jet::ALGO get_algo() const override { return m_algo; };
66 
67  void set_par (float par) override { set_jetpar_R(par); }
68  float get_par () const override { return get_jetpar_R(); }
69 
70  void set_jetpar_R (float par) override { m_jetpar_R = par; }
71  float get_jetpar_R () const override { return m_jetpar_R; }
72 
73  // set access to source identifiers ------------------------------------------
74 
75  bool empty_src() const override { return m_src.empty(); }
76  void insert_src(Jet::SRC src) override { m_src.insert(src); }
77 
78  ConstSrcIter begin_src() const override { return m_src.begin(); }
79  ConstSrcIter find_src(Jet::SRC src) const override { return m_src.find(src); }
80  ConstSrcIter end_src() const override { return m_src.end(); }
81 
82  SrcIter begin_src() override { return m_src.begin(); }
83  SrcIter find_src(Jet::SRC src) override { return m_src.find(src); }
84  SrcIter end_src() override { return m_src.end(); }
85 
86  void print_jets(std::ostream&) override; // print the order of properties in jet
87 
88  void set_rho_median(float _) override { m_RhoMedian = _; };
89  float get_rho_median() const override { return m_RhoMedian; };
90 
91 private:
93 
94  TClonesArray* m_clones {nullptr}; // TClonesArray of Jet objects
95  size_t m_njets {0}; // size of jet_array
96 
97  // properties contained in vectors of all jets
98  std::map<Jet::PROPERTY, Jet::PROPERTY /*really index for vectors in jets*/> m_pindex {}; // indices of properties in each jet property vector
99  size_t m_psize {0}; // size of p_index and p_vec
100 
101  void resize_jet_pvecs();
102 
103  // status
105  float m_jetpar_R {0.4};
106 
107  std::set<Jet::SRC> m_src; //< set of sources (clusters, towers, etc)
108 
109  float m_RhoMedian {NAN};
110 
112 };
113 
114 #endif