#include <MucBuilder.h>
Inheritance diagram for MucBuilder:
Public Types | |
typedef std::map< uint32_t, uint32_t > | TE2REMAP |
typedef std::map< uint32_t, uint32_t > | TE2REMAP |
Public Member Functions | |
virtual uint32_t | getREID (uint32_t teid) |
virtual uint32_t | getREID (uint32_t teid) |
virtual uint32_t | getTEID (uint32_t reid) |
virtual uint32_t | getTEID (uint32_t reid) |
virtual StatusCode | initialize (string &initFile) |
virtual StatusCode | initialize (string &initFile) |
MucBuilder () | |
MucBuilder () | |
virtual StatusCode | pack (MucDigiCol *digiCol, WriteRawEvent *&re) |
virtual StatusCode | pack (MucDigiCol *digiCol, WriteRawEvent *&re) |
virtual void | unPack (uint32_t reDigi, uint32_t &REId, uint32_t &FecData, uint32_t &StrSqc) |
virtual void | unPack (uint32_t reDigi, uint32_t &REId, uint32_t &FecData, uint32_t &StrSqc) |
virtual | ~MucBuilder () |
virtual | ~MucBuilder () |
Static Public Member Functions | |
bool | expect (ifstream &f, string msg, string fname) |
bool | expect (ifstream &f, string msg, string fname) |
bool | expectInt (ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2) |
bool | expectInt (ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2) |
bool | expectLong (ifstream &f, string msg, string fname, uint64_t &val) |
bool | expectLong (ifstream &f, string msg, string fname, uint64_t &val) |
bool | find (ifstream &f, string msg, string fname) |
bool | find (ifstream &f, string msg, string fname) |
Protected Member Functions | |
void | append2event (WriteRawEvent *&re, uint32_t source_id, uint32_t size) |
void | append2event (WriteRawEvent *&re, uint32_t source_id, uint32_t size) |
Protected Attributes | |
uint32_t * | m_buf |
uint32_t * | m_buf |
uint32_t | m_status |
Static Protected Attributes | |
string | m_confFile |
Private Attributes | |
string | m_fec2idFile |
uint32_t | m_idIndex |
uint32_t | m_idMask |
uint32_t | m_overflowIndex |
uint32_t | m_overflowMask |
PropertyMgr | m_propMgr |
uint32_t * | m_re2te |
uint32_t * | m_re2te |
TE2REMAP | m_te2reMap |
uint32_t | m_TQIndex |
uint32_t | m_TQMask |
uint32_t * | strSqcVec |
uint32_t * | strSqcVec |
|
|
|
|
|
00010 :Builder() 00011 { 00012 if (!m_fec2idFile.empty()) return; 00013 m_propMgr.declareProperty("Fec2IdMap", m_fec2idFile); 00014 00015 // Get a pointer to the Job Options Service 00016 IJobOptionsSvc* jobSvc; 00017 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc); 00018 jobSvc->setMyProperties("MucBuilder", &m_propMgr); 00019 00020 m_re2te = new uint32_t[1024]; 00021 strSqcVec = new uint32_t[1024]; 00022 memset((void*)m_re2te, 0xFF, 1024*sizeof(uint32_t)); 00023 memset((void*)strSqcVec, 0, 1024*sizeof(uint32_t)); 00024 00025 initialize (m_fec2idFile); 00026 }
|
|
00029 { 00030 delete m_re2te; 00031 delete strSqcVec; 00032 }
|
|
|
|
|
|
|
|
00077 { 00078 uint32_t run_no = re->run_no(); 00079 uint32_t lvl1_id = re->lvl1_id(); 00080 uint32_t bc_id = 0; // ? 00081 // ROB 00082 eformat::write::ROBFragment* nrob = new eformat::write::ROBFragment( 00083 source_id, // source_id 00084 run_no, // run_no 00085 lvl1_id, // lvl1_id 00086 bc_id, // bc_id 00087 0, // lvl1_type 00088 0, // detev_type 00089 size, // ndata 00090 m_buf, // data 00091 0 // status_position 00092 ); 00093 if(m_status==0xFFFFFFFF){ 00094 nrob->status(0, NULL); 00095 nrob->rod_status(0, NULL); 00096 } 00097 else{ //fucd 00098 nrob->status(1, &m_status); 00099 nrob->rod_status(1, &m_status); 00100 } 00101 // ROS 00102 eformat::write::ROSFragment* nros = new eformat::write::ROSFragment( 00103 source_id, // source_id 00104 run_no, // run_no 00105 lvl1_id, // lvl1_id 00106 bc_id // bc_id 00107 ); 00108 if(m_status==0xFFFFFFFF) nros->status(0, NULL); 00109 else nros->status(1, &m_status); //fucd 00110 // SubDetector 00111 eformat::write::SubDetectorFragment* nsd = new eformat::write::SubDetectorFragment(source_id); 00112 if(m_status==0xFFFFFFFF) nsd->status(0, NULL); 00113 else nsd->status(1, &m_status); //fucd 00114 // append to FullEventFragment 00115 nros->append(nrob); 00116 nsd->append(nros); 00117 re->append(nsd); 00118 }
|
|
|
|
00029 { 00030 string str; 00031 if( f.bad() ) 00032 { 00033 cerr << "Error: file " << fname << " is bad" << endl; 00034 return false; 00035 } 00036 f >> str; 00037 if( str == msg ) 00038 return true; 00039 00040 cerr << "Error: expected `" << msg << "|" << str <<"` in " << fname << endl; 00041 return false; 00042 }
|
|
|
|
00045 { 00046 if( !expect( f, msg, fname ) || f.bad() ) 00047 return false; 00048 f >> val1 >> val2; 00049 return true; 00050 }
|
|
|
|
00053 { 00054 if ( !expect(f, msg, fname) || f.bad() ) 00055 return false; 00056 f >> val; 00057 return true; 00058 }
|
|
|
|
00061 { 00062 if ( f.bad() ) { 00063 cerr << "Error: file " << fname << " bad checked" << endl; 00064 return false; 00065 } 00066 00067 string str; 00068 while ( !f.eof() ) { 00069 f >> str; 00070 if ( str == msg ) return true; 00071 } 00072 00073 return false; 00074 }
|
|
Implements Builder. |
|
Implements Builder. 00105 { 00106 TE2REMAP::iterator itr = m_te2reMap.find(teid); 00107 00108 if (itr == m_te2reMap.end()) { 00109 cout << "wrong teid in muc " << teid << endl; 00110 exit(8); 00111 } 00112 00113 return itr->second; 00114 }
|
|
Implements Builder. 00017 { 00018 if ( reid > 1023 ) return 0xFFFFFFFF; 00019 return m_re2te[reid]; 00020 }
|
|
Implements Builder. 00017 { 00018 if ( reid > 1023 ) return 0xFFFFFFFF; 00019 return m_re2te[reid]; 00020 }
|
|
Reimplemented from Builder. |
|
Reimplemented from Builder. 00077 { 00078 ifstream fs(fec2idFile.c_str()); 00079 if( fs.bad() ) { 00080 cerr << "Error: could not open file " << fec2idFile << endl; 00081 return false; 00082 } 00083 00084 fs.ignore(256, '\n'); 00085 00086 int fec, part, seg, layer, firstStr, strSqc; 00087 00088 for (int i = 0; i < 572; i++) { 00089 fs >> fec >> part >> seg >> layer >> firstStr >> strSqc; 00090 // reid ... teid 00091 uint32_t reid = fec; // ? 00092 uint32_t teid = MucID::getIntID(part, seg, layer, firstStr); 00093 //if (strSqc < 0) teid |= 0x00F00000; // local teid 00094 00095 m_re2te[reid] = teid; 00096 strSqcVec[reid] = strSqc + 1; 00097 m_te2reMap.insert(TE2REMAP::value_type(teid, reid)); 00098 //cout << "teid " << teid << " reid " << reid << " strSqc " << strSqcVec[reid] << endl; 00099 } 00100 00101 return StatusCode::SUCCESS; 00102 }
|
|
|
|
00045 { 00046 if (digiCol == 0 ) { 00047 cerr << "MdcBuilder::pack can't get digiCol" << endl; 00048 return StatusCode::FAILURE; 00049 } 00050 00051 uint32_t size = 0, index; 00052 uint32_t teid, reid, channel; 00053 00054 MucDigiCol::const_iterator pMucDigi = digiCol->begin(); 00055 for (pMucDigi; pMucDigi!= digiCol->end(); pMucDigi++) { 00056 teid = (*pMucDigi)->getIntId(); 00057 reid = getREID(teid&0xFFFFFFF0); 00058 channel = (strSqcVec[reid] == 0) ? (0x8000>>(teid&0xF)) : (0x1<<(teid&0xF)); 00059 // set the value if the current reid has been in the buffer 00060 for (index = 0; index < size; index++) { 00061 if ((m_buf[index]>>16) == reid) { 00062 m_buf[index] |= channel; 00063 break; 00064 } 00065 } 00066 // otherwise, append the current reid and value to the buffer 00067 if (index == size) m_buf[size++] = ((reid << 16) | (channel)); 00068 } 00069 00070 append2event(re, 0xa40000, size); 00071 00072 return StatusCode::SUCCESS; 00073 }
|
|
|
|
00035 { 00036 uint32_t fecAddr = (reDigi&0xFFFF0000) >> 16; 00037 uint32_t module = (fecAddr&0xF800) >> 5; 00038 REId = (fecAddr&0x07FF) | module; 00039 FecData = reDigi&0xFFFF; 00040 StrSqc = strSqcVec[REId]; 00041 return; 00042 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reimplemented from Builder. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|