File indexing completed on 2025-12-16 09:19:44
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 <utility>
0018 #include <vector>
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 = default;
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>::quiet_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>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN());
0079 }
0080
0081
0082 virtual float get_phi() const
0083 {
0084 PHOOL_VIRTUAL_WARN("get_phi()");
0085 return std::numeric_limits<float>::quiet_NaN();
0086 }
0087 virtual float get_r() const
0088 {
0089 PHOOL_VIRTUAL_WARN("get_r()");
0090 return std::numeric_limits<float>::quiet_NaN();
0091 }
0092 virtual float get_z() const
0093 {
0094 PHOOL_VIRTUAL_WARN("get_z()");
0095 return std::numeric_limits<float>::quiet_NaN();
0096 }
0097
0098
0099 virtual void set_tower_cog(float , float , float , float ){return;}
0100 virtual float x_tower_raw() const { return std::numeric_limits<float>::quiet_NaN(); }
0101 virtual float y_tower_raw() const { return std::numeric_limits<float>::quiet_NaN(); }
0102 virtual float x_tower_corr()const { return std::numeric_limits<float>::quiet_NaN(); }
0103 virtual float y_tower_corr()const { return std::numeric_limits<float>::quiet_NaN(); }
0104
0105 virtual void set_mean_time(float ) { return; }
0106 virtual float mean_time() const { return std::numeric_limits<float>::quiet_NaN(); }
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140 virtual float get_x() const
0141 {
0142 PHOOL_VIRTUAL_WARN("get_x()");
0143 return std::numeric_limits<float>::quiet_NaN();
0144 }
0145 virtual float get_y() const
0146 {
0147 PHOOL_VIRTUAL_WARN("get_y()");
0148 return std::numeric_limits<float>::quiet_NaN();
0149 }
0150
0151
0152
0153 virtual float get_ecore() const
0154 {
0155 PHOOL_VIRTUAL_WARN("get_ecore()");
0156 return std::numeric_limits<float>::quiet_NaN();
0157 }
0158
0159 virtual float get_chi2() const
0160 {
0161 PHOOL_VIRTUAL_WARN("get_chi2()");
0162 return std::numeric_limits<float>::quiet_NaN();
0163 }
0164
0165 virtual float get_prob() const
0166 {
0167 PHOOL_VIRTUAL_WARN("get_prob()");
0168 return std::numeric_limits<float>::quiet_NaN();
0169 }
0170
0171 virtual float get_merged_cluster_prob() const
0172 {
0173 PHOOL_VIRTUAL_WARN("get_merged_cluster_prob()");
0174 return std::numeric_limits<float>::quiet_NaN();
0175 }
0176
0177 virtual float get_et_iso() const
0178 {
0179 PHOOL_VIRTUAL_WARN("get_et_iso()");
0180 return std::numeric_limits<float>::quiet_NaN();
0181 }
0182
0183 virtual float get_et_iso(const int , bool , bool ) const
0184 {
0185 PHOOL_VIRTUAL_WARN("get_et_iso(const int radiusx10, bool subtracted, bool clusterTower)");
0186 return std::numeric_limits<float>::quiet_NaN();
0187 }
0188
0189 virtual std::vector<float> get_shower_shapes(float ) const
0190 {
0191 PHOOL_VIRTUAL_WARN("get_shower_shapes(float tower_thresh)");
0192 return std::vector<float>();
0193 }
0194
0195 virtual std::pair<int, int> get_lead_tower() const
0196 {
0197 PHOOL_VIRTUAL_WARN("get_lead_tower()");
0198 return {std::numeric_limits<int>::quiet_NaN(), std::numeric_limits<int>::quiet_NaN()};
0199 }
0200
0201
0202 virtual float get_shower_shape_parameter(const std::string& ) const
0203 {
0204 PHOOL_VIRTUAL_WARN("get_shower_shape_parameter()");
0205 return std::numeric_limits<float>::quiet_NaN();
0206 }
0207
0208 virtual const std::map<std::string, float>& get_all_shower_shapes() const
0209 {
0210 PHOOL_VIRTUAL_WARN("get_all_shower_shapes()");
0211 static const std::map<std::string, float> dummy;
0212 return dummy;
0213 }
0214
0215 virtual bool pass_photon_cuts() const
0216 {
0217 PHOOL_VIRTUAL_WARN("pass_photon_cuts()");
0218 return false;
0219 }
0220
0221 virtual void identify_photon(std::ostream& = std::cout) const
0222 {
0223 PHOOL_VIRTUAL_WARN("identify_photon()");
0224 }
0225
0226
0227 virtual void reset_photon_properties()
0228 {
0229 PHOOL_VIRTUAL_WARN("reset_photon_properties()");
0230 }
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251 virtual void set_id(const RawClusterDefs::keytype) { PHOOL_VIRTUAL_WARNING; }
0252
0253 virtual void addTower(const RawClusterDefs::keytype , const float ) { PHOOL_VIRTUAL_WARNING; }
0254
0255 virtual void set_energy(const float) { PHOOL_VIRTUAL_WARNING; }
0256
0257
0258 virtual void set_phi(const float) { PHOOL_VIRTUAL_WARNING; }
0259 virtual void set_z(const float) { PHOOL_VIRTUAL_WARNING; }
0260 virtual void set_r(const float) { PHOOL_VIRTUAL_WARNING; }
0261
0262
0263
0264 virtual void set_ecore(const float) { PHOOL_VIRTUAL_WARNING; }
0265
0266 virtual void set_chi2(const float) { PHOOL_VIRTUAL_WARNING; }
0267
0268 virtual void set_prob(const float) { PHOOL_VIRTUAL_WARNING; }
0269
0270 virtual void set_merged_cluster_prob(const float) { PHOOL_VIRTUAL_WARNING; }
0271
0272 virtual void set_et_iso(const float) { PHOOL_VIRTUAL_WARNING; }
0273 virtual void set_et_iso(const float , const int , bool , bool ) { PHOOL_VIRTUAL_WARNING; }
0274
0275
0276 virtual void set_shower_shape_parameter(const std::string& , const float )
0277 {
0278 PHOOL_VIRTUAL_WARN("set_shower_shape_parameter()");
0279 }
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294 public:
0295
0296
0297
0298 enum PROPERTY
0299 {
0300
0301
0302 prop_ecore = 0,
0303
0304 prop_prob = 1,
0305
0306 prop_chi2 = 2,
0307
0308 prop_merged_cluster_prob = 3,
0309
0310
0311
0312 prop_et_iso_calotower_sub_R01 = 20,
0313
0314 prop_et_iso_calotower_R01 = 21,
0315
0316 prop_et_iso_calotower_sub_R02 = 22,
0317
0318 prop_et_iso_calotower_R02 = 23,
0319
0320 prop_et_iso_calotower_sub_R03 = 24,
0321
0322 prop_et_iso_calotower_R03 = 25,
0323
0324 prop_et_iso_calotower_sub_R04 = 26,
0325
0326 prop_et_iso_calotower_R04 = 27,
0327
0328 prop_tower_x_raw = 40,
0329
0330 prop_tower_y_raw = 41,
0331
0332 prop_tower_x_corr = 42,
0333
0334 prop_tower_y_corr = 43,
0335
0336 prop_tower_t_mean = 44,
0337
0338
0339 prop_incidence_alpha_phi = 45,
0340
0341 prop_incidence_alpha_eta = 46,
0342
0343
0344
0345
0346
0347
0348
0349 prop_MAX_NUMBER = std::numeric_limits<unsigned char>::max()
0350 };
0351
0352 enum PROPERTY_TYPE
0353 {
0354 type_int = 1,
0355 type_uint = 2,
0356 type_float = 3,
0357 type_unknown = -1
0358 };
0359
0360
0361 virtual bool has_property(const PROPERTY ) const { return false; }
0362 virtual float get_property_float(const PROPERTY ) const { return std::numeric_limits<float>::quiet_NaN(); }
0363 virtual int get_property_int(const PROPERTY ) const { return std::numeric_limits<int>::min(); }
0364 virtual unsigned int get_property_uint(const PROPERTY ) const { return std::numeric_limits<unsigned int>::max(); }
0365
0366 virtual void set_property(const PROPERTY , const float ) { return; }
0367 virtual void set_property(const PROPERTY , const int ) { return; }
0368 virtual void set_property(const PROPERTY , const unsigned int ) { return; }
0369
0370 static std::pair<const std::string, PROPERTY_TYPE> get_property_info(PROPERTY prop_id);
0371 static bool check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type);
0372 static std::string get_property_type(const PROPERTY_TYPE prop_type);
0373
0374
0375
0376 protected:
0377 RawCluster() = default;
0378 ClassDefOverride(RawCluster, 1)
0379 };
0380
0381 #endif