95 DataVect energyVec; energyVec.reserve(cellContainer->
size());
96 DataVect adcCounts1Vec; adcCounts1Vec.reserve(cellContainer->
size() * 10);
97 DataVect adcCounts2Vec; adcCounts2Vec.reserve(cellContainer->
size() * 10);
98 DataVect BadCell; BadCell.reserve(cellContainer->
size());
100 DataVect pmt1Energy; pmt1Energy.reserve(cellContainer->
size());
101 DataVect pmt1Time; pmt1Time.reserve(cellContainer->
size());
102 DataVect pmt1Chi2; pmt1Chi2.reserve(cellContainer->
size());
103 DataVect pmt1Gain; pmt1Gain.reserve(cellContainer->
size());
104 DataVect pmt2Energy; pmt2Energy.reserve(cellContainer->
size());
105 DataVect pmt2Time; pmt2Time.reserve(cellContainer->
size());
106 DataVect pmt2Chi2; pmt2Chi2.reserve(cellContainer->
size());
107 DataVect pmt2Gain; pmt2Gain.reserve(cellContainer->
size());
109 DataVect pmt1RawAmplitude; pmt1RawAmplitude.reserve(cellContainer->
size());
110 DataVect pmt1RawTime; pmt1RawTime.reserve(cellContainer->
size());
111 DataVect pmt1Pedestal; pmt1Pedestal.reserve(cellContainer->
size());
112 DataVect pmt1Number; pmt1Number.reserve(cellContainer->
size());
113 DataVect pmt1ADCStatus; pmt1ADCStatus.reserve(cellContainer->
size());
114 DataVect pmt2RawAmplitude; pmt2RawAmplitude.reserve(cellContainer->
size());
115 DataVect pmt2RawTime; pmt2RawTime.reserve(cellContainer->
size());
116 DataVect pmt2Pedestal; pmt2Pedestal.reserve(cellContainer->
size());
117 DataVect pmt2Number; pmt2Number.reserve(cellContainer->
size());
118 DataVect pmt2ADCStatus; pmt2ADCStatus.reserve(cellContainer->
size());
123 std::string adcCounts1Str =
"adcCounts1 multiple=\"0\"";
124 std::string adcCounts2Str =
"adcCounts2 multiple=\"0\"";
126 const TileID* tileID =
nullptr;
133 double amplitude = 0.;
134 const int vsize = cellContainer->
size();
135 int Index,pmtInd, cellInd, nTileSamples=0;
136 std::vector<double> pmt1ped(vsize,0.0);
137 std::vector<double> pmt2ped(vsize,0.0);
138 std::vector<double> pmt1rawamp(vsize,0.0);
139 std::vector<double> pmt2rawamp(vsize,0.0);
140 std::vector<double> pmt1rawtime(vsize,0.0);
141 std::vector<double> pmt2rawtime(vsize,0.0);
142 std::vector<int> pmt1number(vsize,0);
143 std::vector<int> pmt2number(vsize,0);
144 std::vector<unsigned long int> pmt1status(vsize,0);
145 std::vector<unsigned long int> pmt2status(vsize,0);
146 std::map<int,std::vector<float> > pmt1digit;
147 std::map<int,std::vector<float> > pmt2digit;
148 bool offlineRch =
false;
152 if (detStore()->
retrieve(tileID).isFailure()) {
153 ATH_MSG_ERROR(
"in getCaloTileData(), Could not retrieve TileID" );
157 if (detStore()->
retrieve(tileHWID).isFailure()) {
158 ATH_MSG_ERROR(
"in getCaloTileData(), Could not retrieve TileHWID" );
161 if (detStore()->
retrieve(tileInfo,
"TileInfo").isFailure()) {
162 ATH_MSG_ERROR(
"in getCaloTileData(), Could not retrieve TileInfo" );
180 RChUnit = RawChannelCnt->get_unit();
192 for (
const auto rawChannel : *RawChannelCnt) {
194 for (
const auto cell : *rawChannel) {
196 cell->cell_ID_index(
Index,pmtInd);
197 if (
Index <= -1 )
continue;
199 cellInd = cellContainer->
findIndex(cell_hash);
200 if (cellInd < 0)
continue;
203 int adc = tileHWID->
adc(hwid);
204 int channel = tileHWID->
channel(hwid);
205 int drawer = tileHWID->
drawer(hwid);
206 int ros = tileHWID->
ros(hwid);
207 int PMT = abs( cabling->channel2hole(ros,channel) );
211 amplitude = cell->amplitude();
223 pmt1ped[cellInd] = cell->pedestal();
224 pmt1rawamp[cellInd] = amplitude;
225 pmt1rawtime[cellInd] = cell->uncorrTime();
226 pmt1number[cellInd] = PMT;
227 pmt1status[cellInd] = tileAdcStatus;
231 pmt2ped[cellInd] = cell->pedestal();
232 pmt2rawamp[cellInd] = amplitude;
233 pmt2rawtime[cellInd] = cell->uncorrTime();
234 pmt2number[cellInd] = PMT;
235 pmt2status[cellInd] = tileAdcStatus;
251 for (
const auto digitChannel : *tileDigits) {
253 for (
const auto cell : *digitChannel) {
255 cell->cell_ID_index(
Index,pmtInd);
256 if (
Index <= -1 )
continue;
258 cellInd = cellContainer->
findIndex(cell_hash);
259 if (cellInd < 0)
continue;
262 nTileSamples = cell->NtimeSamples();
263 std::vector<float> tileSamples = cell->samples();
266 pmt1digit.insert(std::make_pair( cellInd, tileSamples ) );
269 pmt2digit.insert(std::make_pair( cellInd, tileSamples ) );
282 double energyAllTile = 0.;
284 for (;it1!=it2;++it1) {
286 if ((*it1)->badcell()) BadCell.push_back(1);
288 else BadCell.push_back(-1);
292 cellInd = cellContainer->
findIndex(cell_hash);
293 if (cellInd < 0)
continue;
296 energyGeV = (*it1)->energy()*(1./
GeV);
298 energyAllTile += energyGeV;
300 idVec.push_back(
DataType( (Identifier::value_type)(*it1)->ID().get_compact() ));
306 if ( !pmt1digit[cellInd].
empty()) {
307 for (
int i=0; i<nTileSamples; i++) {
308 adcCounts1Str=
"adcCounts1 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
309 adcCounts1Vec.push_back(
DataType(
int(pmt1digit[cellInd][i])));
313 for (
int i=0; i<nTileSamples; i++) {
314 adcCounts1Str=
"adcCounts1 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
315 adcCounts1Vec.push_back(
DataType(0));
320 if ( !pmt2digit[cellInd].
empty()) {
321 for (
int i=0; i<nTileSamples; i++) {
322 adcCounts2Str=
"adcCounts2 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
323 adcCounts2Vec.push_back(
DataType(
int(pmt2digit[cellInd][i])));
327 for (
int i=0; i<nTileSamples; i++) {
328 adcCounts2Str=
"adcCounts2 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
329 adcCounts2Vec.push_back(
DataType(0));
337 if (not theTileCell) {
339 throw std::runtime_error(
"Could not cast pointer to TileCell in CaloTileRetriever::getCaloTileData");
341 int gain1 = theTileCell->
gain1();
342 int qual1 = theTileCell->
qual1();
343 bool badch1 = theTileCell->
badch1();
344 bool noch1 = (gain1<0 || gain1>1);
346 int qual2 = theTileCell->
qual2();
347 int gain2 = theTileCell->
gain2();
348 bool badch2 = theTileCell->
badch2();
349 bool noch2 = (gain2<0 || gain2>1);
351 if (badch1 != badch2 && qual1 != qual2 && qual1 < 255 && qual2 < 255) {
352 if (badch1 && !noch1) gain1 = 1 - gain1;
353 if (badch2 && !noch1) gain2 = 1 - gain2;
355 if (badch1) qual1 = -qual1;
356 if (badch2) qual2 = -qual2;
360 pmt1Chi2.push_back(
DataType(qual1));
361 pmt1Gain.push_back(
DataType(gain1));
365 pmt2Chi2.push_back(
DataType(qual2));
366 pmt2Gain.push_back(
DataType(gain2));
368 if (offlineRch && RawChannelCnt.
isValid()
369 && (noch1 || pmt1number[cellInd]!=0) && (noch2 || pmt2number[cellInd]!=0)) {
371 uint32_t tileAdcStatus = pmt1status[cellInd];
372 if (badch1) tileAdcStatus += 10;
374 pmt1RawAmplitude.push_back(
DataType(pmt1rawamp[cellInd]));
375 pmt1RawTime.push_back(
DataType(pmt1rawtime[cellInd]));
376 pmt1Pedestal.push_back(
DataType(pmt1ped[cellInd]));
377 pmt1Number.push_back(
DataType(pmt1number[cellInd]));
378 pmt1ADCStatus.push_back(
DataType(tileAdcStatus));
380 tileAdcStatus = pmt2status[cellInd];
381 if (badch2) tileAdcStatus += 10;
383 pmt2RawAmplitude.push_back(
DataType(pmt2rawamp[cellInd]));
384 pmt2RawTime.push_back(
DataType(pmt2rawtime[cellInd]));
385 pmt2Pedestal.push_back(
DataType(pmt2ped[cellInd]));
386 pmt2Number.push_back(
DataType(pmt2number[cellInd]));
387 pmt2ADCStatus.push_back(
DataType(tileAdcStatus));
394 pmt1RawAmplitude.push_back(
DataType(0));
396 pmt1ADCStatus.push_back(
DataType(0));
398 pmt1Pedestal.push_back(
DataType(0));
402 int adc = tileHWID->
adc(hwid);
403 int channel = tileHWID->
channel(hwid);
404 int drawer = tileHWID->
drawer(hwid);
405 int ros = tileHWID->
ros(hwid);
406 int PMT = abs( cabling->channel2hole(ros,channel) );
410 float amp = theTileCell->
ene1() / scale;
411 float time = theTileCell->
time1();
414 if ((qual1 != 0 || qbit != 0 || amp != 0.0) && (fabs(time) < maxTime && time != 0.0)) {
419 if (badch1) tileAdcStatus += 10;
421 pmt1RawAmplitude.push_back(
DataType(amp));
422 pmt1RawTime.push_back(
DataType(time));
423 pmt1Number.push_back(
DataType(PMT));
424 pmt1ADCStatus.push_back(
DataType( tileAdcStatus ));
425 pmt1Pedestal.push_back(
DataType(0));
429 pmt2RawAmplitude.push_back(
DataType(0));
431 pmt2ADCStatus.push_back(
DataType(0));
433 pmt2Pedestal.push_back(
DataType(0));
437 int adc = tileHWID->
adc(hwid);
438 int channel = tileHWID->
channel(hwid);
439 int drawer = tileHWID->
drawer(hwid);
440 int ros = tileHWID->
ros(hwid);
441 int PMT = abs( cabling->channel2hole(ros,channel) );
445 float amp = theTileCell->
ene2() / scale;
446 float time = theTileCell->
time2();
449 if ((qual2 != 0 || qbit != 0 || amp != 0.0) && (fabs(time) < maxTime && time != 0.0)) {
454 if (badch2) tileAdcStatus += 10;
456 pmt2RawAmplitude.push_back(
DataType(amp));
457 pmt2RawTime.push_back(
DataType(time));
458 pmt2ADCStatus.push_back(
DataType( tileAdcStatus ));
459 pmt2Number.push_back(
DataType(PMT));
460 pmt2Pedestal.push_back(
DataType(0));
466 ATH_MSG_DEBUG(
" Total energy in Tile in GeV : " << energyAllTile );
468 if ( !pmt1digit.empty() ) pmt1digit.clear();
469 if ( !pmt2digit.empty() ) pmt2digit.clear();
476 DataMap[
"id"] = std::move(idVec);
477 DataMap[
"energy"] = std::move(energyVec);
482 DataMap[
"BadCell"]= std::move(BadCell);
486 DataMap[
"pmt1Energy"] = std::move(pmt1Energy);
487 DataMap[
"pmt1Time"] = std::move(pmt1Time);
488 DataMap[
"pmt1Chi2"] = std::move(pmt1Chi2);
489 DataMap[
"pmt1Gain"] = std::move(pmt1Gain);
491 DataMap[
"pmt2Energy"] = std::move(pmt2Energy);
492 DataMap[
"pmt2Time"] = std::move(pmt2Time);
493 DataMap[
"pmt2Chi2"] = std::move(pmt2Chi2);
494 DataMap[
"pmt2Gain"] = std::move(pmt2Gain);
496 DataMap[
"pmt1RawAmplitude"] = std::move(pmt1RawAmplitude);
497 DataMap[
"pmt1RawTime"] = std::move(pmt1RawTime);
498 DataMap[
"pmt1ADCStatus"] = std::move(pmt1ADCStatus);
499 DataMap[
"pmt1Number"] = std::move(pmt1Number);
500 DataMap[
"pmt1Pedestal"] = std::move(pmt1Pedestal);
502 DataMap[
"pmt2RawAmplitude"] = std::move(pmt2RawAmplitude);
503 DataMap[
"pmt2RawTime"] = std::move(pmt2RawTime);
504 DataMap[
"pmt2ADCStatus"] = std::move(pmt2ADCStatus);
505 DataMap[
"pmt2Number"] = std::move(pmt2Number);
506 DataMap[
"pmt2Pedestal"] = std::move(pmt2Pedestal);
509 DataMap[adcCounts1Str] = std::move( adcCounts1Vec);
510 DataMap[adcCounts2Str] = std::move(adcCounts2Vec);