BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataEvtHeaderCnv Class Reference

#include <RawDataEvtHeaderCnv.hpp>

Inheritance diagram for RawDataEvtHeaderCnv:

Public Member Functions

 RawDataEvtHeaderCnv (ISvcLocator *svc)
StatusCode initialize ()
StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&pObj)
unsigned long calEts (uint32_t *dptr)
Public Member Functions inherited from RawDataBaseCnv
StatusCode initialize ()
long repSvcType () const
const long storageType ()
Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
destinationoperator (const source &) const
destinationoperator (const source &) const

Static Public Member Functions

static const CLID & classID ()

Additional Inherited Members

Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
Protected Member Functions inherited from RawDataBaseCnv
 RawDataBaseCnv (long storageType, const CLID &clid, ISvcLocator *svc)
 RawDataBaseCnv (ISvcLocator *svc, const CLID &clid)
Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
Protected Attributes inherited from RawDataBaseCnv
std::vector< IRawDataCnvSvc::Leafm_leaves
IRawDataCnvSvcm_cnvSvc
IRawDataInputSvcm_inputSvc

Detailed Description

Definition at line 13 of file RawDataEvtHeaderCnv.hpp.

Constructor & Destructor Documentation

◆ RawDataEvtHeaderCnv()

RawDataEvtHeaderCnv::RawDataEvtHeaderCnv ( ISvcLocator * svc)
inline

Definition at line 15 of file RawDataEvtHeaderCnv.hpp.

15: RawDataBaseCnv( svc, classID() ) {}
RawDataBaseCnv(long storageType, const CLID &clid, ISvcLocator *svc)
static const CLID & classID()

Member Function Documentation

◆ calEts()

unsigned long RawDataEvtHeaderCnv::calEts ( uint32_t * dptr)
inline

Definition at line 92 of file RawDataEvtHeaderCnv.hpp.

92 {
93 unsigned int tmp = dptr[0] & 0xffffff;
94 unsigned long val = ( tmp >> 16 ) * _localTimeRound * _localTimeRound;
95 val += ( ( tmp >> 8 ) & 0xff ) * _localTimeRound;
96 val += tmp & 0xff;
97 val *= 2000000; // s -> 500ns
98 val += ( dptr[1] & 0x3fffff );
99 return val;
100 }

Referenced by createObj().

◆ classID()

const CLID & RawDataEvtHeaderCnv::classID ( )
inlinestatic

Definition at line 33 of file RawDataEvtHeaderCnv.hpp.

33{ return CLID_EventHeader; }
const CLID & CLID_EventHeader

Referenced by RawDataCnvSvc::addConverters(), RawDataCnvSvc::createConverter(), and RawDataEvtHeaderCnv().

◆ createObj()

StatusCode RawDataEvtHeaderCnv::createObj ( IOpaqueAddress * pAddr,
DataObject *& pObj )
inline

Definition at line 35 of file RawDataEvtHeaderCnv.hpp.

35 {
36 StatusCode sc;
37 RawDataAddress* pEFAddr;
38 const RAWEVENT* evt;
39
40 Event::EventHeader* header = new Event::EventHeader();
41 pObj = header;
42
43 // if ( (pEFAddr = dynamic_cast<RawDataAddress*>(pAddr)) ) {
44 evt = m_inputSvc->currentEvent();
45
46 if ( evt == NULL ) return StatusCode::FAILURE;
47
48 header->setEventNumber( evt->eventHeader().event_number() );
49 header->setRunNumber( evt->eventHeader().run_number() );
50 header->setTime( evt->eventHeader().time() );
51 header->setFlag1( evt->eventHeader().flag1() );
52 // header->setFlag2( evt->eventHeader().flag2() );
53
54 const BufferHolder& rBuf = evt->getEtsBuf();
55 if ( rBuf.nBuf() == 1 )
56 { // this event has ETS data
57 uint32_t dataLen = rBuf.bufSize( 0 );
58 uint32_t* dataPtr = rBuf( 0 );
59
60 if ( dataLen > 11 && dataPtr[1] == 0xffffffff )
61 {
62 uint32_t start = 10;
63 if ( ( dataPtr[start] >> 24 ) == 0xcf )
64 {
65 _localTimeRound = _localRevisor->timeRound( header->runNumber() );
66
67 unsigned long t1 = calEts( dataPtr + start );
68 header->setEtsT1( t1 );
69
70 static unsigned long t2 = 0;
71 if ( ( start + 3 ) < dataLen && dataPtr[start + 2] != 0xf0f0f0f0 )
72 {
73 if ( ( dataPtr[start + 2] >> 24 ) == 0xd1 ) { t2 = calEts( dataPtr + start + 2 ); }
74 else
75 {
76 uint32_t _dataT2[2] = { dataPtr[10], dataPtr[12] };
77 unsigned long _t2 = calEts( _dataT2 );
78 if ( labs( _t2 - t2 ) < 150 /*ms*/ * 2000 ) { t2 = _t2; }
79 else if ( labs( _t2 - 2000000 - t2 ) < 150 * 2000 ) { t2 = _t2 - 2000000; }
80 else if ( labs( _t2 + 2000000 - t2 ) < 150 * 2000 ) { t2 = _t2 + 2000000; }
81 }
82 }
83 header->setEtsT2( t2 );
84 }
85 }
86 }
87
88 return StatusCode::SUCCESS;
89 //}
90 }
void setRunNumber(int value)
Update run number.
void setFlag1(unsigned int value)
Update flags.
void setEventNumber(int value)
Update event number.
void setEtsT1(unsigned long value)
Update ETS.
IRawDataInputSvc * m_inputSvc
unsigned long calEts(uint32_t *dptr)

◆ initialize()

StatusCode RawDataEvtHeaderCnv::initialize ( )
inline

Definition at line 17 of file RawDataEvtHeaderCnv.hpp.

17 {
18 MsgStream log( msgSvc(), "RawDataEvtHeaderCnv" );
19 log << MSG::INFO << "RawDataEvtHeaderCnv::initialize" << endmsg;
20
21 StatusCode sc = RawDataBaseCnv::initialize();
22 if ( sc.isFailure() )
23 {
24 log << MSG::ERROR << "Failed to initialize Converter" << endmsg;
25 return sc;
26 }
27
28 _localRevisor = m_inputSvc->offlineRevisor();
29
30 return StatusCode::SUCCESS;
31 }
IMessageSvc * msgSvc()
StatusCode initialize()

The documentation for this class was generated from the following file: