Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 449 of file LArConditionsTestAlg.cxx.

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

◆ CorrectionCompare()

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

Definition at line 221 of file LArConditionsTestAlg.cxx.

222 {
223  // Comparison of two LArRampComplete::LArCondObj objects
224  if (r1.m_vRamp.size() != r2.m_vRamp.size()) return (false);
225  for (unsigned int i = 0; i < r1.m_vRamp.size(); ++i) {
226  if (r1.m_vRamp[i] != -r2.m_vRamp[i]) return (false);
227  }
228  return (true);
229 }

◆ operator!=()

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

Definition at line 233 of file LArConditionsTestAlg.cxx.

234 {
235  if(r1 == r2)return (false);
236  return (true);
237 }

◆ operator==()

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

Definition at line 209 of file LArConditionsTestAlg.cxx.

210 {
211  // Comparison of two LArRampComplete::LArCondObj objects
212  if (r1.m_vRamp.size() != r2.m_vRamp.size()) return (false);
213  for (unsigned int i = 0; i < r1.m_vRamp.size(); ++i) {
214  if (r1.m_vRamp[i] != r2.m_vRamp[i]) return (false);
215  }
216  return (true);
217 }
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:221
LArConditionsContainer::correctionsApplied
bool correctionsApplied() const
Have corrections been applied?