1#include "Identifier/TofID.h"
2#include "RawDataCnv/Util/TofConverter.h"
8 if ( s_instance == 0 ) {
17 if ( s_instance != 0 ) {
26 return this->
convert(src, tmp, des, des2);
34 uint32_t REId, TEId, TEData, TEOverflow, TETorQ;
35 uint32_t n1buf = tof.
nBuf();
36 uint32_t n2buf = etf.
nBuf();
37 uint32_t nbuf = n1buf + n2buf;
40 typedef std::multimap<uint32_t, TofDigi*>::iterator my_iter;
41 std::multimap<uint32_t, TofDigi*> mapIdData;
44 for (uint32_t i = 0; i < nbuf; ++i) {
45 bool isTof = (i < n1buf);
47 uint32_t ii = isTof ? i : (i-n1buf);
48 uint32_t* buf = rBH(ii);
49 uint32_t bufSize = rBH.
bufSize(ii);
50 for (uint32_t j = 0; j < bufSize; ++j) {
52 m_builder.
unPack(buf[j], REId, TEData, TEOverflow, TETorQ);
53 TEId = m_builder.
getTEID( REId);
56 this->unPackETF(buf[j], TEId, TEData, TEOverflow, TETorQ);
59 if ( TEId == 0xFFFFFFFF ) {
60 uint32_t data_unit = buf[j];
61 if ( (data_unit >> 25) == 0x7F ) {
64 des->push_back(tofDigi);
69 uint32_t
count = mapIdData.count(TEId);
80 mapIdData.insert(make_pair(TEId, tofDigi));
83 pair<my_iter, my_iter> range = mapIdData.equal_range(TEId);
90 while ((++it) != range.second) {
97 while (it != range.second) {
98 tofDigi = (it++)->second;
103 mapIdData.insert(make_pair(TEId, tofDigi));
110 while ((++it) != range.second) {
111 tofDigi = it->second;
117 while (it != range.second) {
118 tofDigi = (it++)->second;
123 mapIdData.insert(make_pair(TEId, tofDigi));
130 my_iter end = mapIdData.end();
131 for (it = mapIdData.begin(); it != end; ++it) {
133 tofDigi = it->second;
134 if ( (TEId&0xFFFF7FFF) != 0x20000060 ) {
135 des->push_back(tofDigi);
140 des2->push_back(
new LumiDigi(tofDigi));
146 return StatusCode::SUCCESS;
151 return m_builder.
pack(src, des);
154TofConverter::TofConverter()
158TofConverter::~TofConverter()
162void TofConverter::unPackETF(uint32_t reDigi, uint32_t& TEId, uint32_t& TEData,
163 uint32_t& TEOverflow, uint32_t& TETorQ)
165 if ( (reDigi>>25) == 0x7F ) {
170 int id = ((reDigi>>25)&0x3F);
171 int pad = ((reDigi>>21)&0xF);
172 int sb = ((reDigi>>20)&1);
175 TEData = reDigi&0x7FFFF;
177 TETorQ = ((reDigi>>19)&1);
ObjectVector< LumiDigi > LumiDigiCol
DOUBLE_PRECISION count[2]
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)
static value_type getIntID(int barrel_ec, int layer, int phi_module, int end)