443 return StatusCode::FAILURE;
449 if (!m_readCondObjs) {
450 if (m_writeCondObjs) {
452 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
454 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
455 << m_rampCache[
i].m_gain <<
" " );
459 ramp.
m_vRamp = m_rampCache[
i].m_vRamp;
461 ramps_rw->
setPdata(m_rampCache[
i].m_channelID,
463 m_rampCache[
i].m_gain);
467 ATH_MSG_DEBUG (
"Finished conditions, now write corrections " );
469 if (m_writeCorrections) {
470 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
473 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
474 << m_rampCorrections[
i].m_gain <<
" " );
478 ramp.
m_vRamp = m_rampCorrections[
i].m_vRamp;
482 m_rampCorrections[
i].m_gain) );
490 CONTAINER::chan_const_iterator chanIt1 = ramps->
chan_begin();
491 CONTAINER::chan_const_iterator endChan1 = ramps->
chan_end ();
492 for (
unsigned int i = 0; chanIt1 != endChan1; ++chanIt1, ++
i) {
493 const CONTAINER::Subset* subset = ramps->at(
i);
495 <<
" channel " << subset->channel()
496 <<
" gain " << subset->gain()
497 <<
" groupingType " << subset->groupingType()
498 <<
" subsetSize " << subset->subsetSize()
499 <<
" correctionVecSize " << subset->correctionVecSize() );
500 if ((*chanIt1) != subset->channel()) {
501 ATH_MSG_ERROR (
"Channel numbers not the same for MultChanColl and subset: "
503 <<
" multchan " << (*chanIt1)
504 <<
" subset " << subset->channel() );
512 << ramps->size() <<
" " );
516 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
519 m_rampCache[
i].m_gain);
520 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
521 m_rampCache[
i].m_gain);
525 << coolChannel <<
" "
526 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
527 << m_rampCache[
i].m_gain <<
" "
536 << coolChannel <<
" "
537 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
538 << m_rampCache[
i].m_gain <<
" "
539 << m_rampCache[
i].m_vRamp[0] <<
" "
540 << m_rampCache[
i].m_vRamp[1] <<
" "
541 << m_rampCache[
i].m_vRamp[2] <<
" "
542 <<
" Compare = " << (rampP == m_rampCache[
i]) );
543 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
551 ATH_MSG_DEBUG (
"Compare LArRampMC with cache using iterator " );
552 CONTAINER::ConstConditionsMapIterator rampIt;
553 CONTAINER::ConstConditionsMapIterator rampEnd;
557 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
559 if (
gain != m_rampCache[
i].m_gain)
continue;
562 while(rampIt != rampEnd) {
564 rampId = rampIt.channelId();
568 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
569 m_rampCache[
i].m_gain);
572 << coolChannel <<
" "
573 << m_onlineID->show_to_string(rampId) <<
" "
574 << m_rampCache[
i].m_gain <<
" "
583 << coolChannel <<
" "
584 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
585 << m_rampCache[
i].m_gain <<
" "
586 << m_rampCache[
i].m_vRamp[0] <<
" "
587 << m_rampCache[
i].m_vRamp[1] <<
" "
588 << m_rampCache[
i].m_vRamp[2] <<
" "
589 <<
" Compare = " << (rampP == m_rampCache[
i]) );
590 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
601 ATH_MSG_DEBUG (
"Compare LArRampMC with cache using iterator and febid selection " );
604 std::vector<unsigned int> ids1[3];
605 std::vector<unsigned int> ids2[3];
606 std::vector<unsigned int> ids3[3];
607 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
608 if (
i < m_rampCache.size()/3) {
609 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
610 ids1[m_rampCache[
i].m_gain].push_back(
id);
612 else if (
i < 2*m_rampCache.size()/3) {
613 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
614 ids2[m_rampCache[
i].m_gain].push_back(
id);
617 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
618 ids3[m_rampCache[
i].m_gain].push_back(
id);
623 for (
unsigned int febSet = 0; febSet < 3; ++febSet) {
625 unsigned int iend = m_rampCache.size()/3;
626 if (febSet < m_rampCache.size()/3) {
629 for (
unsigned int i = 0;
i < ids1[
gain].size(); ++
i) {
635 else if (febSet < 2*m_rampCache.size()/3) {
637 i0 = m_rampCache.size()/3 + 1;
638 iend = 2*m_rampCache.size()/3;
640 for (
unsigned int i = 0;
i < ids2[
gain].size(); ++
i) {
648 i0 = 2*m_rampCache.size()/3 + 1;
649 iend = m_rampCache.size();
651 for (
unsigned int i = 0;
i < ids3[
gain].size(); ++
i) {
660 for (
unsigned int i = i0;
i < iend; ++
i) {
662 if (
gain != m_rampCache[
i].m_gain)
continue;
667 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) );
670 while(rampIt != rampEnd) {
672 rampId = rampIt.channelId();
676 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
677 m_rampCache[
i].m_gain);
680 << coolChannel <<
" "
681 << m_onlineID->show_to_string(rampId) <<
" "
682 << m_rampCache[
i].m_gain <<
" "
691 << coolChannel <<
" "
692 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
693 << m_rampCache[
i].m_gain <<
" "
694 << m_rampCache[
i].m_vRamp[0] <<
" "
695 << m_rampCache[
i].m_vRamp[1] <<
" "
696 << m_rampCache[
i].m_vRamp[2] <<
" "
697 <<
" Compare = " << (rampP == m_rampCache[
i]) );
698 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
708 if (m_applyCorrections) {
709 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
711 m_rampCorrections[
i].m_gain);
712 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
713 m_rampCorrections[
i].m_gain);
716 << coolChannel <<
" "
717 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
718 << m_rampCorrections[
i].m_gain <<
" "
727 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
728 << coolChannel <<
" "
729 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
730 << m_rampCorrections[
i].m_gain <<
" "
731 << m_rampCorrections[
i].m_vRamp[0] <<
" "
732 << m_rampCorrections[
i].m_vRamp[1] <<
" "
733 << m_rampCorrections[
i].m_vRamp[2] <<
" "
737 ATH_MSG_ERROR (
"Before correction: LArRampMC and correction DO NOT compare - should have opposite signs for rampes" );
743 ATH_MSG_DEBUG (
"Apply corrections and compare LArRampMC with corrections " );
747 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
749 m_rampCorrections[
i].m_gain);
750 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
751 m_rampCorrections[
i].m_gain);
754 << coolChannel <<
" "
755 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
756 << m_rampCorrections[
i].m_gain <<
" "
764 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
765 << coolChannel <<
" "
766 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
767 << m_rampCorrections[
i].m_gain <<
" "
768 << m_rampCorrections[
i].m_vRamp[0] <<
" "
769 << m_rampCorrections[
i].m_vRamp[1] <<
" "
770 << m_rampCorrections[
i].m_vRamp[2] <<
" "
771 <<
" Compare = " << (rampP == m_rampCorrections[
i]) );
772 if (rampP != m_rampCorrections[
i] && !rampP.
isEmpty()) {
773 ATH_MSG_ERROR (
"After correction: LArRampMC and correction NOT equal" );
778 ATH_MSG_DEBUG (
"Undo corrections and compare LArRampMC with corrections " );
782 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
784 m_rampCorrections[
i].m_gain);
785 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
786 m_rampCorrections[
i].m_gain);
789 << coolChannel <<
" "
790 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
791 << m_rampCorrections[
i].m_gain <<
" "
799 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
800 << coolChannel <<
" "
801 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
802 << m_rampCorrections[
i].m_gain <<
" "
803 << m_rampCorrections[
i].m_vRamp[0] <<
" "
804 << m_rampCorrections[
i].m_vRamp[1] <<
" "
805 << m_rampCorrections[
i].m_vRamp[2] <<
" "
809 ATH_MSG_ERROR (
"After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
814 ATH_MSG_DEBUG (
"2nd Apply 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] <<
" "
842 <<
" Compare = " << (rampP == m_rampCorrections[
i]) );
843 if (rampP != m_rampCorrections[
i] && !rampP.
isEmpty()) {
844 ATH_MSG_ERROR (
"After correction: LArRampMC and correction NOT equal" );
849 ATH_MSG_DEBUG (
"2nd Undo corrections and compare LArRampMC with corrections " );
853 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
855 m_rampCorrections[
i].m_gain);
856 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
857 m_rampCorrections[
i].m_gain);
860 << coolChannel <<
" "
861 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
862 << m_rampCorrections[
i].m_gain <<
" "
870 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
871 << coolChannel <<
" "
872 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
873 << m_rampCorrections[
i].m_gain <<
" "
874 << m_rampCorrections[
i].m_vRamp[0] <<
" "
875 << m_rampCorrections[
i].m_vRamp[1] <<
" "
876 << m_rampCorrections[
i].m_vRamp[2] <<
" "
880 ATH_MSG_ERROR (
"After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
995 std::set<unsigned int> channelNumbers;
996 CONTAINER::chan_const_iterator chanIt = ramps->
chan_begin();
997 CONTAINER::chan_const_iterator endChan = ramps->
chan_end ();
998 for (
unsigned int i = 0; chanIt != endChan; ++chanIt, ++
i) {
999 const CONTAINER::Subset* subset = ramps->at(
i);
1001 <<
" channel " << subset->channel()
1002 <<
" gain " << subset->gain()
1003 <<
" groupingType " << subset->groupingType()
1004 <<
" subsetSize " << subset->subsetSize()
1005 <<
" correctionVecSize " << subset->correctionVecSize() );
1006 if ((*chanIt) != subset->channel()) {
1007 ATH_MSG_ERROR (
"Channel numbers not the same for MultChanColl and subset: "
1009 <<
" multchan " << (*chanIt)
1010 <<
" subset " << subset->channel() );
1013 if (!(channelNumbers.insert(subset->channel()).second)) {
1015 <<
" channel " << subset->channel() );
1019 ATH_MSG_DEBUG (
"Channel numbers size " << channelNumbers.size()
1020 <<
" ramps size " << ramps->
chan_size() );
1024 return (StatusCode::FAILURE);
1028 return StatusCode::SUCCESS;