BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MucConverter.cxx
Go to the documentation of this file.
2
3MucConverter* MucConverter::s_instance = 0;
4
6{
7 if ( s_instance == 0 ) {
8 s_instance = new MucConverter();
9 }
10
11 return s_instance;
12}
13
15{
16 if ( s_instance != 0 ) {
17 delete s_instance;
18 s_instance = 0;
19 }
20}
21
22StatusCode MucConverter::convert(const BufferHolder& src, MucDigiCol* des)
23{
24 uint32_t REId, TEId, FecData, StrSqc;
25 uint32_t nbuf = src.nBuf();
26
27 for (uint32_t i = 0; i < nbuf; ++i) {
28 uint32_t* buf = src(i);
29 uint32_t bufSize = src.bufSize(i);
30 for (uint32_t j = 0; j < bufSize; ++j) {
31 m_builder.unPack(buf[j], REId, FecData, StrSqc);
32 TEId = m_builder.getTEID( REId );
33 if ( TEId == 0xFFFFFFFF ) continue;
34
35 uint32_t teidBase = TEId & 0xFF0FFFFF;
36 uint32_t teid;
37 for (uint32_t k = 0; FecData != 0 && k < 16; FecData >>= 1, ++k) {
38 if ((FecData & 1) == 0) continue;
39 if (StrSqc == 0) {
40 teid = teidBase + 15 -k;
41 }
42 else {
43 teid = teidBase + k;
44 }
45 MucDigi* mucDigi = new MucDigi(teid);
46 des->push_back( mucDigi );
47 }
48 }
49 }
50
51 return StatusCode::SUCCESS;
52}
53
55{
56 return m_builder.pack(src, des);
57}
58
59MucConverter::MucConverter()
60{
61}
62
63MucConverter::~MucConverter()
64{
65}
ObjectVector< MucDigi > MucDigiCol
Definition: MucDigi.h:29
uint32_t nBuf() const
Definition: BufferHolder.h:15
uint32_t bufSize(int i) const
Definition: BufferHolder.h:16
virtual StatusCode pack(MucDigiCol *digiCol, WriteRawEvent *&re)
Definition: MucBuilder.cxx:44
virtual void unPack(uint32_t reDigi, uint32_t &REId, uint32_t &FecData, uint32_t &StrSqc)
Definition: MucBuilder.cxx:34
virtual uint32_t getTEID(uint32_t reid)
Definition: MucBuilder.h:17
static MucConverter * instance()
Definition: MucConverter.cxx:5
static void destroy()
StatusCode convert(const BufferHolder &src, MucDigiCol *des)