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.
369{
370
371 std::vector<unsigned int> listElec;
372
373 const float uAkOhm = 1.e-3;
374
375
376
382 bool hasPathology=false;
383 if (index<hasPathologyEM.size()) {
384 if (!hasPathologyEM[index].
empty()) {
385 hasPathology=true;
387 }
388 }
389 const EMBDetectorElement* embElement =
dynamic_cast<const EMBDetectorElement*
>(calodetdescrmgr->
get_element(hash));
390 if (!embElement) std::abort();
392 unsigned int nelec =
cell->getNumElectrodes();
393 unsigned int ngap = 2*nelec;
394 float wt = 1./ngap;
395 for (
unsigned int i=0;
i<nelec;
i++) {
396 const EMBHVElectrode& electrode =
cell->getElectrode(i);
397
398
399 for (unsigned int igap=0;igap<2;igap++) {
401 float curr=0;
403 auto hvIt=voltage.find(hvline);
404 if(hvIt != voltage.end()) {
407 curr=hvIt->second.curr;
408 const EMBHVModule &hvmod = electrode.
getModule();
414 igap,
416 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
417 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
418 }
419 if (hasPathology) {
421 msg(MSG::VERBOSE) <<
"Original hv: "<<
hv<<
" ";
422 for (unsigned int ii=0;ii<listElec.size();ii++) {
423 if (listElec[ii]==(2*i+igap) && listElec[ii]<hasPathologyEM[index].size() && hasPathologyEM[index][listElec[ii]]) {
426 curr = 0.;
428 curr = 0.;
429 } else {
431 curr=0.;
432 }
433 }
434 }
436 }
437
438 }
439 else {
440 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
441 }
443 }
444 }
446
447 const EMBDetectorElement* embElement =
dynamic_cast<const EMBDetectorElement*
>(calodetdescrmgr->
get_element(hash));
448 if (!embElement) std::abort();
450 const EMBPresamplerHVModule& hvmodule =
cell->getPresamplerHVModule ();
451
452 float wt = 0.5;
453 for (unsigned int igap=0;igap<2;igap++) {
455 float curr=0;
457 auto hvIt=voltage.find(hvline);
458 if(hvIt != voltage.end()) {
461 curr=hvIt->second.curr;
465 0,
467 igap,
468 0
469 ));
470 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0;
471 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
472 }
473 }
474 else {
475 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
476 }
478 }
481 bool hasPathology=false;
482 if (index<hasPathologyEM.size()) {
483 if (!hasPathologyEM[index].
empty()) {
484 hasPathology=true;
486 }
487 }
488
489 const EMECDetectorElement* emecElement =
dynamic_cast<const EMECDetectorElement*
>(calodetdescrmgr->
get_element(hash));
490 if (!emecElement) std::abort();
492 unsigned int nelec =
cell->getNumElectrodes();
493 unsigned int ngap = 2*nelec;
494 float wt = 1./ngap;
495 for (
unsigned int i=0;
i<nelec;
i++) {
496 const EMECHVElectrode& electrode =
cell->getElectrode(i);
497 for (unsigned int igap=0;igap<2;igap++) {
499 float curr=0;
501 auto hvIt=voltage.find(hvline);
502 if(hvIt != voltage.end()) {
505 curr=hvIt->second.curr;
506 const EMECHVModule &hvmod = electrode.
getModule();
514 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
515 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
516 }
517 if (hasPathology) {
518 msg(MSG::VERBOSE) <<
"Has pathology for id: "<<
m_larem_id->print_to_string(
id)<<
" "<<hasPathologyEM[
index]<<
endmsg;
519 for (unsigned int ii=0;ii<listElec.size();ii++) {
520 if (listElec[ii]==(2*i+igap) && listElec[ii]<hasPathologyEM[index].size() && hasPathologyEM[index][listElec[ii]]) {
523 curr = 0.;
525 curr = 0.;
526 } else {
527 hv=((hasPathologyEM[
index][listElec[ii]]&0xFFF0)>>4);
528 curr=0.;
529 }
530 }
531 }
532 }
533 }
534 else {
535 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
536 }
538 }
539 }
540
542
543 const EMECDetectorElement* emecElement =
dynamic_cast<const EMECDetectorElement*
>(calodetdescrmgr->
get_element(hash));
544 if (!emecElement) std::abort();
546 const EMECPresamplerHVModule& hvmodule =
cell->getPresamplerHVModule ();
547
548 double wt = 0.5;
549 for (unsigned int igap=0;igap<2;igap++) {
551 float curr=0;
553 auto hvIt=voltage.find(hvline);
554 if(hvIt != voltage.end()) {
557 curr=hvIt->second.curr;
561 0,
562 0,
563 igap,
564 0
565 ));
566 if(curr >0.) curr *= uAkOhm * rValues[ridx]; else curr=0.;
567 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr. " << curr <<
" R: "<<rValues[ridx]);
568 }
569
570 }
571 else {
572 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
573 }
575 }
576 } else {
577 ATH_MSG_ERROR(
"This could not be, what happened with EM identifiers ?");
578 return StatusCode::FAILURE;
579 }
580 }
581
582
583
587 bool hasPathology=false;
588 if (index<hasPathologyHEC.size()) {
589 if (!hasPathologyHEC[index].
empty()) {
590 hasPathology=true;
592 }
593 }
594 const HECDetectorElement* hecElement =
dynamic_cast<const HECDetectorElement*
>(calodetdescrmgr->
get_element(hash));
595 if (!hecElement) std::abort();
597 unsigned int nsubgaps =
cell->getNumSubgaps();
598 float wt = 1./nsubgaps;
600 for (
unsigned int i=0;
i<nsubgaps;
i++) {
602 float curr=0;
603 const HECHVSubgap& subgap =
cell->getSubgap(i);
605 auto hvIt=voltage.find(hvline);
606 if(hvIt != voltage.end()) {
609 curr=hvIt->second.curr;
610 const HECHVModule &hvmod = subgap.
getModule();
614 0,
617 0
618 ));
619 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
620 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" cur. " << curr <<
" R: "<<rValues[ridx]);
621 }
622 if (hasPathology) {
624 for (unsigned int ii=0;ii<listElec.size();ii++) {
625 if (listElec[ii]==i && listElec[ii]<hasPathologyHEC[index].size() && hasPathologyHEC[index][listElec[ii]]) {
628 curr = 0.;
630 curr = 0.;
631 } else {
633 curr=0.;
634 }
635 }
636 }
637 }
638 }
639 else {
640 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
641 }
643 }
644 }
645
646
650 bool hasPathology=false;
651 if (index<hasPathologyFCAL.size()) {
652 if (!hasPathologyFCAL[index].
empty()) {
653 hasPathology=true;
655 }
656 }
657
658 const FCALDetectorElement* fcalElement =
dynamic_cast<const FCALDetectorElement*
>(calodetdescrmgr->
get_element(hash));
659 if (!fcalElement) std::abort();
661 unsigned int nlines =
tile->getNumHVLines();
662 unsigned int nlines_found=0;
663 for (
unsigned int i=0;
i<nlines;
i++) {
664 const FCALHVLine*
line =
tile->getHVLine(i);
665 if (line) nlines_found++;
666 }
667 if (nlines_found>0) {
668 float wt = 1./nlines_found;
670 for (
unsigned int i=0;
i<nlines;
i++) {
671 const FCALHVLine*
line =
tile->getHVLine(i);
672 if (!line) continue;
673 unsigned int hvline =
line->hvLineNo(hvCabling);
675 float curr=0;
676 auto hvIt=voltage.find(hvline);
677 if(hvIt != voltage.end()) {
680 if(rValues && useCurrent) {
681 curr=hvIt->second.curr;
682 const FCALHVModule& hvmod =
line->getModule();
686 0,
690 ));
691 if(curr > 0.) curr *= uAkOhm * rValues[ridx]; else curr = 0.;
692 ATH_MSG_VERBOSE(
"channel. "<<std::hex<<
id.get_identifier32()<<std::dec <<
" hvline: "<<hvline<<
" curr." << curr <<
" R: "<<rValues[ridx]);
693 }
694 if (hasPathology) {
696 for (unsigned int ii=0;ii<listElec.size();ii++) {
697 if (listElec[ii]==i && listElec[ii]<hasPathologyFCAL[index].size() && hasPathologyFCAL[index][listElec[ii]]) {
700 curr = 0.;
702 curr = 0.;
703 } else {
704 hv=((hasPathologyFCAL[
index][listElec[ii]]&0xFFF0)>>4);
705 curr=0.;
706 }
707 }
708 }
709 }
710 }
711 else {
712 ATH_MSG_WARNING(
"Do not have hvline: "<<hvline<<
" in LArHVData mapping ! Set voltage to 0 !");
713 }
715
716 }
717 }
718 }
719
720 return StatusCode::SUCCESS;
721}
GeoIntrusivePtr< const EMBCell > EMBCellConstLink
GeoIntrusivePtr< const EMECCell > EMECCellConstLink
GeoIntrusivePtr< const HECCell > HECCellConstLink
@Class: HECCellConstLink
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