Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Jetv1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Jetv1.h
1 
9 #ifndef G4JET_JETV1_H
10 #define G4JET_JETV1_H
11 
12 #include "Jet.h"
13 
14 #include <cstddef> // for size_t
15 #include <cmath>
16 #include <iostream>
17 #include <map>
18 #include <utility> // for pair, make_pair
19 
20 class PHObject;
21 
25 class Jetv1 : public Jet
26 {
27  public:
28  Jetv1();
29  ~Jetv1() override {}
30 
31  // PHObject virtual overloads
32 
33  void identify(std::ostream& os = std::cout) const override;
34  void Reset() override;
35  int isValid() const override;
36  PHObject* CloneMe() const override;
37 
38  // jet info
39 
40  unsigned int get_id() const override { return _id; }
41  void set_id(unsigned int id) override { _id = id; }
42 
43  float get_px() const override { return _mom[0]; }
44  void set_px(float px) override { _mom[0] = px; }
45 
46  float get_py() const override { return _mom[1]; }
47  void set_py(float py) override { _mom[1] = py; }
48 
49  float get_pz() const override { return _mom[2]; }
50  void set_pz(float pz) override { _mom[2] = pz; }
51 
52  float get_e() const override { return _e; }
53  void set_e(float e) override { _e = e; }
54 
55  float get_p() const override;
56  float get_pt() const override;
57  float get_et() const override;
58  float get_eta() const override;
59  float get_phi() const override;
60  float get_mass() const override;
61  float get_mass2() const override;
62 
63  // extended jet info
64 
65  bool has_property(Jet::PROPERTY prop_id) const override;
66  float get_property(Jet::PROPERTY prop_id) const override;
67  void set_property(Jet::PROPERTY prop_id, float value) override;
68  void print_property(std::ostream& os) const override;
69 
70  //
71  // clustered component methods (multimap interface based)
72  // source type id --> unique id within that storage
73  //
74  bool empty_comp() const override { return _comp_ids.empty(); }
75  size_t size_comp() const override { return _comp_ids.size(); }
76 
77  void clear_comp() override { _comp_ids.clear(); }
78  size_t erase_comp(SRC source) override { return _comp_ids.erase(source); }
79  void erase_comp(Iter iter) override
80  {
81  _comp_ids.erase(iter);
82  return;
83  }
84  void erase_comp(Iter first, Iter last) override
85  {
86  _comp_ids.erase(first, last);
87  return;
88  }
89 
90  ConstIter begin_comp() const override { return _comp_ids.begin(); }
91  ConstIter lower_bound_comp(SRC source) const override { return _comp_ids.lower_bound(source); }
92  ConstIter upper_bound_comp(SRC source) const override { return _comp_ids.upper_bound(source); }
93  ConstIter find(SRC source) const override { return _comp_ids.find(source); }
94  ConstIter end_comp() const override { return _comp_ids.end(); }
95 
96  Iter begin_comp() override { return _comp_ids.begin(); }
97  Iter lower_bound_comp(SRC source) override { return _comp_ids.lower_bound(source); }
98  Iter upper_bound_comp(SRC source) override { return _comp_ids.upper_bound(source); }
99  Iter find(SRC source) override { return _comp_ids.find(source); }
100  Iter end_comp() override { return _comp_ids.end(); }
101 
102  private:
104  unsigned int _id = ~0x0;
105 
107  float _mom[3];
108 
110  float _e = NAN;
111 
114 
115  typedef std::map<Jet::PROPERTY, float> typ_property_map;
118 
119  // Function in Jet.h header which are not implemented in Jet.h
120  // messages for function calls from Jet.h which are not implemented in Jetv1.h
121  void not_in_v1_msg(const std::string& method_name, std::ostream& os=std::cout) const;
122  size_t size_properties() const override { return _property_map.size(); };
123  virtual std::vector<float>& get_property_vec() override;
124 
125 
126  void insert_comp(SRC source, unsigned int compid) override
127  { _comp_ids.insert(std::make_pair(source, compid)); }
128  void insert_comp(SRC source, unsigned int compid, bool) override; // v2 only
129  void insert_comp(TYPE_comp_vec&) override; //v2 only
130  void insert_comp(TYPE_comp_vec&, bool) override; //v2 only
131  void set_comp_sort_flag(bool) override; // let comp_vec know it isn't sorted
132  //
133  size_t num_comp(Jet::SRC ) override;
134  void print_comp(std::ostream& , bool ) override;
135  std::vector<Jet::SRC> comp_src_vec() override;
136  std::map<Jet::SRC, size_t> comp_src_sizemap() override;
137  size_t count_comp(SRC source) const override { return _comp_ids.count(source); }
138 
139  ITER_comp_vec comp_begin(Jet::SRC ) override;
140  ITER_comp_vec comp_end(Jet::SRC ) override;
141  ITER_comp_vec comp_begin() override;
142  ITER_comp_vec comp_end() override;
143  TYPE_comp_vec& get_comp_vec() override;
144 
145  void resize_properties(size_t ) override;
146 
148 };
149 
150 #endif // G4JET_JETV1_H