64 return StatusCode::SUCCESS;
73 ATH_MSG_DEBUG (
" retrieve DataHandle<ILArRamp> in execute " );
106 return StatusCode::SUCCESS;
119 return StatusCode::SUCCESS;
139 for (; chanIt != chanEnd; ++chanIt, ++
ichan) {
141 if (
ichan % 1000 != 5)
continue;
160 if (icorr % 10 != 5)
continue;
186 return StatusCode::SUCCESS;
194 if (r1.m_vRamp.size() != r2.m_vRamp.size())
return (
false);
195 for (
unsigned int i = 0;
i < r1.m_vRamp.size(); ++
i) {
196 if (r1.m_vRamp[
i] != r2.m_vRamp[
i])
return (
false);
206 if (r1.m_vRamp.size() != r2.m_vRamp.size())
return (
false);
207 for (
unsigned int i = 0;
i < r1.m_vRamp.size(); ++
i) {
208 if (r1.m_vRamp[
i] != -r2.m_vRamp[
i])
return (
false);
217 if(r1 == r2)
return (
false);
229 static std::atomic<bool>
first =
true;
232 return StatusCode::SUCCESS;
237 typedef CONTAINER::chan_const_iterator chan_const_iterator;
238 typedef CONTAINER::iov_const_iterator iov_const_iterator;
249 ATH_MSG_INFO (
"Retrieved ramps for LArRampsSingleGroup " );
250 ramps =
dynamic_cast<const LArRampMC*
>(iramps);
252 ATH_MSG_ERROR (
"Could not dynamic cast ILArRamp to LArRampMC" );
253 return( StatusCode::FAILURE);
259 ATH_MSG_INFO (
"Created ramps for LArRampsSingleGroup " );
269 ATH_CHECK(
detStore()->record(ramps,
"/LArCalorimeter/LArTests/LArRampsSingleGroup") );
283 return StatusCode::FAILURE;
298 ATH_MSG_INFO (
"Retrieved ramps for LArRampsSubDetectorGrouping " );
299 ramps =
dynamic_cast<const LArRampMC*
>(iramps);
301 ATH_MSG_ERROR (
"Could not dynamic cast ILArRamp to LArRampMC" );
302 return( StatusCode::FAILURE);
317 ATH_CHECK(
detStore()->record(ramps,
"/LArCalorimeter/LArTests/LArRampsSubDetectorGrouping") );
330 return StatusCode::FAILURE;
345 ATH_MSG_INFO (
"Retrieved ramps for LArRampsFeedThroughGrouping " );
346 ramps =
dynamic_cast<const LArRampMC*
>(iramps);
348 ATH_MSG_ERROR (
"Could not dynamic cast ILArRamp to LArRampMC" );
349 return( StatusCode::FAILURE);
364 ATH_CHECK(
detStore()->record(ramps,
"/LArCalorimeter/LArTests/LArRampsFeedThroughGrouping") );
377 return StatusCode::FAILURE;
388 ATH_MSG_DEBUG (
"Statistics for LArRampsFeedThroughGrouping " );
392 iov_const_iterator iovIt = ramps->
iov_begin();
393 iov_const_iterator iovEnd = ramps->
iov_end ();
395 for (; iovIt != iovEnd; ++iovIt) {
400 chan_const_iterator chIt = ramps->
chan_begin();
401 chan_const_iterator chEnd = ramps->
chan_end ();
402 for (; chIt != chEnd; ++chIt) {
407 for (
unsigned int i = 0;
i < ramps->
nGroups(); ++
i) {
413 for (
unsigned int i = 0;
i < ramps->
nGains(); ++
i) {
425 return StatusCode::SUCCESS;
443 return StatusCode::FAILURE;
449 if (!m_readCondObjs) {
450 if (m_writeCondObjs) {
452 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
454 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
455 << m_rampCache[
i].m_gain <<
" " );
459 ramp.
m_vRamp = m_rampCache[
i].m_vRamp;
461 ramps_rw->
setPdata(m_rampCache[
i].m_channelID,
463 m_rampCache[
i].m_gain);
467 ATH_MSG_DEBUG (
"Finished conditions, now write corrections " );
469 if (m_writeCorrections) {
470 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
473 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
474 << m_rampCorrections[
i].m_gain <<
" " );
478 ramp.
m_vRamp = m_rampCorrections[
i].m_vRamp;
482 m_rampCorrections[
i].m_gain) );
490 CONTAINER::chan_const_iterator chanIt1 = ramps->
chan_begin();
491 CONTAINER::chan_const_iterator endChan1 = ramps->
chan_end ();
492 for (
unsigned int i = 0; chanIt1 != endChan1; ++chanIt1, ++
i) {
493 const CONTAINER::Subset* subset = ramps->at(
i);
495 <<
" channel " << subset->channel()
496 <<
" gain " << subset->gain()
497 <<
" groupingType " << subset->groupingType()
498 <<
" subsetSize " << subset->subsetSize()
499 <<
" correctionVecSize " << subset->correctionVecSize() );
500 if ((*chanIt1) != subset->channel()) {
501 ATH_MSG_ERROR (
"Channel numbers not the same for MultChanColl and subset: "
503 <<
" multchan " << (*chanIt1)
504 <<
" subset " << subset->channel() );
512 << ramps->size() <<
" " );
516 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
519 m_rampCache[
i].m_gain);
520 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
521 m_rampCache[
i].m_gain);
525 << coolChannel <<
" "
526 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
527 << m_rampCache[
i].m_gain <<
" "
536 << coolChannel <<
" "
537 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
538 << m_rampCache[
i].m_gain <<
" "
539 << m_rampCache[
i].m_vRamp[0] <<
" "
540 << m_rampCache[
i].m_vRamp[1] <<
" "
541 << m_rampCache[
i].m_vRamp[2] <<
" "
542 <<
" Compare = " << (rampP == m_rampCache[
i]) );
543 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
551 ATH_MSG_DEBUG (
"Compare LArRampMC with cache using iterator " );
552 CONTAINER::ConstConditionsMapIterator rampIt;
553 CONTAINER::ConstConditionsMapIterator rampEnd;
557 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
559 if (
gain != m_rampCache[
i].m_gain)
continue;
562 while(rampIt != rampEnd) {
564 rampId = rampIt.channelId();
568 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
569 m_rampCache[
i].m_gain);
572 << coolChannel <<
" "
573 << m_onlineID->show_to_string(rampId) <<
" "
574 << m_rampCache[
i].m_gain <<
" "
583 << coolChannel <<
" "
584 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
585 << m_rampCache[
i].m_gain <<
" "
586 << m_rampCache[
i].m_vRamp[0] <<
" "
587 << m_rampCache[
i].m_vRamp[1] <<
" "
588 << m_rampCache[
i].m_vRamp[2] <<
" "
589 <<
" Compare = " << (rampP == m_rampCache[
i]) );
590 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
601 ATH_MSG_DEBUG (
"Compare LArRampMC with cache using iterator and febid selection " );
604 std::vector<unsigned int> ids1[3];
605 std::vector<unsigned int> ids2[3];
606 std::vector<unsigned int> ids3[3];
607 for (
unsigned int i = 0;
i < m_rampCache.size(); ++
i) {
608 if (
i < m_rampCache.size()/3) {
609 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
610 ids1[m_rampCache[
i].m_gain].push_back(
id);
612 else if (
i < 2*m_rampCache.size()/3) {
613 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
614 ids2[m_rampCache[
i].m_gain].push_back(
id);
617 unsigned int id = m_onlineID->feb_Id(m_rampCache[
i].m_channelID).get_identifier32().get_compact();
618 ids3[m_rampCache[
i].m_gain].push_back(
id);
623 for (
unsigned int febSet = 0; febSet < 3; ++febSet) {
625 unsigned int iend = m_rampCache.size()/3;
626 if (febSet < m_rampCache.size()/3) {
629 for (
unsigned int i = 0;
i < ids1[
gain].size(); ++
i) {
635 else if (febSet < 2*m_rampCache.size()/3) {
637 i0 = m_rampCache.size()/3 + 1;
638 iend = 2*m_rampCache.size()/3;
640 for (
unsigned int i = 0;
i < ids2[
gain].size(); ++
i) {
648 i0 = 2*m_rampCache.size()/3 + 1;
649 iend = m_rampCache.size();
651 for (
unsigned int i = 0;
i < ids3[
gain].size(); ++
i) {
660 for (
unsigned int i = i0;
i < iend; ++
i) {
662 if (
gain != m_rampCache[
i].m_gain)
continue;
667 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) );
670 while(rampIt != rampEnd) {
672 rampId = rampIt.channelId();
676 unsigned int coolChannel = ramps->
coolChannel(m_rampCache[
i].m_channelID,
677 m_rampCache[
i].m_gain);
680 << coolChannel <<
" "
681 << m_onlineID->show_to_string(rampId) <<
" "
682 << m_rampCache[
i].m_gain <<
" "
691 << coolChannel <<
" "
692 << m_onlineID->show_to_string(m_rampCache[
i].m_channelID) <<
" "
693 << m_rampCache[
i].m_gain <<
" "
694 << m_rampCache[
i].m_vRamp[0] <<
" "
695 << m_rampCache[
i].m_vRamp[1] <<
" "
696 << m_rampCache[
i].m_vRamp[2] <<
" "
697 <<
" Compare = " << (rampP == m_rampCache[
i]) );
698 if (rampP != m_rampCache[
i] && !rampP.
isEmpty()) {
708 if (m_applyCorrections) {
709 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
711 m_rampCorrections[
i].m_gain);
712 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
713 m_rampCorrections[
i].m_gain);
716 << coolChannel <<
" "
717 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
718 << m_rampCorrections[
i].m_gain <<
" "
727 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
728 << coolChannel <<
" "
729 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
730 << m_rampCorrections[
i].m_gain <<
" "
731 << m_rampCorrections[
i].m_vRamp[0] <<
" "
732 << m_rampCorrections[
i].m_vRamp[1] <<
" "
733 << m_rampCorrections[
i].m_vRamp[2] <<
" "
737 ATH_MSG_ERROR (
"Before correction: LArRampMC and correction DO NOT compare - should have opposite signs for rampes" );
743 ATH_MSG_DEBUG (
"Apply corrections and compare LArRampMC with corrections " );
747 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
749 m_rampCorrections[
i].m_gain);
750 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
751 m_rampCorrections[
i].m_gain);
754 << coolChannel <<
" "
755 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
756 << m_rampCorrections[
i].m_gain <<
" "
764 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
765 << coolChannel <<
" "
766 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
767 << m_rampCorrections[
i].m_gain <<
" "
768 << m_rampCorrections[
i].m_vRamp[0] <<
" "
769 << m_rampCorrections[
i].m_vRamp[1] <<
" "
770 << m_rampCorrections[
i].m_vRamp[2] <<
" "
771 <<
" Compare = " << (rampP == m_rampCorrections[
i]) );
772 if (rampP != m_rampCorrections[
i] && !rampP.
isEmpty()) {
773 ATH_MSG_ERROR (
"After correction: LArRampMC and correction NOT equal" );
778 ATH_MSG_DEBUG (
"Undo corrections and compare LArRampMC with corrections " );
782 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
784 m_rampCorrections[
i].m_gain);
785 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
786 m_rampCorrections[
i].m_gain);
789 << coolChannel <<
" "
790 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
791 << m_rampCorrections[
i].m_gain <<
" "
799 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
800 << coolChannel <<
" "
801 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
802 << m_rampCorrections[
i].m_gain <<
" "
803 << m_rampCorrections[
i].m_vRamp[0] <<
" "
804 << m_rampCorrections[
i].m_vRamp[1] <<
" "
805 << m_rampCorrections[
i].m_vRamp[2] <<
" "
809 ATH_MSG_ERROR (
"After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
814 ATH_MSG_DEBUG (
"2nd Apply corrections and compare LArRampMC with corrections " );
818 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
820 m_rampCorrections[
i].m_gain);
821 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
822 m_rampCorrections[
i].m_gain);
825 << coolChannel <<
" "
826 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
827 << m_rampCorrections[
i].m_gain <<
" "
835 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
836 << coolChannel <<
" "
837 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
838 << m_rampCorrections[
i].m_gain <<
" "
839 << m_rampCorrections[
i].m_vRamp[0] <<
" "
840 << m_rampCorrections[
i].m_vRamp[1] <<
" "
841 << m_rampCorrections[
i].m_vRamp[2] <<
" "
842 <<
" Compare = " << (rampP == m_rampCorrections[
i]) );
843 if (rampP != m_rampCorrections[
i] && !rampP.
isEmpty()) {
844 ATH_MSG_ERROR (
"After correction: LArRampMC and correction NOT equal" );
849 ATH_MSG_DEBUG (
"2nd Undo corrections and compare LArRampMC with corrections " );
853 for (
unsigned int i = 0;
i < m_rampCorrections.size(); ++
i) {
855 m_rampCorrections[
i].m_gain);
856 unsigned int coolChannel = ramps->
coolChannel(m_rampCorrections[
i].m_channelID,
857 m_rampCorrections[
i].m_gain);
860 << coolChannel <<
" "
861 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
862 << m_rampCorrections[
i].m_gain <<
" "
870 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
871 << coolChannel <<
" "
872 << m_onlineID->show_to_string(m_rampCorrections[
i].m_channelID) <<
" "
873 << m_rampCorrections[
i].m_gain <<
" "
874 << m_rampCorrections[
i].m_vRamp[0] <<
" "
875 << m_rampCorrections[
i].m_vRamp[1] <<
" "
876 << m_rampCorrections[
i].m_vRamp[2] <<
" "
880 ATH_MSG_ERROR (
"After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
995 std::set<unsigned int> channelNumbers;
996 CONTAINER::chan_const_iterator chanIt = ramps->
chan_begin();
997 CONTAINER::chan_const_iterator endChan = ramps->
chan_end ();
998 for (
unsigned int i = 0; chanIt != endChan; ++chanIt, ++
i) {
999 const CONTAINER::Subset* subset = ramps->at(
i);
1001 <<
" channel " << subset->channel()
1002 <<
" gain " << subset->gain()
1003 <<
" groupingType " << subset->groupingType()
1004 <<
" subsetSize " << subset->subsetSize()
1005 <<
" correctionVecSize " << subset->correctionVecSize() );
1006 if ((*chanIt) != subset->channel()) {
1007 ATH_MSG_ERROR (
"Channel numbers not the same for MultChanColl and subset: "
1009 <<
" multchan " << (*chanIt)
1010 <<
" subset " << subset->channel() );
1013 if (!(channelNumbers.insert(subset->channel()).second)) {
1015 <<
" channel " << subset->channel() );
1019 ATH_MSG_DEBUG (
"Channel numbers size " << channelNumbers.size()
1020 <<
" ramps size " << ramps->
chan_size() );
1024 return (StatusCode::FAILURE);
1028 return StatusCode::SUCCESS;
1038 typedef ChanSet::ConstChannelIt ConstChannelIt;
1051 chanSet.insert(
m_rampCorrections[
i].m_channelID.get_identifier32().get_compact(), ramp);
1056 ATH_MSG_ERROR (
"Corrections not the same size as channel set: "
1058 return (StatusCode::FAILURE);
1064 ConstChannelIt
it = chanSet.begin();
1065 ConstChannelIt itEnd = chanSet.end();
1069 for (;
it != itEnd; ++
it, ++
i) {
1075 ATH_MSG_ERROR (
"Correction retrieved with iterator does not match: "
1103 it = chanSet.find(
id);
1108 ATH_MSG_DEBUG (
"Corrections: cool chan, chan id, gain, ramps "
1122 ATH_MSG_ERROR (
"Failing check of channel set - see above" );
1123 return (StatusCode::FAILURE);
1127 return StatusCode::SUCCESS;
1136 typedef CONTAINER::Subset Subset;
1147 CONTAINER::chan_const_iterator chanIt = ramp->
chan_begin();
1148 CONTAINER::chan_const_iterator endChan = ramp->
chan_end ();
1149 for (
unsigned int i = 0; chanIt != endChan; ++chanIt, ++
i) {
1150 unsigned int coolChan = *chanIt;
1151 const Subset* subset = ramp->at(
i);
1154 <<
" Subset size " << subset->subsetSize()
1155 <<
" gain, channel, grouping type " << subset->gain() <<
" "
1156 << MSG::hex << subset->channel() <<
" " << MSG::dec
1157 << subset->groupingType() <<
" "
1160 Subset::ConstSubsetIt
first = subset->subsetBegin();
1161 Subset::ConstSubsetIt last = subset->subsetEnd();
1166 if ((*first).second.size()) {
1171 for (
unsigned int k = 0;
k < 5; ++
k) {
1175 for (
unsigned int j = 0; j < (*first).second[
k].m_vRamp.size(); ++j) {
1210 return StatusCode::SUCCESS;