479 return StatusCode::FAILURE;
485 if (!m_readCondObjs) {
486 if (m_writeCondObjs) {
488 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
490 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
491 << m_rampCache[
i].m_gain <<
" " );
495 ramp.
m_vRamp = m_rampCache[
i].m_vRamp;
497 ramps_rw->
setPdata(m_rampCache[
i].m_channelID,
499 m_rampCache[
i].m_gain);
503 ATH_MSG_DEBUG (
"Finished conditions, now write corrections " );
505 if (m_writeCorrections) {
506 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
509 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
510 << m_rampCorrections[
i].m_gain <<
" " );
514 ramp.
m_vRamp = m_rampCorrections[
i].m_vRamp;
518 m_rampCorrections[
i].m_gain) );
526 CONTAINER::chan_const_iterator chanIt1 = ramps->
chan_begin();
527 CONTAINER::chan_const_iterator endChan1 = ramps->
chan_end ();
528 for (
unsigned int i = 0; chanIt1 != endChan1; ++chanIt1, ++
i) {
529 const CONTAINER::Subset* subset = ramps->at(
i);
531 <<
" channel " << subset->channel()
532 <<
" gain " << subset->gain()
533 <<
" groupingType " << subset->groupingType()
534 <<
" subsetSize " << subset->subsetSize()
535 <<
" correctionVecSize " << subset->correctionVecSize() );
536 if ((*chanIt1) != subset->channel()) {
537 ATH_MSG_ERROR (
"Channel numbers not the same for MultChanColl and subset: "
539 <<
" multchan " << (*chanIt1)
540 <<
" subset " << subset->channel() );
548 << ramps->size() <<
" " );
552 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
555 m_rampCache[
i].m_gain);
556 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
557 m_rampCache[
i].m_gain);
561 << coolChannel <<
" "
562 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
563 << m_rampCache[
i].m_gain <<
" "
572 << coolChannel <<
" "
573 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
574 << m_rampCache[
i].m_gain <<
" "
575 << m_rampCache[
i].m_vRamp[0] <<
" "
576 << m_rampCache[
i].m_vRamp[1] <<
" "
577 << m_rampCache[
i].m_vRamp[2] <<
" "
578 <<
" Compare = " << (rampP == m_rampCache[
i]) );
579 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
587 ATH_MSG_DEBUG (
"Compare LArRampMC with cache using iterator " );
588 CONTAINER::ConstConditionsMapIterator rampIt;
589 CONTAINER::ConstConditionsMapIterator rampEnd;
593 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
595 if (
gain != m_rampCache[
i].m_gain)
continue;
598 while(rampIt != rampEnd) {
600 rampId = rampIt.channelId();
604 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
605 m_rampCache[
i].m_gain);
608 << coolChannel <<
" "
609 << m_onlineID->show_to_string(rampId) <<
" "
610 << m_rampCache[
i].m_gain <<
" "
619 << coolChannel <<
" "
620 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
621 << m_rampCache[
i].m_gain <<
" "
622 << m_rampCache[
i].m_vRamp[0] <<
" "
623 << m_rampCache[
i].m_vRamp[1] <<
" "
624 << m_rampCache[
i].m_vRamp[2] <<
" "
625 <<
" Compare = " << (rampP == m_rampCache[
i]) );
626 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
637 ATH_MSG_DEBUG (
"Compare LArRampMC with cache using iterator and febid selection " );
640 std::vector<unsigned int> ids1[3];
641 std::vector<unsigned int> ids2[3];
642 std::vector<unsigned int> ids3[3];
643 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
644 if (
i < m_rampCache.size()/3) {
645 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
646 ids1[m_rampCache[
i].m_gain].push_back(
id);
648 else if (
i < 2*m_rampCache.size()/3) {
649 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
650 ids2[m_rampCache[
i].m_gain].push_back(
id);
653 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
654 ids3[m_rampCache[
i].m_gain].push_back(
id);
659 for (
unsigned int febSet = 0; febSet < 3; ++febSet) {
661 unsigned int iend = m_rampCache.size()/3;
662 if (febSet < m_rampCache.size()/3) {
665 for (
unsigned int i = 0;
i < ids1[
gain].size(); ++
i) {
671 else if (febSet < 2*m_rampCache.size()/3) {
673 i0 = m_rampCache.size()/3 + 1;
674 iend = 2*m_rampCache.size()/3;
676 for (
unsigned int i = 0;
i < ids2[
gain].size(); ++
i) {
684 i0 = 2*m_rampCache.size()/3 + 1;
685 iend = m_rampCache.size();
687 for (
unsigned int i = 0;
i < ids3[
gain].size(); ++
i) {
696 for (
unsigned int i = i0;
i < iend; ++
i) {
698 if (
gain != m_rampCache[
i].m_gain)
continue;
703 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) );
706 while(rampIt != rampEnd) {
708 rampId = rampIt.channelId();
712 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
713 m_rampCache[
i].m_gain);
716 << coolChannel <<
" "
717 << m_onlineID->show_to_string(rampId) <<
" "
718 << m_rampCache[
i].m_gain <<
" "
727 << coolChannel <<
" "
728 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
729 << m_rampCache[
i].m_gain <<
" "
730 << m_rampCache[
i].m_vRamp[0] <<
" "
731 << m_rampCache[
i].m_vRamp[1] <<
" "
732 << m_rampCache[
i].m_vRamp[2] <<
" "
733 <<
" Compare = " << (rampP == m_rampCache[
i]) );
734 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
744 if (m_applyCorrections) {
745 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
747 m_rampCorrections[
i].m_gain);
748 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
749 m_rampCorrections[
i].m_gain);
752 << coolChannel <<
" "
753 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
754 << m_rampCorrections[
i].m_gain <<
" "
763 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
764 << coolChannel <<
" "
765 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
766 << m_rampCorrections[
i].m_gain <<
" "
767 << m_rampCorrections[
i].m_vRamp[0] <<
" "
768 << m_rampCorrections[
i].m_vRamp[1] <<
" "
769 << m_rampCorrections[
i].m_vRamp[2] <<
" "
773 ATH_MSG_ERROR (
"Before correction: LArRampMC and correction DO NOT compare - should have opposite signs for rampes" );
779 ATH_MSG_DEBUG (
"Apply corrections and compare LArRampMC with corrections " );
783 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
785 m_rampCorrections[
i].m_gain);
786 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
787 m_rampCorrections[
i].m_gain);
790 << coolChannel <<
" "
791 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
792 << m_rampCorrections[
i].m_gain <<
" "
800 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
801 << coolChannel <<
" "
802 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
803 << m_rampCorrections[
i].m_gain <<
" "
804 << m_rampCorrections[
i].m_vRamp[0] <<
" "
805 << m_rampCorrections[
i].m_vRamp[1] <<
" "
806 << m_rampCorrections[
i].m_vRamp[2] <<
" "
807 <<
" Compare = " << (rampP == m_rampCorrections[
i]) );
808 if (rampP != m_rampCorrections[
i] && !rampP.
isEmpty()) {
809 ATH_MSG_ERROR (
"After correction: LArRampMC and correction NOT equal" );
814 ATH_MSG_DEBUG (
"Undo corrections and compare LArRampMC with corrections " );
818 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
820 m_rampCorrections[
i].m_gain);
821 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
822 m_rampCorrections[
i].m_gain);
825 << coolChannel <<
" "
826 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
827 << m_rampCorrections[
i].m_gain <<
" "
835 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
836 << coolChannel <<
" "
837 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
838 << m_rampCorrections[
i].m_gain <<
" "
839 << m_rampCorrections[
i].m_vRamp[0] <<
" "
840 << m_rampCorrections[
i].m_vRamp[1] <<
" "
841 << m_rampCorrections[
i].m_vRamp[2] <<
" "
845 ATH_MSG_ERROR (
"After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
850 ATH_MSG_DEBUG (
"2nd Apply corrections and compare LArRampMC with corrections " );
854 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
856 m_rampCorrections[
i].m_gain);
857 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
858 m_rampCorrections[
i].m_gain);
861 << coolChannel <<
" "
862 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
863 << m_rampCorrections[
i].m_gain <<
" "
871 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
872 << coolChannel <<
" "
873 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
874 << m_rampCorrections[
i].m_gain <<
" "
875 << m_rampCorrections[
i].m_vRamp[0] <<
" "
876 << m_rampCorrections[
i].m_vRamp[1] <<
" "
877 << m_rampCorrections[
i].m_vRamp[2] <<
" "
878 <<
" Compare = " << (rampP == m_rampCorrections[
i]) );
879 if (rampP != m_rampCorrections[
i] && !rampP.
isEmpty()) {
880 ATH_MSG_ERROR (
"After correction: LArRampMC and correction NOT equal" );
885 ATH_MSG_DEBUG (
"2nd Undo corrections and compare LArRampMC with corrections " );
889 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
891 m_rampCorrections[
i].m_gain);
892 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
893 m_rampCorrections[
i].m_gain);
896 << coolChannel <<
" "
897 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
898 << m_rampCorrections[
i].m_gain <<
" "
906 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
907 << coolChannel <<
" "
908 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
909 << m_rampCorrections[
i].m_gain <<
" "
910 << m_rampCorrections[
i].m_vRamp[0] <<
" "
911 << m_rampCorrections[
i].m_vRamp[1] <<
" "
912 << m_rampCorrections[
i].m_vRamp[2] <<
" "
916 ATH_MSG_ERROR (
"After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
1031 std::set<unsigned int> channelNumbers;
1032 CONTAINER::chan_const_iterator chanIt = ramps->
chan_begin();
1033 CONTAINER::chan_const_iterator endChan = ramps->
chan_end ();
1034 for (
unsigned int i = 0; chanIt != endChan; ++chanIt, ++
i) {
1035 const CONTAINER::Subset* subset = ramps->at(
i);
1037 <<
" channel " << subset->channel()
1038 <<
" gain " << subset->gain()
1039 <<
" groupingType " << subset->groupingType()
1040 <<
" subsetSize " << subset->subsetSize()
1041 <<
" correctionVecSize " << subset->correctionVecSize() );
1042 if ((*chanIt) != subset->channel()) {
1043 ATH_MSG_ERROR (
"Channel numbers not the same for MultChanColl and subset: "
1045 <<
" multchan " << (*chanIt)
1046 <<
" subset " << subset->channel() );
1049 if (!(channelNumbers.insert(subset->channel()).second)) {
1051 <<
" channel " << subset->channel() );
1055 ATH_MSG_DEBUG (
"Channel numbers size " << channelNumbers.size()
1056 <<
" ramps size " << ramps->
chan_size() );
1060 return (StatusCode::FAILURE);
1064 return StatusCode::SUCCESS;