#include <MucMappingAlg.h>
Public Member Functions | |
MucMappingAlg (const std::string &name, ISvcLocator *pSvcLocator) | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
Private Attributes | |
int | m_fFecOrder |
std::string | m_sFileName [2] |
std::string | m_sOutputOption |
std::string | m_sChainMap [MODULE_MAX][SOCKET_MAX] |
MucChain * | m_mucChain [CHAIN_MAX] |
Definition at line 44 of file MucMappingAlg.h.
MucMappingAlg::MucMappingAlg | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 14 of file MucMappingAlg.cxx.
References m_fFecOrder, m_sFileName, and m_sOutputOption.
00014 : 00015 Algorithm(name, pSvcLocator), m_fFecOrder(1) 00016 { 00017 // Declear the properties 00018 declareProperty("FecOrder", m_fFecOrder); 00019 declareProperty("ChainMap", m_sFileName[0]); 00020 declareProperty("FecMap", m_sFileName[1]); 00021 declareProperty("OutputOption", m_sOutputOption); 00022 }
StatusCode MucMappingAlg::execute | ( | ) |
Definition at line 85 of file MucMappingAlg.cxx.
References Bes_Common::INFO, and msgSvc().
00086 { 00087 MsgStream log(msgSvc(), name()); 00088 log << MSG::INFO << endreq << "In execute()" << endreq; 00089 00090 00091 return StatusCode::SUCCESS; 00092 }
StatusCode MucMappingAlg::finalize | ( | ) |
Definition at line 96 of file MucMappingAlg.cxx.
References EvtCyclic3::c_str(), DATA_NAME, DATA_NUM, MucChain::GetFecTotal(), MucChain::GetPart(), genRecEmupikp::i, Bes_Common::INFO, ganga-rec::j, m_fFecOrder, m_mucChain, m_sChainMap, m_sFileName, m_sOutputOption, MODULE_MAX, msgSvc(), and SOCKET_MAX.
00097 { 00098 MsgStream log(msgSvc(), name()); 00099 log << MSG::INFO << endreq << "In finalize()" << endreq << endreq; 00100 00101 ofstream fout(m_sFileName[1].c_str(), ios::out); 00102 if( fout.bad() ) 00103 { 00104 log << MSG::INFO << "Output file created error!" << endreq; 00105 exit(-1); 00106 } 00107 00108 for(int i=0; i<DATA_NUM; i++) 00109 { 00110 if( m_sOutputOption[i] == '1' ) 00111 fout << DATA_NAME[i] << "\t"; 00112 } 00113 fout << endl; 00114 00115 for(int i=0; i<MODULE_MAX; i++) 00116 { 00117 log << MSG::INFO << "----------------------Module [ " << i << " ]----------------------" << endreq; 00118 for(int j=0; j<SOCKET_MAX; j++) 00119 { 00120 int id = i * SOCKET_MAX + j; 00121 m_mucChain[id] = new MucChain( id, m_sChainMap[i][j], i, j, m_fFecOrder ); 00122 00123 for( int k=0; k<m_mucChain[id]->GetFecTotal(); k++ ) 00124 { 00125 MucFec* aFec = m_mucChain[id]->GetFec( k ); 00126 if( m_sOutputOption[0] == '1' ) 00127 fout << aFec->GetChainName() << "\t"; 00128 if( m_sOutputOption[1] == '1' ) 00129 fout << aFec->DecodeModule() << "\t"; 00130 if( m_sOutputOption[2] == '1' ) 00131 fout << aFec->DecodeSocket() << "\t"; 00132 if( m_sOutputOption[3] == '1' ) 00133 fout << aFec->DecodeFecID() << "\t"; 00134 if( m_sOutputOption[4] == '1' ) 00135 fout << aFec->GetVmeAddress() << "\t"; 00136 if( m_sOutputOption[5] == '1' ) 00137 fout << aFec->GetVmeBin() << "\t"; 00138 if( m_sOutputOption[6] == '1' ) 00139 fout << aFec->GetPart() << "\t"; 00140 if( m_sOutputOption[7] == '1' ) 00141 fout << aFec->GetSegment() << "\t"; 00142 if( m_sOutputOption[8] == '1' ) 00143 fout << aFec->GetLayer() << "\t"; 00144 if( m_sOutputOption[9] == '1' ) 00145 fout << aFec->GetFirstStripID() << "\t"; 00146 if( m_sOutputOption[10] == '1' ) 00147 fout << aFec->GetStripOrder() << "\t"; 00148 if( m_sOutputOption[11] == '1' ) 00149 fout << aFec->GetGeoAddress() << "\t"; 00150 if( m_sOutputOption[12] == '1' ) 00151 fout << aFec->GetGeoBin() << "\t"; 00152 if( m_sOutputOption[13] == '1' ) 00153 fout << aFec->GetDataBin() << "\t"; 00154 fout << endl; 00155 } 00156 00157 log << MSG::INFO << "Chain ID: " << id << "\tName: " << m_sChainMap[i][j]; 00158 log << MSG::INFO << "\tSocket: " << j << "\tFecTotal: " << m_mucChain[id]->GetFecTotal() 00159 << "\tFecOrder: " << m_fFecOrder << "\tdone!" << endreq; 00160 } // end socket 00161 } // end module 00162 00163 fout.close(); 00164 00165 return StatusCode::SUCCESS; 00166 }
StatusCode MucMappingAlg::initialize | ( | ) |
Definition at line 25 of file MucMappingAlg.cxx.
References EvtCyclic3::c_str(), DEFAULT_MAP, genRecEmupikp::i, Bes_Common::INFO, ganga-rec::j, m_fFecOrder, m_sChainMap, m_sFileName, m_sOutputOption, MARK_NUM, MODULE_MAX, msgSvc(), delete_small_size::size, SOCKET_MAX, and deljobs::string.
00026 { 00027 MsgStream log(msgSvc(), name()); 00028 log << MSG::INFO << endreq << "In initialize()" << endreq; 00029 log << MSG::INFO << "Fec order:\t\t" << m_fFecOrder << endreq; 00030 log << MSG::INFO << "Chain map:\t" << m_sFileName[0] << endreq; 00031 log << MSG::INFO << "Output map:\t\t" << m_sFileName[1] << endreq; 00032 log << MSG::INFO << "Output option:\t\t" << m_sOutputOption << endreq; 00033 00034 ifstream fin(m_sFileName[0].c_str(), ios::in); 00035 00036 log << MSG::INFO << "-------Chain map--------" << endreq; 00037 if( m_sFileName[0].size() == 0 || fin.bad() ) 00038 { 00039 00040 log << MSG::INFO << endreq << "Load default map!" << endreq; 00041 00042 for(int i=0; i<MODULE_MAX; i++) 00043 { 00044 for(int j=0; j<SOCKET_MAX; j++) 00045 { 00046 m_sChainMap[i][j] = DEFAULT_MAP[i][j]; 00047 // strcpy( m_ChainMap[i][j], DEFAULT_MAP[i][j] ); 00048 log << MSG::INFO << m_sChainMap[i][j] << "\t"; 00049 } 00050 00051 log << MSG::INFO << endreq; 00052 } 00053 } 00054 else 00055 { 00056 string tempMark; 00057 for(int i=0; i<MODULE_MAX; i++) 00058 { 00059 for(int j=0; j<SOCKET_MAX; j++) 00060 { 00061 fin >> tempMark; 00062 // if( strlen( tempMark ) > MARK_NUM ) 00063 if( tempMark.size() > MARK_NUM ) 00064 { 00065 log << MSG::INFO << endreq 00066 << "Mark:\t" << "Module\t" << i << "Socket\t" << j << "\t" 00067 << tempMark << "\terror!"<< endreq; 00068 continue; 00069 } 00070 00071 m_sChainMap[i][j] = tempMark; 00072 // strcpy( m_sChainMap[i][j], tempMark ); 00073 log << MSG::INFO << m_sChainMap[i][j] << "\t"; 00074 } 00075 log << MSG::INFO << endreq; 00076 } 00077 00078 fin.close(); 00079 } 00080 log << MSG::INFO << "------------------------" << endreq; 00081 return StatusCode::SUCCESS; 00082 }
int MucMappingAlg::m_fFecOrder [private] |
Definition at line 55 of file MucMappingAlg.h.
Referenced by finalize(), initialize(), and MucMappingAlg().
MucChain* MucMappingAlg::m_mucChain[CHAIN_MAX] [private] |
std::string MucMappingAlg::m_sChainMap[MODULE_MAX][SOCKET_MAX] [private] |
std::string MucMappingAlg::m_sFileName[2] [private] |
Definition at line 56 of file MucMappingAlg.h.
Referenced by finalize(), initialize(), and MucMappingAlg().
std::string MucMappingAlg::m_sOutputOption [private] |
Definition at line 57 of file MucMappingAlg.h.
Referenced by finalize(), initialize(), and MucMappingAlg().