BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
MucBuilder Class Reference

#include <MucBuilder.h>

+ Inheritance diagram for MucBuilder:

Public Member Functions

 MucBuilder ()
 
virtual ~MucBuilder ()
 
virtual StatusCode initialize (string &initFile)
 
virtual uint32_t getTEID (uint32_t reid)
 
virtual uint32_t getREID (uint32_t teid)
 
virtual void unPack (uint32_t reDigi, uint32_t &REId, uint32_t &FecData, uint32_t &StrSqc)
 
virtual StatusCode pack (MucDigiCol *digiCol, WriteRawEvent *&re)
 
virtual StatusCode initialize (string &initFile)
 
virtual uint32_t getTEID (uint32_t teid)=0
 
virtual uint32_t getREID (uint32_t reid)=0
 

Additional Inherited Members

- Public Types inherited from Builder
typedef std::map< uint32_t, uint32_t > TE2REMAP
 
- Static Public Member Functions inherited from Builder
static bool expect (ifstream &f, string msg, string fname)
 
static bool expectInt (ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2)
 
static bool expectLong (ifstream &f, string msg, string fname, uint64_t &val)
 
static bool find (ifstream &f, string msg, string fname)
 
- Protected Member Functions inherited from Builder
 Builder ()
 
virtual ~Builder ()
 
void append2event (WriteRawEvent *&re, uint32_t source_id, uint32_t size, uint32_t shift=0)
 
- Protected Attributes inherited from Builder
PropertyMgr m_propMgr
 
uint32_t * m_buf
 
uint32_t m_status
 
- Static Protected Attributes inherited from Builder
static string m_confFile
 

Detailed Description

Definition at line 10 of file MucBuilder.h.

Constructor & Destructor Documentation

◆ MucBuilder()

MucBuilder::MucBuilder ( )

Definition at line 9 of file MucBuilder.cxx.

10 :Builder()
11{
12 if (!m_fec2idFile.empty()) return;
13 m_propMgr.declareProperty("Fec2IdMap", m_fec2idFile);
14
15 // Get a pointer to the Job Options Service
16 IJobOptionsSvc* jobSvc;
17 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
18 jobSvc->setMyProperties("MucBuilder", &m_propMgr);
19
20 m_re2te = new uint32_t[1024];
21 strSqcVec = new uint32_t[1024];
22 memset((void*)m_re2te, 0xFF, 1024*sizeof(uint32_t));
23 memset((void*)strSqcVec, 0, 1024*sizeof(uint32_t));
24
25 initialize (m_fec2idFile);
26}
Builder()
Definition: Builder.cxx:8
virtual StatusCode initialize(string &initFile)
Definition: MucBuilder.cxx:76

◆ ~MucBuilder()

MucBuilder::~MucBuilder ( )
virtual

Definition at line 28 of file MucBuilder.cxx.

29{
30 delete m_re2te;
31 delete strSqcVec;
32}

Member Function Documentation

◆ getREID()

uint32_t MucBuilder::getREID ( uint32_t  teid)
virtual

Implements Builder.

Definition at line 104 of file MucBuilder.cxx.

105{
106 TE2REMAP::iterator itr = m_te2reMap.find(teid);
107
108 if (itr == m_te2reMap.end()) {
109 cout << "wrong teid in muc " << teid << endl;
110 exit(8);
111 }
112
113 return itr->second;
114}

Referenced by pack().

◆ getTEID()

virtual uint32_t MucBuilder::getTEID ( uint32_t  reid)
inlinevirtual

Implements Builder.

Definition at line 17 of file MucBuilder.h.

17 {
18 if ( reid > 1023 ) return 0xFFFFFFFF;
19 return m_re2te[reid];
20 }

Referenced by MucConverter::convert().

◆ initialize()

StatusCode MucBuilder::initialize ( string &  initFile)
virtual

Reimplemented from Builder.

Definition at line 76 of file MucBuilder.cxx.

77{
78 ifstream fs(fec2idFile.c_str());
79 if( fs.bad() ) {
80 cerr << "Error: could not open file " << fec2idFile << endl;
81 return false;
82 }
83
84 fs.ignore(256, '\n');
85
86 int fec, part, seg, layer, firstStr, strSqc;
87
88 for (int i = 0; i < 572; i++) {
89 fs >> fec >> part >> seg >> layer >> firstStr >> strSqc;
90 // reid ... teid
91 uint32_t reid = fec; // ?
92 uint32_t teid = MucID::getIntID(part, seg, layer, firstStr);
93 //if (strSqc < 0) teid |= 0x00F00000; // local teid
94
95 m_re2te[reid] = teid;
96 strSqcVec[reid] = strSqc + 1;
97 m_te2reMap.insert(TE2REMAP::value_type(teid, reid));
98 //cout << "teid " << teid << " reid " << reid << " strSqc " << strSqcVec[reid] << endl;
99 }
100
101 return StatusCode::SUCCESS;
102}
static value_type getIntID(int barrel_ec, int segment, int layer, int channel)
Definition: MucID.cxx:147
std::ifstream ifstream
Definition: bpkt_streams.h:44

Referenced by MucBuilder().

◆ pack()

StatusCode MucBuilder::pack ( MucDigiCol digiCol,
WriteRawEvent *&  re 
)
virtual

Definition at line 44 of file MucBuilder.cxx.

45{
46 if (digiCol == 0 ) {
47 cerr << "MdcBuilder::pack can't get digiCol" << endl;
48 return StatusCode::FAILURE;
49 }
50
51 uint32_t size = 0, index;
52 uint32_t teid, reid, channel;
53
54 MucDigiCol::const_iterator pMucDigi = digiCol->begin();
55 for (pMucDigi; pMucDigi!= digiCol->end(); pMucDigi++) {
56 teid = (*pMucDigi)->getIntId();
57 reid = getREID(teid&0xFFFFFFF0);
58 channel = (strSqcVec[reid] == 0) ? (0x8000>>(teid&0xF)) : (0x1<<(teid&0xF));
59 // set the value if the current reid has been in the buffer
60 for (index = 0; index < size; index++) {
61 if ((m_buf[index]>>16) == reid) {
62 m_buf[index] |= channel;
63 break;
64 }
65 }
66 // otherwise, append the current reid and value to the buffer
67 if (index == size) m_buf[size++] = ((reid << 16) | (channel));
68 }
69
70 append2event(re, 0xa40000, size);
71
72 return StatusCode::SUCCESS;
73}
void append2event(WriteRawEvent *&re, uint32_t source_id, uint32_t size, uint32_t shift=0)
Definition: Builder.cxx:76
virtual uint32_t getREID(uint32_t teid)
Definition: MucBuilder.cxx:104

Referenced by MucConverter::convert().

◆ unPack()

void MucBuilder::unPack ( uint32_t  reDigi,
uint32_t &  REId,
uint32_t &  FecData,
uint32_t &  StrSqc 
)
virtual

Definition at line 34 of file MucBuilder.cxx.

35{
36 uint32_t fecAddr = (reDigi&0xFFFF0000) >> 16;
37 uint32_t module = (fecAddr&0xF800) >> 5;
38 REId = (fecAddr&0x07FF) | module;
39 FecData = reDigi&0xFFFF;
40 StrSqc = strSqcVec[REId];
41 return;
42}

Referenced by MucConverter::convert().


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