EmcSectorRec.h

Go to the documentation of this file.
00001 #ifndef EMCSECTORREC_H
00002 #define EMCSECTORREC_H
00003 
00004 // Name: EmcSectorRec.h
00005 // Author: A. Bazilevsky (RIKEN-BNL)
00006 // Major modifications by M. Volkov (RRC KI) Jan 27 2000
00007 
00008 // EmcSectorRec -- abstract base class for both PbSc and PbGl
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;          // Number of cells in X dir
00021   short ny;          // Number of cells in Y dir
00022   float Tower_xSize; // Tower size in X dir
00023   float Tower_ySize; // Tower size in Y dir
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); // ndf added MV 28.01.00
00080   void Mom1(int, EmcModule*, float*, float*, float*);
00081   void Momenta(int, EmcModule*, float*, float*, float*, float*, float*,
00082                float* );
00083 
00084   // Pure virtual functions
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; // ndf added MV 28.01.00
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   // Auxiliary static functions
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   // geometry
00118   int fNx; // length in X direction
00119   int fNy; // length in Y direction
00120   float fModSizex; // module size in X direction (cm)
00121   float fModSizey; // module size in Y direction
00122   float fVx; // vertex position (cm)
00123   float fVy;
00124   float fVz;
00125   //  Sector - to - Global PHENIX transformation matrix
00126   PHMatrix emcrm;
00127   //  Sector - to - Global PHENIX translation vector
00128   PHVector emctr;
00129   //  Inverse transforamtion matrix and vector
00130   PHMatrix invemcrm;
00131   PHVector invemctr;
00132 
00133   // Tabulated values of Chi2 corresponding to 1% and 2% CL
00134   // for 50 values ndf (1-50)
00135   static float fgChi2Level1[];
00136   static float fgChi2Level2[];
00137   static float fgChi2Level[]; // actual level, chosen with SetChi2Limit().
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 // EOF