File indexing completed on 2025-08-03 08:16:56
0001 #ifndef CALOBASE_RAWCLUSTER_H
0002 #define CALOBASE_RAWCLUSTER_H
0003
0004 #include "RawClusterDefs.h"
0005 #include "RawTowerDefs.h"
0006
0007 #include <phool/PHObject.h>
0008 #include <phool/phool.h>
0009
0010 #include <CLHEP/Vector/ThreeVector.h>
0011
0012 #include <cstddef>
0013 #include <iostream>
0014 #include <limits>
0015 #include <map>
0016 #include <string> // for string
0017 #include <type_traits>
0018 #include <utility>
0019
0020 class RawCluster : public PHObject
0021 {
0022 public:
0023 typedef std::map<RawTowerDefs::keytype, float> TowerMap;
0024 typedef TowerMap::iterator TowerIterator;
0025 typedef TowerMap::const_iterator TowerConstIterator;
0026 typedef std::pair<TowerIterator, TowerIterator> TowerRange;
0027 typedef std::pair<TowerConstIterator, TowerConstIterator> TowerConstRange;
0028
0029 ~RawCluster() override {}
0030 void Reset() override { PHOOL_VIRTUAL_WARNING; }
0031
0032 PHObject* CloneMe() const override { return nullptr; }
0033
0034 int isValid() const override
0035 {
0036 PHOOL_VIRTUAL_WARNING;
0037 return 0;
0038 }
0039 void identify(std::ostream& = std::cout) const override { PHOOL_VIRTUAL_WARNING; }
0040
0041
0042
0043
0044 virtual RawClusterDefs::keytype get_id() const
0045 {
0046 PHOOL_VIRTUAL_WARN("get_id()");
0047 return 0;
0048 }
0049
0050 virtual float get_energy() const
0051 {
0052 PHOOL_VIRTUAL_WARN("get_energy()");
0053 return std::numeric_limits<float>::signaling_NaN();
0054 }
0055
0056 virtual size_t getNTowers() const
0057 {
0058 PHOOL_VIRTUAL_WARNING;
0059 return 0;
0060 }
0061 virtual TowerConstRange get_towers() const
0062 {
0063 PHOOL_VIRTUAL_WARN("get_towers()");
0064 static TowerMap dummy;
0065 return make_pair(dummy.begin(), dummy.end());
0066 }
0067
0068 virtual const TowerMap& get_towermap() const
0069 {
0070 PHOOL_VIRTUAL_WARN("get_towers()");
0071 static TowerMap dummy;
0072 return dummy;
0073 }
0074
0075 virtual CLHEP::Hep3Vector get_position() const
0076 {
0077 PHOOL_VIRTUAL_WARN("get_position()");
0078 return CLHEP::Hep3Vector(std::numeric_limits<float>::signaling_NaN(), std::numeric_limits<float>::signaling_NaN(), std::numeric_limits<float>::signaling_NaN());
0079 }
0080
0081
0082 virtual float get_phi() const
0083 {
0084 PHOOL_VIRTUAL_WARN("get_phi()");
0085 return std::numeric_limits<float>::signaling_NaN();
0086 }
0087 virtual float get_r() const
0088 {
0089 PHOOL_VIRTUAL_WARN("get_r()");
0090 return std::numeric_limits<float>::signaling_NaN();
0091 }
0092 virtual float get_z() const
0093 {
0094 PHOOL_VIRTUAL_WARN("get_z()");
0095 return std::numeric_limits<float>::signaling_NaN();
0096 }
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128 virtual float get_x() const
0129 {
0130 PHOOL_VIRTUAL_WARN("get_x()");
0131 return std::numeric_limits<float>::signaling_NaN();
0132 }
0133 virtual float get_y() const
0134 {
0135 PHOOL_VIRTUAL_WARN("get_y()");
0136 return std::numeric_limits<float>::signaling_NaN();
0137 }
0138
0139
0140
0141 virtual float get_ecore() const
0142 {
0143 PHOOL_VIRTUAL_WARN("get_ecore()");
0144 return std::numeric_limits<float>::signaling_NaN();
0145 }
0146
0147 virtual float get_chi2() const
0148 {
0149 PHOOL_VIRTUAL_WARN("get_chi2()");
0150 return std::numeric_limits<float>::signaling_NaN();
0151 }
0152
0153 virtual float get_prob() const
0154 {
0155 PHOOL_VIRTUAL_WARN("get_prob()");
0156 return std::numeric_limits<float>::signaling_NaN();
0157 }
0158
0159 virtual float get_merged_cluster_prob() const
0160 {
0161 PHOOL_VIRTUAL_WARN("get_merged_cluster_prob()");
0162 return std::numeric_limits<float>::signaling_NaN();
0163 }
0164
0165 virtual float get_et_iso() const
0166 {
0167 PHOOL_VIRTUAL_WARN("get_et_iso()");
0168 return std::numeric_limits<float>::signaling_NaN();
0169 }
0170
0171 virtual float get_et_iso(const int , bool , bool ) const
0172 {
0173 PHOOL_VIRTUAL_WARN("get_et_iso(const int radiusx10, bool subtracted, bool clusterTower)");
0174 return std::numeric_limits<float>::signaling_NaN();
0175 }
0176
0177 virtual std::vector<float> get_shower_shapes(float ) const
0178 {
0179 PHOOL_VIRTUAL_WARN("get_shower_shapes(float tower_thresh)");
0180 return std::vector<float>();
0181 }
0182
0183 virtual std::pair<int,int> get_lead_tower() const
0184 {
0185 PHOOL_VIRTUAL_WARN("get_lead_tower()");
0186 return {std::numeric_limits<int>::signaling_NaN(),std::numeric_limits<int>::signaling_NaN()};
0187 }
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208 virtual void set_id(const RawClusterDefs::keytype) { PHOOL_VIRTUAL_WARNING; }
0209
0210 virtual void addTower(const RawClusterDefs::keytype , const float ) { PHOOL_VIRTUAL_WARNING; }
0211
0212 virtual void set_energy(const float) { PHOOL_VIRTUAL_WARNING; }
0213
0214
0215 virtual void set_phi(const float) { PHOOL_VIRTUAL_WARNING; }
0216 virtual void set_z(const float) { PHOOL_VIRTUAL_WARNING; }
0217 virtual void set_r(const float) { PHOOL_VIRTUAL_WARNING; }
0218
0219
0220
0221 virtual void set_ecore(const float) { PHOOL_VIRTUAL_WARNING; }
0222
0223 virtual void set_chi2(const float) { PHOOL_VIRTUAL_WARNING; }
0224
0225 virtual void set_prob(const float) { PHOOL_VIRTUAL_WARNING; }
0226
0227 virtual void set_merged_cluster_prob(const float) { PHOOL_VIRTUAL_WARNING; }
0228
0229 virtual void set_et_iso(const float) { PHOOL_VIRTUAL_WARNING; }
0230 virtual void set_et_iso(const float , const int , bool , bool ) { PHOOL_VIRTUAL_WARNING; }
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245 public:
0246
0247
0248
0249 enum PROPERTY
0250 {
0251
0252
0253 prop_ecore = 0,
0254
0255 prop_prob = 1,
0256
0257 prop_chi2 = 2,
0258
0259 prop_merged_cluster_prob = 3,
0260
0261
0262
0263 prop_et_iso_calotower_sub_R01 = 20,
0264
0265 prop_et_iso_calotower_R01 = 21,
0266
0267 prop_et_iso_calotower_sub_R02 = 22,
0268
0269 prop_et_iso_calotower_R02 = 23,
0270
0271 prop_et_iso_calotower_sub_R03 = 24,
0272
0273 prop_et_iso_calotower_R03 = 25,
0274
0275 prop_et_iso_calotower_sub_R04 = 26,
0276
0277 prop_et_iso_calotower_R04 = 27,
0278
0279
0280
0281
0282
0283
0284
0285 prop_MAX_NUMBER = std::numeric_limits<unsigned char>::max()
0286 };
0287
0288 enum PROPERTY_TYPE
0289 {
0290 type_int = 1,
0291 type_uint = 2,
0292 type_float = 3,
0293 type_unknown = -1
0294 };
0295
0296
0297 virtual bool has_property(const PROPERTY ) const { return false; }
0298 virtual float get_property_float(const PROPERTY ) const { return std::numeric_limits<float>::signaling_NaN(); }
0299 virtual int get_property_int(const PROPERTY ) const { return std::numeric_limits<int>::min(); }
0300 virtual unsigned int get_property_uint(const PROPERTY ) const { return std::numeric_limits<unsigned int>::max(); }
0301
0302 virtual void set_property(const PROPERTY , const float ) { return; }
0303 virtual void set_property(const PROPERTY , const int ) { return; }
0304 virtual void set_property(const PROPERTY , const unsigned int ) { return; }
0305
0306 static std::pair<const std::string, PROPERTY_TYPE> get_property_info(PROPERTY prop_id);
0307 static bool check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type);
0308 static std::string get_property_type(const PROPERTY_TYPE prop_type);
0309
0310
0311
0312 protected:
0313 RawCluster() {}
0314 ClassDefOverride(RawCluster, 1)
0315 };
0316
0317 #endif