461 return StatusCode::FAILURE;
467 if (!m_readCondObjs) {
468 if (m_writeCondObjs) {
470 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
472 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
473 << m_rampCache[
i].m_gain <<
" " );
477 ramp.
m_vRamp = m_rampCache[
i].m_vRamp;
479 ramps_rw->
setPdata(m_rampCache[
i].m_channelID,
481 m_rampCache[
i].m_gain);
485 ATH_MSG_DEBUG (
"Finished conditions, now write corrections " );
487 if (m_writeCorrections) {
488 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
491 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
492 << m_rampCorrections[
i].m_gain <<
" " );
496 ramp.
m_vRamp = m_rampCorrections[
i].m_vRamp;
500 m_rampCorrections[
i].m_gain) );
508 CONTAINER::chan_const_iterator chanIt1 = ramps->
chan_begin();
509 CONTAINER::chan_const_iterator endChan1 = ramps->
chan_end ();
510 for (
unsigned int i = 0; chanIt1 != endChan1; ++chanIt1, ++
i) {
511 const CONTAINER::Subset* subset = ramps->at(
i);
513 <<
" channel " << subset->channel()
514 <<
" gain " << subset->gain()
515 <<
" groupingType " << subset->groupingType()
516 <<
" subsetSize " << subset->subsetSize()
517 <<
" correctionVecSize " << subset->correctionVecSize() );
518 if ((*chanIt1) != subset->channel()) {
519 ATH_MSG_ERROR (
"Channel numbers not the same for MultChanColl and subset: "
521 <<
" multchan " << (*chanIt1)
522 <<
" subset " << subset->channel() );
530 << ramps->size() <<
" " );
534 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
537 m_rampCache[
i].m_gain);
538 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
539 m_rampCache[
i].m_gain);
543 << coolChannel <<
" "
544 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
545 << m_rampCache[
i].m_gain <<
" "
554 << coolChannel <<
" "
555 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
556 << m_rampCache[
i].m_gain <<
" "
557 << m_rampCache[
i].m_vRamp[0] <<
" "
558 << m_rampCache[
i].m_vRamp[1] <<
" "
559 << m_rampCache[
i].m_vRamp[2] <<
" "
560 <<
" Compare = " << (rampP == m_rampCache[
i]) );
561 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
569 ATH_MSG_DEBUG (
"Compare LArRampMC with cache using iterator " );
570 CONTAINER::ConstConditionsMapIterator rampIt;
571 CONTAINER::ConstConditionsMapIterator rampEnd;
575 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
577 if (
gain != m_rampCache[
i].m_gain)
continue;
580 while(rampIt != rampEnd) {
582 rampId = rampIt.channelId();
586 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
587 m_rampCache[
i].m_gain);
590 << coolChannel <<
" "
591 << m_onlineID->show_to_string(rampId) <<
" "
592 << m_rampCache[
i].m_gain <<
" "
601 << coolChannel <<
" "
602 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
603 << m_rampCache[
i].m_gain <<
" "
604 << m_rampCache[
i].m_vRamp[0] <<
" "
605 << m_rampCache[
i].m_vRamp[1] <<
" "
606 << m_rampCache[
i].m_vRamp[2] <<
" "
607 <<
" Compare = " << (rampP == m_rampCache[
i]) );
608 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
619 ATH_MSG_DEBUG (
"Compare LArRampMC with cache using iterator and febid selection " );
622 std::vector<unsigned int> ids1[3];
623 std::vector<unsigned int> ids2[3];
624 std::vector<unsigned int> ids3[3];
625 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
626 if (
i < m_rampCache.size()/3) {
627 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
628 ids1[m_rampCache[
i].m_gain].push_back(
id);
630 else if (
i < 2*m_rampCache.size()/3) {
631 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
632 ids2[m_rampCache[
i].m_gain].push_back(
id);
635 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
636 ids3[m_rampCache[
i].m_gain].push_back(
id);
641 for (
unsigned int febSet = 0; febSet < 3; ++febSet) {
643 unsigned int iend = m_rampCache.size()/3;
644 if (febSet < m_rampCache.size()/3) {
647 for (
unsigned int i = 0;
i < ids1[
gain].size(); ++
i) {
653 else if (febSet < 2*m_rampCache.size()/3) {
655 i0 = m_rampCache.size()/3 + 1;
656 iend = 2*m_rampCache.size()/3;
658 for (
unsigned int i = 0;
i < ids2[
gain].size(); ++
i) {
666 i0 = 2*m_rampCache.size()/3 + 1;
667 iend = m_rampCache.size();
669 for (
unsigned int i = 0;
i < ids3[
gain].size(); ++
i) {
678 for (
unsigned int i = i0;
i < iend; ++
i) {
680 if (
gain != m_rampCache[
i].m_gain)
continue;
685 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) );
688 while(rampIt != rampEnd) {
690 rampId = rampIt.channelId();
694 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
695 m_rampCache[
i].m_gain);
698 << coolChannel <<
" "
699 << m_onlineID->show_to_string(rampId) <<
" "
700 << m_rampCache[
i].m_gain <<
" "
709 << coolChannel <<
" "
710 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
711 << m_rampCache[
i].m_gain <<
" "
712 << m_rampCache[
i].m_vRamp[0] <<
" "
713 << m_rampCache[
i].m_vRamp[1] <<
" "
714 << m_rampCache[
i].m_vRamp[2] <<
" "
715 <<
" Compare = " << (rampP == m_rampCache[
i]) );
716 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
726 if (m_applyCorrections) {
727 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
729 m_rampCorrections[
i].m_gain);
730 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
731 m_rampCorrections[
i].m_gain);
734 << coolChannel <<
" "
735 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
736 << m_rampCorrections[
i].m_gain <<
" "
745 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
746 << coolChannel <<
" "
747 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
748 << m_rampCorrections[
i].m_gain <<
" "
749 << m_rampCorrections[
i].m_vRamp[0] <<
" "
750 << m_rampCorrections[
i].m_vRamp[1] <<
" "
751 << m_rampCorrections[
i].m_vRamp[2] <<
" "
755 ATH_MSG_ERROR (
"Before correction: LArRampMC and correction DO NOT compare - should have opposite signs for rampes" );
761 ATH_MSG_DEBUG (
"Apply corrections and compare LArRampMC with corrections " );
765 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
767 m_rampCorrections[
i].m_gain);
768 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
769 m_rampCorrections[
i].m_gain);
772 << coolChannel <<
" "
773 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
774 << m_rampCorrections[
i].m_gain <<
" "
782 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
783 << coolChannel <<
" "
784 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
785 << m_rampCorrections[
i].m_gain <<
" "
786 << m_rampCorrections[
i].m_vRamp[0] <<
" "
787 << m_rampCorrections[
i].m_vRamp[1] <<
" "
788 << m_rampCorrections[
i].m_vRamp[2] <<
" "
789 <<
" Compare = " << (rampP == m_rampCorrections[
i]) );
790 if (rampP != m_rampCorrections[
i] && !rampP.
isEmpty()) {
791 ATH_MSG_ERROR (
"After correction: LArRampMC and correction NOT equal" );
796 ATH_MSG_DEBUG (
"Undo corrections and compare LArRampMC with corrections " );
800 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
802 m_rampCorrections[
i].m_gain);
803 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
804 m_rampCorrections[
i].m_gain);
807 << coolChannel <<
" "
808 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
809 << m_rampCorrections[
i].m_gain <<
" "
817 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
818 << coolChannel <<
" "
819 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
820 << m_rampCorrections[
i].m_gain <<
" "
821 << m_rampCorrections[
i].m_vRamp[0] <<
" "
822 << m_rampCorrections[
i].m_vRamp[1] <<
" "
823 << m_rampCorrections[
i].m_vRamp[2] <<
" "
827 ATH_MSG_ERROR (
"After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
832 ATH_MSG_DEBUG (
"2nd Apply corrections and compare LArRampMC with corrections " );
836 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
838 m_rampCorrections[
i].m_gain);
839 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
840 m_rampCorrections[
i].m_gain);
843 << coolChannel <<
" "
844 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
845 << m_rampCorrections[
i].m_gain <<
" "
853 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
854 << coolChannel <<
" "
855 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
856 << m_rampCorrections[
i].m_gain <<
" "
857 << m_rampCorrections[
i].m_vRamp[0] <<
" "
858 << m_rampCorrections[
i].m_vRamp[1] <<
" "
859 << m_rampCorrections[
i].m_vRamp[2] <<
" "
860 <<
" Compare = " << (rampP == m_rampCorrections[
i]) );
861 if (rampP != m_rampCorrections[
i] && !rampP.
isEmpty()) {
862 ATH_MSG_ERROR (
"After correction: LArRampMC and correction NOT equal" );
867 ATH_MSG_DEBUG (
"2nd Undo corrections and compare LArRampMC with corrections " );
871 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
873 m_rampCorrections[
i].m_gain);
874 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
875 m_rampCorrections[
i].m_gain);
878 << coolChannel <<
" "
879 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
880 << m_rampCorrections[
i].m_gain <<
" "
888 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
889 << coolChannel <<
" "
890 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
891 << m_rampCorrections[
i].m_gain <<
" "
892 << m_rampCorrections[
i].m_vRamp[0] <<
" "
893 << m_rampCorrections[
i].m_vRamp[1] <<
" "
894 << m_rampCorrections[
i].m_vRamp[2] <<
" "
898 ATH_MSG_ERROR (
"After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
1013 std::set<unsigned int> channelNumbers;
1014 CONTAINER::chan_const_iterator chanIt = ramps->
chan_begin();
1015 CONTAINER::chan_const_iterator endChan = ramps->
chan_end ();
1016 for (
unsigned int i = 0; chanIt != endChan; ++chanIt, ++
i) {
1017 const CONTAINER::Subset* subset = ramps->at(
i);
1019 <<
" channel " << subset->channel()
1020 <<
" gain " << subset->gain()
1021 <<
" groupingType " << subset->groupingType()
1022 <<
" subsetSize " << subset->subsetSize()
1023 <<
" correctionVecSize " << subset->correctionVecSize() );
1024 if ((*chanIt) != subset->channel()) {
1025 ATH_MSG_ERROR (
"Channel numbers not the same for MultChanColl and subset: "
1027 <<
" multchan " << (*chanIt)
1028 <<
" subset " << subset->channel() );
1031 if (!(channelNumbers.insert(subset->channel()).second)) {
1033 <<
" channel " << subset->channel() );
1037 ATH_MSG_DEBUG (
"Channel numbers size " << channelNumbers.size()
1038 <<
" ramps size " << ramps->
chan_size() );
1042 return (StatusCode::FAILURE);
1046 return StatusCode::SUCCESS;