Read the voltage per HV line and store it in structure per readout-cell (resolve the many-HV-lines-to-many-cells mapping). Simulanitously fill the pathologies.
430{
431
432 std::vector<unsigned int> listElec;
433
434 const float uAkOhm = 1.e-3;
435
436
437
443 bool hasPathology=false;
444 if (index<hasPathologyEM.size()) {
445 if (!hasPathologyEM[index].
empty()) {
446 hasPathology=true;
448 }
449 }
450 const EMBDetectorElement* embElement =
dynamic_cast<const EMBDetectorElement*
>(calodetdescrmgr->
get_element(hash));
451 if (!embElement) std::abort();
453 unsigned int nelec =
cell->getNumElectrodes();
454 unsigned int ngap = 2*nelec;
455 float wt = 1./ngap;
456 for (
unsigned int i=0;
i<nelec;
i++) {
457 const EMBHVElectrode& electrode =
cell->getElectrode(i);
458
459
460 for (unsigned int igap=0;igap<2;igap++) {
462 float curr=0;
464 auto hvIt=voltage.find(hvline);
465 if(hvIt != voltage.end()) {
468 curr=hvIt->second.curr;
469 const EMBHVModule &hvmod = electrode.
getModule();
475 igap,
477 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
478 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
479 }
480 if (hasPathology) {
482 msg(MSG::VERBOSE) <<
"Original hv: "<<
hv<<
" ";
483 for (unsigned int ii=0;ii<listElec.size();ii++) {
484 if (listElec[ii]==(2*i+igap) && listElec[ii]<hasPathologyEM[index].
size() && hasPathologyEM[index][listElec[ii]]) {
487 curr = 0.;
489 curr = 0.;
490 } else {
492 curr=0.;
493 }
494 }
495 }
497 }
498
499 }
500 else {
501 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
502 }
504 }
505 }
507
508 const EMBDetectorElement* embElement =
dynamic_cast<const EMBDetectorElement*
>(calodetdescrmgr->
get_element(hash));
509 if (!embElement) std::abort();
511 const EMBPresamplerHVModule& hvmodule =
cell->getPresamplerHVModule ();
512
513 float wt = 0.5;
514 for (unsigned int igap=0;igap<2;igap++) {
516 float curr=0;
518 auto hvIt=voltage.find(hvline);
519 if(hvIt != voltage.end()) {
522 curr=hvIt->second.curr;
526 0,
528 igap,
529 0
530 ));
531 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0;
532 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
533 }
534 }
535 else {
536 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
537 }
539 }
542 bool hasPathology=false;
543 if (index<hasPathologyEM.size()) {
544 if (!hasPathologyEM[index].
empty()) {
545 hasPathology=true;
547 }
548 }
549
550 const EMECDetectorElement* emecElement =
dynamic_cast<const EMECDetectorElement*
>(calodetdescrmgr->
get_element(hash));
551 if (!emecElement) std::abort();
553 unsigned int nelec =
cell->getNumElectrodes();
554 unsigned int ngap = 2*nelec;
555 float wt = 1./ngap;
556 for (
unsigned int i=0;
i<nelec;
i++) {
557 const EMECHVElectrode& electrode =
cell->getElectrode(i);
558 for (unsigned int igap=0;igap<2;igap++) {
560 float curr=0;
562 auto hvIt=voltage.find(hvline);
563 if(hvIt != voltage.end()) {
566 curr=hvIt->second.curr;
567 const EMECHVModule &hvmod = electrode.
getModule();
575 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
576 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
577 }
578 if (hasPathology) {
579 msg(MSG::VERBOSE) <<
"Has pathology for id: "<<
m_larem_id->print_to_string(
id)<<
" "<<hasPathologyEM[
index]<<
endmsg;
580 for (unsigned int ii=0;ii<listElec.size();ii++) {
581 if (listElec[ii]==(2*i+igap) && listElec[ii]<hasPathologyEM[index].
size() && hasPathologyEM[index][listElec[ii]]) {
584 curr = 0.;
586 curr = 0.;
587 } else {
588 hv=((hasPathologyEM[
index][listElec[ii]]&0xFFF0)>>4);
589 curr=0.;
590 }
591 }
592 }
593 }
594 }
595 else {
596 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
597 }
599 }
600 }
601
603
604 const EMECDetectorElement* emecElement =
dynamic_cast<const EMECDetectorElement*
>(calodetdescrmgr->
get_element(hash));
605 if (!emecElement) std::abort();
607 const EMECPresamplerHVModule& hvmodule =
cell->getPresamplerHVModule ();
608
609 double wt = 0.5;
610 for (unsigned int igap=0;igap<2;igap++) {
612 float curr=0;
614 auto hvIt=voltage.find(hvline);
615 if(hvIt != voltage.end()) {
618 curr=hvIt->second.curr;
622 0,
623 0,
624 igap,
625 0
626 ));
627 if(curr >0.) curr *= uAkOhm * rValues[ridx]; else curr=0.;
628 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
629 }
630
631 }
632 else {
633 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
634 }
636 }
637 } else {
638 ATH_MSG_ERROR(
"This could not be, what happened with EM identifiers ?");
639 return StatusCode::FAILURE;
640 }
641 }
642
643
644
648 bool hasPathology=false;
649 if (index<hasPathologyHEC.size()) {
650 if (!hasPathologyHEC[index].
empty()) {
651 hasPathology=true;
653 }
654 }
655 const HECDetectorElement* hecElement =
dynamic_cast<const HECDetectorElement*
>(calodetdescrmgr->
get_element(hash));
656 if (!hecElement) std::abort();
658 unsigned int nsubgaps =
cell->getNumSubgaps();
659 float wt = 1./nsubgaps;
661 for (
unsigned int i=0;
i<nsubgaps;
i++) {
663 float curr=0;
664 const HECHVSubgap& subgap =
cell->getSubgap(i);
666 auto hvIt=voltage.find(hvline);
667 if(hvIt != voltage.end()) {
670 curr=hvIt->second.curr;
671 const HECHVModule &hvmod = subgap.
getModule();
675 0,
678 0
679 ));
680 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
681 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" cur. " << curr <<
" R: "<<rValues[ridx]);
682 }
683 if (hasPathology) {
685 for (unsigned int ii=0;ii<listElec.size();ii++) {
686 if (listElec[ii]==i && listElec[ii]<hasPathologyHEC[index].
size() && hasPathologyHEC[index][listElec[ii]]) {
689 curr = 0.;
691 curr = 0.;
692 } else {
694 curr=0.;
695 }
696 }
697 }
698 }
699 }
700 else {
701 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
702 }
704 }
705 }
706
707
711 bool hasPathology=false;
712 if (index<hasPathologyFCAL.size()) {
713 if (!hasPathologyFCAL[index].
empty()) {
714 hasPathology=true;
716 }
717 }
718
719 const FCALDetectorElement* fcalElement =
dynamic_cast<const FCALDetectorElement*
>(calodetdescrmgr->
get_element(hash));
720 if (!fcalElement) std::abort();
722 unsigned int nlines =
tile->getNumHVLines();
723 unsigned int nlines_found=0;
724 for (
unsigned int i=0;
i<nlines;
i++) {
725 const FCALHVLine*
line =
tile->getHVLine(i);
726 if (line) nlines_found++;
727 }
728 if (nlines_found>0) {
729 float wt = 1./nlines_found;
731 for (
unsigned int i=0;
i<nlines;
i++) {
732 const FCALHVLine*
line =
tile->getHVLine(i);
733 if (!line) continue;
734 unsigned int hvline =
line->hvLineNo(hvCabling);
736 float curr=0;
737 auto hvIt=voltage.find(hvline);
738 if(hvIt != voltage.end()) {
741 if(rValues && useCurrent) {
742 curr=hvIt->second.curr;
743 const FCALHVModule& hvmod =
line->getModule();
747 0,
751 ));
752 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
753 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr." << curr <<
" R: "<<rValues[ridx]);
754 }
755 if (hasPathology) {
757 for (unsigned int ii=0;ii<listElec.size();ii++) {
758 if (listElec[ii]==i && listElec[ii]<hasPathologyFCAL[index].
size() && hasPathologyFCAL[index][listElec[ii]]) {
761 curr = 0.;
763 curr = 0.;
764 } else {
765 hv=((hasPathologyFCAL[
index][listElec[ii]]&0xFFF0)>>4);
766 curr=0.;
767 }
768 }
769 }
770 }
771 }
772 else {
773 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
774 }
776
777 }
778 }
779 }
780
781 return StatusCode::SUCCESS;
782}
GeoIntrusivePtr< const EMBCell > EMBCellConstLink
GeoIntrusivePtr< const EMECCell > EMECCellConstLink
GeoIntrusivePtr< const HECCell > HECCellConstLink
@Class: HECCellConstLink
size_t size() const
Number of registered mappings.
static const Attributes_t empty
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
EMBCellConstLink getEMBCell() const
EMB Cell description from LArReadoutGeometry.
const EMBHVModule & getModule() const
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
unsigned int getElectrodeIndex() const
unsigned int getPhiIndex() const
unsigned int getSideIndex() const
unsigned int getEtaIndex() const
unsigned int getSideIndex() const
unsigned int getEtaIndex() const
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
EMECCellConstLink getEMECCell() const
EMEC Cell description from LArReadoutGeometry.
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
unsigned int getElectrodeIndex() const
const EMECHVModule & getModule() const
unsigned int getSideIndex() const
unsigned int getSectorIndex() const
unsigned int getPhiIndex() const
unsigned int getEtaIndex() const
unsigned int getSideIndex() const
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
const FCALTile * getFCALTile() const
FCAL Tile description from LArReadoutGeometry.
unsigned int getSamplingIndex() const
unsigned int getSideIndex() const
unsigned int getSectorIndex() const
HECCellConstLink getHECCell() const
HEC Cell description from LArReadoutGeometry.
unsigned int getSideIndex() const
unsigned int getSamplingIndex() const
const HECHVModule & getModule() const
unsigned int getSubgapIndex() const
int hvLineNo(const LArHVIdMapping *hvIdMapping) const
const CaloCell_ID * m_calocellID
void addHV(voltageCell_t &v, float hv, float weight) const
Add voltage/weight for a sub-gap of a cell.
Gaudi::Property< bool > m_useCurrentFCAL1
Gaudi::Property< bool > m_useCurrentEMB
std::vector< unsigned int > getElecList(const Identifier &id, const LArHVPathology &pathologies) const
LArHVScaleCorrTool::voltageCell_t voltageCell_t
const LArElectrodeID * m_electrodeID
const LArHEC_ID * m_larhec_id
const LArEM_ID * m_larem_id
const LArFCAL_ID * m_larfcal_id
Gaudi::Property< bool > m_useCurrentOthers
int getCellModule(const Identifier &offId) const
returns the Module of a given offId
static const unsigned short MaskCurr
static const unsigned short SetHVMask
static const unsigned short MaskHV