39 #include "CaloGeoHelpers/CaloSampling.h"
92 constexpr
unsigned expSize=
MAXLYRNS*2+1;
94 ATH_MSG_ERROR(
"Unexpected size of LayerNames property. Expect "<< expSize <<
" entries, found "<<
m_layerNames.size() <<
" entries");
95 return StatusCode::FAILURE;
237 if (!hLArDigitContainer.isValid()) {
238 ATH_MSG_WARNING(
"The requested digit container key could not be retrieved. Was there a problem retrieving information from the run logger?");
240 ATH_MSG_DEBUG(
"hLArDigitContainer.size() " << hLArDigitContainer->size());
243 if (!hSCetContainer.isValid()) {
244 ATH_MSG_WARNING(
"The requested SC ET container key could not be retrieved. Was there a problem retrieving information from the run logger?");
246 ATH_MSG_DEBUG(
"hSCetContainer.size() " << hSCetContainer->size());
249 if (!hSCetRecoContainer.isValid()) {
250 ATH_MSG_WARNING(
"The requested SC ET reco container key could not be retrieved. Was there a problem retrieving information from the run logger?");
252 ATH_MSG_DEBUG(
"hSCetRecoContainer.size() " << hSCetRecoContainer->size());
257 if (!hLArLATOMEHeaderContainer.isValid()) {
258 ATH_MSG_WARNING(
"The requested LATOME header container key could not be retrieved. Was there a problem retrieving information from the run logger?");
260 ATH_MSG_DEBUG(
"hLArLATOMEHeaderContainer.size() " << hLArLATOMEHeaderContainer->size());
263 if ( hLArDigitContainer->size() == 0 && hSCetContainer->size() == 0 && hSCetRecoContainer->size() == 0 && hLArLATOMEHeaderContainer->size() == 0){
265 ATH_MSG_WARNING(
"All of the requested containers are empty. Was there a problem retrieving information from the run logger?");
266 return StatusCode::SUCCESS;
269 BCID = thisEvent->bcid();
270 lumi_block = thisEvent->lumiBlock();
271 time_stamp = thisEvent->timeStamp();
293 if ( (hLArDigitContainer.isValid()) ){
294 std::vector<std::vector<Digi_MonValues>> digiMonValueVec(
m_layerNames.size());
295 for (
auto& innerVec : digiMonValueVec) {
296 innerVec.reserve(1600);
300 for (
const LArDigit* pLArDigit : *hLArDigitContainer) {
303 if(!
cabling->isOnlineConnected(
id))
continue;
305 const unsigned trueNSamples = pLArDigit->nsamples();
306 Digi_Nsamples = trueNSamples;
307 const int cgain = pLArDigit->gain();
311 if(caloDetElement == 0 ){
315 Digi_eta = caloDetElement->
eta_raw();
316 Digi_phi = caloDetElement->
phi_raw();
321 const int calosample=caloDetElement->
getSampling();
325 const unsigned iLyr=iLyrNS*2+
side;
326 auto& lvaluemap_digi = digiMonValueVec[iLyr];
327 auto& lvaluemap_digi_ALL = digiMonValueVec.back();
332 Digi_partition = ThisPartition;
343 Pedestal = pedestals->
pedestal(
id,cgain);
352 Digi_SCChannel = scdigi->
Channel();
353 Digi_latomeSourceId = scdigi->
SourceId();
357 const std::vector<short>* digito = &pLArDigit->samples();
360 std::vector<short>::const_iterator maxSam = std::max_element(digito->begin(), digito->end());
362 Digi_maxpos=thismaxPos+1;
363 float ADC_max = pLArDigit->samples().at(Digi_maxpos-1);
365 float ADC_0 = pLArDigit->samples().at(0);
371 Digi_Diff_ADC0_Ped = ADC_0 - Pedestal;
372 for(
unsigned i=0;
i<trueNSamples;++
i) {
373 badNotMasked =
false;
378 Digi_ADC = pLArDigit->samples().at(
i);
383 Digi_Diff_ADC_Ped = Digi_ADC - Pedestal;
384 if ( ADC_max != Pedestal ){
385 Digi_Diff_ADC_Ped_Norm = (Digi_ADC - Pedestal) / std::abs(ADC_max - Pedestal);
396 if(ADC_max - Pedestal > 10*PedestalRMS) {
399 if ( notMasked && notBadQual && ADCped10RMS ){
403 lvaluemap_digi.emplace_back(Digi_eta, Digi_phi, Digi_ieta, Digi_iphi, Digi_sampos, Digi_ADC, Digi_latomeSourceIdBIN, Pedestal, Digi_maxpos, Digi_partition, Digi_Diff_ADC_Ped_Norm, Digi_Diff_ADC_Ped, Digi_Diff_ADC0_Ped,
BCID, lumi_block, passDigiNom, badNotMasked);
404 lvaluemap_digi_ALL.emplace_back(Digi_eta, Digi_phi, Digi_ieta, Digi_iphi, Digi_sampos, Digi_ADC, Digi_latomeSourceIdBIN, Pedestal, Digi_maxpos, Digi_partition, Digi_Diff_ADC_Ped_Norm, Digi_Diff_ADC_Ped, Digi_Diff_ADC0_Ped,
BCID, lumi_block, passDigiNom, badNotMasked);
412 for (
size_t ilayer = 0; ilayer < digiMonValueVec.size(); ++ilayer) {
413 const auto&
tool = digiMonValueVec[ilayer];
420 auto digi_part_latomesourceidbin =
Monitored::Collection(
"Digi_part_latomesourceidbin",
tool,[](
const auto&
v){
return v.digi_latomesourceidbin;});
424 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;});
426 auto digi_part_diff_adc0_ped =
Monitored::Collection(
"Digi_part_diff_adc0_ped",
tool,[](
const auto&
v){
return v.digi_diff_adc0_ped;});
433 digi_part_eta, digi_part_phi, digi_part_ieta, digi_part_iphi, digi_part_sampos, digi_part_adc, digi_part_latomesourceidbin, digi_part_pedestal, digi_part_maxpos, digi_part_diff_adc_ped_norm, digi_part_diff_adc_ped, digi_part_diff_adc0_ped, digi_part_bcid, digi_part_lb, digi_part_passDigiNom, digi_part_badNotMasked);
440 if ( hSCetContainer.isValid() && hSCetRecoContainer.isValid() ){
447 std::vector<std::vector<SC_MonValues>> scMonValueVec(
m_layerNames.size());
448 for (
auto& innerVec : scMonValueVec) {
449 innerVec.reserve(1600);
453 for ( ; itSC!=itSC_e;++itSC,++itSCReco) {
455 if ( itSCReco < hSCetRecoContainer->
end() ){
456 rawSCReco = *itSCReco;
458 ATH_MSG_WARNING(
"Looping SC ET container, but we have reached the end of the SC ET Reco iterator. Check the sizes of these containers. Is SC ET Reco size zero? Is there a problem with the digit container name sent by the run logger?");
461 SC_SCChannel = rawSC->
chan();
464 if(!
cabling->isOnlineConnected(
id))
continue;
469 if (caloDetElement == 0) {
470 ATH_MSG_ERROR(
"Cannot retrieve (eta,phi) coordinates for raw channels");
474 SC_eta = caloDetElement->
eta_raw();
475 SC_phi = caloDetElement->
phi_raw();
483 const unsigned iLyr=iLyrNS*2+
side;
485 auto& lvaluemap_sc = scMonValueVec[iLyr];
486 auto& lvaluemap_sc_ALL = scMonValueVec.back();
500 onlofflEmismatch=
false;
504 passSCNom10tauGt3 =
false;
505 saturNotMasked =
false;
506 OFCbOFNotMasked =
false;
507 notMaskedEoflNe0 =
false;
508 notMaskedEoflGt1 =
false;
509 nonZeroETofl =
false;
519 unsigned int bcid_ind = 0;
521 for (
auto & SCe : rawSC->
bcids() ){
522 if ( SCe ==
BCID )
break;
525 if ( bcid_ind >= rawSC->
bcids().size() ){
526 ATH_MSG_WARNING(
"BCID not found in SC bcids list!! "<<
BCID<<
" BCIDs size: "<<rawSC->
bcids().size()<<
", proposed index: "<<bcid_ind);
527 }
else if ( rawSC->
bcids().at(bcid_ind) !=
BCID ){
531 if (rawSC->
energies().size() > bcid_ind){
532 SC_energy_onl = rawSC->
energies().at(bcid_ind);
534 ATH_MSG_WARNING(
"rawSC energies vector is too small for the requested BCID index "<<bcid_ind<<
" (size is "<<rawSC->
energies().size()<<
", bcid vec size is "<<rawSC->
bcids().size()<<
")");
542 if ( rawSCReco != 0 ){
543 if ( rawSCReco->
energies().size()>0 ){
544 SC_energy_ofl = rawSCReco->
energies().at(0);
550 SC_ET_diff = SC_energy_onl - SC_energy_ofl;
551 SC_ET_onl = ( SC_energy_onl* 12.5 ) / 1000;
552 SC_ET_ofl = ( SC_energy_ofl* 12.5 ) / 1000;
553 SC_ET_onl_muscaled = event_mu > 0. ? SC_ET_onl / event_mu : SC_ET_onl;
555 if ( rawSCReco != 0 ){
558 SC_time = (SC_energy_ofl != 0) ? (
float)Etau / (
float)SC_energy_ofl : Etau;
560 ATH_MSG_DEBUG(
"Energy onl - Energy ofl: "<<SC_energy_onl<<
", "<<SC_energy_ofl<<std::endl);
561 if (SC_ET_onl != 0 ){
570 if (SC_ET_ofl != 0 ) {
576 if ( rawSC->
satur().size()>bcid_ind ){
577 if ( rawSC->
satur().at(bcid_ind) ){
579 saturNotMasked =
true;
588 if ( rawSCReco != 0 && rawSCReco->
ofcbOverflow() ==
false ){
592 OFCbOFNotMasked =
true;
595 if ( std::abs(SC_time) > 3 ){
599 if ( notMasked && notSatur && notOFCbOF ){
601 notMaskedEoflNe0 =
true;
604 notMaskedEoflGt1 =
true;
617 passSCNom10tauGt3 =
true;
620 if (SC_energy_onl != SC_energy_ofl){
621 onlofflEmismatch =
true;
626 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, lumi_block, passSCNom, passSCNom1, passSCNom10, passSCNom10tauGt3, saturNotMasked, OFCbOFNotMasked, notMaskedEoflNe0, notMaskedEoflGt1);
627 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,
BCID, lumi_block, passSCNom, passSCNom1, passSCNom10, passSCNom10tauGt3, saturNotMasked, OFCbOFNotMasked, notMaskedEoflNe0, notMaskedEoflGt1);
633 for (
size_t ilayer = 0; ilayer < scMonValueVec.size(); ++ilayer) {
634 const auto&
tool = scMonValueVec[ilayer];
639 auto sc_part_latomesourceidbin =
Monitored::Collection(
"SC_part_latomesourceidbin",
tool,[](
const auto&
v){
return v.sc_latomesourceidbin;});
643 auto sc_part_et_onl_muscaled =
Monitored::Collection(
"SC_part_et_onl_muscaled",
tool,[](
const auto&
v){
return v.sc_et_onl_muscaled;});
650 auto sc_part_passSCNom10tauGt3 =
Monitored::Collection(
"SC_part_passSCNom10tauGt3",
tool,[](
const auto&
v){
return v.sc_passSCNom10tauGt3;});
652 auto sc_part_OFCbOFNotMasked =
Monitored::Collection(
"SC_part_OFCbOFNotMasked",
tool,[](
const auto&
v){
return v.sc_OFCbOFNotMasked;});
653 auto sc_part_notMaskedEoflNe0 =
Monitored::Collection(
"SC_part_notMaskedEoflNe0",
tool,[](
const auto&
v){
return v.sc_notMaskedEoflNe0;});
654 auto sc_part_notMaskedEoflGt1 =
Monitored::Collection(
"SC_part_notMaskedEoflGt1",
tool,[](
const auto&
v){
return v.sc_notMaskedEoflGt1;});
658 sc_part_eta, sc_part_phi, sc_part_ieta, sc_part_iphi, sc_part_latomesourceidbin, 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_part_passSCNom, sc_part_passSCNom1, sc_part_passSCNom10, sc_part_passSCNom10tauGt3, sc_part_saturNotMasked, sc_part_OFCbOFNotMasked, sc_part_notMaskedEoflNe0, sc_part_notMaskedEoflGt1);
667 if ( (hLArLATOMEHeaderContainer.isValid()) ){
669 for (
const LArLATOMEHeader* pLArLATOMEHeader : *hLArLATOMEHeaderContainer) {
670 event_size += pLArLATOMEHeader->ROBFragSize() + 48;
672 event_size /= (1024*1024/4);
680 return StatusCode::SUCCESS;
690 if(
side==0)
return 0;
693 if(
side==0)
return 2;
696 if(
side==0)
return 4;
699 if(
side==0)
return 6;
710 const unsigned detID = sourceID >> 16;
711 const unsigned value = sourceID & 0xF;
714 detStartingBin=mapit->second;
717 unsigned binx = detStartingBin+
value;