mEmcGeometryModule.h

Go to the documentation of this file.
00001 #ifndef __MEMCGEOMETRYMODULE_H__
00002 #define __MEMCGEOMETRYMODULE_H__
00003 
00004 //
00005 // EMC Geometry class.
00006 //
00007 // Alexander Bazilevsky (Sep-00)
00008 //
00009 // Modifications by Julia Velkovska to allow geometry transformations (Jan 2002)
00010 //
00011 // Utilities added by D.d'Enterria (Apr. 2003)
00012 //
00013 
00014 #include "PHGeometry.h"
00015 #include <iostream>
00016 #include "PHTimeStamp.h"
00017 #include "TObject.h"
00018 #include "PISAEvent.h"
00019 
00020 #define MAX_SECTORS 8
00021 #define NARMS 2
00022 #define NSECTORS 4
00023 
00026 class mEmcGeometryModule:public TObject
00027 {
00028 public:
00029 
00030   enum ERealm { kReal=0, kPISA=1 };
00031 
00032   mEmcGeometryModule(ERealm type=kReal);
00033 
00034   virtual ~mEmcGeometryModule() {};
00035 
00036   void BuildGeometry();
00037   void BuildGeometryPISA();
00038 
00039   void Retract();
00040   void Retract( float* eastEmc, float* westEmc );
00041   void SetSectorDim( int is, int nX, int nY );
00042   void SetTowerSize( int is, float xsz, float ysz );
00043   void SetMatrixVector( int is, PHMatrix mx, PHVector vt );
00044   void GetSectorDim( int is, int &nX, int &nY );
00045   void GetTowerSize( int is, float &xsz, float &ysz );
00046   void GetMatrixVector( int is, PHMatrix &mx, PHVector &vt );
00047   int GetTowerPosLocal( int is, int ind, float &x, float &y, float &z);
00048   int GetTowerPosLocal( int is, int ix, int iy, float &x, float &y, float &z);
00049   int GetTowerPosGlobal( int is, int ind, float &x, float &y, float &z);
00050   int GetTowerPosGlobal( int is, int ix, int iy, float &x, float &y, float &z);
00051   double GetSectorCenterInGlobalCoords( int is, int xyz );
00052   void LocalToGlobal( int is, float xl, float yl, float zl, float &xg, float &yg, float &zg);
00053   void GlobalToLocal( float xg, float yg, float zg, int is, float &xl, float &yl, float &zl);
00054 
00055   void print();
00056   void printCorners();
00057   void printSectorNumberingConventions();
00058   PHPanel GetPanel(short arm, short sector);  //get the sector geometry
00059 
00062   static int emcOfflineToEmc(short arm, short sector);
00063 
00066   static int emcOfflineToEmcOnline(short arm, short sector);
00067 
00070   static void emcToPhenix(int i, short &arm,short &sector);
00071 
00074   static int emcToEmcOnline(int iS);
00075 
00078   static int emcOnlineToEmc(int is);
00079 
00082   static int PhenixToEmc(short arm, short sector);
00083 
00084   void BuildPanels();
00085   void readFromDB();
00086   PHBoolean isIntersection(PHLine&,const short&); // true if Line intersects with sector int is  
00087   PHBoolean Intersection(PHLine&,const short&,PHPoint&); // project line onto sector is
00088 
00089   // utilities
00090 
00091   int HitInEMCalAcceptance(const float*, const float*);
00092   int EventInEMCalAcceptance(const PISAEvent *pisaEvent,const int kevent, TTree *T);
00093   bool HitInPbSc(const float*, const float* , int&);
00094   bool HitInPbGl(const float*, const float* , int&);
00095 
00096 private:
00097 
00098 #ifndef __CINT__
00099 
00100   int nx[MAX_SECTORS];
00101   int ny[MAX_SECTORS];
00102   float tower_xsize[MAX_SECTORS];
00103   float tower_ysize[MAX_SECTORS];
00104   PHMatrix emcrm[MAX_SECTORS];
00105   PHVector emctr[MAX_SECTORS];
00106   PHMatrix invemcrm[MAX_SECTORS];
00107   PHVector invemctr[MAX_SECTORS];
00108   PHPanel emcSectors[NARMS][NSECTORS];
00109 
00110 #endif
00111 
00112   ClassDef(mEmcGeometryModule,1)
00113 };
00114 
00115 #endif /*__MEMCGEOMETRYMODULE_H__*/