39 #include "CaloGeoHelpers/CaloSampling.h"
57 return (
c.key().empty() || !
c.isValid() ||
c->size()==0);
100 constexpr
unsigned expSize=
MAXLYRNS*2+1;
102 ATH_MSG_ERROR(
"Unexpected size of LayerNames property. Expect "<< expSize <<
" entries, found "<<
m_layerNames.size() <<
" entries");
103 return StatusCode::FAILURE;
261 if (!hLArDigitContainer.
isValid()) {
262 ATH_MSG_WARNING(
"The requested digit container key could not be retrieved. Was there a problem retrieving information from the run logger?");
273 if (!hSCetContainer.
isValid()) {
274 ATH_MSG_WARNING(
"The requested SC ET container key could not be retrieved. Was there a problem retrieving information from the run logger?");
284 if (!hSCetRecoContainer.
isValid()) {
285 ATH_MSG_WARNING(
"The requested SC ET reco container key could not be retrieved. Was there a problem retrieving information from the run logger?");
293 if (!hLArLATOMEHeaderContainer.isValid()) {
294 ATH_MSG_WARNING(
"The requested LATOME header container key could not be retrieved. Was there a problem retrieving information from the run logger?");
296 ATH_MSG_DEBUG(
"hLArLATOMEHeaderContainer.size() " << hLArLATOMEHeaderContainer->size());
301 ATH_MSG_WARNING(
"All of the requested containers are empty. Was there a problem retrieving information from the run logger?");
302 return StatusCode::SUCCESS;
305 BCID = thisEvent->bcid();
306 lumi_block = thisEvent->lumiBlock();
307 time_stamp = thisEvent->timeStamp();
326 bcCont = (*bcContHdl);
328 if ((hLArDigitContainer.
isValid())) {
329 std::vector<std::vector<Digi_MonValues>> digiMonValueVec(
m_layerNames.size());
330 for (
auto& innerVec : digiMonValueVec) {
331 innerVec.reserve(1600);
335 for (
const LArDigit* pLArDigit : *hLArDigitContainer) {
338 if (!
cabling->isOnlineConnected(
id))
341 const unsigned trueNSamples = pLArDigit->nsamples();
342 if (trueNSamples == 0)
344 Digi_Nsamples = trueNSamples;
345 const int cgain = pLArDigit->gain();
349 if (caloDetElement == 0) {
353 Digi_eta = caloDetElement->
eta_raw();
354 Digi_phi = caloDetElement->
phi_raw();
359 const int calosample = caloDetElement->
getSampling();
363 const unsigned iLyr = iLyrNS * 2 +
side;
364 auto& lvaluemap_digi = digiMonValueVec[iLyr];
365 auto& lvaluemap_digi_ALL = digiMonValueVec.back();
369 Digi_partition = ThisPartition;
380 Pedestal = pedestals->
pedestal(
id, cgain);
389 Digi_SCChannel = scdigi->
Channel();
390 Digi_latomeSourceId = scdigi->
SourceId();
394 const std::vector<short>* digito = &pLArDigit->samples();
397 std::vector<short>::const_iterator maxSam = std::max_element(digito->begin(), digito->end());
399 Digi_maxpos = thismaxPos + 1;
400 float ADC_max = pLArDigit->samples().at(Digi_maxpos - 1);
402 float ADC_0 = pLArDigit->samples().at(0);
408 float samp_mean = samp_sum /
static_cast<float>(trueNSamples);
409 float sq_sum = std::inner_product(digito->begin(), digito->end(), digito->begin(), 0.0);
410 float rms_arg = sq_sum /
static_cast<float>(trueNSamples) - samp_mean * samp_mean;
415 Digi_ADC_RMS = std::sqrt(rms_arg);
419 Digi_Diff_ADC0_Ped = ADC_0 - Pedestal;
420 for (
unsigned i = 0;
i < trueNSamples; ++
i) {
421 badNotMasked =
false;
426 Digi_ADC = pLArDigit->samples().at(
i);
428 Digi_ADC = Digi_ADC / 8;
431 Digi_Diff_ADC_Ped = Digi_ADC - Pedestal;
432 if (ADC_max != Pedestal) {
433 Digi_Diff_ADC_Ped_Norm = (Digi_ADC - Pedestal) / std::abs(ADC_max - Pedestal);
437 if (Digi_ADC != -1) {
444 if (ADC_max - Pedestal > 10 * PedestalRMS) {
447 if (notMasked && notBadQual && ADCped10RMS) {
451 lvaluemap_digi.emplace_back(Digi_eta, Digi_phi, Digi_ieta, Digi_iphi, Digi_sampos, Digi_ADC, Digi_latomeSourceIdBIN, Pedestal, Digi_maxpos,
452 Digi_partition, Digi_Diff_ADC_Ped_Norm, Digi_Diff_ADC_Ped, Digi_Diff_ADC0_Ped, Digi_ADC_RMS,
BCID, lumi_block, passDigiNom,
454 lvaluemap_digi_ALL.emplace_back(Digi_eta, Digi_phi, Digi_ieta, Digi_iphi, Digi_sampos, Digi_ADC, Digi_latomeSourceIdBIN, Pedestal, Digi_maxpos,
455 Digi_partition, Digi_Diff_ADC_Ped_Norm, Digi_Diff_ADC_Ped, Digi_Diff_ADC0_Ped, Digi_ADC_RMS,
BCID, lumi_block, passDigiNom,
463 for (
size_t ilayer = 0; ilayer < digiMonValueVec.size(); ++ilayer) {
464 const auto&
tool = digiMonValueVec[ilayer];
471 auto digi_part_latomesourceidbin =
Monitored::Collection(
"Digi_part_latomesourceidbin",
tool, [](
const auto&
v) {
return v.digi_latomesourceidbin; });
475 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; });
476 auto digi_part_diff_adc_ped =
Monitored::Collection(
"Digi_part_diff_adc_ped",
tool, [](
const auto&
v) {
return v.digi_diff_adc_ped; });
477 auto digi_part_diff_adc0_ped =
Monitored::Collection(
"Digi_part_diff_adc0_ped",
tool, [](
const auto&
v) {
return v.digi_diff_adc0_ped; });
480 auto digi_part_passDigiNom =
Monitored::Collection(
"Digi_part_passDigiNom",
tool, [](
const auto&
v) {
return v.digi_passDigiNom; });
481 auto digi_part_badNotMasked =
Monitored::Collection(
"Digi_part_badNotMasked",
tool, [](
const auto&
v) {
return v.digi_badNotMasked; });
485 digi_part_adc, digi_part_latomesourceidbin, digi_part_pedestal, digi_part_maxpos, digi_part_diff_adc_ped_norm, digi_part_diff_adc_ped,
486 digi_part_diff_adc0_ped, digi_part_adc_rms, digi_part_bcid, digi_part_lb, digi_part_passDigiNom, digi_part_badNotMasked);
499 std::vector<std::vector<SC_MonValues>> scMonValueVec(
m_layerNames.size());
500 for (
auto& innerVec : scMonValueVec) {
501 innerVec.reserve(1600);
505 for (; itSC != itSC_e; ++itSC, ++itSCReco) {
507 if (itSCReco < hSCetRecoContainer->
end()) {
508 rawSCReco = *itSCReco;
514 SC_SCChannel = rawSC->
chan();
517 if (!
cabling->isOnlineConnected(
id))
523 if (caloDetElement == 0) {
524 ATH_MSG_ERROR(
"Cannot retrieve (eta,phi) coordinates for raw channels");
526 <<
"; rawSC->SourceId() = " << rawSC->
SourceId());
529 SC_eta = caloDetElement->
eta_raw();
530 SC_phi = caloDetElement->
phi_raw();
538 const unsigned iLyr = iLyrNS * 2 +
side;
540 auto& lvaluemap_sc = scMonValueVec[iLyr];
541 auto& lvaluemap_sc_ALL = scMonValueVec.back();
552 eTgt0p325GeV =
false;
553 eTgt0lt0p325GeV =
false;
560 onlofflEmismatch =
false;
561 passSCNom0_0p325 =
false;
562 passSCNom0p325_1 =
false;
565 passSCNom10tauGt3 =
false;
566 saturNotMasked =
false;
567 OFCbOFNotMasked =
false;
568 notMaskedEoflNe0 =
false;
569 notMaskedEoflGt1 =
false;
570 nonZeroETofl =
false;
572 passSCNomInvalid =
false;
582 unsigned int bcid_ind = 0;
584 for (
auto& SCe : rawSC->
bcids()) {
589 if (bcid_ind >= rawSC->
bcids().size()) {
590 ATH_MSG_WARNING(
"BCID not found in SC bcids list!! " <<
BCID <<
" BCIDs size: " << rawSC->
bcids().size() <<
", proposed index: " << bcid_ind);
591 }
else if (rawSC->
bcids().at(bcid_ind) !=
BCID) {
595 if (rawSC->
energies().size() > bcid_ind) {
596 SC_energy_onl = rawSC->
energies().at(bcid_ind);
598 ATH_MSG_WARNING(
"rawSC energies vector is too small for the requested BCID index " << bcid_ind <<
" (size is " << rawSC->
energies().size()
599 <<
", bcid vec size is " << rawSC->
bcids().size() <<
")");
607 if (rawSCReco != 0) {
608 if (rawSCReco->
energies().size() > 0) {
609 SC_energy_ofl = rawSCReco->
energies().at(0);
615 SC_ET_diff = SC_energy_onl - SC_energy_ofl;
616 SC_ET_onl = (SC_energy_onl * 12.5) / 1000;
617 SC_ET_ofl = (SC_energy_ofl * 12.5) / 1000;
618 SC_ET_onl_muscaled = event_mu > 0. ? SC_ET_onl / event_mu : SC_ET_onl;
620 if (rawSCReco != 0) {
625 SC_time = (SC_energy_ofl != 0) ? (
float)Etau / (
float)SC_energy_ofl : Etau;
627 ATH_MSG_DEBUG(
"Energy onl - Energy ofl: " << SC_energy_onl <<
", " << SC_energy_ofl << std::endl);
628 if (SC_ET_onl != 0) {
633 if (SC_ET_onl > 0.325) {
635 }
else if (SC_ET_onl < 0.325 && SC_ET_onl > 0.) {
636 eTgt0lt0p325GeV =
true;
644 if (SC_ET_onl > 10) {
647 if (SC_ET_onl < 10) {
650 if (SC_ET_ofl != 0) {
656 if (rawSC->
satur().size() > bcid_ind) {
657 if (rawSC->
satur().at(bcid_ind)) {
659 saturNotMasked =
true;
668 if (rawSCReco != 0 && rawSCReco->
ofcbOverflow() ==
false) {
672 OFCbOFNotMasked =
true;
675 if (std::abs(SC_time) > 3) {
679 if (notMasked && notSatur && notOFCbOF) {
681 notMaskedEoflNe0 =
true;
684 notMaskedEoflGt1 =
true;
686 if (SC_energy_onl == -99999) {
687 passSCNomInvalid =
true;
692 if (eTgt0lt0p325GeV) {
693 passSCNom0_0p325 =
true;
695 if (eTgt0p325GeV && eTlt1GeV) {
696 passSCNom0p325_1 =
true;
704 passSCNom10tauGt3 =
true;
707 if (SC_energy_onl != SC_energy_ofl) {
708 onlofflEmismatch =
true;
713 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,
714 lumi_block, zeroET, passSCNomInvalid, passSCNom0_0p325, passSCNom0p325_1, passSCNom1, passSCNom10, passSCNom10tauGt3, saturNotMasked, OFCbOFNotMasked, notMaskedEoflNe0,
716 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,
717 BCID, lumi_block, zeroET, passSCNomInvalid, passSCNom0_0p325, passSCNom0p325_1, passSCNom1, passSCNom10, passSCNom10tauGt3, saturNotMasked, OFCbOFNotMasked,
718 notMaskedEoflNe0, notMaskedEoflGt1);
723 for (
size_t ilayer = 0; ilayer < scMonValueVec.size(); ++ilayer) {
724 const auto&
tool = scMonValueVec[ilayer];
729 auto sc_part_latomesourceidbin =
Monitored::Collection(
"SC_part_latomesourceidbin",
tool, [](
const auto&
v) {
return v.sc_latomesourceidbin; });
733 auto sc_part_et_onl_muscaled =
Monitored::Collection(
"SC_part_et_onl_muscaled",
tool, [](
const auto&
v) {
return v.sc_et_onl_muscaled; });
739 auto sc_part_passSCNomInvalid =
Monitored::Collection(
"SC_part_passSCNomInvalid",
tool, [](
const auto&
v) {
return v.sc_passSCNomInvalid; });
740 auto sc_part_passSCNom0_0p325 =
Monitored::Collection(
"SC_part_passSCNom0_0p325",
tool, [](
const auto&
v) {
return v.sc_passSCNom0_0p325; });
741 auto sc_part_passSCNom0p325_1 =
Monitored::Collection(
"SC_part_passSCNom0p325_1",
tool, [](
const auto&
v) {
return v.sc_passSCNom0p325_1; });
744 auto sc_part_passSCNom10tauGt3 =
Monitored::Collection(
"SC_part_passSCNom10tauGt3",
tool, [](
const auto&
v) {
return v.sc_passSCNom10tauGt3; });
745 auto sc_part_saturNotMasked =
Monitored::Collection(
"SC_part_saturNotMasked",
tool, [](
const auto&
v) {
return v.sc_saturNotMasked; });
746 auto sc_part_OFCbOFNotMasked =
Monitored::Collection(
"SC_part_OFCbOFNotMasked",
tool, [](
const auto&
v) {
return v.sc_OFCbOFNotMasked; });
747 auto sc_part_notMaskedEoflNe0 =
Monitored::Collection(
"SC_part_notMaskedEoflNe0",
tool, [](
const auto&
v) {
return v.sc_notMaskedEoflNe0; });
748 auto sc_part_notMaskedEoflGt1 =
Monitored::Collection(
"SC_part_notMaskedEoflGt1",
tool, [](
const auto&
v) {
return v.sc_notMaskedEoflGt1; });
752 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,
753 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,
754 sc_part_notMaskedEoflGt1);
763 if ((hLArLATOMEHeaderContainer.isValid())) {
765 for (
const LArLATOMEHeader* pLArLATOMEHeader : *hLArLATOMEHeaderContainer) {
766 event_size += pLArLATOMEHeader->ROBFragSize() + 48;
768 event_size /= (1024 * 1024 / 4);
774 return StatusCode::SUCCESS;
783 if(
side==0)
return 0;
786 if(
side==0)
return 2;
789 if(
side==0)
return 4;
792 if(
side==0)
return 6;
803 const unsigned detID = sourceID >> 16;
804 const unsigned value = sourceID & 0xF;
807 detStartingBin=mapit->second;
810 unsigned binx = detStartingBin+
value;