EmcIndexer.h

Go to the documentation of this file.
00001 #ifndef __EMCINDEXER_H__
00002 #define __EMCINDEXER_H__
00003 
00004 #include <vector>
00005 #include <string>
00006 
00019 class EmcIndexer
00020 {
00021 public:
00022 
00023   EmcIndexer() {}
00024   virtual ~EmcIndexer() {}
00025 
00030 
00032   virtual void iST_SMInd(const int , int &, int &, int &, int &) = 0;
00033 
00035   virtual void iSTxyST(const int , int &, int &) = 0;
00036 
00038   virtual int SMiSMTiST(int , int ) = 0;
00039 
00041   virtual void SMxySM(int, int &, int &) = 0; 
00042 
00044   virtual int xySMiSM(int x, int y) = 0;  
00045 
00047   virtual int SMxySMTiST(int , int , int ) = 0; 
00048 
00050   virtual int xySMTiSMT(int , int ) = 0;  
00051 
00053 
00057 
00059   static bool IsValid(int iS, int x, int y);
00060 
00063   static int iSiSTiPX(int iS, int iST);
00064 
00066   static void iPXiSiST(int TowerId, int & iS, int & iST);
00067 
00069   static void iPXiSiSMiSMT(int TowerId, int & iS, int & iSM, int & iSMT);
00070 
00072   static void iSTxyST(int iS, int iST, int & x, int & y);
00073 
00075   static int xySTiST(int iS, int x,int y);
00076 
00078   static int getTowerId(int iS, int x, int y);
00079 
00082   static void decodeTowerId(int TowerId, int & iS, int & x, int & y);
00083 
00085   static void TowerLocation(int towerID, int& arm, int& sector_in_arm,
00086                             int& yrow, int& zrow);
00087   
00089   //  static int TowerID(int arm, int sector_in_arm, int yrow, int zrow);
00090 
00092   static void decodeSoftwareKey(int software, int& arm, int& sector_in_arm,
00093                                 int& yrow, int& zrow);
00094 
00096   static int TowerID(int arm, int sector_in_arm, int yrow, int zrow);
00097   static int TowerID(int softwareKey);
00098 
00100   //  static long getSoftwareKey(int TowerId) 
00101   static int SoftwareKey(int TowerId);
00102   static int SoftwareKey(int arm, int sector_in_arm, int yrow, int zrow);
00103 
00105   static bool isPbScReference(int TowerId);
00106 
00108   static bool isPbGlReference(int TowerId);
00109 
00111   static bool isReference(int TowerId) {
00112     return (TowerId>24767);
00113   }
00114 
00116   static bool isReferenceFEM(int femAbsolutePosition) {
00117     return (femAbsolutePosition>=EmcIndexer::FirstReferenceFEMAbsolutePosition());
00118   }
00119     
00121   static bool isPbSc(int TowerId) {
00122     return ( (TowerId>=0 && TowerId<108*144) || isPbScReference(TowerId) );
00123   }
00124 
00126   static bool isPbScFEM(int absFEM) {
00127     return ( (absFEM>=0 && absFEM<108) || (absFEM>=172 && absFEM<=174));
00128   }
00129 
00131   static bool isPbGl(int TowerId) {
00132     return ( (TowerId>=15552 && TowerId<24768) || isPbGlReference(TowerId) );
00133   }
00134 
00136   static bool isPbGlFEM(int absFEM) {
00137     return (absFEM>=108 && absFEM<172) || (absFEM>=176 && absFEM<=179);
00138   }
00139 
00141   static void iSiSTiSMiSMT(const int iS, const int iST, int& iSM , int& iSMT);
00142 
00144   static int iSiSM144_PXSM144(int iS, int iSM144);
00145 
00149   static int iSMTiCH(const int iSMT) { return iSMTiCH(iSMT,true); }
00150 
00151   // SectorNumber,SMNumber,SMTower -> PHENIX Tower.
00152   static int iSiSMiSMTiPX(int iS, int iSM, int iSMT);
00153   
00158   static int iSMTiCH(const int iSMT, const bool fl);
00159 
00161   static void iSM144TxySM144T(const int iSMT, int& xsmt, int& ysmt);
00162 
00163 
00164   // SectorNumber,SMNumber,SMTower -> Sector Tower.
00165   static int iSiSMiSMTiST(int iS, int iSM, int SMT);
00166 
00168   static void PXSM144_iSiSM144(int PXSM144, int& iS, int & iSM144);
00169 
00172   static void PXPXSM144CH(int PX, int& PXSM144, int& CH);
00173 
00175   static int PXSM144iCH_iPX(const int SM144, const int CH);
00176 
00180   static int iCHiSMT(int ch);
00181 
00184   static int iCHiSMT(const int , bool ASIC24); 
00185 
00187   static int MaxNumberOfFEMs(void) { return 182; }
00188 
00193   static int FirstReferenceFEMAbsolutePosition(void) { return 172; }
00194 
00196   static int EmcSectorNumber(const char* sectorName);
00197   
00199   static const char* EmcSectorId(int sectorNumber);
00200 
00202   static int sectorOfflineToOnline(int arm, int offline_sector);
00203 
00205   static void sectorOnlineToOffline(int sectorOnline, int& arm,
00206                                     int& offline_sector);
00207 
00209 
00212 
00219   static int absFEMCHiPX(const int absFEMCH);
00220 
00226   static int iPXabsFEMCH(const int iPX);
00227 
00230   static void iCH192ASICi32(const int iCH192, int& ASIC, int& iCH32);
00231 
00234   static void iSM144TtoHWIndexes(int iSMT, bool ASIC24, int & QB, int &Cell, 
00235                                  int &ASIC, int &Preamp, int &Input, 
00236                                  int &FEMChannel);
00237   
00240   static void findItemIdentity(const int ItemId, const bool ASIC24, 
00241                                const bool EMCalMapStyle, int &iS, int& iSM, 
00242                                int& iSMT, int &iFEM, int &iCH192, int &ASIC, 
00243                                int &ASICCh);
00244 
00246 
00247 private:
00248 
00249   static std::vector<std::string> fEmcSectorIdent;
00250 
00251 };
00252 
00253 #endif
00254 
00255 
00256 
00257