ATLAS Offline Software
Functions
LArConditionsTestAlg.cxx File Reference

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

#include "LArConditionsTest/LArConditionsTestAlg.h"
#include "LArIdentifier/LArOnlineID.h"
#include "CaloIdentifier/CaloCell_ID.h"
#include "LArRawConditions/LArRampMC.h"
#include "LArRawConditions/LArConditionsChannelSet.h"
#include "LArElecCalib/ILArOFC.h"
#include "StoreGate/ReadCondHandle.h"
#include "AthenaKernel/errorcheck.h"
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 467 of file LArConditionsTestAlg.cxx.

468 {
469  ATH_MSG_INFO ("in testEachCondObject()" );
470  bool error = false;
471 
472  typedef LArRampMC::CONTAINER CONTAINER;
473  //typedef CONTAINER::ConstCorrectionIt ConstCorrectionIt;
474 
475  // Cast into r/w for tests
476  LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
477  if (!ramps_rw) {
478  ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
479  return StatusCode::FAILURE;
480  }
481 
482  if (ramps_rw->correctionsApplied())
483  ATH_CHECK(ramps_rw->undoCorrections());
484 
485  if (!m_readCondObjs) {
486  if (m_writeCondObjs) {
487 
488  for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
489  ATH_MSG_DEBUG ("setPdata for chan, chan id, gain " << i << " "
490  << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
491  << m_rampCache[i].m_gain << " " );
492 
493  // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
495  ramp.m_vRamp = m_rampCache[i].m_vRamp;
496 
497  ramps_rw->setPdata(m_rampCache[i].m_channelID,
498  ramp,
499  m_rampCache[i].m_gain);
500  }
501  }
502 
503  ATH_MSG_DEBUG ( "Finished conditions, now write corrections " );
504 
505  if (m_writeCorrections) {
506  for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
507 
508  ATH_MSG_DEBUG ("insert corr for chan, chan id, gain " << i << " "
509  << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
510  << m_rampCorrections[i].m_gain << " " );
511 
512  // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
514  ramp.m_vRamp = m_rampCorrections[i].m_vRamp;
515 
516  ATH_CHECK( ramps_rw->insertCorrection(m_rampCorrections[i].m_channelID,
517  ramp,
518  m_rampCorrections[i].m_gain) );
519  }
520  }
521  }
522 
523  ATH_MSG_DEBUG ("Number of channels, iovs "
524  << ramps->chan_size() << " " << ramps->iov_size() );
525 
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);
530  ATH_MSG_DEBUG ( "Index " << 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: "
538  << i
539  << " multchan " << (*chanIt1)
540  << " subset " << subset->channel() );
541  error = true;
542  }
543  }
544 
545  ATH_MSG_DEBUG ("Number of channels, iovs, subsets "
546  << ramps->chan_size() << " "
547  << ramps->iov_size() << " "
548  << ramps->size() << " " );
549 
550  ATH_MSG_DEBUG ("Compare LArRampMC with cache " );
551  // Now loop over ramps and compare with cache
552  for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
553 
554  LArRampComplete::LArCondObj rampP = ramps->get(m_rampCache[i].m_channelID,
555  m_rampCache[i].m_gain);
556  unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
557  m_rampCache[i].m_gain);
558 
559  if (!rampP.isEmpty()) {
560  ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
561  << coolChannel << " "
562  << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
563  << m_rampCache[i].m_gain << " "
564  << rampP.m_vRamp[0] << " "
565  << rampP.m_vRamp[1] << " "
566  << rampP.m_vRamp[2] << " " );
567  }
568  else {
569  ATH_MSG_DEBUG ("New : isEmpty " );
570  }
571  ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
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()) {
580  ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
581  error = true;
582  }
583  }
584 
585 
586  // Now loop over ramps using generic iterator and compare with cache
587  ATH_MSG_DEBUG ("Compare LArRampMC with cache using iterator " );
588  CONTAINER::ConstConditionsMapIterator rampIt;
589  CONTAINER::ConstConditionsMapIterator rampEnd;
590  for (unsigned int gain = 0; gain < 3; ++gain) {
591  rampIt = ramps->begin(gain);
592  rampEnd = ramps->end (gain);
593  for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
594  // cache is not in order for gains, select the current gain
595  if (gain != m_rampCache[i].m_gain) continue;
597  HWIdentifier rampId;
598  while(rampIt != rampEnd) {
599  rampP = *rampIt;
600  rampId = rampIt.channelId();
601  ++rampIt;
602  if (!rampP.isEmpty()) break; // break out for first non-empty ramp
603  }
604  unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
605  m_rampCache[i].m_gain);
606  if (!rampP.isEmpty()) {
607  ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
608  << coolChannel << " "
609  << m_onlineID->show_to_string(rampId) << " "
610  << m_rampCache[i].m_gain << " "
611  << rampP.m_vRamp[0] << " "
612  << rampP.m_vRamp[1] << " "
613  << rampP.m_vRamp[2] << " " );
614  }
615  else {
616  ATH_MSG_DEBUG ("New : isEmpty " );
617  }
618  ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
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()) {
627  ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
628  error = true;
629  }
630  }
631  }
632 
633 
634 
635  // Now loop over ramps in pieces using the selector on febids to
636  // iterate and compare with cache
637  ATH_MSG_DEBUG ("Compare LArRampMC with cache using iterator and febid selection " );
638  // Loop over cache and divide the febids into three sets, where
639  // each set is an array of size 3 for the separate gains
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);
647  }
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);
651  }
652  else {
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);
655  }
656  }
657 
658  for (unsigned int gain = 0; gain < 3; ++gain) {
659  for (unsigned int febSet = 0; febSet < 3; ++febSet) {
660  unsigned int i0 = 0;
661  unsigned int iend = m_rampCache.size()/3;
662  if (febSet < m_rampCache.size()/3) {
663  rampIt = ramps->begin(gain, ids1[gain]);
664  msg() << MSG::DEBUG <<"FebID vec 1 : ";
665  for (unsigned int i = 0; i < ids1[gain].size(); ++i) {
666  msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids1[gain][i]))
667  << " ";
668  }
669  msg() << MSG::DEBUG << endmsg;
670  }
671  else if (febSet < 2*m_rampCache.size()/3) {
672  rampIt = ramps->begin(gain, ids2[gain]);
673  i0 = m_rampCache.size()/3 + 1;
674  iend = 2*m_rampCache.size()/3;
675  msg() << MSG::DEBUG <<"FebID vec 2 : ";
676  for (unsigned int i = 0; i < ids2[gain].size(); ++i) {
677  msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids2[gain][i]))
678  << " ";
679  }
680  msg() << MSG::DEBUG << endmsg;
681  }
682  else {
683  rampIt = ramps->begin(gain, ids3[gain]);
684  i0 = 2*m_rampCache.size()/3 + 1;
685  iend = m_rampCache.size();
686  msg() << MSG::DEBUG <<"FebID vec 3 : ";
687  for (unsigned int i = 0; i < ids3[gain].size(); ++i) {
688  msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids3[gain][i]))
689  << " ";
690  }
691  msg() << MSG::DEBUG << endmsg;
692  }
693 
694  rampEnd = ramps->end (gain);
695  ATH_MSG_DEBUG ("After ramps->end " );
696  for (unsigned int i = i0; i < iend; ++i) {
697  // cache is not in order for gains, select the current gain
698  if (gain != m_rampCache[i].m_gain) continue;
700  HWIdentifier rampId;
701 
702  ATH_MSG_DEBUG ("Looking for "
703  << m_onlineID->show_to_string(m_rampCache[i].m_channelID) );
704 
705  // Skip the empty channels
706  while(rampIt != rampEnd) {
707  rampP = *rampIt;
708  rampId = rampIt.channelId();
709  ++rampIt;
710  if (!rampP.isEmpty()) break; // break out for first non-empty ramp
711  }
712  unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
713  m_rampCache[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(rampId) << " "
718  << m_rampCache[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  ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
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()) {
735  ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
736  error = true;
737  }
738  }
739  }
740  }
741 
742  ATH_MSG_DEBUG ("Compare LArRampMC with corrections " );
743 
744  if (m_applyCorrections) {
745  for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
746  LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
747  m_rampCorrections[i].m_gain);
748  unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
749  m_rampCorrections[i].m_gain);
750  if (!rampP.isEmpty()) {
751  ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
752  << coolChannel << " "
753  << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
754  << m_rampCorrections[i].m_gain << " "
755  << rampP.m_vRamp[0] << " "
756  << rampP.m_vRamp[1] << " "
757  << rampP.m_vRamp[2] << " " );
758  }
759  else {
760  ATH_MSG_DEBUG ("New : isEmpty " );
761  }
762 
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] << " "
770  << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
771  if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
772 
773  ATH_MSG_ERROR ("Before correction: LArRampMC and correction DO NOT compare - should have opposite signs for rampes" );
774  error = true;
775  }
776  }
777 
778 
779  ATH_MSG_DEBUG ("Apply corrections and compare LArRampMC with corrections " );
780  ATH_CHECK( ramps_rw->applyCorrections() );
781  ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
782 
783  for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
784  LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
785  m_rampCorrections[i].m_gain);
786  unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
787  m_rampCorrections[i].m_gain);
788  if (!rampP.isEmpty()) {
789  ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
790  << coolChannel << " "
791  << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
792  << m_rampCorrections[i].m_gain << " "
793  << rampP.m_vRamp[0] << " "
794  << rampP.m_vRamp[1] << " "
795  << rampP.m_vRamp[2] << " " );
796  }
797  else {
798  ATH_MSG_DEBUG ("New : isEmpty " );
799  }
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" );
810  error = true;
811  }
812  }
813 
814  ATH_MSG_DEBUG ("Undo corrections and compare LArRampMC with corrections " );
815  ATH_CHECK( ramps_rw->undoCorrections() );
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 = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
843  if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
844 
845  ATH_MSG_ERROR ("After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
846  error = true;
847  }
848  }
849 
850  ATH_MSG_DEBUG ("2nd Apply corrections and compare LArRampMC with corrections " );
851  ATH_CHECK( ramps_rw->applyCorrections() );
852  ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
853 
854  for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
855  LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
856  m_rampCorrections[i].m_gain);
857  unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
858  m_rampCorrections[i].m_gain);
859  if (!rampP.isEmpty()) {
860  ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
861  << coolChannel << " "
862  << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
863  << m_rampCorrections[i].m_gain << " "
864  << rampP.m_vRamp[0] << " "
865  << rampP.m_vRamp[1] << " "
866  << rampP.m_vRamp[2] << " " );
867  }
868  else {
869  ATH_MSG_DEBUG ("New : isEmpty " );
870  }
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" );
881  error = true;
882  }
883  }
884 
885  ATH_MSG_DEBUG ("2nd Undo corrections and compare LArRampMC with corrections " );
886  ATH_CHECK( ramps_rw->undoCorrections() );
887  ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
888 
889  for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
890  LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
891  m_rampCorrections[i].m_gain);
892  unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
893  m_rampCorrections[i].m_gain);
894  if (!rampP.isEmpty()) {
895  ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
896  << coolChannel << " "
897  << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
898  << m_rampCorrections[i].m_gain << " "
899  << rampP.m_vRamp[0] << " "
900  << rampP.m_vRamp[1] << " "
901  << rampP.m_vRamp[2] << " " );
902  }
903  else {
904  ATH_MSG_DEBUG ("New : isEmpty " );
905  }
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] << " "
913  << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
914  if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
915 
916  ATH_MSG_ERROR ("After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
917  error = true;
918  }
919  }
920  }
921 
922 
923  /*
924  log << MSG::DEBUG <<"Find each correction "
925  << endmsg;
926 
927  for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
928  HWIdentifier id = m_rampCorrections[i].m_channelID;
929  unsigned int gain = m_rampCorrections[i].m_gain;
930 
931  ConstCorrectionIt it = ramps->findCorrection(id, gain);
932  // May not have any corrections
933  if (it != ramps->correctionsEnd(gain)) {
934 
935  unsigned int coolChannel = ramps->coolChannel(id, gain);
936  HWIdentifier id1((*it).first);
937  LArRampComplete::LArCondObj rampP = (*it).second;
938  if (id != id1 || rampP != m_rampCorrections[i]) {
939  log << MSG::ERROR <<"Correction retrieved with findCorrection does not match: "
940  << " i = " << i << endmsg;
941  error = true;
942  log << MSG::DEBUG <<"New : cool chan, chan id, gain, ramps "
943  << coolChannel << " "
944  << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
945  << m_rampCorrections[i].m_gain << " "
946  << rampP.m_vRamp[0] << " "
947  << rampP.m_vRamp[1] << " "
948  << rampP.m_vRamp[2] << " "
949  << endmsg;
950  log << MSG::DEBUG <<"Corrections: cool chan, chan id, gain, ramps "
951  << coolChannel << " "
952  << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
953  << m_rampCorrections[i].m_gain << " "
954  << m_rampCorrections[i].m_vRamp[0] << " "
955  << m_rampCorrections[i].m_vRamp[1] << " "
956  << m_rampCorrections[i].m_vRamp[2] << " "
957  << " Compare = " << (rampP == m_rampCorrections[i])
958  << endmsg;
959  }
960  }
961  else {
962  log << MSG::DEBUG <<"No corrections found "
963  << endmsg;
964  }
965  }
966  log << MSG::DEBUG <<"End - Find each correction "
967  << endmsg;
968 
969 
970  // Count the number of corrections per gain
971  unsigned int gains[3] = {0,0,0};
972  for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
973  unsigned int gain = m_rampCorrections[i].m_gain;
974  gains[gain]++;
975  }
976  for (unsigned int i = 0; i < 3; ++i) {
977  if (gains[i] != ramps->correctionsSize(i)) {
978  log << MSG::ERROR <<"Number of corrections not same as number inserted: "
979  << gains[i] << " "
980  << ramps->correctionsSize(i) << " gain " << i
981  << endmsg;
982  error = true;
983  }
984 
985  // Check that each correction is the same using container iterator
986  unsigned int nit = 0;
987  ConstCorrectionIt it = ramps->correctionsBegin(i);
988  ConstCorrectionIt end = ramps->correctionsEnd(i);
989  unsigned int icorr = 0;
990  for (; it != end && icorr < m_rampCorrections.size(); ++it, ++nit, ++icorr) {
991  while (m_rampCorrections[icorr].m_gain != i) ++icorr;
992  HWIdentifier id = m_rampCorrections[icorr].m_channelID;
993  unsigned int gain = m_rampCorrections[icorr].m_gain;
994  unsigned int coolChannel = ramps->coolChannel(id, gain);
995  HWIdentifier id1((*it).first);
996  LArRampComplete::LArCondObj rampP = (*it).second;
997  if (id != id1 || rampP != m_rampCorrections[icorr]) {
998  log << MSG::ERROR <<"Correction retrieved with iterator does not match: "
999  << " gain = " << i
1000  << " icorr = " << icorr
1001  << " nit = " << nit
1002  << endmsg;
1003  error = true;
1004  log << MSG::DEBUG <<"New : cool chan, chan id, gain, ramps "
1005  << coolChannel << " "
1006  << m_onlineID->show_to_string(m_rampCorrections[icorr].m_channelID) << " "
1007  << m_rampCorrections[icorr].m_gain << " "
1008  << rampP.m_vRamp[0] << " "
1009  << rampP.m_vRamp[1] << " "
1010  << rampP.m_vRamp[2] << " "
1011  << endmsg;
1012  log << MSG::DEBUG <<"Corrections: cool chan, chan id, gain, ramps "
1013  << coolChannel << " "
1014  << m_onlineID->show_to_string(m_rampCorrections[icorr].m_channelID) << " "
1015  << m_rampCorrections[icorr].m_gain << " "
1016  << m_rampCorrections[icorr].m_vRamp[0] << " "
1017  << m_rampCorrections[icorr].m_vRamp[1] << " "
1018  << m_rampCorrections[icorr].m_vRamp[2] << " "
1019  << " Compare = " << (rampP == m_rampCorrections[icorr])
1020  << endmsg;
1021  }
1022  }
1023  }
1024 
1025  removed.
1026  */
1027 
1028  ATH_MSG_DEBUG ("Number of channels, iovs "
1029  << ramps->chan_size() << " " << ramps->iov_size() );
1030 
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);
1036  ATH_MSG_DEBUG ( "Index " << 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: "
1044  << i
1045  << " multchan " << (*chanIt)
1046  << " subset " << subset->channel() );
1047  error = true;
1048  }
1049  if (!(channelNumbers.insert(subset->channel()).second)) {
1050  ATH_MSG_ERROR ( "Duplicate channel number - Index " << i
1051  << " channel " << subset->channel() );
1052  error = true;
1053  }
1054  }
1055  ATH_MSG_DEBUG ( "Channel numbers size " << channelNumbers.size()
1056  << " ramps size " << ramps->chan_size() );
1057 
1058  if (error) {
1059  ATH_MSG_ERROR ("Failing check of LArRamp - see above" );
1060  return (StatusCode::FAILURE);
1061  }
1062 
1063  ATH_MSG_DEBUG ( "End of testEachCondObject " );
1064  return StatusCode::SUCCESS;
1065 }

◆ CorrectionCompare()

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

Definition at line 239 of file LArConditionsTestAlg.cxx.

240 {
241  // Comparison of two LArRampComplete::LArCondObj objects
242  if (r1.m_vRamp.size() != r2.m_vRamp.size()) return (false);
243  for (unsigned int i = 0; i < r1.m_vRamp.size(); ++i) {
244  if (r1.m_vRamp[i] != -r2.m_vRamp[i]) return (false);
245  }
246  return (true);
247 }

◆ operator!=()

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

Definition at line 251 of file LArConditionsTestAlg.cxx.

252 {
253  if(r1 == r2)return (false);
254  return (true);
255 }

◆ operator==()

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

Definition at line 227 of file LArConditionsTestAlg.cxx.

228 {
229  // Comparison of two LArRampComplete::LArCondObj objects
230  if (r1.m_vRamp.size() != r2.m_vRamp.size()) return (false);
231  for (unsigned int i = 0; i < r1.m_vRamp.size(); ++i) {
232  if (r1.m_vRamp[i] != r2.m_vRamp[i]) return (false);
233  }
234  return (true);
235 }
LArConditionsContainer::applyCorrections
StatusCode applyCorrections()
apply correction set
LArConditionsContainer::setPdata
void setPdata(const HWIdentifier id, const T &payload, unsigned int gain=0)
put payload in persistent data
LArRampP1::isEmpty
bool isEmpty() const
Definition: LArRampP1.h:29
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArRampMC
Implementation of the interface ILArRamp for MC Derives from LArRampComplete, and implements the phi-...
Definition: LArRampMC.h:22
LArConditionsContainer::undoCorrections
StatusCode undoCorrections()
undo corrections that have been already applied
LArConditionsContainer::chan_begin
chan_const_iterator chan_begin() const
Access to Channel numbers via iterators - from MultChanCollection.
LArRampP1
Persistent data for LArRamp Copied from LAr.
Definition: LArRampP1.h:24
LArConditionsContainer::insertCorrection
StatusCode insertCorrection(HWIdentifier id, const T &cond, unsigned int gain, bool corrChannel=true)
access to corrections -
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
MCP::ScaleSmearParam::r2
@ r2
HWIdentifier
Definition: HWIdentifier.h:13
LArRampP1::m_vRamp
std::vector< float > m_vRamp
Definition: LArRampP1.h:30
LArConditionsContainer::coolChannel
unsigned int coolChannel(const HWIdentifier id, unsigned int gain=0) const
Return the COOL channel number for a given online id and gain.
LArConditionsContainer< LArRampP1 >
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArConditionsContainer::end
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArConditionsContainer::get
ConstReference get(const HWIdentifier id, unsigned int gain=0) const
get data with online identifier
LArConditionsContainer::iov_size
iov_size_type iov_size() const
number of IOVs - from MultChanCollection
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArConditionsContainer::chan_end
chan_const_iterator chan_end() const
LArConditionsContainer::chan_size
chan_size_type chan_size() const
number of channels - from MultChanCollection
DEBUG
#define DEBUG
Definition: page_access.h:11
LArConditionsContainer::begin
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
MCP::ScaleSmearParam::r1
@ r1
error
Definition: IImpactPoint3dEstimator.h:70
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
CorrectionCompare
bool CorrectionCompare(const LArRampComplete::LArCondObj &r1, const LArRampPTmp &r2)
Definition: LArConditionsTestAlg.cxx:239
LArConditionsContainer::correctionsApplied
bool correctionsApplied() const
Have corrections been applied?