EIC 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; }
131  typedef std::map<prop_id_t, prop_storage_t> prop_map_t;
132 
134  union u_property {
135  float fdata;
136  int32_t idata;
138 
139  u_property(int32_t in)
140  : idata(in)
141  {
142  }
144  : uidata(in)
145  {
146  }
147  u_property(float in)
148  : fdata(in)
149  {
150  }
152  : uidata(0)
153  {
154  }
155 
156  prop_storage_t get_storage() const { return uidata; }
157  };
158 
161  // end of property map definitions
163 
164  //
165  protected:
169  float _energy;
172 
174  float _r;
175  float _phi;
176  float _z;
177 
178  ClassDefOverride(RawClusterv1, 3)
179 };
180 
181 #endif