39 #include "CaloGeoHelpers/CaloSampling.h"
57 return (!
c.isValid() ||
c->size()==0);
97 constexpr
unsigned expSize=
MAXLYRNS*2+1;
99 ATH_MSG_ERROR(
"Unexpected size of LayerNames property. Expect "<< expSize <<
" entries, found "<<
m_layerNames.size() <<
" entries");
100 return StatusCode::FAILURE;
253 if (!hLArDigitContainer.isValid()) {
254 ATH_MSG_WARNING(
"The requested digit container key could not be retrieved. Was there a problem retrieving information from the run logger?");
256 ATH_MSG_DEBUG(
"hLArDigitContainer.size() " << hLArDigitContainer->size());
259 if (!hSCetContainer.isValid()) {
260 ATH_MSG_WARNING(
"The requested SC ET container key could not be retrieved. Was there a problem retrieving information from the run logger?");
262 ATH_MSG_DEBUG(
"hSCetContainer.size() " << hSCetContainer->size());
265 if (!hSCetRecoContainer.isValid()) {
266 ATH_MSG_WARNING(
"The requested SC ET reco container key could not be retrieved. Was there a problem retrieving information from the run logger?");
268 ATH_MSG_DEBUG(
"hSCetRecoContainer.size() " << hSCetRecoContainer->size());
273 if (!hLArLATOMEHeaderContainer.isValid()) {
274 ATH_MSG_WARNING(
"The requested LATOME header container key could not be retrieved. Was there a problem retrieving information from the run logger?");
276 ATH_MSG_DEBUG(
"hLArLATOMEHeaderContainer.size() " << hLArLATOMEHeaderContainer->size());
281 ATH_MSG_WARNING(
"All of the requested containers are empty. Was there a problem retrieving information from the run logger?");
282 return StatusCode::SUCCESS;
285 BCID = thisEvent->bcid();
286 lumi_block = thisEvent->lumiBlock();
287 time_stamp = thisEvent->timeStamp();
306 bcCont = (*bcContHdl);
308 if ((hLArDigitContainer.isValid())) {
309 std::vector<std::vector<Digi_MonValues>> digiMonValueVec(
m_layerNames.size());
310 for (
auto& innerVec : digiMonValueVec) {
311 innerVec.reserve(1600);
315 for (
const LArDigit* pLArDigit : *hLArDigitContainer) {
318 if (!
cabling->isOnlineConnected(
id))
321 const unsigned trueNSamples = pLArDigit->nsamples();
322 if (trueNSamples == 0)
324 Digi_Nsamples = trueNSamples;
325 const int cgain = pLArDigit->gain();
329 if (caloDetElement == 0) {
333 Digi_eta = caloDetElement->
eta_raw();
334 Digi_phi = caloDetElement->
phi_raw();
339 const int calosample = caloDetElement->
getSampling();
343 const unsigned iLyr = iLyrNS * 2 +
side;
344 auto& lvaluemap_digi = digiMonValueVec[iLyr];
345 auto& lvaluemap_digi_ALL = digiMonValueVec.back();
349 Digi_partition = ThisPartition;
360 Pedestal = pedestals->
pedestal(
id, cgain);
369 Digi_SCChannel = scdigi->
Channel();
370 Digi_latomeSourceId = scdigi->
SourceId();
374 const std::vector<short>* digito = &pLArDigit->samples();
377 std::vector<short>::const_iterator maxSam = std::max_element(digito->begin(), digito->end());
379 Digi_maxpos = thismaxPos + 1;
380 float ADC_max = pLArDigit->samples().at(Digi_maxpos - 1);
382 float ADC_0 = pLArDigit->samples().at(0);
388 Digi_Diff_ADC0_Ped = ADC_0 - Pedestal;
389 for (
unsigned i = 0;
i < trueNSamples; ++
i) {
390 badNotMasked =
false;
395 Digi_ADC = pLArDigit->samples().at(
i);
397 Digi_ADC = Digi_ADC / 8;
400 Digi_Diff_ADC_Ped = Digi_ADC - Pedestal;
401 if (ADC_max != Pedestal) {
402 Digi_Diff_ADC_Ped_Norm = (Digi_ADC - Pedestal) / std::abs(ADC_max - Pedestal);
406 if (Digi_ADC != -1) {
413 if (ADC_max - Pedestal > 10 * PedestalRMS) {
416 if (notMasked && notBadQual && ADCped10RMS) {
420 lvaluemap_digi.emplace_back(Digi_eta, Digi_phi, Digi_ieta, Digi_iphi, Digi_sampos, Digi_ADC, Digi_latomeSourceIdBIN, Pedestal, Digi_maxpos,
421 Digi_partition, Digi_Diff_ADC_Ped_Norm, Digi_Diff_ADC_Ped, Digi_Diff_ADC0_Ped,
BCID, lumi_block, passDigiNom,
423 lvaluemap_digi_ALL.emplace_back(Digi_eta, Digi_phi, Digi_ieta, Digi_iphi, Digi_sampos, Digi_ADC, Digi_latomeSourceIdBIN, Pedestal, Digi_maxpos,
424 Digi_partition, Digi_Diff_ADC_Ped_Norm, Digi_Diff_ADC_Ped, Digi_Diff_ADC0_Ped,
BCID, lumi_block, passDigiNom,
432 for (
size_t ilayer = 0; ilayer < digiMonValueVec.size(); ++ilayer) {
433 const auto&
tool = digiMonValueVec[ilayer];
440 auto digi_part_latomesourceidbin =
Monitored::Collection(
"Digi_part_latomesourceidbin",
tool, [](
const auto&
v) {
return v.digi_latomesourceidbin; });
444 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; });
445 auto digi_part_diff_adc_ped =
Monitored::Collection(
"Digi_part_diff_adc_ped",
tool, [](
const auto&
v) {
return v.digi_diff_adc_ped; });
446 auto digi_part_diff_adc0_ped =
Monitored::Collection(
"Digi_part_diff_adc0_ped",
tool, [](
const auto&
v) {
return v.digi_diff_adc0_ped; });
449 auto digi_part_passDigiNom =
Monitored::Collection(
"Digi_part_passDigiNom",
tool, [](
const auto&
v) {
return v.digi_passDigiNom; });
450 auto digi_part_badNotMasked =
Monitored::Collection(
"Digi_part_badNotMasked",
tool, [](
const auto&
v) {
return v.digi_badNotMasked; });
453 digi_part_adc, digi_part_latomesourceidbin, digi_part_pedestal, digi_part_maxpos, digi_part_diff_adc_ped_norm, digi_part_diff_adc_ped,
454 digi_part_diff_adc0_ped, digi_part_bcid, digi_part_lb, digi_part_passDigiNom, digi_part_badNotMasked);
460 if (hSCetContainer.isValid() && hSCetRecoContainer.isValid()) {
467 std::vector<std::vector<SC_MonValues>> scMonValueVec(
m_layerNames.size());
468 for (
auto& innerVec : scMonValueVec) {
469 innerVec.reserve(1600);
473 for (; itSC != itSC_e; ++itSC, ++itSCReco) {
475 if (itSCReco < hSCetRecoContainer->
end()) {
476 rawSCReco = *itSCReco;
482 SC_SCChannel = rawSC->
chan();
485 if (!
cabling->isOnlineConnected(
id))
491 if (caloDetElement == 0) {
492 ATH_MSG_ERROR(
"Cannot retrieve (eta,phi) coordinates for raw channels");
494 <<
"; rawSC->SourceId() = " << rawSC->
SourceId());
497 SC_eta = caloDetElement->
eta_raw();
498 SC_phi = caloDetElement->
phi_raw();
506 const unsigned iLyr = iLyrNS * 2 +
side;
508 auto& lvaluemap_sc = scMonValueVec[iLyr];
509 auto& lvaluemap_sc_ALL = scMonValueVec.back();
520 eTgt0p325GeV =
false;
521 eTgt0lt0p325GeV =
false;
528 onlofflEmismatch =
false;
529 passSCNom0_0p325 =
false;
530 passSCNom0p325_1 =
false;
533 passSCNom10tauGt3 =
false;
534 saturNotMasked =
false;
535 OFCbOFNotMasked =
false;
536 notMaskedEoflNe0 =
false;
537 notMaskedEoflGt1 =
false;
538 nonZeroETofl =
false;
540 passSCNomInvalid =
false;
550 unsigned int bcid_ind = 0;
552 for (
auto& SCe : rawSC->
bcids()) {
557 if (bcid_ind >= rawSC->
bcids().size()) {
558 ATH_MSG_WARNING(
"BCID not found in SC bcids list!! " <<
BCID <<
" BCIDs size: " << rawSC->
bcids().size() <<
", proposed index: " << bcid_ind);
559 }
else if (rawSC->
bcids().at(bcid_ind) !=
BCID) {
563 if (rawSC->
energies().size() > bcid_ind) {
564 SC_energy_onl = rawSC->
energies().at(bcid_ind);
566 ATH_MSG_WARNING(
"rawSC energies vector is too small for the requested BCID index " << bcid_ind <<
" (size is " << rawSC->
energies().size()
567 <<
", bcid vec size is " << rawSC->
bcids().size() <<
")");
575 if (rawSCReco != 0) {
576 if (rawSCReco->
energies().size() > 0) {
577 SC_energy_ofl = rawSCReco->
energies().at(0);
583 SC_ET_diff = SC_energy_onl - SC_energy_ofl;
584 SC_ET_onl = (SC_energy_onl * 12.5) / 1000;
585 SC_ET_ofl = (SC_energy_ofl * 12.5) / 1000;
586 SC_ET_onl_muscaled = event_mu > 0. ? SC_ET_onl / event_mu : SC_ET_onl;
588 if (rawSCReco != 0) {
593 SC_time = (SC_energy_ofl != 0) ? (
float)Etau / (
float)SC_energy_ofl : Etau;
595 ATH_MSG_DEBUG(
"Energy onl - Energy ofl: " << SC_energy_onl <<
", " << SC_energy_ofl << std::endl);
596 if (SC_ET_onl != 0) {
601 if (SC_ET_onl > 0.325) {
603 }
else if (SC_ET_onl < 0.325 && SC_ET_onl > 0.) {
604 eTgt0lt0p325GeV =
true;
612 if (SC_ET_onl > 10) {
615 if (SC_ET_onl < 10) {
618 if (SC_ET_ofl != 0) {
624 if (rawSC->
satur().size() > bcid_ind) {
625 if (rawSC->
satur().at(bcid_ind)) {
627 saturNotMasked =
true;
636 if (rawSCReco != 0 && rawSCReco->
ofcbOverflow() ==
false) {
640 OFCbOFNotMasked =
true;
643 if (std::abs(SC_time) > 3) {
647 if (notMasked && notSatur && notOFCbOF) {
649 notMaskedEoflNe0 =
true;
652 notMaskedEoflGt1 =
true;
654 if (SC_energy_onl == -99999) {
655 passSCNomInvalid =
true;
660 if (eTgt0lt0p325GeV) {
661 passSCNom0_0p325 =
true;
663 if (eTgt0p325GeV && eTlt1GeV) {
664 passSCNom0p325_1 =
true;
672 passSCNom10tauGt3 =
true;
675 if (SC_energy_onl != SC_energy_ofl) {
676 onlofflEmismatch =
true;
681 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,
682 lumi_block, zeroET, passSCNomInvalid, passSCNom0_0p325, passSCNom0p325_1, passSCNom1, passSCNom10, passSCNom10tauGt3, saturNotMasked, OFCbOFNotMasked, notMaskedEoflNe0,
684 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,
685 BCID, lumi_block, zeroET, passSCNomInvalid, passSCNom0_0p325, passSCNom0p325_1, passSCNom1, passSCNom10, passSCNom10tauGt3, saturNotMasked, OFCbOFNotMasked,
686 notMaskedEoflNe0, notMaskedEoflGt1);
691 for (
size_t ilayer = 0; ilayer < scMonValueVec.size(); ++ilayer) {
692 const auto&
tool = scMonValueVec[ilayer];
697 auto sc_part_latomesourceidbin =
Monitored::Collection(
"SC_part_latomesourceidbin",
tool, [](
const auto&
v) {
return v.sc_latomesourceidbin; });
701 auto sc_part_et_onl_muscaled =
Monitored::Collection(
"SC_part_et_onl_muscaled",
tool, [](
const auto&
v) {
return v.sc_et_onl_muscaled; });
707 auto sc_part_passSCNomInvalid =
Monitored::Collection(
"SC_part_passSCNomInvalid",
tool, [](
const auto&
v) {
return v.sc_passSCNomInvalid; });
708 auto sc_part_passSCNom0_0p325 =
Monitored::Collection(
"SC_part_passSCNom0_0p325",
tool, [](
const auto&
v) {
return v.sc_passSCNom0_0p325; });
709 auto sc_part_passSCNom0p325_1 =
Monitored::Collection(
"SC_part_passSCNom0p325_1",
tool, [](
const auto&
v) {
return v.sc_passSCNom0p325_1; });
712 auto sc_part_passSCNom10tauGt3 =
Monitored::Collection(
"SC_part_passSCNom10tauGt3",
tool, [](
const auto&
v) {
return v.sc_passSCNom10tauGt3; });
713 auto sc_part_saturNotMasked =
Monitored::Collection(
"SC_part_saturNotMasked",
tool, [](
const auto&
v) {
return v.sc_saturNotMasked; });
714 auto sc_part_OFCbOFNotMasked =
Monitored::Collection(
"SC_part_OFCbOFNotMasked",
tool, [](
const auto&
v) {
return v.sc_OFCbOFNotMasked; });
715 auto sc_part_notMaskedEoflNe0 =
Monitored::Collection(
"SC_part_notMaskedEoflNe0",
tool, [](
const auto&
v) {
return v.sc_notMaskedEoflNe0; });
716 auto sc_part_notMaskedEoflGt1 =
Monitored::Collection(
"SC_part_notMaskedEoflGt1",
tool, [](
const auto&
v) {
return v.sc_notMaskedEoflGt1; });
720 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,
721 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,
722 sc_part_notMaskedEoflGt1);
731 if ((hLArLATOMEHeaderContainer.isValid())) {
733 for (
const LArLATOMEHeader* pLArLATOMEHeader : *hLArLATOMEHeaderContainer) {
734 event_size += pLArLATOMEHeader->ROBFragSize() + 48;
736 event_size /= (1024 * 1024 / 4);
742 return StatusCode::SUCCESS;
751 if(
side==0)
return 0;
754 if(
side==0)
return 2;
757 if(
side==0)
return 4;
760 if(
side==0)
return 6;
771 const unsigned detID = sourceID >> 16;
772 const unsigned value = sourceID & 0xF;
775 detStartingBin=mapit->second;
778 unsigned binx = detStartingBin+
value;