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

#include <RawDataEvtHeaderCnv.h>

+ Inheritance diagram for RawDataEvtHeaderCnv:

Public Member Functions

StatusCode initialize ()
 
virtual long repSvcType () const
 
StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&pObj)
 
virtual StatusCode updateObj (IOpaqueAddress *, DataObject *)
 override the RawDataBaseCnv version
 
- Public Member Functions inherited from RawDataBaseCnv
 RawDataBaseCnv (ISvcLocator *svc)
 
 RawDataBaseCnv (unsigned char storageType, const CLID &clid, ISvcLocator *svc)
 
virtual ~RawDataBaseCnv ()
 
virtual long repSvcType () const
 
StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &bank, long par=0)
 Store TDS path to link a particular converter to an object on the TDS.
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the converted representation of a transient object.
 
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the references of an already converted object.
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
static const unsigned char storageType ()
 
- Static Public Member Functions inherited from RawDataBaseCnv
static const long storageType ()
 
static const CLID & classID ()
 

Protected Member Functions

 RawDataEvtHeaderCnv (ISvcLocator *svc)
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< RawDataEvtHeaderCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from RawDataBaseCnv
IRawDataCnvSvcm_CnvSvc
 Pointer to event conversion service interface.
 
std::vector< IRawDataCnvSvc::Leafm_leaves
 Leaf objects giving the locations of the objects in the data store.
 

Detailed Description

Definition at line 17 of file RawDataEvtHeaderCnv.h.

Constructor & Destructor Documentation

◆ RawDataEvtHeaderCnv()

RawDataEvtHeaderCnv::RawDataEvtHeaderCnv ( ISvcLocator *  svc)
protected

Definition at line 19 of file RawDataEvtHeaderCnv.cxx.

19 :
21{
22 // for Mutil-thread by tianhl
23 //init();
24 // for Mutil-thread by tianhl
25}
unsigned const long PACKEDRAWEVENT_StorageType
Definition: ClassID_temp.h:17
static const CLID & classID()

Member Function Documentation

◆ classID()

const CLID & RawDataEvtHeaderCnv::classID ( )
static

Definition at line 79 of file RawDataEvtHeaderCnv.cxx.

80{
81 return CLID_EventHeader;
82}
const CLID & CLID_EventHeader
Definition: EventModel.cxx:196

Referenced by PackedRawDataCnvSvc::addConverters().

◆ createObj()

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

Definition at line 91 of file RawDataEvtHeaderCnv.cxx.

92{
93 StatusCode sc;
94 RawDataAddress *pEFAddr;
95 const RAWEVENT *evt;
96
98 pObj = header;
99
100 //if ( (pEFAddr = dynamic_cast<RawDataAddress*>(pAddr)) ) {
101 evt = m_inputSvc->currentEvent();
102
103 if (evt == NULL) return StatusCode::FAILURE;
104
105 header->setEventNumber(evt->eventHeader().event_number());
106 header->setRunNumber(evt->eventHeader().run_number());
107 header->setTime(evt->eventHeader().time());
108 header->setFlag1( evt->eventHeader().flag1() );
109 //header->setFlag2( evt->eventHeader().flag2() );
110
111 const BufferHolder& rBuf = evt->getEtsBuf();
112 if ( rBuf.nBuf() == 1 ) { // this event has ETS data
113 uint32_t dataLen = rBuf.bufSize(0);
114 uint32_t * dataPtr = rBuf(0);
115 //{ // debug
116 // std::cout << "[ETS]: " << std::hex;
117 // for ( uint32_t i = 0; i < dataLen; ++i ) {
118 // std::cout << " 0x" << std::setw(8) << std::setfill('0') << dataPtr[i];
119 // }
120 // std::cout << std::dec << std::endl;
121 //}
122 // check
123 if ( dataLen > 11 && dataPtr[1] == 0xffffffff ) {
124 uint32_t start = 10;
125 if ( (dataPtr[start] >> 24) == 0xcf ) {
126 _localTimeRound = _localRevisor->timeRound(header->runNumber());
127
128 unsigned long t1 = calEts( dataPtr + start );
129 header->setEtsT1(t1);
130
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 );
135 }
136 else {
137 uint32_t _dataT2[2] = {dataPtr[10], dataPtr[12]};
138 unsigned long _t2 = calEts( _dataT2 );
139 if ( labs(_t2-t2) < 150/*ms*/*2000 ) {
140 t2 = _t2;
141 }
142 else if ( labs(_t2-2000000-t2) < 150*2000 ) {
143 t2 = _t2 - 2000000;
144 }
145 else if ( labs(_t2+2000000-t2) < 150*2000 ) {
146 t2 = _t2 + 2000000;
147 }
148 }
149 }
150 header->setEtsT2(t2);
151
152 //do not revise ets here, move to ResetEtsAlg
153 //_localRevisor->fixHeader(header);
154
155 //if ( header->etsT1() != t1 || header->etsT2() != t2 )
156 //{
157 // std::cout << "event " << header->eventNumber()
158 // << " time " << header->time()
159 // << " new t1 " << header->etsT1()
160 // << " old t1 " << t1
161 // << " new t2 " << header->etsT2()
162 // << " old t2 " << t2
163 // << std::endl;
164 //}
165 }
166 }
167 }
168
169 return StatusCode::SUCCESS;
170 //}
171 //else {
172 // return StatusCode::FAILURE;
173 //}
174
175}
uint32_t nBuf() const
Definition: BufferHolder.h:15
uint32_t bufSize(int i) const
Definition: BufferHolder.h:16
void setRunNumber(int value)
Update run number.
Definition: EventHeader.h:44
void setTime(int value)
Definition: EventHeader.h:48
void setFlag1(unsigned int value)
Update flags.
Definition: EventHeader.h:59
int runNumber() const
Retrieve run number.
Definition: EventHeader.h:42
void setEventNumber(int value)
Update event number.
Definition: EventHeader.h:39
void setEtsT2(unsigned long value)
Definition: EventHeader.h:71
void setEtsT1(unsigned long value)
Update ETS.
Definition: EventHeader.h:69
virtual RAWEVENT * currentEvent()=0
int timeRound(int run)
Definition: OfflineRevise.h:17
uint32_t flag1() const
Definition: RAWEVENT.h:26
uint32_t run_number() const
Definition: RAWEVENT.h:22
uint32_t event_number() const
Definition: RAWEVENT.h:23
uint32_t time() const
Definition: RAWEVENT.h:24
const BufferHolder & getEtsBuf() const
Definition: RAWEVENT.h:103
const RawEventHeader & eventHeader() const
Definition: RAWEVENT.h:93

◆ initialize()

StatusCode RawDataEvtHeaderCnv::initialize ( )

Definition at line 27 of file RawDataEvtHeaderCnv.cxx.

28{
29 StatusCode sc = RawDataBaseCnv::initialize();
30 if ( sc.isFailure() ) return sc;
31
32 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
33 std::string RawDataInputSvc_Name("RawDataInputSvc");
34 std::string RawDataEvtHeaderCnv_Name("RawDataEvtHeaderCnv");
35
36 // for Mutil-thread by tianhl
37 //ConversionSvc* pCnvSvc = 0;
38 //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
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());
44 }
45 //}
46 // for Mutil-thread by tianhl
47 MsgStream log(messageService(), RawDataEvtHeaderCnv_Name.c_str());
48
49 IService* svc = 0;
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;
54 }
55
56 m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (svc);
57 if (m_RawDataAccess == 0 ) {
58 log << MSG::ERROR << "RawDataEvtHeaderCnv: Cant cast to RawDataCnvSvc" << endreq;
59 return StatusCode::FAILURE;
60 }
61
62 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
63 if ( sc.isFailure() ) {
64 log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq;
65 return sc ;
66 }
67
68 m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
69 if ( m_inputSvc == 0 ) {
70 log << MSG::ERROR << "Cant cast to RawDataInputSvc" << endreq;
71 return StatusCode::FAILURE ;
72 }
73
74 _localRevisor = dynamic_cast<RawDataInputSvc*>(m_inputSvc)->offlineRevisor();
75
76 return StatusCode::SUCCESS;
77}
StatusCode initialize()

◆ repSvcType()

virtual long RawDataEvtHeaderCnv::repSvcType ( ) const
inlinevirtual

Reimplemented from RawDataBaseCnv.

Definition at line 32 of file RawDataEvtHeaderCnv.h.

32 {
34 }

◆ storageType()

static const unsigned char RawDataEvtHeaderCnv::storageType ( )
inlinestatic

Definition at line 36 of file RawDataEvtHeaderCnv.h.

36 {
38 }

◆ updateObj()

StatusCode RawDataEvtHeaderCnv::updateObj ( IOpaqueAddress *  pAddr,
DataObject *  pObj 
)
virtual

override the RawDataBaseCnv version

Definition at line 84 of file RawDataEvtHeaderCnv.cxx.

84 {
85 //MsgStream log(msgSvc(), "RawDataEvtHeaderCnv");
86 //log << MSG::DEBUG << "RawDataEvtHeaderCnv::updateObj" << endreq;
87 return Converter::updateObj(pAddr, pObj);
88}

Friends And Related Function Documentation

◆ CnvFactory< RawDataEvtHeaderCnv >

friend class CnvFactory< RawDataEvtHeaderCnv >
friend

Definition at line 1 of file RawDataEvtHeaderCnv.h.


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