ATLAS Offline Software
Loading...
Searching...
No Matches
LArConditionsTestAlg.cxx File Reference

This file contains an algorithm for testing lar conditions data access. More...

Include dependency graph for LArConditionsTestAlg.cxx:

Go to the source code of this file.

Functions

bool operator== (const LArRampComplete::LArCondObj &r1, const LArRampPTmp &r2)
bool CorrectionCompare (const LArRampComplete::LArCondObj &r1, const LArRampPTmp &r2)
bool operator!= (const LArRampComplete::LArCondObj &r1, const LArRampPTmp &r2)
StatusCode LArConditionsTestAlg::testEachCondObject ATLAS_NOT_THREAD_SAFE (const LArRampMC *ramps)

Detailed Description

This file contains an algorithm for testing lar conditions data access.

Author
RD Schaffer R.D.S.nosp@m.chaf.nosp@m.fer@c.nosp@m.ern..nosp@m.ch
Hong Ma hma@b.nosp@m.nl.g.nosp@m.ov

Definition in file LArConditionsTestAlg.cxx.

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

StatusCode LArConditionsTestAlg::testEachCondObject ATLAS_NOT_THREAD_SAFE ( const LArRampMC * ramps)

Definition at line 431 of file LArConditionsTestAlg.cxx.

432{
433 ATH_MSG_INFO ("in testEachCondObject()" );
434 bool error = false;
435
436 typedef LArRampMC::CONTAINER CONTAINER;
437 //typedef CONTAINER::ConstCorrectionIt ConstCorrectionIt;
438
439 // Cast into r/w for tests
440 LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
441 if (!ramps_rw) {
442 ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
443 return StatusCode::FAILURE;
444 }
445
446 if (ramps_rw->correctionsApplied())
447 ATH_CHECK(ramps_rw->undoCorrections());
448
449 if (!m_readCondObjs) {
450 if (m_writeCondObjs) {
451
452 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
453 ATH_MSG_DEBUG ("setPdata for chan, chan id, gain " << i << " "
454 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
455 << m_rampCache[i].m_gain << " " );
456
457 // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
459 ramp.m_vRamp = m_rampCache[i].m_vRamp;
460
461 ramps_rw->setPdata(m_rampCache[i].m_channelID,
462 ramp,
463 m_rampCache[i].m_gain);
464 }
465 }
466
467 ATH_MSG_DEBUG ( "Finished conditions, now write corrections " );
468
469 if (m_writeCorrections) {
470 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
471
472 ATH_MSG_DEBUG ("insert corr for chan, chan id, gain " << i << " "
473 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
474 << m_rampCorrections[i].m_gain << " " );
475
476 // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
478 ramp.m_vRamp = m_rampCorrections[i].m_vRamp;
479
480 ATH_CHECK( ramps_rw->insertCorrection(m_rampCorrections[i].m_channelID,
481 ramp,
482 m_rampCorrections[i].m_gain) );
483 }
484 }
485 }
486
487 ATH_MSG_DEBUG ("Number of channels, iovs "
488 << ramps->chan_size() << " " << ramps->iov_size() );
489
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);
494 ATH_MSG_DEBUG ( "Index " << 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: "
502 << i
503 << " multchan " << (*chanIt1)
504 << " subset " << subset->channel() );
505 error = true;
506 }
507 }
508
509 ATH_MSG_DEBUG ("Number of channels, iovs, subsets "
510 << ramps->chan_size() << " "
511 << ramps->iov_size() << " "
512 << ramps->size() << " " );
513
514 ATH_MSG_DEBUG ("Compare LArRampMC with cache " );
515 // Now loop over ramps and compare with cache
516 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
517
518 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCache[i].m_channelID,
519 m_rampCache[i].m_gain);
520 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
521 m_rampCache[i].m_gain);
522
523 if (!rampP.isEmpty()) {
524 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
525 << coolChannel << " "
526 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
527 << m_rampCache[i].m_gain << " "
528 << rampP.m_vRamp[0] << " "
529 << rampP.m_vRamp[1] << " "
530 << rampP.m_vRamp[2] << " " );
531 }
532 else {
533 ATH_MSG_DEBUG ("New : isEmpty " );
534 }
535 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
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()) {
544 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
545 error = true;
546 }
547 }
548
549
550 // Now loop over ramps using generic iterator and compare with cache
551 ATH_MSG_DEBUG ("Compare LArRampMC with cache using iterator " );
552 CONTAINER::ConstConditionsMapIterator rampIt;
553 CONTAINER::ConstConditionsMapIterator rampEnd;
554 for (unsigned int gain = 0; gain < 3; ++gain) {
555 rampIt = ramps->begin(gain);
556 rampEnd = ramps->end (gain);
557 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
558 // cache is not in order for gains, select the current gain
559 if (gain != m_rampCache[i].m_gain) continue;
561 HWIdentifier rampId;
562 while(rampIt != rampEnd) {
563 rampP = *rampIt;
564 rampId = rampIt.channelId();
565 ++rampIt;
566 if (!rampP.isEmpty()) break; // break out for first non-empty ramp
567 }
568 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
569 m_rampCache[i].m_gain);
570 if (!rampP.isEmpty()) {
571 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
572 << coolChannel << " "
573 << m_onlineID->show_to_string(rampId) << " "
574 << m_rampCache[i].m_gain << " "
575 << rampP.m_vRamp[0] << " "
576 << rampP.m_vRamp[1] << " "
577 << rampP.m_vRamp[2] << " " );
578 }
579 else {
580 ATH_MSG_DEBUG ("New : isEmpty " );
581 }
582 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
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()) {
591 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
592 error = true;
593 }
594 }
595 }
596
597
598
599 // Now loop over ramps in pieces using the selector on febids to
600 // iterate and compare with cache
601 ATH_MSG_DEBUG ("Compare LArRampMC with cache using iterator and febid selection " );
602 // Loop over cache and divide the febids into three sets, where
603 // each set is an array of size 3 for the separate gains
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);
611 }
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);
615 }
616 else {
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);
619 }
620 }
621
622 for (unsigned int gain = 0; gain < 3; ++gain) {
623 for (unsigned int febSet = 0; febSet < 3; ++febSet) {
624 unsigned int i0 = 0;
625 unsigned int iend = m_rampCache.size()/3;
626 if (febSet < m_rampCache.size()/3) {
627 rampIt = ramps->begin(gain, ids1[gain]);
628 msg() << MSG::DEBUG <<"FebID vec 1 : ";
629 for (unsigned int i = 0; i < ids1[gain].size(); ++i) {
630 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids1[gain][i]))
631 << " ";
632 }
633 msg() << MSG::DEBUG << endmsg;
634 }
635 else if (febSet < 2*m_rampCache.size()/3) {
636 rampIt = ramps->begin(gain, ids2[gain]);
637 i0 = m_rampCache.size()/3 + 1;
638 iend = 2*m_rampCache.size()/3;
639 msg() << MSG::DEBUG <<"FebID vec 2 : ";
640 for (unsigned int i = 0; i < ids2[gain].size(); ++i) {
641 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids2[gain][i]))
642 << " ";
643 }
644 msg() << MSG::DEBUG << endmsg;
645 }
646 else {
647 rampIt = ramps->begin(gain, ids3[gain]);
648 i0 = 2*m_rampCache.size()/3 + 1;
649 iend = m_rampCache.size();
650 msg() << MSG::DEBUG <<"FebID vec 3 : ";
651 for (unsigned int i = 0; i < ids3[gain].size(); ++i) {
652 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids3[gain][i]))
653 << " ";
654 }
655 msg() << MSG::DEBUG << endmsg;
656 }
657
658 rampEnd = ramps->end (gain);
659 ATH_MSG_DEBUG ("After ramps->end " );
660 for (unsigned int i = i0; i < iend; ++i) {
661 // cache is not in order for gains, select the current gain
662 if (gain != m_rampCache[i].m_gain) continue;
664 HWIdentifier rampId;
665
666 ATH_MSG_DEBUG ("Looking for "
667 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) );
668
669 // Skip the empty channels
670 while(rampIt != rampEnd) {
671 rampP = *rampIt;
672 rampId = rampIt.channelId();
673 ++rampIt;
674 if (!rampP.isEmpty()) break; // break out for first non-empty ramp
675 }
676 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
677 m_rampCache[i].m_gain);
678 if (!rampP.isEmpty()) {
679 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
680 << coolChannel << " "
681 << m_onlineID->show_to_string(rampId) << " "
682 << m_rampCache[i].m_gain << " "
683 << rampP.m_vRamp[0] << " "
684 << rampP.m_vRamp[1] << " "
685 << rampP.m_vRamp[2] << " " );
686 }
687 else {
688 ATH_MSG_DEBUG ("New : isEmpty " );
689 }
690 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
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()) {
699 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
700 error = true;
701 }
702 }
703 }
704 }
705
706 ATH_MSG_DEBUG ("Compare LArRampMC with corrections " );
707
708 if (m_applyCorrections) {
709 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
710 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
711 m_rampCorrections[i].m_gain);
712 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
713 m_rampCorrections[i].m_gain);
714 if (!rampP.isEmpty()) {
715 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
716 << coolChannel << " "
717 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
718 << m_rampCorrections[i].m_gain << " "
719 << rampP.m_vRamp[0] << " "
720 << rampP.m_vRamp[1] << " "
721 << rampP.m_vRamp[2] << " " );
722 }
723 else {
724 ATH_MSG_DEBUG ("New : isEmpty " );
725 }
726
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] << " "
734 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
735 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
736
737 ATH_MSG_ERROR ("Before correction: LArRampMC and correction DO NOT compare - should have opposite signs for rampes" );
738 error = true;
739 }
740 }
741
742
743 ATH_MSG_DEBUG ("Apply corrections and compare LArRampMC with corrections " );
744 ATH_CHECK( ramps_rw->applyCorrections() );
745 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
746
747 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
748 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
749 m_rampCorrections[i].m_gain);
750 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
751 m_rampCorrections[i].m_gain);
752 if (!rampP.isEmpty()) {
753 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
754 << coolChannel << " "
755 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
756 << m_rampCorrections[i].m_gain << " "
757 << rampP.m_vRamp[0] << " "
758 << rampP.m_vRamp[1] << " "
759 << rampP.m_vRamp[2] << " " );
760 }
761 else {
762 ATH_MSG_DEBUG ("New : isEmpty " );
763 }
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" );
774 error = true;
775 }
776 }
777
778 ATH_MSG_DEBUG ("Undo corrections and compare LArRampMC with corrections " );
779 ATH_CHECK( ramps_rw->undoCorrections() );
780 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
781
782 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
783 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
784 m_rampCorrections[i].m_gain);
785 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
786 m_rampCorrections[i].m_gain);
787 if (!rampP.isEmpty()) {
788 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
789 << coolChannel << " "
790 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
791 << m_rampCorrections[i].m_gain << " "
792 << rampP.m_vRamp[0] << " "
793 << rampP.m_vRamp[1] << " "
794 << rampP.m_vRamp[2] << " " );
795 }
796 else {
797 ATH_MSG_DEBUG ("New : isEmpty " );
798 }
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] << " "
806 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
807 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
808
809 ATH_MSG_ERROR ("After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
810 error = true;
811 }
812 }
813
814 ATH_MSG_DEBUG ("2nd Apply corrections and compare LArRampMC with corrections " );
815 ATH_CHECK( ramps_rw->applyCorrections() );
816 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
817
818 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
819 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
820 m_rampCorrections[i].m_gain);
821 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
822 m_rampCorrections[i].m_gain);
823 if (!rampP.isEmpty()) {
824 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
825 << coolChannel << " "
826 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
827 << m_rampCorrections[i].m_gain << " "
828 << rampP.m_vRamp[0] << " "
829 << rampP.m_vRamp[1] << " "
830 << rampP.m_vRamp[2] << " " );
831 }
832 else {
833 ATH_MSG_DEBUG ("New : isEmpty " );
834 }
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" );
845 error = true;
846 }
847 }
848
849 ATH_MSG_DEBUG ("2nd Undo corrections and compare LArRampMC with corrections " );
850 ATH_CHECK( ramps_rw->undoCorrections() );
851 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
852
853 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
854 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
855 m_rampCorrections[i].m_gain);
856 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
857 m_rampCorrections[i].m_gain);
858 if (!rampP.isEmpty()) {
859 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
860 << coolChannel << " "
861 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
862 << m_rampCorrections[i].m_gain << " "
863 << rampP.m_vRamp[0] << " "
864 << rampP.m_vRamp[1] << " "
865 << rampP.m_vRamp[2] << " " );
866 }
867 else {
868 ATH_MSG_DEBUG ("New : isEmpty " );
869 }
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] << " "
877 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
878 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
879
880 ATH_MSG_ERROR ("After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
881 error = true;
882 }
883 }
884 }
885
886
887 /*
888 log << MSG::DEBUG <<"Find each correction "
889 << endmsg;
890
891 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
892 HWIdentifier id = m_rampCorrections[i].m_channelID;
893 unsigned int gain = m_rampCorrections[i].m_gain;
894
895 ConstCorrectionIt it = ramps->findCorrection(id, gain);
896 // May not have any corrections
897 if (it != ramps->correctionsEnd(gain)) {
898
899 unsigned int coolChannel = ramps->coolChannel(id, gain);
900 HWIdentifier id1((*it).first);
901 LArRampComplete::LArCondObj rampP = (*it).second;
902 if (id != id1 || rampP != m_rampCorrections[i]) {
903 log << MSG::ERROR <<"Correction retrieved with findCorrection does not match: "
904 << " i = " << i << endmsg;
905 error = true;
906 log << MSG::DEBUG <<"New : 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 << rampP.m_vRamp[0] << " "
911 << rampP.m_vRamp[1] << " "
912 << rampP.m_vRamp[2] << " "
913 << endmsg;
914 log << MSG::DEBUG <<"Corrections: cool chan, chan id, gain, ramps "
915 << coolChannel << " "
916 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
917 << m_rampCorrections[i].m_gain << " "
918 << m_rampCorrections[i].m_vRamp[0] << " "
919 << m_rampCorrections[i].m_vRamp[1] << " "
920 << m_rampCorrections[i].m_vRamp[2] << " "
921 << " Compare = " << (rampP == m_rampCorrections[i])
922 << endmsg;
923 }
924 }
925 else {
926 log << MSG::DEBUG <<"No corrections found "
927 << endmsg;
928 }
929 }
930 log << MSG::DEBUG <<"End - Find each correction "
931 << endmsg;
932
933
934 // Count the number of corrections per gain
935 unsigned int gains[3] = {0,0,0};
936 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
937 unsigned int gain = m_rampCorrections[i].m_gain;
938 gains[gain]++;
939 }
940 for (unsigned int i = 0; i < 3; ++i) {
941 if (gains[i] != ramps->correctionsSize(i)) {
942 log << MSG::ERROR <<"Number of corrections not same as number inserted: "
943 << gains[i] << " "
944 << ramps->correctionsSize(i) << " gain " << i
945 << endmsg;
946 error = true;
947 }
948
949 // Check that each correction is the same using container iterator
950 unsigned int nit = 0;
951 ConstCorrectionIt it = ramps->correctionsBegin(i);
952 ConstCorrectionIt end = ramps->correctionsEnd(i);
953 unsigned int icorr = 0;
954 for (; it != end && icorr < m_rampCorrections.size(); ++it, ++nit, ++icorr) {
955 while (m_rampCorrections[icorr].m_gain != i) ++icorr;
956 HWIdentifier id = m_rampCorrections[icorr].m_channelID;
957 unsigned int gain = m_rampCorrections[icorr].m_gain;
958 unsigned int coolChannel = ramps->coolChannel(id, gain);
959 HWIdentifier id1((*it).first);
960 LArRampComplete::LArCondObj rampP = (*it).second;
961 if (id != id1 || rampP != m_rampCorrections[icorr]) {
962 log << MSG::ERROR <<"Correction retrieved with iterator does not match: "
963 << " gain = " << i
964 << " icorr = " << icorr
965 << " nit = " << nit
966 << endmsg;
967 error = true;
968 log << MSG::DEBUG <<"New : cool chan, chan id, gain, ramps "
969 << coolChannel << " "
970 << m_onlineID->show_to_string(m_rampCorrections[icorr].m_channelID) << " "
971 << m_rampCorrections[icorr].m_gain << " "
972 << rampP.m_vRamp[0] << " "
973 << rampP.m_vRamp[1] << " "
974 << rampP.m_vRamp[2] << " "
975 << endmsg;
976 log << MSG::DEBUG <<"Corrections: cool chan, chan id, gain, ramps "
977 << coolChannel << " "
978 << m_onlineID->show_to_string(m_rampCorrections[icorr].m_channelID) << " "
979 << m_rampCorrections[icorr].m_gain << " "
980 << m_rampCorrections[icorr].m_vRamp[0] << " "
981 << m_rampCorrections[icorr].m_vRamp[1] << " "
982 << m_rampCorrections[icorr].m_vRamp[2] << " "
983 << " Compare = " << (rampP == m_rampCorrections[icorr])
984 << endmsg;
985 }
986 }
987 }
988
989 removed.
990 */
991
992 ATH_MSG_DEBUG ("Number of channels, iovs "
993 << ramps->chan_size() << " " << ramps->iov_size() );
994
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);
1000 ATH_MSG_DEBUG ( "Index " << 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: "
1008 << i
1009 << " multchan " << (*chanIt)
1010 << " subset " << subset->channel() );
1011 error = true;
1012 }
1013 if (!(channelNumbers.insert(subset->channel()).second)) {
1014 ATH_MSG_ERROR ( "Duplicate channel number - Index " << i
1015 << " channel " << subset->channel() );
1016 error = true;
1017 }
1018 }
1019 ATH_MSG_DEBUG ( "Channel numbers size " << channelNumbers.size()
1020 << " ramps size " << ramps->chan_size() );
1021
1022 if (error) {
1023 ATH_MSG_ERROR ("Failing check of LArRamp - see above" );
1024 return (StatusCode::FAILURE);
1025 }
1026
1027 ATH_MSG_DEBUG ( "End of testEachCondObject " );
1028 return StatusCode::SUCCESS;
1029}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
bool CorrectionCompare(const LArRampComplete::LArCondObj &r1, const LArRampPTmp &r2)
StatusCode insertCorrection(HWIdentifier id, const T &cond, unsigned int gain, bool corrChannel=true)
access to corrections -
bool correctionsApplied() const
Have corrections been applied?
void setPdata(const HWIdentifier id, const T &payload, unsigned int gain=0)
put payload in persistent data
unsigned int coolChannel(const HWIdentifier id, unsigned int gain=0) const
Return the COOL channel number for a given online id and gain.
StatusCode applyCorrections()
apply correction set
StatusCode undoCorrections()
undo corrections that have been already applied
chan_const_iterator chan_begin() const
Access to Channel numbers via iterators - from MultChanCollection.
ConstReference get(const HWIdentifier id, unsigned int gain=0) const
get data with online identifier
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
chan_size_type chan_size() const
number of channels - from MultChanCollection
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
iov_size_type iov_size() const
number of IOVs - from MultChanCollection
chan_const_iterator chan_end() const
Implementation of the interface ILArRamp for MC Derives from LArRampComplete, and implements the phi-...
Definition LArRampMC.h:22
LArRampComplete::CONTAINER CONTAINER
Definition LArRampMC.h:26
std::vector< float > m_vRamp
Definition LArRampP1.h:30
bool isEmpty() const
Definition LArRampP1.h:29
MsgStream & msg
Definition testRead.cxx:32

◆ CorrectionCompare()

bool CorrectionCompare ( const LArRampComplete::LArCondObj & r1,
const LArRampPTmp & r2 )
inline

Definition at line 203 of file LArConditionsTestAlg.cxx.

204{
205 // Comparison of two LArRampComplete::LArCondObj objects
206 if (r1.m_vRamp.size() != r2.m_vRamp.size()) return (false);
207 for (unsigned int i = 0; i < r1.m_vRamp.size(); ++i) {
208 if (r1.m_vRamp[i] != -r2.m_vRamp[i]) return (false);
209 }
210 return (true);
211}

◆ operator!=()

bool operator!= ( const LArRampComplete::LArCondObj & r1,
const LArRampPTmp & r2 )
inline

Definition at line 215 of file LArConditionsTestAlg.cxx.

216{
217 if(r1 == r2)return (false);
218 return (true);
219}

◆ operator==()

bool operator== ( const LArRampComplete::LArCondObj & r1,
const LArRampPTmp & r2 )
inline

Definition at line 191 of file LArConditionsTestAlg.cxx.

192{
193 // Comparison of two LArRampComplete::LArCondObj objects
194 if (r1.m_vRamp.size() != r2.m_vRamp.size()) return (false);
195 for (unsigned int i = 0; i < r1.m_vRamp.size(); ++i) {
196 if (r1.m_vRamp[i] != r2.m_vRamp[i]) return (false);
197 }
198 return (true);
199}