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

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