EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BEmcCluster.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BEmcCluster.h
1 #ifndef CALORECO_EMCCLUSTER_H
2 #define CALORECO_EMCCLUSTER_H
3 
4 // Name: EmcCluster.h
5 // Author: A. Bazilevsky (RIKEN-BNL)
6 // Major modifications by M. Volkov (RRC KI) Jan 27 2000
7 
8 #include <TObject.h>
9 
10 #include <cmath>
11 #include <cstdlib>
12 #include <vector>
13 
14 // Forward declarations
15 class BEmcRec;
16 
21 class EmcModule
22 {
23  public:
24  EmcModule();
25  EmcModule(int ich_, float amp_, float tof_);
26 
27  virtual ~EmcModule() {}
28 
29  int ich; // module id (linear)
30  float amp; // module signal
31  float tof; // module time-of-flight
32 };
33 
34 // ///////////////////////////////////////////////////////////////////////////
35 
43 class EmcCluster : public TObject
44 {
45  public:
48  : fOwner(nullptr)
49  {
50  }
51 
53  : fOwner(sector)
54  {
55  }
56 
58 
59  EmcCluster(const std::vector<EmcModule>& hlist,
60  BEmcRec* sector)
61  : fHitList(hlist)
62  , fOwner(sector)
63  {
64  }
65 
67  ~EmcCluster() override
68  {
69  }
70 
72 
73  void ReInitialize(const std::vector<EmcModule>& hlist)
74  {
75  fHitList = hlist;
76  }
78  int GetNofHits() { return fHitList.size(); }
80  std::vector<EmcModule> GetHitList() { return fHitList; };
84  // EmcModule GetImpactTower();
86  float GetTowerEnergy(int ich);
88  float GetTowerEnergy(int ix, int iy);
90  float GetTowerToF(int ich);
92  float GetE4();
94  float GetE9();
96  float GetE9(int ich);
98  float GetECore();
100  float GetECoreCorrected();
102  float GetTotalEnergy();
104  void GetMoments(float& pxcg, float& pycg,
105  float& pxx, float& pxy, float& pyy);
107  void GetCorrPos(float& xc, float& yc);
109  void GetGlobalPos(float& xg, float& yg, float& zg);
111  int GetSubClusters(std::vector<EmcCluster>* sClList, std::vector<EmcModule>* ppeaks);
112  float GetProb(float& chi2, int& ndf);
113 
114  protected:
115  std::vector<EmcModule> fHitList;
116 
117  BEmcRec* fOwner; // what sector it belongs to
118 
119  // static members
120  static int const fgMaxNofPeaks;
121  static int const fgPeakIter;
122  static float const fgEmin;
123 
124  public:
125  // MV 2002/02/28 moved these functions here from #define's
126 
127  static int max(int a, int b)
128  {
129  return a > b ? a : b;
130  }
131  static float max(float a, float b)
132  {
133  return a > b ? a : b;
134  }
135  static double max(double a, double b)
136  {
137  return a > b ? a : b;
138  }
139 
140  static int min(int a, int b)
141  {
142  return a < b ? a : b;
143  }
144  static float min(float a, float b)
145  {
146  return a < b ? a : b;
147  }
148  static double min(double a, double b)
149  {
150  return a < b ? a : b;
151  }
152 
153  static int ABS(int x)
154  {
155  return abs(x);
156  }
157  static float ABS(float x)
158  {
159  return fabsf(x);
160  }
161  static double ABS(double x)
162  {
163  return fabs(x);
164  }
165 
166  static int lowint(float x)
167  {
168  return x < 0. ? int(x - 1) : int(x);
169  }
170 };
171 
172 // ///////////////////////////////////////////////////////////////////////////
173 
174 #endif