File indexing completed on 2025-08-06 08:17:31
0001 #ifndef CALORECO_EMCCLUSTER_H
0002 #define CALORECO_EMCCLUSTER_H
0003
0004
0005
0006
0007
0008 #include <TObject.h>
0009
0010 #include <cmath>
0011 #include <cstdlib>
0012 #include <vector>
0013
0014
0015 class BEmcRec;
0016
0017
0018
0019
0020
0021 class EmcModule
0022 {
0023 public:
0024 EmcModule() = default;
0025
0026
0027 EmcModule(int ich_, float amp_, float tof_)
0028 : ich(ich_)
0029 , amp(amp_)
0030 , tof(tof_)
0031 {
0032 }
0033
0034 virtual ~EmcModule() {}
0035
0036 int ich {0};
0037 float amp {0};
0038 float tof {0};
0039
0040
0041 };
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 class EmcCluster : public TObject
0053 {
0054 public:
0055
0056 EmcCluster()
0057 : fOwner(nullptr)
0058 {
0059 }
0060
0061 explicit EmcCluster(BEmcRec* sector)
0062 : fOwner(sector)
0063 {
0064 }
0065
0066
0067
0068 EmcCluster(const std::vector<EmcModule>& hlist,
0069 BEmcRec* sector)
0070 : fHitList(hlist)
0071 , fOwner(sector)
0072 {
0073 }
0074
0075
0076 ~EmcCluster() override
0077 {
0078 }
0079
0080
0081
0082 void ReInitialize(const std::vector<EmcModule>& hlist)
0083 {
0084 fHitList = hlist;
0085 }
0086
0087 int GetNofHits() { return fHitList.size(); }
0088
0089 const std::vector<EmcModule> &GetHitList() { return fHitList; };
0090
0091 EmcModule GetMaxTower();
0092
0093
0094
0095 float GetTowerEnergy(int ich);
0096
0097 float GetTowerEnergy(int ix, int iy);
0098
0099 float GetTowerToF(int ich);
0100
0101 float GetE4();
0102
0103 float GetE9();
0104
0105 float GetE9(int ich);
0106
0107 float GetECore();
0108
0109 float GetECoreCorrected();
0110
0111 float GetTotalEnergy();
0112
0113 void GetMoments(float& x, float& y,
0114 float& pxx, float& pxy, float& pyy);
0115
0116 void GetCorrPos(float& xc, float& yc);
0117
0118 void GetGlobalPos(float& xA, float& yA, float& zA);
0119
0120 int GetSubClusters(std::vector<EmcCluster>& PkList, std::vector<EmcModule>& ppeaks, bool dosubclustersplitting);
0121 float GetProb(float& chi2, int& ndf);
0122
0123 protected:
0124 std::vector<EmcModule> fHitList;
0125
0126 BEmcRec* fOwner;
0127
0128
0129 static int const fgMaxNofPeaks;
0130 static int const fgPeakIter;
0131 static float const fgEmin;
0132
0133 public:
0134
0135
0136 static int max(int a, int b)
0137 {
0138 return a > b ? a : b;
0139 }
0140 static float max(float a, float b)
0141 {
0142 return a > b ? a : b;
0143 }
0144 static double max(double a, double b)
0145 {
0146 return a > b ? a : b;
0147 }
0148
0149 static int min(int a, int b)
0150 {
0151 return a < b ? a : b;
0152 }
0153 static float min(float a, float b)
0154 {
0155 return a < b ? a : b;
0156 }
0157 static double min(double a, double b)
0158 {
0159 return a < b ? a : b;
0160 }
0161
0162 static int ABS(int x)
0163 {
0164 return abs(x);
0165 }
0166 static float ABS(float x)
0167 {
0168 return fabsf(x);
0169 }
0170 static double ABS(double x)
0171 {
0172 return fabs(x);
0173 }
0174
0175 static int lowint(float x)
0176 {
0177 return x < 0. ? int(x - 1) : int(x);
0178 }
0179 };
0180
0181
0182
0183 #endif