39 #include "CaloGeoHelpers/CaloSampling.h"
43 #include "CaloDetDescr/CaloDetDescrElement.h"
58 return (
c.key().empty() || !
c.isValid() ||
c->size()==0);
101 constexpr
unsigned expSize=
MAXLYRNS*2+1;
103 ATH_MSG_ERROR(
"Unexpected size of LayerNames property. Expect "<< expSize <<
" entries, found "<<
m_layerNames.size() <<
" entries");
104 return StatusCode::FAILURE;
262 if (!hLArDigitContainer.
isValid()) {
263 ATH_MSG_WARNING(
"The requested digit container key could not be retrieved. Was there a problem retrieving information from the run logger?");
274 if (!hSCetContainer.
isValid()) {
275 ATH_MSG_WARNING(
"The requested SC ET container key could not be retrieved. Was there a problem retrieving information from the run logger?");
285 if (!hSCetRecoContainer.
isValid()) {
286 ATH_MSG_WARNING(
"The requested SC ET reco container key could not be retrieved. Was there a problem retrieving information from the run logger?");
294 if (!hLArLATOMEHeaderContainer.isValid()) {
295 ATH_MSG_WARNING(
"The requested LATOME header container key could not be retrieved. Was there a problem retrieving information from the run logger?");
297 ATH_MSG_DEBUG(
"hLArLATOMEHeaderContainer.size() " << hLArLATOMEHeaderContainer->size());
302 ATH_MSG_WARNING(
"All of the requested containers are empty. Was there a problem retrieving information from the run logger?");
303 return StatusCode::SUCCESS;
306 BCID = thisEvent->bcid();
307 lumi_block = thisEvent->lumiBlock();
308 time_stamp = thisEvent->timeStamp();
327 bcCont = (*bcContHdl);
329 if ((hLArDigitContainer.
isValid())) {
330 std::vector<std::vector<Digi_MonValues>> digiMonValueVec(
m_layerNames.size());
331 for (
auto& innerVec : digiMonValueVec) {
332 innerVec.reserve(1600);
336 for (
const LArDigit* pLArDigit : *hLArDigitContainer) {
339 if (!
cabling->isOnlineConnected(
id))
342 const unsigned trueNSamples = pLArDigit->nsamples();
343 if (trueNSamples == 0)
345 Digi_Nsamples = trueNSamples;
346 const int cgain = pLArDigit->gain();
350 if (caloDetElement == 0) {
354 Digi_eta = caloDetElement->
eta_raw();
355 Digi_phi = caloDetElement->
phi_raw();
360 const int calosample = caloDetElement->
getSampling();
364 const unsigned iLyr = iLyrNS * 2 +
side;
365 auto& lvaluemap_digi = digiMonValueVec[iLyr];
366 auto& lvaluemap_digi_ALL = digiMonValueVec.back();
370 Digi_partition = ThisPartition;
381 Pedestal = pedestals->
pedestal(
id, cgain);
390 Digi_SCChannel = scdigi->
Channel();
391 Digi_latomeSourceId = scdigi->
SourceId();
395 const std::vector<short>* digito = &pLArDigit->samples();
398 std::vector<short>::const_iterator maxSam = std::max_element(digito->begin(), digito->end());
400 Digi_maxpos = thismaxPos + 1;
401 float ADC_max = pLArDigit->samples().at(Digi_maxpos - 1);
403 float ADC_0 = pLArDigit->samples().at(0);
409 float samp_mean = samp_sum /
static_cast<float>(trueNSamples);
410 float sq_sum = std::inner_product(digito->begin(), digito->end(), digito->begin(), 0.0);
411 float rms_arg = sq_sum /
static_cast<float>(trueNSamples) - samp_mean * samp_mean;
416 Digi_ADC_RMS = std::sqrt(rms_arg);
420 Digi_Diff_ADC0_Ped = ADC_0 - Pedestal;
421 for (
unsigned i = 0;
i < trueNSamples; ++
i) {
422 badNotMasked =
false;
427 Digi_ADC = pLArDigit->samples().at(
i);
429 Digi_ADC = Digi_ADC / 8;
432 Digi_Diff_ADC_Ped = Digi_ADC - Pedestal;
433 if (ADC_max != Pedestal) {
434 Digi_Diff_ADC_Ped_Norm = (Digi_ADC - Pedestal) / std::abs(ADC_max - Pedestal);
438 if (Digi_ADC != -1) {
445 if (ADC_max - Pedestal > 10 * PedestalRMS) {
448 if (notMasked && notBadQual && ADCped10RMS) {
452 lvaluemap_digi.emplace_back(Digi_eta, Digi_phi, Digi_ieta, Digi_iphi, Digi_sampos, Digi_ADC, Digi_latomeSourceIdBIN, Pedestal, Digi_maxpos,
453 Digi_partition, Digi_Diff_ADC_Ped_Norm, Digi_Diff_ADC_Ped, Digi_Diff_ADC0_Ped, Digi_ADC_RMS,
BCID, lumi_block, passDigiNom,
455 lvaluemap_digi_ALL.emplace_back(Digi_eta, Digi_phi, Digi_ieta, Digi_iphi, Digi_sampos, Digi_ADC, Digi_latomeSourceIdBIN, Pedestal, Digi_maxpos,
456 Digi_partition, Digi_Diff_ADC_Ped_Norm, Digi_Diff_ADC_Ped, Digi_Diff_ADC0_Ped, Digi_ADC_RMS,
BCID, lumi_block, passDigiNom,
464 for (
size_t ilayer = 0; ilayer < digiMonValueVec.size(); ++ilayer) {
465 const auto&
tool = digiMonValueVec[ilayer];
472 auto digi_part_latomesourceidbin =
Monitored::Collection(
"Digi_part_latomesourceidbin",
tool, [](
const auto&
v) {
return v.digi_latomesourceidbin; });
476 auto digi_part_diff_adc_ped_norm =
Monitored::Collection(
"Digi_part_diff_adc_ped_norm",
tool, [](
const auto&
v) {
return v.digi_diff_adc_ped_norm; });
477 auto digi_part_diff_adc_ped =
Monitored::Collection(
"Digi_part_diff_adc_ped",
tool, [](
const auto&
v) {
return v.digi_diff_adc_ped; });
478 auto digi_part_diff_adc0_ped =
Monitored::Collection(
"Digi_part_diff_adc0_ped",
tool, [](
const auto&
v) {
return v.digi_diff_adc0_ped; });
481 auto digi_part_passDigiNom =
Monitored::Collection(
"Digi_part_passDigiNom",
tool, [](
const auto&
v) {
return v.digi_passDigiNom; });
482 auto digi_part_badNotMasked =
Monitored::Collection(
"Digi_part_badNotMasked",
tool, [](
const auto&
v) {
return v.digi_badNotMasked; });
486 digi_part_adc, digi_part_latomesourceidbin, digi_part_pedestal, digi_part_maxpos, digi_part_diff_adc_ped_norm, digi_part_diff_adc_ped,
487 digi_part_diff_adc0_ped, digi_part_adc_rms, digi_part_bcid, digi_part_lb, digi_part_passDigiNom, digi_part_badNotMasked);
500 std::vector<std::vector<SC_MonValues>> scMonValueVec(
m_layerNames.size());
501 for (
auto& innerVec : scMonValueVec) {
502 innerVec.reserve(1600);
506 for (; itSC != itSC_e; ++itSC, ++itSCReco) {
508 if (itSCReco < hSCetRecoContainer->
end()) {
509 rawSCReco = *itSCReco;
515 SC_SCChannel = rawSC->
chan();
518 if (!
cabling->isOnlineConnected(
id))
524 if (caloDetElement == 0) {
525 ATH_MSG_ERROR(
"Cannot retrieve (eta,phi) coordinates for raw channels");
527 <<
"; rawSC->SourceId() = " << rawSC->
SourceId());
530 SC_eta = caloDetElement->
eta_raw();
531 SC_phi = caloDetElement->
phi_raw();
539 const unsigned iLyr = iLyrNS * 2 +
side;
541 auto& lvaluemap_sc = scMonValueVec[iLyr];
542 auto& lvaluemap_sc_ALL = scMonValueVec.back();
553 eTgt0p325GeV =
false;
554 eTgt0lt0p325GeV =
false;
561 onlofflEmismatch =
false;
562 passSCNom0_0p325 =
false;
563 passSCNom0p325_1 =
false;
566 passSCNom10tauGt3 =
false;
567 saturNotMasked =
false;
568 OFCbOFNotMasked =
false;
569 notMaskedEoflNe0 =
false;
570 notMaskedEoflGt1 =
false;
571 nonZeroETofl =
false;
573 passSCNomInvalid =
false;
583 unsigned int bcid_ind = 0;
585 for (
auto& SCe : rawSC->
bcids()) {
590 if (bcid_ind >= rawSC->
bcids().size()) {
591 ATH_MSG_WARNING(
"BCID not found in SC bcids list!! " <<
BCID <<
" BCIDs size: " << rawSC->
bcids().size() <<
", proposed index: " << bcid_ind);
592 }
else if (rawSC->
bcids().at(bcid_ind) !=
BCID) {
596 if (rawSC->
energies().size() > bcid_ind) {
597 SC_energy_onl = rawSC->
energies().at(bcid_ind);
599 ATH_MSG_WARNING(
"rawSC energies vector is too small for the requested BCID index " << bcid_ind <<
" (size is " << rawSC->
energies().size()
600 <<
", bcid vec size is " << rawSC->
bcids().size() <<
")");
608 if (rawSCReco != 0) {
609 if (rawSCReco->
energies().size() > 0) {
610 SC_energy_ofl = rawSCReco->
energies().at(0);
616 SC_ET_diff = SC_energy_onl - SC_energy_ofl;
617 SC_ET_onl = (SC_energy_onl * 12.5) / 1000;
618 SC_ET_ofl = (SC_energy_ofl * 12.5) / 1000;
619 SC_ET_onl_muscaled = event_mu > 0. ? SC_ET_onl / event_mu : SC_ET_onl;
621 if (rawSCReco != 0) {
626 SC_time = (SC_energy_ofl != 0) ? (
float)Etau / (
float)SC_energy_ofl : Etau;
628 ATH_MSG_DEBUG(
"Energy onl - Energy ofl: " << SC_energy_onl <<
", " << SC_energy_ofl << std::endl);
629 if (SC_ET_onl != 0) {
634 if (SC_ET_onl > 0.325) {
636 }
else if (SC_ET_onl < 0.325 && SC_ET_onl > 0.) {
637 eTgt0lt0p325GeV =
true;
645 if (SC_ET_onl > 10) {
648 if (SC_ET_onl < 10) {
651 if (SC_ET_ofl != 0) {
657 if (rawSC->
satur().size() > bcid_ind) {
658 if (rawSC->
satur().at(bcid_ind)) {
660 saturNotMasked =
true;
669 if (rawSCReco != 0 && rawSCReco->
ofcbOverflow() ==
false) {
673 OFCbOFNotMasked =
true;
676 if (std::abs(SC_time) > 3) {
680 if (notMasked && notSatur && notOFCbOF) {
682 notMaskedEoflNe0 =
true;
685 notMaskedEoflGt1 =
true;
687 if (SC_energy_onl == -99999) {
688 passSCNomInvalid =
true;
693 if (eTgt0lt0p325GeV) {
694 passSCNom0_0p325 =
true;
696 if (eTgt0p325GeV && eTlt1GeV) {
697 passSCNom0p325_1 =
true;
705 passSCNom10tauGt3 =
true;
708 if (SC_energy_onl != SC_energy_ofl) {
709 onlofflEmismatch =
true;
714 lvaluemap_sc.emplace_back(SC_eta, SC_phi, SC_ieta, SC_iphi, SC_latomeSourceIdBIN, SC_ET_ofl, SC_ET_diff, SC_ET_onl, SC_ET_onl_muscaled, SC_time,
BCID,
715 lumi_block, zeroET, passSCNomInvalid, passSCNom0_0p325, passSCNom0p325_1, passSCNom1, passSCNom10, passSCNom10tauGt3, saturNotMasked, OFCbOFNotMasked, notMaskedEoflNe0,
717 lvaluemap_sc_ALL.emplace_back(SC_eta, SC_phi, SC_ieta, SC_iphi, SC_latomeSourceIdBIN, SC_ET_ofl, SC_ET_diff, SC_ET_onl, SC_ET_onl_muscaled, SC_time,
718 BCID, lumi_block, zeroET, passSCNomInvalid, passSCNom0_0p325, passSCNom0p325_1, passSCNom1, passSCNom10, passSCNom10tauGt3, saturNotMasked, OFCbOFNotMasked,
719 notMaskedEoflNe0, notMaskedEoflGt1);
724 for (
size_t ilayer = 0; ilayer < scMonValueVec.size(); ++ilayer) {
725 const auto&
tool = scMonValueVec[ilayer];
730 auto sc_part_latomesourceidbin =
Monitored::Collection(
"SC_part_latomesourceidbin",
tool, [](
const auto&
v) {
return v.sc_latomesourceidbin; });
734 auto sc_part_et_onl_muscaled =
Monitored::Collection(
"SC_part_et_onl_muscaled",
tool, [](
const auto&
v) {
return v.sc_et_onl_muscaled; });
740 auto sc_part_passSCNomInvalid =
Monitored::Collection(
"SC_part_passSCNomInvalid",
tool, [](
const auto&
v) {
return v.sc_passSCNomInvalid; });
741 auto sc_part_passSCNom0_0p325 =
Monitored::Collection(
"SC_part_passSCNom0_0p325",
tool, [](
const auto&
v) {
return v.sc_passSCNom0_0p325; });
742 auto sc_part_passSCNom0p325_1 =
Monitored::Collection(
"SC_part_passSCNom0p325_1",
tool, [](
const auto&
v) {
return v.sc_passSCNom0p325_1; });
745 auto sc_part_passSCNom10tauGt3 =
Monitored::Collection(
"SC_part_passSCNom10tauGt3",
tool, [](
const auto&
v) {
return v.sc_passSCNom10tauGt3; });
746 auto sc_part_saturNotMasked =
Monitored::Collection(
"SC_part_saturNotMasked",
tool, [](
const auto&
v) {
return v.sc_saturNotMasked; });
747 auto sc_part_OFCbOFNotMasked =
Monitored::Collection(
"SC_part_OFCbOFNotMasked",
tool, [](
const auto&
v) {
return v.sc_OFCbOFNotMasked; });
748 auto sc_part_notMaskedEoflNe0 =
Monitored::Collection(
"SC_part_notMaskedEoflNe0",
tool, [](
const auto&
v) {
return v.sc_notMaskedEoflNe0; });
749 auto sc_part_notMaskedEoflGt1 =
Monitored::Collection(
"SC_part_notMaskedEoflGt1",
tool, [](
const auto&
v) {
return v.sc_notMaskedEoflGt1; });
753 sc_part_et_ofl, sc_part_et_diff, sc_part_et_onl, sc_part_et_onl_muscaled, sc_part_time, sc_part_bcid, sc_part_lb, sc_zeroET, sc_part_passSCNomInvalid,
754 sc_part_passSCNom0_0p325, sc_part_passSCNom0p325_1, sc_part_passSCNom1, sc_part_passSCNom10, sc_part_passSCNom10tauGt3, sc_part_saturNotMasked, sc_part_OFCbOFNotMasked, sc_part_notMaskedEoflNe0,
755 sc_part_notMaskedEoflGt1);
764 if ((hLArLATOMEHeaderContainer.isValid())) {
766 for (
const LArLATOMEHeader* pLArLATOMEHeader : *hLArLATOMEHeaderContainer) {
767 event_size += pLArLATOMEHeader->ROBFragSize() + 48;
769 event_size /= (1024 * 1024 / 4);
775 return StatusCode::SUCCESS;
784 if(
side==0)
return 0;
787 if(
side==0)
return 2;
790 if(
side==0)
return 4;
793 if(
side==0)
return 6;
804 const unsigned detID = sourceID >> 16;
805 const unsigned value = sourceID & 0xF;
808 detStartingBin=mapit->second;
811 unsigned binx = detStartingBin+
value;