127 DataVect energyVec; energyVec.reserve(cellContainer->
size());
128 DataVect adcCounts1Vec; adcCounts1Vec.reserve(cellContainer->
size() * 10);
129 DataVect adcCounts2Vec; adcCounts2Vec.reserve(cellContainer->
size() * 10);
130 DataVect BadCell; BadCell.reserve(cellContainer->
size());
132 DataVect pmt1Energy; pmt1Energy.reserve(cellContainer->
size());
133 DataVect pmt1Time; pmt1Time.reserve(cellContainer->
size());
134 DataVect pmt1Chi2; pmt1Chi2.reserve(cellContainer->
size());
135 DataVect pmt1Gain; pmt1Gain.reserve(cellContainer->
size());
136 DataVect pmt2Energy; pmt2Energy.reserve(cellContainer->
size());
137 DataVect pmt2Time; pmt2Time.reserve(cellContainer->
size());
138 DataVect pmt2Chi2; pmt2Chi2.reserve(cellContainer->
size());
139 DataVect pmt2Gain; pmt2Gain.reserve(cellContainer->
size());
141 DataVect pmt1RawAmplitude; pmt1RawAmplitude.reserve(cellContainer->
size());
142 DataVect pmt1RawTime; pmt1RawTime.reserve(cellContainer->
size());
143 DataVect pmt1Pedestal; pmt1Pedestal.reserve(cellContainer->
size());
144 DataVect pmt1Number; pmt1Number.reserve(cellContainer->
size());
145 DataVect pmt1ADCStatus; pmt1ADCStatus.reserve(cellContainer->
size());
146 DataVect pmt2RawAmplitude; pmt2RawAmplitude.reserve(cellContainer->
size());
147 DataVect pmt2RawTime; pmt2RawTime.reserve(cellContainer->
size());
148 DataVect pmt2Pedestal; pmt2Pedestal.reserve(cellContainer->
size());
149 DataVect pmt2Number; pmt2Number.reserve(cellContainer->
size());
150 DataVect pmt2ADCStatus; pmt2ADCStatus.reserve(cellContainer->
size());
155 std::string adcCounts1Str =
"adcCounts1 multiple=\"0\"";
156 std::string adcCounts2Str =
"adcCounts2 multiple=\"0\"";
158 const TileID* tileID =
nullptr;
165 double amplitude = 0.;
166 const int vsize = cellContainer->
size();
167 int Index,pmtInd, cellInd, nTileSamples=0;
168 std::vector<double> pmt1ped(vsize,0.0);
169 std::vector<double> pmt2ped(vsize,0.0);
170 std::vector<double> pmt1rawamp(vsize,0.0);
171 std::vector<double> pmt2rawamp(vsize,0.0);
172 std::vector<double> pmt1rawtime(vsize,0.0);
173 std::vector<double> pmt2rawtime(vsize,0.0);
174 std::vector<int> pmt1number(vsize,0);
175 std::vector<int> pmt2number(vsize,0);
176 std::vector<unsigned long int> pmt1status(vsize,0);
177 std::vector<unsigned long int> pmt2status(vsize,0);
178 std::map<int,std::vector<float> > pmt1digit;
179 std::map<int,std::vector<float> > pmt2digit;
180 bool offlineRch =
false;
185 ATH_MSG_ERROR(
"in getCaloTileData(), Could not retrieve TileID" );
190 ATH_MSG_ERROR(
"in getCaloTileData(), Could not retrieve TileHWID" );
194 ATH_MSG_ERROR(
"in getCaloTileData(), Could not retrieve TileInfo" );
212 RChUnit = RawChannelCnt->
get_unit();
224 for (
const auto rawChannel : *RawChannelCnt) {
226 for (
const auto cell : *rawChannel) {
229 if (
Index <= -1 )
continue;
231 cellInd = cellContainer->
findIndex(cell_hash);
232 if (cellInd < 0)
continue;
235 int adc = tileHWID->
adc(hwid);
238 int ros = tileHWID->
ros(hwid);
243 amplitude =
cell->amplitude();
255 pmt1ped[cellInd] =
cell->pedestal();
256 pmt1rawamp[cellInd] = amplitude;
257 pmt1rawtime[cellInd] =
cell->uncorrTime();
258 pmt1number[cellInd] = PMT;
259 pmt1status[cellInd] = tileAdcStatus;
263 pmt2ped[cellInd] =
cell->pedestal();
264 pmt2rawamp[cellInd] = amplitude;
265 pmt2rawtime[cellInd] =
cell->uncorrTime();
266 pmt2number[cellInd] = PMT;
267 pmt2status[cellInd] = tileAdcStatus;
283 for (
const auto digitChannel : *tileDigits) {
285 for (
const auto cell : *digitChannel) {
288 if (
Index <= -1 )
continue;
290 cellInd = cellContainer->
findIndex(cell_hash);
291 if (cellInd < 0)
continue;
294 nTileSamples =
cell->NtimeSamples();
295 std::vector<float> tileSamples =
cell->samples();
298 pmt1digit.insert(std::make_pair( cellInd, tileSamples ) );
301 pmt2digit.insert(std::make_pair( cellInd, tileSamples ) );
314 double energyAllTile = 0.;
318 if ((*it1)->badcell()) BadCell.push_back(1);
320 else BadCell.push_back(-1);
324 cellInd = cellContainer->
findIndex(cell_hash);
327 energyGeV = (*it1)->energy()*(1./
GeV);
329 energyAllTile += energyGeV;
337 if ( !pmt1digit[cellInd].
empty()) {
338 for (
int i=0;
i<nTileSamples;
i++) {
339 adcCounts1Str=
"adcCounts1 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
340 adcCounts1Vec.push_back(
DataType(
int(pmt1digit[cellInd][
i])));
344 for (
int i=0;
i<nTileSamples;
i++) {
345 adcCounts1Str=
"adcCounts1 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
346 adcCounts1Vec.push_back(
DataType(0));
351 if ( !pmt2digit[cellInd].
empty()) {
352 for (
int i=0;
i<nTileSamples;
i++) {
353 adcCounts2Str=
"adcCounts2 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
354 adcCounts2Vec.push_back(
DataType(
int(pmt2digit[cellInd][
i])));
358 for (
int i=0;
i<nTileSamples;
i++) {
359 adcCounts2Str=
"adcCounts2 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
360 adcCounts2Vec.push_back(
DataType(0));
368 if (not theTileCell) {
370 throw std::runtime_error(
"Could not cast pointer to TileCell in CaloTileRetriever::getCaloTileData");
372 int gain1 = theTileCell->gain1();
373 int qual1 = theTileCell->qual1();
374 bool badch1 = theTileCell->badch1();
375 bool noch1 = (gain1<0 || gain1>1);
377 int qual2 = theTileCell->qual2();
378 int gain2 = theTileCell->gain2();
379 bool badch2 = theTileCell->badch2();
380 bool noch2 = (gain2<0 || gain2>1);
382 if (badch1 != badch2 && qual1 != qual2 && qual1 < 255 && qual2 < 255) {
386 if (badch1) qual1 = -qual1;
387 if (badch2) qual2 = -qual2;
389 pmt1Energy.push_back(
DataType(theTileCell->ene1()*(1./
GeV)));
390 pmt1Time.push_back(
DataType(theTileCell->time1()));
391 pmt1Chi2.push_back(
DataType(qual1));
394 pmt2Energy.push_back(
DataType(theTileCell->ene2()*(1./
GeV)));
395 pmt2Time.push_back(
DataType(theTileCell->time2()));
396 pmt2Chi2.push_back(
DataType(qual2));
399 if (offlineRch && RawChannelCnt.isValid()
400 && (noch1 || pmt1number[cellInd]!=0) && (noch2 || pmt2number[cellInd]!=0)) {
402 uint32_t tileAdcStatus = pmt1status[cellInd];
403 if (badch1) tileAdcStatus += 10;
405 pmt1RawAmplitude.push_back(
DataType(pmt1rawamp[cellInd]));
406 pmt1RawTime.push_back(
DataType(pmt1rawtime[cellInd]));
407 pmt1Pedestal.push_back(
DataType(pmt1ped[cellInd]));
408 pmt1Number.push_back(
DataType(pmt1number[cellInd]));
409 pmt1ADCStatus.push_back(
DataType(tileAdcStatus));
411 tileAdcStatus = pmt2status[cellInd];
412 if (badch2) tileAdcStatus += 10;
414 pmt2RawAmplitude.push_back(
DataType(pmt2rawamp[cellInd]));
415 pmt2RawTime.push_back(
DataType(pmt2rawtime[cellInd]));
416 pmt2Pedestal.push_back(
DataType(pmt2ped[cellInd]));
417 pmt2Number.push_back(
DataType(pmt2number[cellInd]));
418 pmt2ADCStatus.push_back(
DataType(tileAdcStatus));
425 pmt1RawAmplitude.push_back(
DataType(0));
427 pmt1ADCStatus.push_back(
DataType(0));
429 pmt1Pedestal.push_back(
DataType(0));
433 int adc = tileHWID->
adc(hwid);
436 int ros = tileHWID->
ros(hwid);
441 float amp = theTileCell->ene1() /
scale;
442 float time = theTileCell->time1();
445 if ((qual1 != 0 || qbit != 0 || amp != 0.0) && (fabs(
time) < maxTime &&
time != 0.0)) {
450 if (badch1) tileAdcStatus += 10;
452 pmt1RawAmplitude.push_back(
DataType(amp));
454 pmt1Number.push_back(
DataType(PMT));
455 pmt1ADCStatus.push_back(
DataType( tileAdcStatus ));
456 pmt1Pedestal.push_back(
DataType(0));
460 pmt2RawAmplitude.push_back(
DataType(0));
462 pmt2ADCStatus.push_back(
DataType(0));
464 pmt2Pedestal.push_back(
DataType(0));
468 int adc = tileHWID->
adc(hwid);
471 int ros = tileHWID->
ros(hwid);
476 float amp = theTileCell->ene2() /
scale;
477 float time = theTileCell->time2();
480 if ((qual2 != 0 || qbit != 0 || amp != 0.0) && (fabs(
time) < maxTime &&
time != 0.0)) {
485 if (badch2) tileAdcStatus += 10;
487 pmt2RawAmplitude.push_back(
DataType(amp));
489 pmt2ADCStatus.push_back(
DataType( tileAdcStatus ));
490 pmt2Number.push_back(
DataType(PMT));
491 pmt2Pedestal.push_back(
DataType(0));
497 ATH_MSG_DEBUG(
" Total energy in Tile in GeV : " << energyAllTile );
499 if ( !pmt1digit.empty() ) pmt1digit.clear();
500 if ( !pmt2digit.empty() ) pmt2digit.clear();
507 DataMap[
"id"] = std::move(idVec);
508 DataMap[
"energy"] = std::move(energyVec);
513 DataMap[
"BadCell"]= std::move(BadCell);
517 DataMap[
"pmt1Energy"] = std::move(pmt1Energy);
518 DataMap[
"pmt1Time"] = std::move(pmt1Time);
519 DataMap[
"pmt1Chi2"] = std::move(pmt1Chi2);
520 DataMap[
"pmt1Gain"] = std::move(pmt1Gain);
522 DataMap[
"pmt2Energy"] = std::move(pmt2Energy);
523 DataMap[
"pmt2Time"] = std::move(pmt2Time);
524 DataMap[
"pmt2Chi2"] = std::move(pmt2Chi2);
525 DataMap[
"pmt2Gain"] = std::move(pmt2Gain);
527 DataMap[
"pmt1RawAmplitude"] = std::move(pmt1RawAmplitude);
528 DataMap[
"pmt1RawTime"] = std::move(pmt1RawTime);
529 DataMap[
"pmt1ADCStatus"] = std::move(pmt1ADCStatus);
530 DataMap[
"pmt1Number"] = std::move(pmt1Number);
531 DataMap[
"pmt1Pedestal"] = std::move(pmt1Pedestal);
533 DataMap[
"pmt2RawAmplitude"] = std::move(pmt2RawAmplitude);
534 DataMap[
"pmt2RawTime"] = std::move(pmt2RawTime);
535 DataMap[
"pmt2ADCStatus"] = std::move(pmt2ADCStatus);
536 DataMap[
"pmt2Number"] = std::move(pmt2Number);
537 DataMap[
"pmt2Pedestal"] = std::move(pmt2Pedestal);
540 DataMap[adcCounts1Str] = std::move( adcCounts1Vec);
541 DataMap[adcCounts2Str] = std::move(adcCounts2Vec);