Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RawClusterv1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RawClusterv1.h
1 #ifndef CALOBASE_RAWCLUSTERV1_H
2 #define CALOBASE_RAWCLUSTERV1_H
3 
4 #include "RawCluster.h"
5 #include "RawClusterDefs.h"
6 
7 #include <CLHEP/Vector/ThreeVector.h>
8 
9 #include <cstddef>
10 #include <cstdint>
11 #include <iostream>
12 #include <map>
13 #include <utility>
14 
15 class PHObject;
16 
17 class RawClusterv1 : public RawCluster
18 {
19  public:
20  RawClusterv1();
21  ~RawClusterv1() override {}
22 
23  void Reset() override;
24  PHObject* CloneMe() const override { return new RawClusterv1(*this); }
25  int isValid() const override { return towermap.size() > 0; }
26  void identify(std::ostream& os = std::cout) const override;
27 
31 
32  RawClusterDefs::keytype get_id() const override { return clusterid; }
34  float get_energy() const override { return _energy; }
36  size_t getNTowers() const override { return towermap.size(); }
37  RawCluster::TowerConstRange get_towers() const override { return make_pair(towermap.begin(), towermap.end()); }
39  const TowerMap& get_towermap() const override { return towermap; }
40  //
42  CLHEP::Hep3Vector get_position() const override
43  {
44  return CLHEP::Hep3Vector(get_x(), get_y(), get_z());
45  }
47  float get_phi() const override { return _phi; }
48  float get_r() const override { return _r; }
49  float get_z() const override { return _z; }
50  //
51  // //! convert cluster location to psuedo-rapidity given a user chosen z-location
52  // virtual float get_eta(const float z) const;
53  // //! convert cluster E_T given a user chosen z-location
54  // virtual float get_et(const float z) const;
55  //
57  float get_x() const override { return get_r() * std::cos(get_phi()); }
58  float get_y() const override { return get_r() * std::sin(get_phi()); }
59  //
62  float get_ecore() const override { return get_property_float(prop_ecore); }
64  float get_chi2() const override { return get_property_float(prop_chi2); }
66  float get_prob() const override { return get_property_float(prop_prob); }
68  float get_et_iso() const override { return get_property_float(prop_et_iso_calotower_R03); }
70  float get_et_iso(const int radiusx10, bool subtracted, bool clusterTower) const override;
71  // //! truth cluster's PHG4Particle ID
72  // virtual int get_truth_track_ID() const override { return get_property_int(prop_truth_track_ID); }
73  // //! truth cluster's PHG4Particle flavor
74  // virtual int get_truth_flavor() const override { return get_property_int(prop_truth_flavor); }
75  // // end of getters
77 
81 
82  void set_id(const RawClusterDefs::keytype id) override { clusterid = id; }
84  void addTower(const RawClusterDefs::keytype twrid, const float etower) override;
86  void set_energy(const float energy) override { _energy = energy; }
88  void set_phi(const float phi) override { _phi = phi; }
89  void set_z(const float z) override { _z = z; }
90  void set_r(const float r) override { _r = r; }
91  //
94  void set_ecore(const float ecore) override { set_property(prop_ecore, ecore); }
96  void set_chi2(const float chi2) override { set_property(prop_chi2, chi2); }
98  void set_prob(const float prob) override { set_property(prop_prob, prob); }
100  void set_et_iso(const float e) override { set_property(prop_et_iso_calotower_R03, e); }
102  void set_et_iso(const float et_iso, const int radiusx10, bool subtracted, bool clusterTower) override;
103  // //! truth cluster's PHG4Particle ID
104  // virtual void set_truth_track_ID(const int i) override { set_property(prop_truth_track_ID, i); }
105  // //! truth cluster's PHG4Particle flavor
106  // virtual void set_truth_flavor(const int f) override { set_property(prop_truth_flavor, f); }
107  //
108  /*
109  *
110  * @} */
111  // end of setters
112 
116  public:
117  bool has_property(const PROPERTY prop_id) const override;
118  float get_property_float(const PROPERTY prop_id) const override;
119  int get_property_int(const PROPERTY prop_id) const override;
120  unsigned int get_property_uint(const PROPERTY prop_id) const override;
121  void set_property(const PROPERTY prop_id, const float value) override;
122  void set_property(const PROPERTY prop_id, const int value) override;
123  void set_property(const PROPERTY prop_id, const unsigned int value) override;
124 
125  protected: // protected is declared twice !?
126  unsigned int get_property_nocheck(const PROPERTY prop_id) const;
127  void set_property_nocheck(const PROPERTY prop_id, const unsigned int ui) { prop_map[prop_id] = ui; }
129  typedef uint8_t prop_id_t;
130  typedef uint32_t prop_storage_t;
131  typedef std::map<prop_id_t, prop_storage_t> prop_map_t;
132 
135  {
136  float fdata;
137  int32_t idata;
138  uint32_t uidata;
139 
140  u_property(int32_t in)
141  : idata(in)
142  {
143  }
144  u_property(uint32_t in)
145  : uidata(in)
146  {
147  }
148  u_property(float in)
149  : fdata(in)
150  {
151  }
153  : uidata(0)
154  {
155  }
156 
157  prop_storage_t get_storage() const { return uidata; }
158  };
159 
162  // end of property map definitions
164 
165  //
166  protected:
170  float _energy;
173 
175  float _r;
176  float _phi;
177  float _z;
178 
179  ClassDefOverride(RawClusterv1, 3)
180 };
181 
182 #endif