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.
409{
410
411 std::vector<unsigned int> listElec;
412
413 const float uAkOhm = 1.e-3;
414
415
416
422 bool hasPathology=false;
423 if (index<hasPathologyEM.size()) {
424 if (!hasPathologyEM[index].
empty()) {
425 hasPathology=true;
427 }
428 }
429 const EMBDetectorElement* embElement =
dynamic_cast<const EMBDetectorElement*
>(calodetdescrmgr->
get_element(hash));
430 if (!embElement) std::abort();
432 unsigned int nelec =
cell->getNumElectrodes();
433 unsigned int ngap = 2*nelec;
434 float wt = 1./ngap;
435 for (
unsigned int i=0;
i<nelec;
i++) {
436 const EMBHVElectrode& electrode =
cell->getElectrode(i);
437
438
439 for (unsigned int igap=0;igap<2;igap++) {
441 float curr=0;
443 auto hvIt=
voltage.find(hvline);
447 curr=hvIt->second.curr;
448 const EMBHVModule &hvmod = electrode.
getModule();
454 igap,
456 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
457 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
458 }
459 if (hasPathology) {
461 msg(MSG::VERBOSE) <<
"Original hv: "<<
hv<<
" ";
462 for (unsigned int ii=0;ii<listElec.size();ii++) {
463 if (listElec[ii]==(2*i+igap) && listElec[ii]<hasPathologyEM[index].
size() && hasPathologyEM[index][listElec[ii]]) {
466 curr = 0.;
468 curr = 0.;
469 } else {
471 curr=0.;
472 }
473 }
474 }
476 }
477
478 }
479 else {
480 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
481 }
483 }
484 }
486
487 const EMBDetectorElement* embElement =
dynamic_cast<const EMBDetectorElement*
>(calodetdescrmgr->
get_element(hash));
488 if (!embElement) std::abort();
490 const EMBPresamplerHVModule& hvmodule =
cell->getPresamplerHVModule ();
491
492 float wt = 0.5;
493 for (unsigned int igap=0;igap<2;igap++) {
495 float curr=0;
497 auto hvIt=
voltage.find(hvline);
501 curr=hvIt->second.curr;
505 0,
507 igap,
508 0
509 ));
510 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0;
511 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
512 }
513 }
514 else {
515 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
516 }
518 }
521 bool hasPathology=false;
522 if (index<hasPathologyEM.size()) {
523 if (!hasPathologyEM[index].
empty()) {
524 hasPathology=true;
526 }
527 }
528
529 const EMECDetectorElement* emecElement =
dynamic_cast<const EMECDetectorElement*
>(calodetdescrmgr->
get_element(hash));
530 if (!emecElement) std::abort();
532 unsigned int nelec =
cell->getNumElectrodes();
533 unsigned int ngap = 2*nelec;
534 float wt = 1./ngap;
535 for (
unsigned int i=0;
i<nelec;
i++) {
536 const EMECHVElectrode& electrode =
cell->getElectrode(i);
537 for (unsigned int igap=0;igap<2;igap++) {
539 float curr=0;
541 auto hvIt=
voltage.find(hvline);
545 curr=hvIt->second.curr;
546 const EMECHVModule &hvmod = electrode.
getModule();
554 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
555 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
556 }
557 if (hasPathology) {
558 msg(MSG::VERBOSE) <<
"Has pathology for id: "<<
m_larem_id->print_to_string(
id)<<
" "<<hasPathologyEM[
index]<<
endmsg;
559 for (unsigned int ii=0;ii<listElec.size();ii++) {
560 if (listElec[ii]==(2*i+igap) && listElec[ii]<hasPathologyEM[index].
size() && hasPathologyEM[index][listElec[ii]]) {
563 curr = 0.;
565 curr = 0.;
566 } else {
567 hv=((hasPathologyEM[
index][listElec[ii]]&0xFFF0)>>4);
568 curr=0.;
569 }
570 }
571 }
572 }
573 }
574 else {
575 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
576 }
578 }
579 }
580
582
583 const EMECDetectorElement* emecElement =
dynamic_cast<const EMECDetectorElement*
>(calodetdescrmgr->
get_element(hash));
584 if (!emecElement) std::abort();
586 const EMECPresamplerHVModule& hvmodule =
cell->getPresamplerHVModule ();
587
588 double wt = 0.5;
589 for (unsigned int igap=0;igap<2;igap++) {
591 float curr=0;
593 auto hvIt=
voltage.find(hvline);
597 curr=hvIt->second.curr;
601 0,
602 0,
603 igap,
604 0
605 ));
606 if(curr >0.) curr *= uAkOhm * rValues[ridx]; else curr=0.;
607 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
608 }
609
610 }
611 else {
612 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
613 }
615 }
616 } else {
617 ATH_MSG_ERROR(
"This could not be, what happened with EM identifiers ?");
618 return StatusCode::FAILURE;
619 }
620 }
621
622
623
627 bool hasPathology=false;
628 if (index<hasPathologyHEC.size()) {
629 if (!hasPathologyHEC[index].
empty()) {
630 hasPathology=true;
632 }
633 }
634 const HECDetectorElement* hecElement =
dynamic_cast<const HECDetectorElement*
>(calodetdescrmgr->
get_element(hash));
635 if (!hecElement) std::abort();
637 unsigned int nsubgaps =
cell->getNumSubgaps();
638 float wt = 1./nsubgaps;
640 for (
unsigned int i=0;
i<nsubgaps;
i++) {
642 float curr=0;
643 const HECHVSubgap& subgap =
cell->getSubgap(i);
645 auto hvIt=
voltage.find(hvline);
649 curr=hvIt->second.curr;
650 const HECHVModule &hvmod = subgap.
getModule();
654 0,
657 0
658 ));
659 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
660 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" cur. " << curr <<
" R: "<<rValues[ridx]);
661 }
662 if (hasPathology) {
664 for (unsigned int ii=0;ii<listElec.size();ii++) {
665 if (listElec[ii]==i && listElec[ii]<hasPathologyHEC[index].
size() && hasPathologyHEC[index][listElec[ii]]) {
668 curr = 0.;
670 curr = 0.;
671 } else {
673 curr=0.;
674 }
675 }
676 }
677 }
678 }
679 else {
680 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
681 }
683 }
684 }
685
686
690 bool hasPathology=false;
691 if (index<hasPathologyFCAL.size()) {
692 if (!hasPathologyFCAL[index].
empty()) {
693 hasPathology=true;
695 }
696 }
697
698 const FCALDetectorElement* fcalElement =
dynamic_cast<const FCALDetectorElement*
>(calodetdescrmgr->
get_element(hash));
699 if (!fcalElement) std::abort();
701 unsigned int nlines =
tile->getNumHVLines();
702 unsigned int nlines_found=0;
703 for (
unsigned int i=0;
i<nlines;
i++) {
704 const FCALHVLine*
line =
tile->getHVLine(i);
705 if (line) nlines_found++;
706 }
707 if (nlines_found>0) {
708 float wt = 1./nlines_found;
710 for (
unsigned int i=0;
i<nlines;
i++) {
711 const FCALHVLine*
line =
tile->getHVLine(i);
712 if (!line) continue;
713 unsigned int hvline =
line->hvLineNo(hvCabling);
715 float curr=0;
716 auto hvIt=
voltage.find(hvline);
720 if(rValues && useCurrent) {
721 curr=hvIt->second.curr;
722 const FCALHVModule& hvmod =
line->getModule();
726 0,
730 ));
731 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
732 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr." << curr <<
" R: "<<rValues[ridx]);
733 }
734 if (hasPathology) {
736 for (unsigned int ii=0;ii<listElec.size();ii++) {
737 if (listElec[ii]==i && listElec[ii]<hasPathologyFCAL[index].
size() && hasPathologyFCAL[index][listElec[ii]]) {
740 curr = 0.;
742 curr = 0.;
743 } else {
744 hv=((hasPathologyFCAL[
index][listElec[ii]]&0xFFF0)>>4);
745 curr=0.;
746 }
747 }
748 }
749 }
750 }
751 else {
752 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
753 }
755
756 }
757 }
758 }
759
760 return StatusCode::SUCCESS;
761}
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