1#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/ThreadGaudi.h"
17static int _localTimeRound = 0;
30 if ( sc.isFailure() )
return sc;
32 std::string PackedRawDataCnvSvc_Name(
"PackedRawDataCnvSvc");
33 std::string RawDataInputSvc_Name(
"RawDataInputSvc");
34 std::string RawDataEvtHeaderCnv_Name(
"RawDataEvtHeaderCnv");
39 SmartIF<IService> pCnvSvc(conversionSvc());
40 if (isGaudiThreaded(pCnvSvc->name())){
41 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
42 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
43 RawDataEvtHeaderCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
47 MsgStream log(messageService(), RawDataEvtHeaderCnv_Name.c_str());
50 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), svc);
51 if ( sc.isFailure() ) {
52 log << MSG::ERROR <<
"Can't get RawDataAccess interface" << endreq;
53 return StatusCode::FAILURE;
57 if (m_RawDataAccess == 0 ) {
58 log << MSG::ERROR <<
"RawDataEvtHeaderCnv: Cant cast to RawDataCnvSvc" << endreq;
59 return StatusCode::FAILURE;
62 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
63 if ( sc.isFailure() ) {
64 log << MSG::WARNING <<
"Cant get RawDataInputSvc " << endreq;
69 if ( m_inputSvc == 0 ) {
70 log << MSG::ERROR <<
"Cant cast to RawDataInputSvc" << endreq;
71 return StatusCode::FAILURE ;
74 _localRevisor =
dynamic_cast<RawDataInputSvc*
>(m_inputSvc)->offlineRevisor();
76 return StatusCode::SUCCESS;
87 return Converter::updateObj(pAddr, pObj);
103 if (evt ==
NULL)
return StatusCode::FAILURE;
112 if ( rBuf.
nBuf() == 1 ) {
113 uint32_t dataLen = rBuf.
bufSize(0);
114 uint32_t * dataPtr = rBuf(0);
123 if ( dataLen > 11 && dataPtr[1] == 0xffffffff ) {
125 if ( (dataPtr[start] >> 24) == 0xcf ) {
128 unsigned long t1 = calEts( dataPtr + start );
131 static unsigned long t2 = 0;
132 if ( (start+3) < dataLen && dataPtr[start+2] != 0xf0f0f0f0 ) {
133 if ((dataPtr[start+2]>>24) == 0xd1 ) {
134 t2 = calEts( dataPtr + start + 2 );
137 uint32_t _dataT2[2] = {dataPtr[10], dataPtr[12]};
138 unsigned long _t2 = calEts( _dataT2 );
139 if ( labs(_t2-t2) < 150*2000 ) {
142 else if ( labs(_t2-2000000-t2) < 150*2000 ) {
145 else if ( labs(_t2+2000000-t2) < 150*2000 ) {
169 return StatusCode::SUCCESS;
177unsigned long RawDataEvtHeaderCnv::calEts(uint32_t* dptr)
179 unsigned int tmp = dptr[0] & 0xffffff;
181 unsigned long val = (tmp >> 16 ) * _localTimeRound * _localTimeRound;
182 val += ((tmp >> 8) & 0xff) * _localTimeRound;
185 val += (dptr[1] & 0x3fffff);
unsigned const long PACKEDRAWEVENT_StorageType
uint32_t bufSize(int i) const
const BufferHolder & getEtsBuf() const
const RawEventHeader & eventHeader() const