98 std::string name =
m_storeGate->proxy(cont)->name();
99 auto vecCell = std::make_unique<TileCellVec>();
102 ATH_MSG_DEBUG(
"storing TileCells from " << name <<
" in POOL");
107 std::vector<const TileCell *> allCells;
112 for (
const TileCell* cell : *cont) {
114 <<
" time=" << cell->time()
115 <<
" qual=" << (
int)cell->qual1()
116 <<
" gain=" << (
int)cell->gain());
117 unsigned int id = cell->ID().get_identifier32().get_compact();
118 int ene =
round32(cell->energy() * 1000.);
119 unsigned int tim = 0x8000 +
round16(cell->time()*100.);
120 unsigned int qua = std::max(0, std::min(0xFF, (
int)cell->qual1()));
121 unsigned int gai = std::max(0, std::min(0xFF, 0x80 + (
int)(cell->gain())));
122 unsigned int tqg = (tim<<16) | (qua<<8) | gai;
123 vecCell->push_back(
id);
124 vecCell->push_back((
unsigned int)ene);
125 vecCell->push_back(tqg);
127 " " << ene <<
" " << tqg << MSG::dec);
135 for (
const TileCell* cell : *cont) {
143 allCells[ind] = cell;
146 allCells.push_back(cell);
149 allCells.push_back(cell);
162 const TileCell* cell = allCells[ind];
164 energy =
round32(cell->energy() * 1000.);
165 time =
round16(cell->time() * 100.);
166 quality= cell->qual1();
170 " ene=" << cell->energy() <<
171 " time=" << cell->time() <<
172 " qual=" << (
int)cell->qual1() <<
173 " gain=" << (
int)cell->gain());
176 ATH_MSG_VERBOSE(
"ind=" << ind <<
" create MBTS cell with zero energy");
181 -0x10000 < energy && energy < 0xEFFFF &&
182 -17 < gain && gain < 0 ) {
184 unsigned int ene = energy+0x10000;
185 unsigned int qua = std::max(0, std::min(0xFF, quality));
187 unsigned int gqe = (gai << 28) | (qua<<20) | ene;
188 vecCell->push_back(gqe);
191 MSG::hex << gqe << MSG::dec);
196 unsigned int ene = std::max(0, std::min(0x7FFFFFFF, 0x40000000 + energy));
197 unsigned int tim = std::max(0, std::min(0xFFFF, 0x8000 + time));
198 unsigned int qua = std::max(0, std::min(0xFF, quality));
199 unsigned int gai = std::max(0, std::min(0xFF, 0x80 + gain));
200 unsigned int tqg = (tim<<16) | (qua<<8) | gai;
201 vecCell->push_back(ene);
202 vecCell->push_back(tqg);
205 MSG::hex << ene <<
" " << tqg << MSG::dec);
215 for (
unsigned int ind=
NCELLMBTS; ind<allCells.size(); ++ind) {
217 const TileCell* cell = allCells[ind];
220 " ene=" << cell->energy() <<
221 " time=" << cell->time() <<
222 " qual=" << (
int)cell->qual1() <<
223 " gain=" << (
int)cell->gain());
225 unsigned int id = cell->ID().get_identifier32().get_compact();
226 int ene =
round32(cell->energy() * 1000.);
227 unsigned int tim = 0x8000 +
round16(cell->time()*100.);
228 unsigned int qua = std::max(0, std::min(0xFF, (
int)cell->qual1()));
229 unsigned int gai = std::max(0, std::min(0xFF, 0x80 + (
int)(cell->gain())));
230 unsigned int tqg = (tim<<16) | (qua<<8) | gai;
231 vecCell->push_back(
id);
232 vecCell->push_back((
unsigned int)ene);
233 vecCell->push_back(tqg);
236 MSG::hex <<
id <<
" " << ene <<
" " << tqg << MSG::dec);
246 ATH_MSG_DEBUG(
"Storing data vector of size " << vecCell->size() <<
" with version " << vecCell->front());
248 return vecCell.release();
260 auto cont = std::make_unique<TileCellContainer>();
262 TileCellVec::const_iterator it =
vec->begin();
263 TileCellVec::const_iterator last =
vec->end();
265 unsigned int version = *it++;
271 for (; it != last; ) {
274 int ene = (int)(*it++);
275 unsigned int tqg = *it++;
277 float ener = ene*1e-3;
278 float time = ((int)(tqg>>16) - 0x8000 ) * 0.01;
279 uint16_t qual = ((tqg>>8) & 0xFF);
281 int gain = (int)(tqg & 0xFF) - 0x80;
284 MSG::hex <<
id << MSG::dec <<
" " << ene <<
" " <<
285 MSG::hex << tqg << MSG::dec);
288 " qual=" << qual <<
" gain=" << gain);
291 cont->push_back(cell);
297 for (; it != last; ) {
308 msg() << MSG::VERBOSE <<
"reading cell " << iCell <<
" ";
315 int ene = (int)(*it++);
318 msg() << MSG::hex <<
id <<
" " << ene <<
" " << MSG::dec;
326 ener = ((ene & 0xFFFFF) - 0x10000) * 1e-3;
327 qual = ((ene>>20) & 0xFF);
328 gain =
m_gain[((ene>>28) & 0x7)];
332 unsigned int tqg = *it++;
335 ener = (ene - 0x40000000) * 1e-3;
336 time = ((int)(tqg>>16) - 0x8000 ) * 0.01;
337 qual = ((tqg>>8) & 0xFF);
338 gain = (int)(tqg & 0xFF) - 0x80;
344 int ene = (int)(*it++);
345 unsigned int tqg = *it++;
348 " " << MSG::hex << tqg << MSG::dec);
351 time = ((int)(tqg>>16) - 0x8000 ) * 0.01;
352 qual = ((tqg>>8) & 0xFF);
353 gain = (int)(tqg & 0xFF) - 0x80;
357 <<
" qual=" << qual <<
" gain=" << gain);
361 cont->push_back(cell);
372 ATH_MSG_ERROR(
"Unknown version of TileCellVec, ver="<<version);
375 return cont.release();