97 DataVect energyVec; energyVec.reserve(cellContainer->
size());
98 DataVect adcCounts1Vec; adcCounts1Vec.reserve(cellContainer->
size() * 10);
99 DataVect adcCounts2Vec; adcCounts2Vec.reserve(cellContainer->
size() * 10);
100 DataVect BadCell; BadCell.reserve(cellContainer->
size());
102 DataVect pmt1Energy; pmt1Energy.reserve(cellContainer->
size());
103 DataVect pmt1Time; pmt1Time.reserve(cellContainer->
size());
104 DataVect pmt1Chi2; pmt1Chi2.reserve(cellContainer->
size());
105 DataVect pmt1Gain; pmt1Gain.reserve(cellContainer->
size());
106 DataVect pmt2Energy; pmt2Energy.reserve(cellContainer->
size());
107 DataVect pmt2Time; pmt2Time.reserve(cellContainer->
size());
108 DataVect pmt2Chi2; pmt2Chi2.reserve(cellContainer->
size());
109 DataVect pmt2Gain; pmt2Gain.reserve(cellContainer->
size());
111 DataVect pmt1RawAmplitude; pmt1RawAmplitude.reserve(cellContainer->
size());
112 DataVect pmt1RawTime; pmt1RawTime.reserve(cellContainer->
size());
113 DataVect pmt1Pedestal; pmt1Pedestal.reserve(cellContainer->
size());
114 DataVect pmt1Number; pmt1Number.reserve(cellContainer->
size());
115 DataVect pmt1ADCStatus; pmt1ADCStatus.reserve(cellContainer->
size());
116 DataVect pmt2RawAmplitude; pmt2RawAmplitude.reserve(cellContainer->
size());
117 DataVect pmt2RawTime; pmt2RawTime.reserve(cellContainer->
size());
118 DataVect pmt2Pedestal; pmt2Pedestal.reserve(cellContainer->
size());
119 DataVect pmt2Number; pmt2Number.reserve(cellContainer->
size());
120 DataVect pmt2ADCStatus; pmt2ADCStatus.reserve(cellContainer->
size());
125 std::string adcCounts1Str =
"adcCounts1 multiple=\"0\"";
126 std::string adcCounts2Str =
"adcCounts2 multiple=\"0\"";
128 const TileID* tileID =
nullptr;
135 double amplitude = 0.;
136 const int vsize = cellContainer->
size();
137 int Index,pmtInd, cellInd, nTileSamples=0;
138 std::vector<double> pmt1ped(vsize,0.0);
139 std::vector<double> pmt2ped(vsize,0.0);
140 std::vector<double> pmt1rawamp(vsize,0.0);
141 std::vector<double> pmt2rawamp(vsize,0.0);
142 std::vector<double> pmt1rawtime(vsize,0.0);
143 std::vector<double> pmt2rawtime(vsize,0.0);
144 std::vector<int> pmt1number(vsize,0);
145 std::vector<int> pmt2number(vsize,0);
146 std::vector<unsigned long int> pmt1status(vsize,0);
147 std::vector<unsigned long int> pmt2status(vsize,0);
148 std::map<int,std::vector<float> > pmt1digit;
149 std::map<int,std::vector<float> > pmt2digit;
150 bool offlineRch =
false;
154 if (detStore()->
retrieve(tileID).isFailure()) {
155 ATH_MSG_ERROR(
"in getCaloTileData(), Could not retrieve TileID" );
159 if (detStore()->
retrieve(tileHWID).isFailure()) {
160 ATH_MSG_ERROR(
"in getCaloTileData(), Could not retrieve TileHWID" );
163 if (detStore()->
retrieve(tileInfo,
"TileInfo").isFailure()) {
164 ATH_MSG_ERROR(
"in getCaloTileData(), Could not retrieve TileInfo" );
182 RChUnit = RawChannelCnt->get_unit();
194 for (
const auto rawChannel : *RawChannelCnt) {
196 for (
const auto cell : *rawChannel) {
198 cell->cell_ID_index(
Index,pmtInd);
199 if (
Index <= -1 )
continue;
201 cellInd = cellContainer->
findIndex(cell_hash);
202 if (cellInd < 0)
continue;
205 int adc = tileHWID->
adc(hwid);
206 int channel = tileHWID->
channel(hwid);
207 int drawer = tileHWID->
drawer(hwid);
208 int ros = tileHWID->
ros(hwid);
209 int PMT = abs( cabling->channel2hole(ros,channel) );
213 amplitude = cell->amplitude();
225 pmt1ped[cellInd] = cell->pedestal();
226 pmt1rawamp[cellInd] = amplitude;
227 pmt1rawtime[cellInd] = cell->uncorrTime();
228 pmt1number[cellInd] = PMT;
229 pmt1status[cellInd] = tileAdcStatus;
233 pmt2ped[cellInd] = cell->pedestal();
234 pmt2rawamp[cellInd] = amplitude;
235 pmt2rawtime[cellInd] = cell->uncorrTime();
236 pmt2number[cellInd] = PMT;
237 pmt2status[cellInd] = tileAdcStatus;
253 for (
const auto digitChannel : *tileDigits) {
255 for (
const auto cell : *digitChannel) {
257 cell->cell_ID_index(
Index,pmtInd);
258 if (
Index <= -1 )
continue;
260 cellInd = cellContainer->
findIndex(cell_hash);
261 if (cellInd < 0)
continue;
264 nTileSamples = cell->NtimeSamples();
265 std::vector<float> tileSamples = cell->samples();
268 pmt1digit.insert(std::make_pair( cellInd, tileSamples ) );
271 pmt2digit.insert(std::make_pair( cellInd, tileSamples ) );
284 double energyAllTile = 0.;
286 for (;it1!=it2;++it1) {
288 if ((*it1)->badcell()) BadCell.push_back(1);
290 else BadCell.push_back(-1);
294 cellInd = cellContainer->
findIndex(cell_hash);
295 if (cellInd < 0)
continue;
298 energyGeV = (*it1)->energy()*(1./
GeV);
300 energyAllTile += energyGeV;
302 idVec.push_back(
DataType( (Identifier::value_type)(*it1)->ID().get_compact() ));
308 if ( !pmt1digit[cellInd].
empty()) {
309 for (
int i=0; i<nTileSamples; i++) {
310 adcCounts1Str=
"adcCounts1 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
311 adcCounts1Vec.push_back(
DataType(
int(pmt1digit[cellInd][i])));
315 for (
int i=0; i<nTileSamples; i++) {
316 adcCounts1Str=
"adcCounts1 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
317 adcCounts1Vec.push_back(
DataType(0));
322 if ( !pmt2digit[cellInd].
empty()) {
323 for (
int i=0; i<nTileSamples; i++) {
324 adcCounts2Str=
"adcCounts2 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
325 adcCounts2Vec.push_back(
DataType(
int(pmt2digit[cellInd][i])));
329 for (
int i=0; i<nTileSamples; i++) {
330 adcCounts2Str=
"adcCounts2 multiple=\""+
DataType(nTileSamples).toString()+
"\"";
331 adcCounts2Vec.push_back(
DataType(0));
339 if (not theTileCell) {
341 throw std::runtime_error(
"Could not cast pointer to TileCell in CaloTileRetriever::getCaloTileData");
343 int gain1 = theTileCell->
gain1();
344 int qual1 = theTileCell->
qual1();
345 bool badch1 = theTileCell->
badch1();
346 bool noch1 = (gain1<0 || gain1>1);
348 int qual2 = theTileCell->
qual2();
349 int gain2 = theTileCell->
gain2();
350 bool badch2 = theTileCell->
badch2();
351 bool noch2 = (gain2<0 || gain2>1);
353 if (badch1 != badch2 && qual1 != qual2 && qual1 < 255 && qual2 < 255) {
354 if (badch1 && !noch1) gain1 = 1 - gain1;
355 if (badch2 && !noch1) gain2 = 1 - gain2;
357 if (badch1) qual1 = -qual1;
358 if (badch2) qual2 = -qual2;
362 pmt1Chi2.push_back(
DataType(qual1));
363 pmt1Gain.push_back(
DataType(gain1));
367 pmt2Chi2.push_back(
DataType(qual2));
368 pmt2Gain.push_back(
DataType(gain2));
370 if (offlineRch && RawChannelCnt.
isValid()
371 && (noch1 || pmt1number[cellInd]!=0) && (noch2 || pmt2number[cellInd]!=0)) {
373 uint32_t tileAdcStatus = pmt1status[cellInd];
374 if (badch1) tileAdcStatus += 10;
376 pmt1RawAmplitude.push_back(
DataType(pmt1rawamp[cellInd]));
377 pmt1RawTime.push_back(
DataType(pmt1rawtime[cellInd]));
378 pmt1Pedestal.push_back(
DataType(pmt1ped[cellInd]));
379 pmt1Number.push_back(
DataType(pmt1number[cellInd]));
380 pmt1ADCStatus.push_back(
DataType(tileAdcStatus));
382 tileAdcStatus = pmt2status[cellInd];
383 if (badch2) tileAdcStatus += 10;
385 pmt2RawAmplitude.push_back(
DataType(pmt2rawamp[cellInd]));
386 pmt2RawTime.push_back(
DataType(pmt2rawtime[cellInd]));
387 pmt2Pedestal.push_back(
DataType(pmt2ped[cellInd]));
388 pmt2Number.push_back(
DataType(pmt2number[cellInd]));
389 pmt2ADCStatus.push_back(
DataType(tileAdcStatus));
396 pmt1RawAmplitude.push_back(
DataType(0));
398 pmt1ADCStatus.push_back(
DataType(0));
400 pmt1Pedestal.push_back(
DataType(0));
404 int adc = tileHWID->
adc(hwid);
405 int channel = tileHWID->
channel(hwid);
406 int drawer = tileHWID->
drawer(hwid);
407 int ros = tileHWID->
ros(hwid);
408 int PMT = abs( cabling->channel2hole(ros,channel) );
412 float amp = theTileCell->
ene1() / scale;
413 float time = theTileCell->
time1();
416 if ((qual1 != 0 || qbit != 0 || amp != 0.0) && (fabs(time) < maxTime && time != 0.0)) {
421 if (badch1) tileAdcStatus += 10;
423 pmt1RawAmplitude.push_back(
DataType(amp));
424 pmt1RawTime.push_back(
DataType(time));
425 pmt1Number.push_back(
DataType(PMT));
426 pmt1ADCStatus.push_back(
DataType( tileAdcStatus ));
427 pmt1Pedestal.push_back(
DataType(0));
431 pmt2RawAmplitude.push_back(
DataType(0));
433 pmt2ADCStatus.push_back(
DataType(0));
435 pmt2Pedestal.push_back(
DataType(0));
439 int adc = tileHWID->
adc(hwid);
440 int channel = tileHWID->
channel(hwid);
441 int drawer = tileHWID->
drawer(hwid);
442 int ros = tileHWID->
ros(hwid);
443 int PMT = abs( cabling->channel2hole(ros,channel) );
447 float amp = theTileCell->
ene2() / scale;
448 float time = theTileCell->
time2();
451 if ((qual2 != 0 || qbit != 0 || amp != 0.0) && (fabs(time) < maxTime && time != 0.0)) {
456 if (badch2) tileAdcStatus += 10;
458 pmt2RawAmplitude.push_back(
DataType(amp));
459 pmt2RawTime.push_back(
DataType(time));
460 pmt2ADCStatus.push_back(
DataType( tileAdcStatus ));
461 pmt2Number.push_back(
DataType(PMT));
462 pmt2Pedestal.push_back(
DataType(0));
468 ATH_MSG_DEBUG(
" Total energy in Tile in GeV : " << energyAllTile );
470 if ( !pmt1digit.empty() ) pmt1digit.clear();
471 if ( !pmt2digit.empty() ) pmt2digit.clear();
478 DataMap[
"id"] = std::move(idVec);
479 DataMap[
"energy"] = std::move(energyVec);
484 DataMap[
"BadCell"]= std::move(BadCell);
488 DataMap[
"pmt1Energy"] = std::move(pmt1Energy);
489 DataMap[
"pmt1Time"] = std::move(pmt1Time);
490 DataMap[
"pmt1Chi2"] = std::move(pmt1Chi2);
491 DataMap[
"pmt1Gain"] = std::move(pmt1Gain);
493 DataMap[
"pmt2Energy"] = std::move(pmt2Energy);
494 DataMap[
"pmt2Time"] = std::move(pmt2Time);
495 DataMap[
"pmt2Chi2"] = std::move(pmt2Chi2);
496 DataMap[
"pmt2Gain"] = std::move(pmt2Gain);
498 DataMap[
"pmt1RawAmplitude"] = std::move(pmt1RawAmplitude);
499 DataMap[
"pmt1RawTime"] = std::move(pmt1RawTime);
500 DataMap[
"pmt1ADCStatus"] = std::move(pmt1ADCStatus);
501 DataMap[
"pmt1Number"] = std::move(pmt1Number);
502 DataMap[
"pmt1Pedestal"] = std::move(pmt1Pedestal);
504 DataMap[
"pmt2RawAmplitude"] = std::move(pmt2RawAmplitude);
505 DataMap[
"pmt2RawTime"] = std::move(pmt2RawTime);
506 DataMap[
"pmt2ADCStatus"] = std::move(pmt2ADCStatus);
507 DataMap[
"pmt2Number"] = std::move(pmt2Number);
508 DataMap[
"pmt2Pedestal"] = std::move(pmt2Pedestal);
511 DataMap[adcCounts1Str] = std::move( adcCounts1Vec);
512 DataMap[adcCounts2Str] = std::move(adcCounts2Vec);