1#include "RawDataCnv/Util/TofConverter.h"
7 if ( s_instance == 0 ) {
16 if ( s_instance != 0 ) {
24 uint32_t REId, TEId, TEData, TEOverflow, TETorQ;
25 uint32_t nbuf = src.
nBuf();
28 typedef std::multimap<uint32_t, TofDigi*>::iterator my_iter;
29 std::multimap<uint32_t, TofDigi*> mapIdData;
32 for (uint32_t i = 0; i < nbuf; ++i) {
33 uint32_t* buf = src(i);
34 uint32_t bufSize = src.
bufSize(i);
35 for (uint32_t j = 0; j < bufSize; ++j) {
36 m_builder.
unPack(buf[j], REId, TEData, TEOverflow, TETorQ);
37 TEId = m_builder.
getTEID( REId);
38 if ( TEId == 0xFFFFFFFF ) {
39 uint32_t data_unit = buf[j];
40 if ( (data_unit >> 25) == 0x7F ) {
43 des->push_back(tofDigi);
48 uint32_t count = mapIdData.count(TEId);
59 mapIdData.insert(make_pair(TEId, tofDigi));
62 pair<my_iter, my_iter> range = mapIdData.equal_range(TEId);
69 while ((++it) != range.second) {
75 uint32_t flag = (tofDigi->
getOverflow() & 0x3C) | 8;
76 while (it != range.second) {
77 tofDigi = (it++)->second;
82 mapIdData.insert(make_pair(TEId, tofDigi));
89 while ((++it) != range.second) {
95 uint32_t flag = (tofDigi->
getOverflow() & 0x3C) | 4;
96 while (it != range.second) {
97 tofDigi = (it++)->second;
102 mapIdData.insert(make_pair(TEId, tofDigi));
109 my_iter end = mapIdData.end();
110 for (it = mapIdData.begin(); it != end; ++it) {
112 tofDigi = it->second;
113 if ( (TEId&0xFFFF7FFF) != 0x20000060 ) {
114 des->push_back(tofDigi);
119 des2->push_back(
new LumiDigi(tofDigi));
125 return StatusCode::SUCCESS;
130 return m_builder.
pack(src, des);
133TofConverter::TofConverter()
137TofConverter::~TofConverter()
ObjectVector< LumiDigi > LumiDigiCol
ObjectVector< TofDigi > TofDigiCol
uint32_t bufSize(int i) const
void setChargeChannel(const unsigned int chargeChannel)
unsigned int getChargeChannel() const
void setTimeChannel(const unsigned int timeChannel)
unsigned int getTimeChannel() const
virtual uint32_t getTEID(uint32_t reid)
virtual StatusCode pack(TofDigiCol *digiCol, WriteRawEvent *&re)
virtual void unPack(uint32_t reDigi, uint32_t &REId, uint32_t &TEData, uint32_t &overFlow, uint32_t &TorQ)
StatusCode convert(const BufferHolder &src, TofDigiCol *des, LumiDigiCol *des2=0)
static TofConverter * instance()
unsigned int getOverflow()
void setOverflow(const unsigned int overflow)