00001 #ifndef EMCSECTORREC_H
00002 #define EMCSECTORREC_H
00003
00004
00005
00006
00007
00008
00009
00010 #include "PHMatrix.h"
00011 #include "PHVector.h"
00012 #include <vector>
00013
00014
00015 class EmcCluster;
00016 class EmcModule;
00017
00018 typedef struct SecGeom{
00019
00020 short nx;
00021 short ny;
00022 float Tower_xSize;
00023 float Tower_ySize;
00024
00025 } SecGeom;
00026
00027
00028
00035 class EmcSectorRec
00036 {
00037
00038 public:
00039
00040 EmcSectorRec();
00041 virtual ~EmcSectorRec();
00042
00043 void SetVertex(float *vv){ fVx = vv[0]; fVy = vv[1]; fVz = vv[2]; }
00044 void SetGeometry(SecGeom const &geom, PHMatrix * rm, PHVector * tr );
00045
00046 int GetNx() const { return fNx; }
00047 int GetNy() const { return fNy; }
00048 float GetModSizex() const { return fModSizex; }
00049 float GetModSizey() const { return fModSizey; }
00050 float GetVx() const { return fVx; }
00051 float GetVy() const { return fVy; }
00052 float GetVz() const { return fVz; }
00053 void SetPeakThreshold(float Thresh) { fgMinPeakEnergy = Thresh; }
00054 float GetPeakThreshold() { return fgMinPeakEnergy; }
00055 float GetTowerThreshold() { return fgTowerThresh; }
00056
00057 #ifndef __CINT__
00058 void SetModules(std::vector<EmcModule> const *modules);
00059 std::vector<EmcModule> *GetModules(){ return fModules; }
00060 std::vector<EmcCluster> *GetClusters(){ return fClusters; }
00061 #endif
00062
00063 int FindClusters();
00064 void GetImpactAngle(float x, float y, float *sinT );
00065 void GlobalToSector(float, float, float, float*, float*, float*);
00066 void SectorToGlobal(float xsec, float ysec, float zsec, float* px,
00067 float* py, float* pz );
00068 void SectorToGlobalErr( float dxsec, float dysec, float dzsec, float* pdx,
00069 float* pdy, float* pdz );
00071 virtual void TowersToSector(float, float, float &, float &) = 0;
00073 virtual void TowersToSector(int, int, float &, float &) = 0;
00075 virtual void SectorToTowers(float, float, int &, int &) = 0;
00076
00077 virtual void Gamma(int, EmcModule*, float*, float*, float*, float*, float*,
00078 float*, float*, float*,
00079 int &ndf);
00080 void Mom1(int, EmcModule*, float*, float*, float*);
00081 void Momenta(int, EmcModule*, float*, float*, float*, float*, float*,
00082 float* );
00083
00084
00085 virtual void SetTowerThreshold(float Thresh)=0;
00086 virtual void SetProfileParameters(int, float, float, float)=0;
00087 void SetChi2Limit(int lim);
00088 virtual float ClusterChisq(int, EmcModule*, float, float, float,
00089 int &ndf)=0;
00090 virtual float Chi2Correct(float chi2,int ndf)=0;
00091 virtual void CorrectPosition(float energy, float x, float y, float *xcorr,
00092 float *ycorr, bool callSetPar=true)=0;
00093 virtual void CorrectEnergy(float energy, float x, float y, float *ecorr)=0;
00094 virtual void CorrectECore(float ecore, float x, float y, float *ecorecorr)=0;
00095 virtual void TwoGamma(int, EmcModule*, float*, float*, float*, float*,
00096 float*, float*, float*)=0;
00097 virtual float Chi2Limit(int ndf)=0;
00098 virtual float PredictEnergy(float, float, float)=0;
00099 virtual void CalculateErrors(float e, float x, float y, float* pde,
00100 float* pdx, float* pdy, float* pdz)=0;
00101 virtual void getTowerPos(int ix, int iy, float &x, float & y) = 0;
00102
00103
00104 static int HitNCompare(const void*, const void*);
00105 static int HitACompare(const void*, const void*);
00106 static void CopyVector(int*, int*, int);
00107 static void CopyVector(EmcModule*, EmcModule*, int);
00108 static void ZeroVector(int*, int);
00109 static void ZeroVector(float*, int);
00110 static void ZeroVector(EmcModule*, int);
00111 static void ResizeVector(int* , int, int);
00112 static void c3to5(float, float, float, float, float, float, float*, float*,
00113 float*, float*, float*, float*);
00114
00115 protected:
00116
00117
00118 int fNx;
00119 int fNy;
00120 float fModSizex;
00121 float fModSizey;
00122 float fVx;
00123 float fVy;
00124 float fVz;
00125
00126 PHMatrix emcrm;
00127
00128 PHVector emctr;
00129
00130 PHMatrix invemcrm;
00131 PHVector invemctr;
00132
00133
00134
00135 static float fgChi2Level1[];
00136 static float fgChi2Level2[];
00137 static float fgChi2Level[];
00138
00139 #ifndef __CINT__
00140 std::vector<EmcModule> *fModules;
00141 std::vector<EmcCluster> *fClusters;
00142 #endif
00143
00144 float fgTowerThresh;
00145 float fgMinPeakEnergy;
00146 static float const fgMinShowerEnergy;
00147 static int const fgMaxLen;
00148
00149 };
00150
00151 #endif // #ifndef EMCSECTORREC_H
00152
00153
00154