#include <HltBuilder.h>
Inheritance diagram for HltBuilder:
Public Types | |
typedef std::map< uint32_t, uint32_t > | TE2REMAP |
Public Member Functions | |
HltBuilder () | |
virtual | ~HltBuilder () |
StatusCode | initialize (string &initFile) |
uint32_t | getTEID (uint32_t reid) |
uint32_t | getREID (uint32_t teid) |
void | unPack (uint32_t reDigi, uint32_t n, uint32_t &REId, uint32_t &TEData1, uint32_t &TEData2) |
StatusCode | pack (HltRawCol *digiCol, WriteRawEvent *&re) |
Static Public Member Functions | |
static bool | expect (ifstream &f, string msg, string fname) |
static bool | expectInt (ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2) |
static bool | expectLong (ifstream &f, string msg, string fname, uint64_t &val) |
static bool | find (ifstream &f, string msg, string fname) |
Protected Member Functions | |
void | append2event (WriteRawEvent *&re, uint32_t source_id, uint32_t size) |
Protected Attributes | |
uint32_t * | m_buf |
uint32_t | m_status |
Static Protected Attributes | |
static string | m_confFile |
Private Attributes | |
uint32_t | m_idIndex |
uint32_t | m_idMask |
uint32_t | m_algIndex |
uint32_t | m_algMask |
uint32_t | m_criIndex |
uint32_t | m_criMask |
uint32_t | m_varIndex |
uint32_t | m_varMask |
uint32_t * | m_re2te |
TE2REMAP | m_te2reMap |
PropertyMgr | m_propMgr |
Definition at line 9 of file HltBuilder.h.
typedef std::map<uint32_t, uint32_t> Builder::TE2REMAP [inherited] |
HltBuilder::HltBuilder | ( | ) |
Definition at line 7 of file HltBuilder.cxx.
References initialize(), Builder::m_confFile, and m_re2te.
00008 :Builder() 00009 { 00010 // set vector size (2^14) and initialize to -1 00011 m_re2te = new uint32_t[256]; // we have 2^8 different REID 00012 memset((void*)m_re2te, 0xFF, 256*sizeof(uint32_t)); 00013 00014 initialize (Builder::m_confFile); 00015 }
HltBuilder::~HltBuilder | ( | ) | [virtual] |
Definition at line 17 of file HltBuilder.cxx.
References m_re2te.
00018 { 00019 delete m_re2te; 00020 }
void Builder::append2event | ( | WriteRawEvent *& | re, | |
uint32_t | source_id, | |||
uint32_t | size | |||
) | [protected, inherited] |
Definition at line 76 of file Builder.cxx.
References eformat::write::FullEventFragment::append(), eformat::write::SubDetectorFragment::append(), eformat::write::ROSFragment::append(), eformat::write::FullEventFragment::lvl1_id(), Builder::m_buf, Builder::m_status, eformat::write::ROBFragment::rod_status(), eformat::write::FullEventFragment::run_no(), eformat::write::SubDetectorFragment::status(), eformat::write::ROSFragment::status(), and eformat::write::ROBFragment::status().
Referenced by TofBuilder::pack(), MucBuilder::pack(), MdcBuilder::pack(), McParticleBuilder::pack(), pack(), and EmcBuilder::pack().
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 }
Definition at line 28 of file Builder.cxx.
References deljobs::string.
Referenced by Builder::expectInt(), Builder::expectLong(), TofMcHitBuilder::initialize(), TofBuilder::initialize(), MucMcHitBuilder::initialize(), MdcMcHitBuilder::initialize(), MdcBuilder::initialize(), initialize(), EmcMcHitBuilder::initialize(), and EmcBuilder::initialize().
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 }
bool Builder::expectInt | ( | ifstream & | f, | |
string | msg, | |||
string | fname, | |||
uint32_t & | val1, | |||
uint32_t & | val2 | |||
) | [static, inherited] |
Definition at line 44 of file Builder.cxx.
References Builder::expect().
Referenced by TofMcHitBuilder::initialize(), TofBuilder::initialize(), MucMcHitBuilder::initialize(), MdcMcHitBuilder::initialize(), MdcBuilder::initialize(), initialize(), EmcMcHitBuilder::initialize(), and EmcBuilder::initialize().
00045 { 00046 if( !expect( f, msg, fname ) || f.bad() ) 00047 return false; 00048 f >> val1 >> val2; 00049 return true; 00050 }
bool Builder::expectLong | ( | ifstream & | f, | |
string | msg, | |||
string | fname, | |||
uint64_t & | val | |||
) | [static, inherited] |
Definition at line 52 of file Builder.cxx.
References Builder::expect().
Referenced by TofMcHitBuilder::initialize(), MucMcHitBuilder::initialize(), MdcMcHitBuilder::initialize(), and EmcMcHitBuilder::initialize().
00053 { 00054 if ( !expect(f, msg, fname) || f.bad() ) 00055 return false; 00056 f >> val; 00057 return true; 00058 }
Definition at line 60 of file Builder.cxx.
References deljobs::string.
Referenced by TofMcHitBuilder::initialize(), TofBuilder::initialize(), MucMcHitBuilder::initialize(), MdcMcHitBuilder::initialize(), MdcBuilder::initialize(), McParticleBuilder::initialize(), initialize(), EmcMcHitBuilder::initialize(), and EmcBuilder::initialize().
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 }
uint32_t HltBuilder::getREID | ( | uint32_t | teid | ) | [virtual] |
Implements Builder.
Definition at line 143 of file HltBuilder.cxx.
References m_te2reMap.
00144 { 00145 00146 TE2REMAP::iterator itr = m_te2reMap.find(teid); 00147 00148 uint32_t reid = 0; 00149 if(itr!= m_te2reMap.end()) 00150 reid = (*itr).second; 00151 else 00152 { 00153 cout<<"wrong teid in emc "<<teid<<endl; 00154 exit(8); 00155 } 00156 00157 return reid; 00158 00159 }
uint32_t HltBuilder::getTEID | ( | uint32_t | reid | ) | [inline, virtual] |
Implements Builder.
Definition at line 16 of file HltBuilder.h.
References m_re2te.
Referenced by RawDataHltRawCnv::createObj().
00016 { return m_re2te[reid]; }
StatusCode HltBuilder::initialize | ( | string & | initFile | ) | [virtual] |
Reimplemented from Builder.
Definition at line 98 of file HltBuilder.cxx.
References Builder::expect(), Builder::expectInt(), Builder::find(), genRecEmupikp::i, m_algIndex, m_algMask, m_criIndex, m_criMask, m_idIndex, m_idMask, m_re2te, m_te2reMap, m_varIndex, m_varMask, and dchain::value_type().
Referenced by HltBuilder().
00099 { 00100 ifstream f; 00101 00102 //----------------------------------------------------------- 00103 // read initFile 00104 f.open( initFile.c_str()); 00105 00106 if( f.bad() ) 00107 { 00108 cerr << "Error: could not open file " << initFile << endl; 00109 return false; 00110 } 00111 00112 if (!Builder::find( f, "##HltRawConf", initFile)) { 00113 cerr << "Error: could not find '##HltRawConf' in file " << initFile << endl; 00114 return StatusCode::FAILURE; 00115 } 00116 00117 if( !Builder::expect( f, "#Index,mask", initFile) || 00118 !Builder::expectInt( f, "id", initFile, m_idIndex, m_idMask) || 00119 !Builder::expectInt( f, "alg", initFile, m_algIndex, m_algMask) || 00120 !Builder::expectInt( f, "cri", initFile, m_criIndex, m_criMask) || 00121 !Builder::expectInt( f, "var", initFile, m_varIndex, m_varMask)) 00122 return false; 00123 f.close(); 00124 00125 cout<<"HltBuilder:: #Index mask"<<endl 00126 <<" "<<m_idIndex<<" "<<m_idMask<<endl 00127 <<" "<<m_algIndex<<" "<<m_algMask<<endl 00128 <<" "<<m_criIndex<<" "<<m_criMask<<endl 00129 <<" "<<m_varIndex<<" "<<m_varMask<<endl; 00130 00131 //----------------------------------------------------------- 00132 //Build re2te table 00133 for (uint32_t i = 0; i < 256; i++) { 00134 m_re2te[i] = (0x50000000 | i); //m_re2te[i]=0x50000000+0x00000000+i; 00135 //if(i>4) m_re2te[i]+=0x00000000; 00136 m_te2reMap.insert(TE2REMAP::value_type(m_re2te[i], i)) ; 00137 } 00138 // return successful initialization 00139 return StatusCode::SUCCESS; 00140 }
StatusCode HltBuilder::pack | ( | HltRawCol * | digiCol, | |
WriteRawEvent *& | re | |||
) |
Definition at line 47 of file HltBuilder.cxx.
References Builder::append2event(), eformat::write::FullEventFragment::event_filter_info(), HltID::is_algorithm(), HltID::is_criteria(), HltID::is_energy(), HltID::is_eventtype(), HltID::is_version(), m_algIndex, m_algMask, Builder::m_buf, m_criMask, and delete_small_size::size.
Referenced by RawDataHltRawCnv::createRep().
00048 { 00049 if (digiCol == 0 ) { 00050 cerr << "HltBuilder::pack can't get digiCol" << endl; 00051 return StatusCode::FAILURE; 00052 } 00053 00054 uint32_t size = 0; 00055 uint32_t hltdigi = 0; 00056 Identifier id; 00057 uint32_t event_filter[4]={0,0,0,0}; 00058 00059 HltRawCol::const_iterator pHltDigi = digiCol->begin(); 00060 for ( ; pHltDigi!= digiCol->end(); pHltDigi++) { 00061 id = (*pHltDigi)->identify(); 00062 if(HltID::is_algorithm(id)){ 00063 uint32_t alg= (*pHltDigi)->getIntChannel(); 00064 uint32_t cri=0; 00065 //cout << " debug by fucd: alg=" << alg << endl; 00066 pHltDigi++; 00067 if(!HltID::is_criteria((*pHltDigi)->identify())) { 00068 pHltDigi--; 00069 } 00070 else { 00071 cri= (*pHltDigi)->getIntChannel(); 00072 } 00073 hltdigi = ((alg<<m_algIndex)&m_algMask) | ((cri<<m_algIndex)&m_criMask); 00074 event_filter[1] =hltdigi; 00075 } 00076 else if(HltID::is_criteria(id)){ 00077 cerr<< "HltBuilder::pack(): HLT raw data error!" << endl; 00078 return StatusCode::FAILURE; 00079 } 00080 else{ 00081 hltdigi = (*pHltDigi)->getIntChannel(); 00082 if(HltID::is_eventtype(id)) event_filter[0]=hltdigi; 00083 else if(HltID::is_version(id)) event_filter[2]=hltdigi; 00084 else if(HltID::is_energy(id)) event_filter[3]=hltdigi; 00085 else m_buf[size++] = hltdigi; 00086 } 00087 //cout << " debug by fucd: digi="<< hex << hltdigi << dec <<endl; 00088 } 00089 00090 re->event_filter_info(&event_filter[0]); 00091 append2event(re, 0x7c0000, size); 00092 00093 return StatusCode::SUCCESS; 00094 }
void HltBuilder::unPack | ( | uint32_t | reDigi, | |
uint32_t | n, | |||
uint32_t & | REId, | |||
uint32_t & | TEData1, | |||
uint32_t & | TEData2 | |||
) |
Definition at line 22 of file HltBuilder.cxx.
References m_algIndex, m_algMask, m_criIndex, and m_criMask.
Referenced by RawDataHltRawCnv::createObj().
00024 { 00025 if ( n == 0 ) { 00026 REId = 0; 00027 TEData1 = reDigi; 00028 TEData2 = 0; 00029 } 00030 else if ( n == 1 ) { 00031 REId = 1; 00032 TEData1 = (reDigi&m_algMask) >> m_algIndex; 00033 TEData2 = (reDigi&m_criMask) >> m_criIndex; 00034 //cout<<hex<<reDigi<<"=>"<<TEData1<<","<<TEData2<<endl 00035 // <<m_algMask<<" "<<m_algIndex<<" "<<m_criMask 00036 // <<" "<<m_criIndex<<dec<<endl; 00037 } 00038 else { 00039 REId = n+1; 00040 TEData1 =reDigi; 00041 TEData2 =0; 00042 } 00043 00044 return; 00045 }
uint32_t HltBuilder::m_algIndex [private] |
uint32_t HltBuilder::m_algMask [private] |
uint32_t* Builder::m_buf [protected, inherited] |
Definition at line 46 of file Builder.h.
Referenced by Builder::append2event(), Builder::Builder(), TofBuilder::pack(), MucBuilder::pack(), MdcBuilder::pack(), McParticleBuilder::pack(), pack(), EmcBuilder::pack(), and Builder::~Builder().
string Builder::m_confFile [static, protected, inherited] |
Definition at line 47 of file Builder.h.
Referenced by Builder::Builder(), EmcBuilder::EmcBuilder(), EmcMcHitBuilder::EmcMcHitBuilder(), HltBuilder(), MdcBuilder::MdcBuilder(), MdcMcHitBuilder::MdcMcHitBuilder(), MucMcHitBuilder::MucMcHitBuilder(), TofBuilder::TofBuilder(), and TofMcHitBuilder::TofMcHitBuilder().
uint32_t HltBuilder::m_criIndex [private] |
uint32_t HltBuilder::m_criMask [private] |
uint32_t HltBuilder::m_idIndex [private] |
uint32_t HltBuilder::m_idMask [private] |
PropertyMgr HltBuilder::m_propMgr [private] |
uint32_t* HltBuilder::m_re2te [private] |
Definition at line 33 of file HltBuilder.h.
Referenced by getTEID(), HltBuilder(), initialize(), and ~HltBuilder().
uint32_t Builder::m_status [protected, inherited] |
Definition at line 49 of file Builder.h.
Referenced by Builder::append2event(), and Builder::Builder().
TE2REMAP HltBuilder::m_te2reMap [private] |
uint32_t HltBuilder::m_varIndex [private] |
uint32_t HltBuilder::m_varMask [private] |