Execute method.
219{
224 return StatusCode::SUCCESS;
225 }
226
228
231
235 int bunchId = eventInfo->
bcid();
236
237
241 return StatusCode::SUCCESS;
242 }
243
244
245 SG::ReadCondHandle<BunchCrossingCondData> bccd (
m_bcDataKey,ctx);
246 const BunchCrossingCondData* bunchCrossing=*bccd;
247 if (!bunchCrossing) {
249 return StatusCode::FAILURE;
250 }
251
252 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{
m_caloMgrKey, ctx};
254 const CaloDetDescrManager* caloMgr = *caloMgrHandle;
255
257 if (!bccd->isFilled(bunchId)) {
260 return StatusCode::SUCCESS;
261 }
262 }
263
264
269 if (eventIndex < 0) return StatusCode::FAILURE;
270 }
271
272 SG::ReadHandle<LArDigitContainer> hdlDigit(
m_digitsKey, ctx);
273 if(!hdlDigit.isValid()) {
275 return StatusCode::SUCCESS;
276 } else
278 const LArDigitContainer* larDigitContainer = &(*hdlDigit);
279
280 if (larDigitContainer->
empty()) {
283 return StatusCode::SUCCESS;
284 }
285
286 SG::ReadHandle<LArRawChannelContainer> hdlRaw(
m_channelsKey, ctx);
287 if(!hdlRaw.isValid()) {
289 return StatusCode::SUCCESS;
290 } else
293
297 return StatusCode::SUCCESS;
298 }
299
300
301
302 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{
m_cablingKey, ctx};
303 const LArOnOffIdMapping*
cabling=*cablingHdl;
304 if(!cabling) {
305 ATH_MSG_ERROR(
"Do not have cabling object LArOnOffIdMapping" );
306 return StatusCode::FAILURE;
307 }
308
309 SG::ReadCondHandle<LArADC2MeV> adc2mevHdl(
m_adc2mevKey, ctx);
310 const LArADC2MeV* adc2MeV=*adc2mevHdl;
311 if(!adc2MeV) {
313 return StatusCode::FAILURE;
314 }
315
317 const ILArPedestal* pedestals=*pedHdl;
318 if (!pedestals) {
320 return StatusCode::FAILURE;
321 }
322
323 const ILArAutoCorr* aCorr=nullptr;
325 SG::ReadCondHandle<ILArAutoCorr> acorrHdl(
m_acorrKey, ctx);
326 aCorr=*acorrHdl;
327 if (!aCorr) {
329 return StatusCode::FAILURE;
330 }
331 }
332
333 SG::ReadCondHandle<LArBadChannelCont> readHandle{
m_BCKey, ctx};
335 if(!bcCont) {
337 return StatusCode::FAILURE;
338 }
339
340 const LArOFIterResultsContainer* ofIterResult = nullptr;
344 } else {
346 }
347 }
348
351 const std::map<unsigned int,uint16_t>& febErrorMap = larFebErrorSummary->
get_all_febs();
352 std::map<unsigned int, const LArRawChannel*> channelsToKeep;
353
356 {
358 if (
m_bcMask.cellShouldBeMasked(bcCont,
channel->channelID()))
continue;
359
361
362 if (!
hash.is_valid()) {
364 << ") does not correspond to a valid hash -- returning StatusCode::FAILURE." );
365 return StatusCode::FAILURE;
366 }
369 HistoryContainer* histCont =
m_samples->hist_cont(hash);
370 CellInfo*
info =
nullptr;
371 if (!histCont) {
372 HWIdentifier channelID =
channel->hardwareID();
373 const Identifier
id =
cabling->cnvToIdentifier(channelID);
374 const CaloDetDescrElement* caloDetElement = caloMgr->
get_element(
id);
376 if (!info) continue;
378 }
379 }
380 }
381
382 std::map<HWIdentifier, LArOFIterResultsContainer::const_iterator> ofcResultPosition;
384 for (LArOFIterResultsContainer::const_iterator ofResult = ofIterResult->begin();
385 ofResult != ofIterResult->end(); ++ofResult)
386 ofcResultPosition[ofResult->getChannelID()] = ofResult;
387
389 << " " << (ofIterResult ? ofIterResult->size() : 0) << " "
391 }
393 const CaloNoise* noiseCDO=*noiseHdl;
394
396 digit != larDigitContainer->
end(); ++digit)
397 {
398
400
401 std::map<unsigned int, const LArRawChannel*>::const_iterator findChannel = channelsToKeep.find(hash);
402 if (findChannel == channelsToKeep.end()) continue;
403 const LArRawChannel* rawChannel = findChannel->second;
404
405
406 HWIdentifier channelID = (*digit)->hardwareID();
410
411
414
415
416 const bool connected =
cabling->isOnlineConnected(channelID);
418
419
420 float pedestal = pedestals->
pedestal(channelID, gain);
421 float pedestalRMS = pedestals->
pedestalRMS(channelID, gain);
423 const std::vector<short>& samples = (*digit)->samples();
425 for (short sample : samples)
429 }
430
431 const Identifier
id =
cabling->cnvToIdentifier(channelID);
432 const CaloDetDescrElement* caloDetElement = nullptr;
433
434 HistoryContainer* histCont =
m_samples->hist_cont(hash);
435 CellInfo*
info =
nullptr;
436 if (!histCont) {
437 if (!caloDetElement) caloDetElement = caloMgr->
get_element(
id);
439 if (!info) continue;
440 histCont =
m_samples->makeNewHistory(hash, info);
441 }
442 else
444
446 unsigned int status = 0xFFFFFFFF;
447 if (connected) {
448 if (!caloDetElement) caloDetElement = caloMgr->
get_element(
id);
453 if (findError != febErrorMap.end()) {
454 unsigned int febErrWord = findError->second;
456 }
457 }
458
459
462 const LArAutoCorrComplete* autoCorrObj = dynamic_cast<const LArAutoCorrComplete*>(aCorr);
463 if (!autoCorrObj)
464 ATH_MSG_WARNING (
"AutoCorr object is not of type LArAutoCorrComplete!" );
465 else
466 autoCorr = autoCorrObj->
autoCorr(channelID, gain);
467 }
468
469 if (!
info->shape((*digit)->gain()))
470 info->setShape((*digit)->gain(),
m_dumperTool->retrieveShape(channelID, gain));
471
472 if (!eventData) {
474 if (eventIndex < 0) return StatusCode::FAILURE;
475 }
476
477 DataContainer*
data =
478 new DataContainer((*digit)->gain(), (*digit)->samples(),
480 rawChannel->
time()/
double(1000),
482 eventIndex,
483 autoCorr,
484 noise, pedestal, pedestalRMS, status);
485
486
487
488
489
490
491
492
493
494
495
496
497 const auto ramp=adc2MeV->
ADC2MEV(channelID,gain);
498 data->setADCMax(rawChannel->
energy()/ramp[1]);
499
500
502 }
503
505 std::map<unsigned int, const LArRawSC*> scToKeep;
506
507 SG::ReadHandle<LArRawSCContainer> hdlSC(
m_rawscKey, ctx);
508 if(!hdlSC.isValid()) {
510 return StatusCode::SUCCESS;
511 } else
513
514 if (hdlSC->empty()) {
516 return StatusCode::SUCCESS;
517 }
518
520 if(!hdlrecoSC.isValid()) {
522 return StatusCode::SUCCESS;
523 } else
525
526 if (hdlrecoSC->empty()) {
528 return StatusCode::SUCCESS;
529 }
530
531 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{
m_cablingKeySC, ctx};
532 const LArOnOffIdMapping* cablingSC=*cablingHdl;
533 if(!cablingSC) {
534 ATH_MSG_ERROR(
"Do not have cabling object LArOnOffIdMapping" );
535 return StatusCode::FAILURE;
536 }
537
540 const CaloSuperCellDetDescrManager* caloMgrSC = *caloMgrHandle;
541
543 const ILArPedestal* pedestalsSC=*pedHdl;
544 if (!pedestals) {
545 ATH_MSG_ERROR(
"Failed to retrieve pedestal cond obj for SC");
546 return StatusCode::FAILURE;
547 }
548
549 std::map<unsigned int, std::pair<float, std::pair<float,float> > > channelsToKeepSC;
550
551 for (const LArRawSC* rawSC : *hdlSC) {
552
553
554 if (
m_bcMaskSC.cellShouldBeMasked(bcCont,rawSC->hardwareID()))
continue;
555
556 const std::vector<unsigned short>& bcids = rawSC->bcids();
557 const std::vector<int>& energies = rawSC->energies();
558 const std::vector<bool>& satur = rawSC->satur();
559
560
561 float scEne = 0;
562 float defValue = -99999999.;
563
564 const size_t nBCIDs = bcids.size();
566 for (i = 0;
i < nBCIDs && bcids[
i] != bunchId;
i++)
567 ;
568 if(i==nBCIDs) continue;
569 if (satur[i]) continue;
570
573 if (
m_bcMaskSC.cellShouldBeMasked(bcCont,rawSC->hardwareID()))
continue;
574
576
577 if (!
hash.is_valid()) {
578 ATH_MSG_FATAL (
"Found a LArRawSC whose HWIdentifier (" << rawSC->hardwareID()
579 << ") does not correspond to a valid hash -- returning StatusCode::FAILURE." );
580 return StatusCode::FAILURE;
581 }
582
583 channelsToKeepSC[
hash] = std::make_pair(scEne, std::make_pair(defValue,defValue));
584
586 HistoryContainer* histCont =
m_samples->hist_cont_sc(hash);
587 CellInfo*
info =
nullptr;
588 if (!histCont) {
589 HWIdentifier channelID = rawSC->hardwareID();
591 const CaloDetDescrElement* caloDetElement = caloMgrSC->
get_element(
id);
593 if (!info) continue;
595 }
596 }
597 }
598 ATH_MSG_INFO(
"SC to keep in this event: "<<channelsToKeepSC.size());
599
600 for (const LArRawSC* rawSC : *hdlrecoSC) {
601
602 if (
m_bcMaskSC.cellShouldBeMasked(bcCont,rawSC->hardwareID()))
continue;
604 if (!
hash.is_valid()) {
605 ATH_MSG_FATAL (
"Found a LArRawSC whose HWIdentifier (" << rawSC->hardwareID()
606 << ") does not correspond to a valid hash -- returning StatusCode::FAILURE." );
607 return StatusCode::FAILURE;
608 }
609
610
611 if (channelsToKeepSC.find(hash) == channelsToKeepSC.end()) continue;
612
613 const std::vector<unsigned short>& bcids = rawSC->bcids();
614 const std::vector<int>& energies = rawSC->energies();
615 const std::vector<int>& tauenergies = rawSC->tauEnergies();
616
617
618 float scEne = 0;
619 float scTim = -99999999.;
620
621 const size_t nBCIDs = bcids.size();
623 for (i = 0;
i < nBCIDs && bcids[
i] != bunchId;
i++)
624 ;
625 if(i==nBCIDs) continue;
626
628
629 if(tauenergies.size() && scEne != 0) scTim = tauenergies[
i] / scEne;
630
631 channelsToKeepSC[
hash].second = std::make_pair(scEne, scTim);
632
634 HistoryContainer* histCont =
m_samples->hist_cont_sc(hash);
635 CellInfo*
info =
nullptr;
636 if (!histCont) {
637 HWIdentifier channelID = rawSC->hardwareID();
639 const CaloDetDescrElement* caloDetElement = caloMgrSC->
get_element(
id);
641 if (!info) continue;
643 }
644 }
645 }
646
647 SG::ReadHandle<LArDigitContainer> hdlSCDigit(
m_digitsKeySC, ctx);
648 if(!hdlSCDigit.isValid()) {
650 return StatusCode::SUCCESS;
651 } else
653 const LArDigitContainer* larSCDigitContainer = &(*hdlSCDigit);
654
655 if (larSCDigitContainer->
empty()) {
658 return StatusCode::SUCCESS;
659 }
660
662 digit != larSCDigitContainer->
end(); ++digit)
663 {
664
666
667 std::map<unsigned int, std::pair<float, std::pair<float,float> > >::const_iterator findChannel = channelsToKeepSC.find(hash);
668 if (findChannel == channelsToKeepSC.end()) continue;
669
670
671 float pedestal = pedestalsSC->
pedestal((*digit)->channelID(), 0);
673 const std::vector<short>& samples = (*digit)->samples();
675 for (short sample : samples)
678 }
679
680 const Identifier
id = cablingSC->
cnvToIdentifier((*digit)->channelID());
681 const CaloDetDescrElement* caloDetElement = nullptr;
682
683 HistoryContainer* histCont =
m_samples->hist_cont_sc(hash);
684 CellInfo*
info =
nullptr;
685 if (!histCont) {
686 if (!caloDetElement) caloDetElement = caloMgrSC->
get_element(
id);
688 if (!info) continue;
689 histCont =
m_samples->makeNewHistorySC(hash, info);
690 }
691 else
693
694 if (!eventData) {
696 if (eventIndex < 0) return StatusCode::FAILURE;
697 }
698
699 DataContainer*
data =
700 new DataContainer((*digit)->gain(), (*digit)->samples(),
701 findChannel->second.first,
702 findChannel->second.second.second,
703 findChannel->second.second.first,
704 eventIndex,
705 LArVectorProxy(),
706 -1, pedestal, 0, 0);
707
708
710 }
711
712 }
713
714 return StatusCode::SUCCESS;
715}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define maxValue(current, test)
LArBadXCont< LArBadChannel > LArBadChannelCont
Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old LArRawChannelContainer
ServiceHandle< StoreGateSvc > & evtStore()
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
LArVectorProxy AutoCorrRef_t
virtual float pedestal(const HWIdentifier &id, int gain) const =0
virtual float pedestalRMS(const HWIdentifier &id, int gain) const =0
access to RMS of Pedestal index by Identifier, and gain setting
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
const LArVectorProxy ADC2MEV(const HWIdentifier &id, int gain) const
virtual AutoCorrRef_t autoCorr(const HWIdentifier &CellID, int gain) const
BitWord packedData() const
LArBC_t status(const HWIdentifier channel) const
Query the status of a particular channel or FEB This is the main client access method.
const std::map< unsigned int, uint16_t > & get_all_febs() const
get all febs with error
Identifier cnvToIdentifier(const HWIdentifier &sid) const
create an Identifier from a HWIdentifier (inline)
void add(const DataContainer *data)
append data (takes ownership)
CellInfo * cell_info() const
SG::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey
SG::ReadCondHandleKey< ILArPedestal > m_pedestalKeySC
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
SG::ReadHandleKey< LArRawSCContainer > m_rawscKey
ToolHandle< ILArShapeDumperTool > m_dumperToolSC
SG::ReadHandleKey< LArRawSCContainer > m_rawRecomputedscKey
SG::ReadCondHandleKey< LArBadChannelCont > m_BCKey
int makeEvent(LArSamples::EventData *&eventData, int run, int event, int lumiBlock, int bunchXing) const
ToolHandle< ILArShapeDumperTool > m_dumperTool
SG::ReadCondHandleKey< CaloSuperCellDetDescrManager > m_caloSuperCellMgrKey
LArBadChannelMask m_bcMask
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
SG::ReadCondHandleKey< ILArAutoCorr > m_acorrKey
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
bool m_gains[CaloGain::LARNGAIN]
SG::ReadHandleKey< LArRawChannelContainer > m_channelsKey
SG::ReadCondHandleKey< BunchCrossingCondData > m_bcDataKey
SG::ReadHandleKey< LArDigitContainer > m_digitsKeySC
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
SG::ReadCondHandleKey< ILArPedestal > m_pedestalKey
SG::ReadHandleKey< LArDigitContainer > m_digitsKey
uint32_t lumiBlock() const
The current event's luminosity block number.
uint32_t bcid() const
The bunch crossing ID of the event.
@ LAr
The LAr calorimeter.
@ Error
The sub-detector issued an error.
uint32_t runNumber() const
The current event's run number.
EventFlagErrorState errorState(EventFlagSubDet subDet) const
Get the error state for a particular sub-detector.
uint64_t eventNumber() const
The current event's event number.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
event_number_t eventIndex
EventInfo_v1 EventInfo
Definition of the latest event info version.
int run(int argc, char *argv[])