00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef MUC_CHAIN_H
00010 #define MUC_CHAIN_H
00011
00012 #include<iostream>
00013 #include<vector>
00014 #include<string>
00015
00016 using namespace std;
00017
00018 #include "MucFec.h"
00019 #include "MucGeoConst.h"
00020
00021 static const int FEC_NUM = 16;
00022 static const int DEFAULT_FEC_ORDER = 1;
00023
00024
00025 const int FIRST_STRIP_ID[7] = {0, 16, 32, 48, 64, 80, 96};
00026 const int FIRST_STRID_SQC_EC[4] = {48, 32, 16, 0};
00027 const int FIRST_STRID_SQC_BETOP[4]= {64, 96, 80, 48};
00028 const int FIRST_STRID_SQC_BEA[3] = {48, 64, 80} ;
00029 const int FIRST_STRID_SQC_BEB[3] = {80, 64, 48} ;
00030 const int FIRST_STRID_SQC_BWA[3] = {32, 16, 0} ;
00031
00032 const int FIRST_STRID_SQC_BWB[3] = {0, 16, 32} ;
00033
00034 const int STRORDER_ECA[E_LAY_NUM] = {-1, 1, -1, 1, -1, 1, -1, 1};
00035
00036 const int STRORDER_ECB[E_LAY_NUM] = {1, -1, 1, -1, 1, -1, 1, -1};
00037
00038 const int STRORDER_BETOP[4] = {1, -1, 1, -1} ;
00039 const int STRORDER_BEA[3] = {-1, -1, 1} ;
00040
00041 const int STRORDER_BEB[3] = {1, -1, -1} ;
00042
00043 const int STRORDER_BWO[3] = {-1, -1, -1} ;
00044
00045 class MucChain {
00046
00047 public:
00048 MucChain( int id, string name, int module, int socket, int fecOrder);
00049 ~MucChain( );
00050
00051 int GetID() { return m_ID; }
00052 int GetPart() { return m_Part; }
00053 int GetSegment() { return m_Segment; }
00054 int GetFecTotal() { return m_FecTotal;}
00055 int GetFecOrder() { return m_FecOrder;}
00056 string GetName() { return m_Name; }
00057 vector< MucFec> GetFecVect() { return m_FecVect; }
00058
00059 MucFec* GetFec( int fecId ) { return &m_FecVect[fecId]; }
00060 int GetFecLayerID( int fecID ) { return m_FecLayerID[fecID]; }
00061 int GetFirstStripID( int fecID ) { return m_FirstStripID[fecID]; }
00062
00063
00064 void ReMap( string name, int module, int socket );
00065 void SetFecOrder( int fecOrder );
00066 void SetStripOrder( int stripOrder );
00067 void SetStripOrder( int fecID, int stripOrder );
00068 void ArrayInvert( int* array, int number );
00069
00070 private:
00071 int m_ID;
00072 string m_Name;
00073 int m_Module;
00074 int m_Socket;
00075 int m_FecOrder;
00076 int m_Part;
00077 int m_Segment;
00078 int m_FecLayerID[FEC_NUM];
00079 int m_FecTotal;
00080 int m_FecPerLayer;
00081 int m_FirstStripID[FEC_NUM];
00082 int m_StripOrder[FEC_NUM];
00083 vector< MucFec> m_FecVect;
00084
00085 void Mapping();
00086 void InitPart();
00087 void InitSegment();
00088 void InitFecTotal();
00089 void InitFecPerLayer();
00090 void InitFecLayerID();
00091 void InitFirstStripID();
00092 void InitStripOrder();
00093 unsigned int EncodeVmeRecord( int module, int socket, int fecId, unsigned short data);
00094 void InitFecVect();
00095 };
00096
00097 #endif