1#include "GaudiKernel/Bootstrap.h"
2#include "GaudiKernel/ISvcLocator.h"
3#include "GaudiKernel/IJobOptionsSvc.h"
4#include "Identifier/MucID.h"
5#include "RawDataCnv/EventManagement/MucBuilder.h"
12 if (!m_fec2idFile.empty())
return;
13 m_propMgr.declareProperty(
"Fec2IdMap", m_fec2idFile);
16 IJobOptionsSvc* jobSvc;
17 Gaudi::svcLocator()->service(
"JobOptionsSvc", jobSvc);
18 jobSvc->setMyProperties(
"MucBuilder", &m_propMgr);
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));
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];
47 cerr <<
"MdcBuilder::pack can't get digiCol" << endl;
48 return StatusCode::FAILURE;
51 uint32_t size = 0, index;
52 uint32_t teid, reid, channel;
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));
60 for (index = 0; index < size; index++) {
61 if ((
m_buf[index]>>16) == reid) {
62 m_buf[index] |= channel;
67 if (index == size)
m_buf[size++] = ((reid << 16) | (channel));
72 return StatusCode::SUCCESS;
78 ifstream fs(fec2idFile.c_str());
80 cerr <<
"Error: could not open file " << fec2idFile << endl;
86 int fec, part, seg, layer, firstStr, strSqc;
88 for (
int i = 0; i < 572; i++) {
89 fs >> fec >> part >> seg >> layer >> firstStr >> strSqc;
96 strSqcVec[reid] = strSqc + 1;
97 m_te2reMap.insert(TE2REMAP::value_type(teid, reid));
101 return StatusCode::SUCCESS;
106 TE2REMAP::iterator itr = m_te2reMap.find(teid);
108 if (itr == m_te2reMap.end()) {
109 cout <<
"wrong teid in muc " << teid << endl;
ObjectVector< MucDigi > MucDigiCol
void append2event(WriteRawEvent *&re, uint32_t source_id, uint32_t size)
virtual StatusCode pack(MucDigiCol *digiCol, WriteRawEvent *&re)
virtual void unPack(uint32_t reDigi, uint32_t &REId, uint32_t &FecData, uint32_t &StrSqc)
virtual StatusCode initialize(string &initFile)
virtual uint32_t getREID(uint32_t teid)
static value_type getIntID(int barrel_ec, int segment, int layer, int channel)