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 413 of file LArConditionsTestAlg.cxx.

414{
415 ATH_MSG_INFO ("in testEachCondObject()" );
416 bool error = false;
417
418 typedef LArRampMC::CONTAINER CONTAINER;
419 //typedef CONTAINER::ConstCorrectionIt ConstCorrectionIt;
420
421 // Cast into r/w for tests
422 LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
423 if (!ramps_rw) {
424 ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
425 return StatusCode::FAILURE;
426 }
427
428 if (ramps_rw->correctionsApplied())
429 ATH_CHECK(ramps_rw->undoCorrections());
430
431 if (!m_readCondObjs) {
432 if (m_writeCondObjs) {
433
434 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
435 ATH_MSG_DEBUG ("setPdata for chan, chan id, gain " << i << " "
436 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
437 << m_rampCache[i].m_gain << " " );
438
439 // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
441 ramp.m_vRamp = m_rampCache[i].m_vRamp;
442
443 ramps_rw->setPdata(m_rampCache[i].m_channelID,
444 ramp,
445 m_rampCache[i].m_gain);
446 }
447 }
448
449 ATH_MSG_DEBUG ( "Finished conditions, now write corrections " );
450
451 if (m_writeCorrections) {
452 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
453
454 ATH_MSG_DEBUG ("insert corr for chan, chan id, gain " << i << " "
455 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
456 << m_rampCorrections[i].m_gain << " " );
457
458 // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
460 ramp.m_vRamp = m_rampCorrections[i].m_vRamp;
461
462 ATH_CHECK( ramps_rw->insertCorrection(m_rampCorrections[i].m_channelID,
463 ramp,
464 m_rampCorrections[i].m_gain) );
465 }
466 }
467 }
468
469 ATH_MSG_DEBUG ("Number of channels, iovs "
470 << ramps->chan_size() << " " << ramps->iov_size() );
471
472 CONTAINER::chan_const_iterator chanIt1 = ramps->chan_begin();
473 CONTAINER::chan_const_iterator endChan1 = ramps->chan_end ();
474 for (unsigned int i = 0; chanIt1 != endChan1; ++chanIt1, ++i) {
475 const CONTAINER::Subset* subset = ramps->at(i);
476 ATH_MSG_DEBUG ( "Index " << i
477 << " channel " << subset->channel()
478 << " gain " << subset->gain()
479 << " groupingType " << subset->groupingType()
480 << " subsetSize " << subset->subsetSize()
481 << " correctionVecSize " << subset->correctionVecSize() );
482 if ((*chanIt1) != subset->channel()) {
483 ATH_MSG_ERROR ( "Channel numbers not the same for MultChanColl and subset: "
484 << i
485 << " multchan " << (*chanIt1)
486 << " subset " << subset->channel() );
487 error = true;
488 }
489 }
490
491 ATH_MSG_DEBUG ("Number of channels, iovs, subsets "
492 << ramps->chan_size() << " "
493 << ramps->iov_size() << " "
494 << ramps->size() << " " );
495
496 ATH_MSG_DEBUG ("Compare LArRampMC with cache " );
497 // Now loop over ramps and compare with cache
498 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
499
500 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCache[i].m_channelID,
501 m_rampCache[i].m_gain);
502 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
503 m_rampCache[i].m_gain);
504
505 if (!rampP.isEmpty()) {
506 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
507 << coolChannel << " "
508 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
509 << m_rampCache[i].m_gain << " "
510 << rampP.m_vRamp[0] << " "
511 << rampP.m_vRamp[1] << " "
512 << rampP.m_vRamp[2] << " " );
513 }
514 else {
515 ATH_MSG_DEBUG ("New : isEmpty " );
516 }
517 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
518 << coolChannel << " "
519 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
520 << m_rampCache[i].m_gain << " "
521 << m_rampCache[i].m_vRamp[0] << " "
522 << m_rampCache[i].m_vRamp[1] << " "
523 << m_rampCache[i].m_vRamp[2] << " "
524 << " Compare = " << (rampP == m_rampCache[i]) );
525 if (rampP != m_rampCache[i] && !rampP.isEmpty()) {
526 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
527 error = true;
528 }
529 }
530
531
532 // Now loop over ramps using generic iterator and compare with cache
533 ATH_MSG_DEBUG ("Compare LArRampMC with cache using iterator " );
534 CONTAINER::ConstConditionsMapIterator rampIt;
535 CONTAINER::ConstConditionsMapIterator rampEnd;
536 for (unsigned int gain = 0; gain < 3; ++gain) {
537 rampIt = ramps->begin(gain);
538 rampEnd = ramps->end (gain);
539 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
540 // cache is not in order for gains, select the current gain
541 if (gain != m_rampCache[i].m_gain) continue;
543 HWIdentifier rampId;
544 while(rampIt != rampEnd) {
545 rampP = *rampIt;
546 rampId = rampIt.channelId();
547 ++rampIt;
548 if (!rampP.isEmpty()) break; // break out for first non-empty ramp
549 }
550 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
551 m_rampCache[i].m_gain);
552 if (!rampP.isEmpty()) {
553 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
554 << coolChannel << " "
555 << m_onlineID->show_to_string(rampId) << " "
556 << m_rampCache[i].m_gain << " "
557 << rampP.m_vRamp[0] << " "
558 << rampP.m_vRamp[1] << " "
559 << rampP.m_vRamp[2] << " " );
560 }
561 else {
562 ATH_MSG_DEBUG ("New : isEmpty " );
563 }
564 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
565 << coolChannel << " "
566 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
567 << m_rampCache[i].m_gain << " "
568 << m_rampCache[i].m_vRamp[0] << " "
569 << m_rampCache[i].m_vRamp[1] << " "
570 << m_rampCache[i].m_vRamp[2] << " "
571 << " Compare = " << (rampP == m_rampCache[i]) );
572 if (rampP != m_rampCache[i] && !rampP.isEmpty()) {
573 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
574 error = true;
575 }
576 }
577 }
578
579
580
581 // Now loop over ramps in pieces using the selector on febids to
582 // iterate and compare with cache
583 ATH_MSG_DEBUG ("Compare LArRampMC with cache using iterator and febid selection " );
584 // Loop over cache and divide the febids into three sets, where
585 // each set is an array of size 3 for the separate gains
586 std::vector<unsigned int> ids1[3];
587 std::vector<unsigned int> ids2[3];
588 std::vector<unsigned int> ids3[3];
589 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
590 if (i < m_rampCache.size()/3) {
591 unsigned int id = m_onlineID->feb_Id(m_rampCache[i].m_channelID).get_identifier32().get_compact();
592 ids1[m_rampCache[i].m_gain].push_back(id);
593 }
594 else if (i < 2*m_rampCache.size()/3) {
595 unsigned int id = m_onlineID->feb_Id(m_rampCache[i].m_channelID).get_identifier32().get_compact();
596 ids2[m_rampCache[i].m_gain].push_back(id);
597 }
598 else {
599 unsigned int id = m_onlineID->feb_Id(m_rampCache[i].m_channelID).get_identifier32().get_compact();
600 ids3[m_rampCache[i].m_gain].push_back(id);
601 }
602 }
603
604 for (unsigned int gain = 0; gain < 3; ++gain) {
605 for (unsigned int febSet = 0; febSet < 3; ++febSet) {
606 unsigned int i0 = 0;
607 unsigned int iend = m_rampCache.size()/3;
608 if (febSet < m_rampCache.size()/3) {
609 rampIt = ramps->begin(gain, ids1[gain]);
610 msg() << MSG::DEBUG <<"FebID vec 1 : ";
611 for (unsigned int i = 0; i < ids1[gain].size(); ++i) {
612 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids1[gain][i]))
613 << " ";
614 }
615 msg() << MSG::DEBUG << endmsg;
616 }
617 else if (febSet < 2*m_rampCache.size()/3) {
618 rampIt = ramps->begin(gain, ids2[gain]);
619 i0 = m_rampCache.size()/3 + 1;
620 iend = 2*m_rampCache.size()/3;
621 msg() << MSG::DEBUG <<"FebID vec 2 : ";
622 for (unsigned int i = 0; i < ids2[gain].size(); ++i) {
623 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids2[gain][i]))
624 << " ";
625 }
626 msg() << MSG::DEBUG << endmsg;
627 }
628 else {
629 rampIt = ramps->begin(gain, ids3[gain]);
630 i0 = 2*m_rampCache.size()/3 + 1;
631 iend = m_rampCache.size();
632 msg() << MSG::DEBUG <<"FebID vec 3 : ";
633 for (unsigned int i = 0; i < ids3[gain].size(); ++i) {
634 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids3[gain][i]))
635 << " ";
636 }
637 msg() << MSG::DEBUG << endmsg;
638 }
639
640 rampEnd = ramps->end (gain);
641 ATH_MSG_DEBUG ("After ramps->end " );
642 for (unsigned int i = i0; i < iend; ++i) {
643 // cache is not in order for gains, select the current gain
644 if (gain != m_rampCache[i].m_gain) continue;
646 HWIdentifier rampId;
647
648 ATH_MSG_DEBUG ("Looking for "
649 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) );
650
651 // Skip the empty channels
652 while(rampIt != rampEnd) {
653 rampP = *rampIt;
654 rampId = rampIt.channelId();
655 ++rampIt;
656 if (!rampP.isEmpty()) break; // break out for first non-empty ramp
657 }
658 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
659 m_rampCache[i].m_gain);
660 if (!rampP.isEmpty()) {
661 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
662 << coolChannel << " "
663 << m_onlineID->show_to_string(rampId) << " "
664 << m_rampCache[i].m_gain << " "
665 << rampP.m_vRamp[0] << " "
666 << rampP.m_vRamp[1] << " "
667 << rampP.m_vRamp[2] << " " );
668 }
669 else {
670 ATH_MSG_DEBUG ("New : isEmpty " );
671 }
672 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
673 << coolChannel << " "
674 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
675 << m_rampCache[i].m_gain << " "
676 << m_rampCache[i].m_vRamp[0] << " "
677 << m_rampCache[i].m_vRamp[1] << " "
678 << m_rampCache[i].m_vRamp[2] << " "
679 << " Compare = " << (rampP == m_rampCache[i]) );
680 if (rampP != m_rampCache[i] && !rampP.isEmpty()) {
681 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
682 error = true;
683 }
684 }
685 }
686 }
687
688 ATH_MSG_DEBUG ("Compare LArRampMC with corrections " );
689
690 if (m_applyCorrections) {
691 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
692 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
693 m_rampCorrections[i].m_gain);
694 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
695 m_rampCorrections[i].m_gain);
696 if (!rampP.isEmpty()) {
697 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
698 << coolChannel << " "
699 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
700 << m_rampCorrections[i].m_gain << " "
701 << rampP.m_vRamp[0] << " "
702 << rampP.m_vRamp[1] << " "
703 << rampP.m_vRamp[2] << " " );
704 }
705 else {
706 ATH_MSG_DEBUG ("New : isEmpty " );
707 }
708
709 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
710 << coolChannel << " "
711 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
712 << m_rampCorrections[i].m_gain << " "
713 << m_rampCorrections[i].m_vRamp[0] << " "
714 << m_rampCorrections[i].m_vRamp[1] << " "
715 << m_rampCorrections[i].m_vRamp[2] << " "
716 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
717 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
718
719 ATH_MSG_ERROR ("Before correction: LArRampMC and correction DO NOT compare - should have opposite signs for rampes" );
720 error = true;
721 }
722 }
723
724
725 ATH_MSG_DEBUG ("Apply corrections and compare LArRampMC with corrections " );
726 ATH_CHECK( ramps_rw->applyCorrections() );
727 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
728
729 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
730 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
731 m_rampCorrections[i].m_gain);
732 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
733 m_rampCorrections[i].m_gain);
734 if (!rampP.isEmpty()) {
735 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
736 << coolChannel << " "
737 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
738 << m_rampCorrections[i].m_gain << " "
739 << rampP.m_vRamp[0] << " "
740 << rampP.m_vRamp[1] << " "
741 << rampP.m_vRamp[2] << " " );
742 }
743 else {
744 ATH_MSG_DEBUG ("New : isEmpty " );
745 }
746 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
747 << coolChannel << " "
748 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
749 << m_rampCorrections[i].m_gain << " "
750 << m_rampCorrections[i].m_vRamp[0] << " "
751 << m_rampCorrections[i].m_vRamp[1] << " "
752 << m_rampCorrections[i].m_vRamp[2] << " "
753 << " Compare = " << (rampP == m_rampCorrections[i]) );
754 if (rampP != m_rampCorrections[i] && !rampP.isEmpty()) {
755 ATH_MSG_ERROR ("After correction: LArRampMC and correction NOT equal" );
756 error = true;
757 }
758 }
759
760 ATH_MSG_DEBUG ("Undo corrections and compare LArRampMC with corrections " );
761 ATH_CHECK( ramps_rw->undoCorrections() );
762 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
763
764 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
765 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
766 m_rampCorrections[i].m_gain);
767 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
768 m_rampCorrections[i].m_gain);
769 if (!rampP.isEmpty()) {
770 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
771 << coolChannel << " "
772 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
773 << m_rampCorrections[i].m_gain << " "
774 << rampP.m_vRamp[0] << " "
775 << rampP.m_vRamp[1] << " "
776 << rampP.m_vRamp[2] << " " );
777 }
778 else {
779 ATH_MSG_DEBUG ("New : isEmpty " );
780 }
781 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
782 << coolChannel << " "
783 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
784 << m_rampCorrections[i].m_gain << " "
785 << m_rampCorrections[i].m_vRamp[0] << " "
786 << m_rampCorrections[i].m_vRamp[1] << " "
787 << m_rampCorrections[i].m_vRamp[2] << " "
788 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
789 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
790
791 ATH_MSG_ERROR ("After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
792 error = true;
793 }
794 }
795
796 ATH_MSG_DEBUG ("2nd Apply corrections and compare LArRampMC with corrections " );
797 ATH_CHECK( ramps_rw->applyCorrections() );
798 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
799
800 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
801 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
802 m_rampCorrections[i].m_gain);
803 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
804 m_rampCorrections[i].m_gain);
805 if (!rampP.isEmpty()) {
806 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
807 << coolChannel << " "
808 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
809 << m_rampCorrections[i].m_gain << " "
810 << rampP.m_vRamp[0] << " "
811 << rampP.m_vRamp[1] << " "
812 << rampP.m_vRamp[2] << " " );
813 }
814 else {
815 ATH_MSG_DEBUG ("New : isEmpty " );
816 }
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] << " "
824 << " Compare = " << (rampP == m_rampCorrections[i]) );
825 if (rampP != m_rampCorrections[i] && !rampP.isEmpty()) {
826 ATH_MSG_ERROR ("After correction: LArRampMC and correction NOT equal" );
827 error = true;
828 }
829 }
830
831 ATH_MSG_DEBUG ("2nd Undo corrections and compare LArRampMC with corrections " );
832 ATH_CHECK( ramps_rw->undoCorrections() );
833 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
834
835 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
836 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
837 m_rampCorrections[i].m_gain);
838 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
839 m_rampCorrections[i].m_gain);
840 if (!rampP.isEmpty()) {
841 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
842 << coolChannel << " "
843 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
844 << m_rampCorrections[i].m_gain << " "
845 << rampP.m_vRamp[0] << " "
846 << rampP.m_vRamp[1] << " "
847 << rampP.m_vRamp[2] << " " );
848 }
849 else {
850 ATH_MSG_DEBUG ("New : isEmpty " );
851 }
852 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
853 << coolChannel << " "
854 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
855 << m_rampCorrections[i].m_gain << " "
856 << m_rampCorrections[i].m_vRamp[0] << " "
857 << m_rampCorrections[i].m_vRamp[1] << " "
858 << m_rampCorrections[i].m_vRamp[2] << " "
859 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
860 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
861
862 ATH_MSG_ERROR ("After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
863 error = true;
864 }
865 }
866 }
867
868
869 /*
870 log << MSG::DEBUG <<"Find each correction "
871 << endmsg;
872
873 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
874 HWIdentifier id = m_rampCorrections[i].m_channelID;
875 unsigned int gain = m_rampCorrections[i].m_gain;
876
877 ConstCorrectionIt it = ramps->findCorrection(id, gain);
878 // May not have any corrections
879 if (it != ramps->correctionsEnd(gain)) {
880
881 unsigned int coolChannel = ramps->coolChannel(id, gain);
882 HWIdentifier id1((*it).first);
883 LArRampComplete::LArCondObj rampP = (*it).second;
884 if (id != id1 || rampP != m_rampCorrections[i]) {
885 log << MSG::ERROR <<"Correction retrieved with findCorrection does not match: "
886 << " i = " << i << endmsg;
887 error = true;
888 log << MSG::DEBUG <<"New : 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 << rampP.m_vRamp[0] << " "
893 << rampP.m_vRamp[1] << " "
894 << rampP.m_vRamp[2] << " "
895 << endmsg;
896 log << MSG::DEBUG <<"Corrections: cool chan, chan id, gain, ramps "
897 << coolChannel << " "
898 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
899 << m_rampCorrections[i].m_gain << " "
900 << m_rampCorrections[i].m_vRamp[0] << " "
901 << m_rampCorrections[i].m_vRamp[1] << " "
902 << m_rampCorrections[i].m_vRamp[2] << " "
903 << " Compare = " << (rampP == m_rampCorrections[i])
904 << endmsg;
905 }
906 }
907 else {
908 log << MSG::DEBUG <<"No corrections found "
909 << endmsg;
910 }
911 }
912 log << MSG::DEBUG <<"End - Find each correction "
913 << endmsg;
914
915
916 // Count the number of corrections per gain
917 unsigned int gains[3] = {0,0,0};
918 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
919 unsigned int gain = m_rampCorrections[i].m_gain;
920 gains[gain]++;
921 }
922 for (unsigned int i = 0; i < 3; ++i) {
923 if (gains[i] != ramps->correctionsSize(i)) {
924 log << MSG::ERROR <<"Number of corrections not same as number inserted: "
925 << gains[i] << " "
926 << ramps->correctionsSize(i) << " gain " << i
927 << endmsg;
928 error = true;
929 }
930
931 // Check that each correction is the same using container iterator
932 unsigned int nit = 0;
933 ConstCorrectionIt it = ramps->correctionsBegin(i);
934 ConstCorrectionIt end = ramps->correctionsEnd(i);
935 unsigned int icorr = 0;
936 for (; it != end && icorr < m_rampCorrections.size(); ++it, ++nit, ++icorr) {
937 while (m_rampCorrections[icorr].m_gain != i) ++icorr;
938 HWIdentifier id = m_rampCorrections[icorr].m_channelID;
939 unsigned int gain = m_rampCorrections[icorr].m_gain;
940 unsigned int coolChannel = ramps->coolChannel(id, gain);
941 HWIdentifier id1((*it).first);
942 LArRampComplete::LArCondObj rampP = (*it).second;
943 if (id != id1 || rampP != m_rampCorrections[icorr]) {
944 log << MSG::ERROR <<"Correction retrieved with iterator does not match: "
945 << " gain = " << i
946 << " icorr = " << icorr
947 << " nit = " << nit
948 << endmsg;
949 error = true;
950 log << MSG::DEBUG <<"New : cool chan, chan id, gain, ramps "
951 << coolChannel << " "
952 << m_onlineID->show_to_string(m_rampCorrections[icorr].m_channelID) << " "
953 << m_rampCorrections[icorr].m_gain << " "
954 << rampP.m_vRamp[0] << " "
955 << rampP.m_vRamp[1] << " "
956 << rampP.m_vRamp[2] << " "
957 << endmsg;
958 log << MSG::DEBUG <<"Corrections: cool chan, chan id, gain, ramps "
959 << coolChannel << " "
960 << m_onlineID->show_to_string(m_rampCorrections[icorr].m_channelID) << " "
961 << m_rampCorrections[icorr].m_gain << " "
962 << m_rampCorrections[icorr].m_vRamp[0] << " "
963 << m_rampCorrections[icorr].m_vRamp[1] << " "
964 << m_rampCorrections[icorr].m_vRamp[2] << " "
965 << " Compare = " << (rampP == m_rampCorrections[icorr])
966 << endmsg;
967 }
968 }
969 }
970
971 removed.
972 */
973
974 ATH_MSG_DEBUG ("Number of channels, iovs "
975 << ramps->chan_size() << " " << ramps->iov_size() );
976
977 std::set<unsigned int> channelNumbers;
978 CONTAINER::chan_const_iterator chanIt = ramps->chan_begin();
979 CONTAINER::chan_const_iterator endChan = ramps->chan_end ();
980 for (unsigned int i = 0; chanIt != endChan; ++chanIt, ++i) {
981 const CONTAINER::Subset* subset = ramps->at(i);
982 ATH_MSG_DEBUG ( "Index " << i
983 << " channel " << subset->channel()
984 << " gain " << subset->gain()
985 << " groupingType " << subset->groupingType()
986 << " subsetSize " << subset->subsetSize()
987 << " correctionVecSize " << subset->correctionVecSize() );
988 if ((*chanIt) != subset->channel()) {
989 ATH_MSG_ERROR ( "Channel numbers not the same for MultChanColl and subset: "
990 << i
991 << " multchan " << (*chanIt)
992 << " subset " << subset->channel() );
993 error = true;
994 }
995 if (!(channelNumbers.insert(subset->channel()).second)) {
996 ATH_MSG_ERROR ( "Duplicate channel number - Index " << i
997 << " channel " << subset->channel() );
998 error = true;
999 }
1000 }
1001 ATH_MSG_DEBUG ( "Channel numbers size " << channelNumbers.size()
1002 << " ramps size " << ramps->chan_size() );
1003
1004 if (error) {
1005 ATH_MSG_ERROR ("Failing check of LArRamp - see above" );
1006 return (StatusCode::FAILURE);
1007 }
1008
1009 ATH_MSG_DEBUG ( "End of testEachCondObject " );
1010 return StatusCode::SUCCESS;
1011}
#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 185 of file LArConditionsTestAlg.cxx.

186{
187 // Comparison of two LArRampComplete::LArCondObj objects
188 if (r1.m_vRamp.size() != r2.m_vRamp.size()) return (false);
189 for (unsigned int i = 0; i < r1.m_vRamp.size(); ++i) {
190 if (r1.m_vRamp[i] != -r2.m_vRamp[i]) return (false);
191 }
192 return (true);
193}

◆ operator!=()

Definition at line 197 of file LArConditionsTestAlg.cxx.

198{
199 if(r1 == r2)return (false);
200 return (true);
201}

◆ operator==()

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

Definition at line 173 of file LArConditionsTestAlg.cxx.

174{
175 // Comparison of two LArRampComplete::LArCondObj objects
176 if (r1.m_vRamp.size() != r2.m_vRamp.size()) return (false);
177 for (unsigned int i = 0; i < r1.m_vRamp.size(); ++i) {
178 if (r1.m_vRamp[i] != r2.m_vRamp[i]) return (false);
179 }
180 return (true);
181}