#include <RawDataInputSvc.h>
Inheritance diagram for RawDataInputSvc:
Public Member Functions | |
virtual RAWEVENT * | currentEvent () |
virtual RAWEVENT * | currentEvent () |
std::string | currentFile () const |
std::string | currentFile () const |
virtual StatusCode | finalize () |
virtual StatusCode | finalize () |
virtual StatusCode | initialize () |
virtual StatusCode | initialize () |
virtual RAWEVENT * | nextEvent () |
virtual RAWEVENT * | nextEvent () |
RawDataInputSvc (const std::string &name, ISvcLocator *svcloc) | |
RawDataInputSvc (const std::string &name, ISvcLocator *svcloc) | |
int | runMode () |
int | runMode () |
virtual bool | setCurrentEvent (RAWEVENT *m_onlinere) |
virtual bool | setCurrentEvent (RAWEVENT *m_onlinere) |
virtual | ~RawDataInputSvc () |
virtual | ~RawDataInputSvc () |
Static Public Member Functions | |
const InterfaceID & | interfaceID () |
const InterfaceID & | interfaceID () |
Private Attributes | |
std::string | m_evtServer |
std::vector< std::string > | m_inputFiles |
std::vector< std::string > | m_inputFiles |
int | m_mode |
RAWEVENT * | m_re |
RAWEVENT * | m_re |
IRawReader * | m_reader |
IRawReader * | m_reader |
const uint32_t ** | m_robs |
const uint32_t ** | m_robs |
const uint32_t ** | m_sds |
const uint32_t ** | m_sds |
|
00025 : 00026 Service(name,svcloc), 00027 m_re(0), 00028 m_reader(0), 00029 m_sds(0), 00030 m_robs(0) 00031 { 00032 // Get a pointer to the Job Options Service 00033 IJobOptionsSvc* jobSvc; 00034 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc); 00035 00036 PropertyMgr m_propMgr; 00037 // 0-NormalNetMode, 1-OnlineMode, 2-OfflineMode, 3-DistBossMode 00038 m_propMgr.declareProperty("RunMode", m_mode = 2); 00039 m_propMgr.declareProperty("InputFiles", m_inputFiles); 00040 00041 jobSvc->setMyProperties("RawDataInputSvc", &m_propMgr); 00042 }
|
|
00046 { 00047 //MsgStream log(messageService(), name() ); 00048 //log << MSG::DEBUG << "RawDataInputSvc Destructor called " << endreq; 00049 }
|
|
|
|
|
|
Implements IRawDataInputSvc. |
|
Get a pointer to the current event. Implements IRawDataInputSvc. 00255 { 00256 // Return a pointer to the raw event. 00257 //std::cout << "RawDataCnv -> Return a pointer to the raw event." << std::endl; 00258 //std::cout << "It is the first time to call the currentEvent()" << std::endl; 00259 return m_re; 00260 }
|
|
Implements IRawDataInputSvc. 00044 { return m_reader->currentFile(); }
|
|
Implements IRawDataInputSvc. 00044 { return m_reader->currentFile(); }
|
|
Reimplemented from IRawDataInputSvc. |
|
Reimplemented from IRawDataInputSvc. 00093 { 00094 // clean up 00095 if ( m_re ) { 00096 delete m_re; 00097 m_re = 0; 00098 } 00099 00100 if ( m_reader ) { 00101 delete m_reader; 00102 m_reader = 0; 00103 } 00104 00105 if ( m_sds ) delete m_sds; 00106 if ( m_robs ) delete m_robs; 00107 00108 return StatusCode::SUCCESS; 00109 }
|
|
Reimplemented from IRawDataInputSvc. |
|
Reimplemented from IRawDataInputSvc. 00053 { 00054 //MsgStream log(messageService(), name() ); 00055 //log << MSG::DEBUG << " in RawDataInputSvc::initialize()" << endreq; 00056 00057 //StatusCode sc= IRawDataInputSvc::initialize(); 00058 //if(!sc.isSuccess()) { 00059 // log << MSG::ERROR << "failed to initialize IRawDataInputSvc" << endreq; 00060 // return sc; 00061 //} 00062 00063 #ifndef OnlineMode 00064 if ( m_mode > 1 ) { 00065 try { 00066 if ( m_mode == 2 ) { //OfflineMode 00067 if ( m_inputFiles.empty() ) return StatusCode::SUCCESS; 00068 m_reader = new RawFileReader(m_inputFiles); 00069 } 00070 else if ( m_mode == 3 ) { //DistBossMode 00071 DistBoss::GetPropertyValue<std::string>("DistBoss", "ServerName", m_evtServer); 00072 m_reader = new NetDataReader(m_evtServer+"/RawEvtSvc"); 00073 } 00074 else { 00075 throw RawExMessage("RawDataInputSvc: Invalid RunMode!"); 00076 } 00077 } 00078 catch (RawFileException& ex) { 00079 ex.print(); 00080 return StatusCode::FAILURE; 00081 } 00082 00083 m_re = new RAWEVENT; 00084 00085 m_sds = new const uint32_t*[64]; 00086 m_robs = new const uint32_t*[256]; 00087 } 00088 #endif 00089 00090 return StatusCode::SUCCESS; 00091 }
|
|
00028 { return IID_RawDataInputSvc; }
|
|
00028 { return IID_RawDataInputSvc; }
|
|
Implements IRawDataInputSvc. |
|
Implements IRawDataInputSvc. 00112 { 00113 00114 //MsgStream log(messageService(), name() ); 00115 #ifndef OnlineMode 00116 //OfflineMode and DistBossMode 00117 m_re->reset(); 00118 00119 try { 00120 const uint32_t* fragment = m_reader->nextEvent(); 00121 00122 RawEvent f(fragment); 00123 if (!f.check()) { 00124 std::cerr << "Found invalid event (traceback):" << std::endl; 00125 std::exit(1); 00126 } 00127 //1.print basic event information 00128 // log << MSG::DEBUG<< "run" << f.run_no() << " [Event No. #" << f.global_id() 00129 // << "] " << f.fragment_size_word() << " words in " 00130 // << f.nchildren() << " subdetectors " 00131 // << endreq; 00132 m_re->setRunNo(f.run_no()); 00133 m_re->setEventNo(f.global_id()); 00134 m_re->setTime(f.time()); 00135 00136 //fucd: get event filter information 00137 const uint32_t* ef=NULL; 00138 f.event_filter_info(ef); 00139 if ( !ef ) { 00140 //log << MSG::ERROR << "Event Filter Data Failed!!!" << endreq; 00141 exit(1); 00142 } 00143 else { 00144 //log << MSG::DEBUG<< "Event Filter Information*********" <<std::hex<<endreq 00145 // <<*ef<< " "<<*(ef+1)<<" "<<*(ef+2)<<" "<<*(ef+3)<<std::dec<<endreq; 00146 m_re->addReHltRaw((uint32_t*)ef, 4); 00147 } 00148 00149 //set HV status and get all robs 00150 uint32_t hv_status = 0; 00151 int nrobs = 0; 00152 int nsds = f.children(m_sds, 64); 00153 for ( int sdi = 0; sdi < nsds; ++sdi ) { 00154 eformat::SubDetectorFragment<const uint32_t*> sd(m_sds[sdi]); 00155 00156 if ( sd.nspecific() != 0 ) { 00157 const uint32_t* specific_header; 00158 sd.specific_header(specific_header); 00159 uint32_t source_id_number = sd.source_id(); 00160 source_id_number <<= 8; 00161 source_id_number >>= 24; 00162 switch( source_id_number ) { 00163 case 161: 00164 hv_status |= ((8 | ((*specific_header)&0x7)) << 8); 00165 break; 00166 case 162: 00167 hv_status |= ((8 | ((*specific_header)&0x7)) << 4); 00168 break; 00169 case 164: 00170 hv_status |= (8 | ((*specific_header)&0x7)); 00171 break; 00172 default: 00173 break; 00174 } 00175 } 00176 00177 nrobs += eformat::get_robs(m_sds[sdi], m_robs+nrobs, 256-nrobs); 00178 } 00179 00180 m_re->setFlag1( hv_status ); 00181 00182 //log << MSG::INFO << " nrobs: " << nrobs << endreq; 00183 for (int robi = 0; robi < nrobs; robi++) { 00184 eformat::ROBFragment<uint32_t*> rob((uint32_t*)m_robs[robi]); 00185 //uint32_t detev_type = rob.rod_detev_type(); 00186 if ((rob.rod_detev_type() & 0x2) != 0) continue; //bad data 00187 uint32_t* dataptr = NULL; 00188 rob.rod_data(dataptr); 00189 00190 //log << MSG::DEBUG<< "addReHltRaw" << endreq; 00191 uint32_t source_id_number = rob.rod_source_id(); 00192 //std::cout<<"#####source_id_number#####"<<source_id_number<<std::endl; 00193 source_id_number <<= 8; 00194 source_id_number >>= 24; 00195 //std::cout<<"#####(source_id_number<<24)>>29#####"<<source_id_number<<std::endl; 00196 //be careful here!!! 00197 switch(source_id_number) { 00198 case 161: 00199 m_re->addReMdcDigi(dataptr, rob.rod_ndata()); 00200 break; 00201 case 163: 00202 m_re->addReEmcDigi(dataptr, rob.rod_ndata()); 00203 break; 00204 case 162: 00205 m_re->addReTofDigi(dataptr, rob.rod_ndata()); 00206 break; 00207 case 164: 00208 m_re->addReMucDigi(dataptr, rob.rod_ndata()); 00209 break; 00210 case 165: // trigger !!! 00211 //std::cout << "Get Trigger Data -" << std::endl; 00212 //for (int i = 0; i < rob.rod_ndata(); i++) { 00213 // std::cout << "\t0x" << std::hex << dataptr[i] << std::dec << std::endl; 00214 //} 00215 m_re->addReTrigGTD(dataptr, rob.rod_ndata()); 00216 break; 00217 case 124: // EventFilter 00218 m_re->addReHltRaw(dataptr, rob.rod_ndata()); 00219 break; 00220 case 241: // McParticle 00221 m_re->addMcParticle(dataptr, rob.rod_ndata()); 00222 break; 00223 default: 00224 //log << MSG::ERROR << "no such subdetector type: " << source_id_number << endreq; 00225 break; 00226 } 00227 } 00228 } 00229 catch (RawFileException& ex) { 00230 ex.print(); 00231 delete m_re; 00232 m_re = NULL; 00233 } 00234 catch (eformat::Issue& ex) { 00235 std::cerr << std::endl << "Uncaught eformat issue: " << ex.what() << std::endl; 00236 } 00237 catch (ers::Issue& ex) { 00238 std::cerr << std::endl << "Uncaught ERS issue: " << ex.what() << std::endl; 00239 } 00240 catch (std::exception& ex) { 00241 std::cerr << std::endl << "Uncaught std exception: " << ex.what() << std::endl; 00242 } 00243 catch (...) { 00244 std::cerr << std::endl << "Uncaught unknown exception" << std::endl; 00245 } 00246 #endif 00247 00248 return m_re; 00249 }
|
|
Implements IRawDataInputSvc. 00047 { return m_mode; }
|
|
Implements IRawDataInputSvc. 00047 { return m_mode; }
|
|
Implements IRawDataInputSvc. |
|
Implements IRawDataInputSvc. 00263 { 00264 //std::cout << "setCurrentEvent(RAWEVENT* m_onlinere)" << std::endl; 00265 return (m_re = m_onlinere); 00266 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|