00001 #ifndef EMCCLUSTER_H
00002 #define EMCCLUSTER_H
00003
00004
00005
00006
00007
00008
00009 #include <cstdio>
00010 #include <cmath>
00011 #include <vector>
00012 #include "TObject.h"
00013 #include "TMath.h"
00014
00015
00016 class EmcSectorRec;
00017 class EmcCluster;
00018 class EmcPeakarea;
00019 class EmcEmshower;
00020
00025 struct EmcModule
00026 {
00027 EmcModule();
00028 EmcModule(int ich_, int softkey_, float amp_, float tof_,
00029 int deadmap_, int warnmap_, float adc_, float tac_);
00030
00031 int ich;
00032 int softKey;
00033
00034
00035
00036
00037 float amp;
00038 float tof;
00039 int deadmap;
00040 int warnmap;
00041 float adc;
00042 float tac;
00043 };
00044
00045
00046
00054 class EmcCluster : public TObject
00055 {
00056
00057 public:
00058
00060 EmcCluster()
00061 {}
00062
00063 EmcCluster(EmcSectorRec *sector): fOwner(sector)
00064 {}
00065
00067 #ifndef __CINT__
00068
00069 EmcCluster(const std::vector<EmcModule>& hlist,
00070 EmcSectorRec *sector)
00071 : fOwner(sector)
00072 {
00073 fHitList = hlist;
00074 }
00075 #endif
00076
00078 virtual ~EmcCluster()
00079 {}
00080
00082 #ifndef __CINT__
00083
00084 void ReInitialize( const std::vector<EmcModule>& hlist )
00085 {
00086 fHitList = hlist;
00087 }
00088 #endif
00089
00090 int GetNofHits()
00091 {
00092 return fHitList.size();
00093 }
00095 void GetHits(EmcModule* phit, int n);
00097 #ifndef __CINT__
00098
00099 void GetHitList(std::vector<EmcModule> *&plist)
00100 {
00101 plist = &fHitList;
00102 };
00103 #endif
00104
00105 EmcModule GetMaxTower();
00107 EmcModule GetImpactTower();
00109 float GetTowerEnergy( int ich );
00111 float GetTowerEnergy( int ix, int iy );
00113 float GetTowerToF( int ich );
00115 int GetTowerDeadMap( int ich );
00117 int GetTowerWarnMap( int ich );
00118 float GetTowerADC( int ich );
00119 float GetTowerTAC( int ich );
00121 int GetNDead();
00122 int GetDeadMap();
00123 int GetWarnMap();
00125 float GetE4();
00127 float GetE9();
00129 float GetE9( int ich );
00131 float GetECore();
00133 float GetTotalEnergy();
00135 void GetMoments( float* pxcg, float* pycg,
00136 float* pxx, float* pxy, float* pyy );
00138 void GetCorrPos( float* pxc, float* pyc );
00140 void GetGlobalPos( float* pxg, float* pyg, float* pzg );
00142 void GetErrors( float* pde, float* pdx, float* pdy, float* pdz);
00144 void GetChar( float* pe,
00145 float* pxcg, float* pysg,
00146 float* pxc, float* pyc,
00147 float* pxg, float* pyg, float* pzg,
00148 float* pxx, float* pxy, float* pyy,
00149 float* pde, float* pdx, float* pdy, float* pdz );
00151 int GetPeaks(EmcPeakarea*, EmcModule*);
00152
00153 protected:
00154
00155 #ifndef __CINT__
00156
00157 std::vector<EmcModule> fHitList;
00158 #endif
00159
00160 EmcSectorRec *fOwner;
00161
00162
00163 static int const fgMaxNofPeaks;
00164 static int const fgPeakIter;
00165 static float const fgEmin;
00166 static float const fgChisq;
00167 static float const fgXABSURD;
00168 static float const fgYABSURD;
00169
00170 public:
00171
00172
00173
00174 static int max(int a, int b)
00175 {
00176 return a > b ? a : b;
00177 }
00178 static float max(float a, float b)
00179 {
00180 return a > b ? a : b;
00181 }
00182 static double max(double a, double b)
00183 {
00184 return a > b ? a : b;
00185 }
00186
00187 static int min(int a, int b)
00188 {
00189 return a < b ? a : b;
00190 }
00191 static float min(float a, float b)
00192 {
00193 return a < b ? a : b;
00194 }
00195 static double min(double a, double b)
00196 {
00197 return a < b ? a : b;
00198 }
00199
00200 static int ABS(int x)
00201 {
00202 return abs(x);
00203 }
00204 static float ABS(float x)
00205 {
00206 return fabsf(x);
00207 }
00208 static double ABS(double x)
00209 {
00210 return fabs(x);
00211 }
00212
00213 static int lowint(float x)
00214 {
00215 return x < 0. ? int(x - 1) : int(x);
00216 }
00217
00218 };
00219
00220
00221
00227 class EmcPeakarea: public EmcCluster
00228 {
00229
00230 public:
00231
00233 EmcPeakarea(): fNdf(0), fCL(1.)
00234 {}
00235
00236 EmcPeakarea(EmcSectorRec *sector):
00237 EmcCluster(sector), fNdf(0), fCL(1.)
00238 {}
00239
00241 #ifndef __CINT__
00242
00243 EmcPeakarea(const std::vector<EmcModule>& hlist, EmcSectorRec *sector):
00244 EmcCluster(hlist, sector), fNdf(0), fCL(1.)
00245 {}
00246 #endif
00247
00248 virtual ~EmcPeakarea()
00249 {}
00250
00252 float GetChi2();
00253 float GetChi2New();
00254 int GetNdf() const
00255 {
00256 return fNdf;
00257 }
00258
00259 float GetCL() const
00260 {
00261 return fCL;
00262 }
00263
00264 float GetCLNew();
00265
00267 void GetCGmin( float* pxcgmin, float* pycgmin );
00268
00270 void GetChar( float* pe, float* pec, float* pecore, float* pecorec,
00271 float* pxcg, float* pysg,
00272 float* pxcgmin, float* pysgmin,
00273 float* pxc, float* pyc,
00274 float* pxg, float* pyg, float* pzg,
00275 float* pxx, float* pxy, float* pyy,
00276 float* pchi,
00277 float* pde, float* pdx, float* pdy, float* pdz );
00278
00280 int GetGammas( EmcEmshower* );
00281
00282 protected:
00283
00284 int fNdf;
00285 float fCL;
00286
00287 };
00288
00289
00290
00295 class EmcEmshower
00296 {
00297
00298 public:
00299
00301 EmcEmshower();
00302 EmcEmshower(EmcSectorRec *sector);
00303
00305 EmcEmshower(float e, float x, float y, float chi, int ndf,
00306 EmcSectorRec *sector);
00307
00309 void ReInitialize(float e, float x, float y, float chi, int ndf)
00310 {
00311 fEnergy = e;
00312 fXcg = x;
00313 fYcg = y;
00314 fChisq = chi;
00315 fNdf = ndf;
00316 }
00317
00319 float GetTotalEnergy()
00320 {
00321 return fEnergy;
00322 }
00323
00325 void GetCG(float* px, float* py)
00326 {
00327 *px = fXcg;
00328 *py = fYcg;
00329 }
00330
00332 void GetCorrPos(float*, float* );
00333
00335 void GetGlobalPos(float*, float*, float*);
00336
00338 float GetChi2() const
00339 {
00340 return fChisq;
00341 }
00342
00344 float GetCL() const
00345 {
00346 return fCL;
00347 }
00348
00349
00351 void GetErrors( float* pde, float* pdx, float* pdy, float* pdz);
00352
00354 void GetChar( float* pe,
00355 float* pxcg, float* pysg,
00356 float* pxc, float* pyc,
00357 float* pxg, float* pyg, float* pzg,
00358 float* pchi,
00359 float* pde, float* pdx, float* pdy, float* pdz );
00360
00361 protected:
00362
00363 EmcSectorRec* fOwner;
00364 int fNdf;
00365 float fCL;
00366 float fEnergy;
00367 float fXcg;
00368 float fYcg;
00369 float fChisq;
00370
00371 };
00372
00373 #endif // #ifdef EMCCLUSTER_H