12#include "GaudiKernel/EventIDRange.h"
49 return StatusCode::SUCCESS;
59 return StatusCode::SUCCESS;
67 larOnlineID = scidhelper;
71 larOnlineID = idhelper;
76 larOnOffIdMapping = *larOnOffIdMappingHdl;
77 if ( larOnOffIdMapping ==
nullptr ) {
78 ATH_MSG_ERROR(
"Failed to retrieve LArOnOffIdMapping object" );
79 return StatusCode::FAILURE;
85 larMCsym = *larMCsymHdl;
86 if ( larMCsym ==
nullptr ) {
88 return StatusCode::FAILURE;
94 EventIDRange rangeAutoCorr;
98 if ( !AutoCorrHdl.
range( rangeAutoCorr ) ) {
99 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << AutoCorrHdl.
key() );
102 std::vector<std::map<HWIdentifier, std::vector<float>>> terms(
m_nGains );
104 std::vector<HWIdentifier>::const_iterator it, it_e;
106 it = larMCsym->
symIds().begin();
107 it_e = larMCsym->
symIds().end();
115 for ( ; it != it_e; ++it ) {
121 for (
unsigned int igain = 0; igain <
m_nGains; igain++ ) {
124 std::vector<float> vTerms;
126 vTerms.resize( size );
129 for (
int j = 0; j <
m_nSampl; j++ ) {
132 for (
int k = 0; k <= j - 1; k++ ) {
137 vTerms[j *
m_nSampl + j] = sqrt( std::fabs( 1. - ck ) );
139 for (
int i = j + 1; i <
m_nSampl; i++ ) {
141 for (
int k = 0; k <= j - 1; k++ ) {
144 ck = ck + vTerms[index1] * vTerms[index2];
148 unsigned int index3 = ( i - j ) - 1;
150 if ( index3 < ( AC.size() ) )
AutoCorr = AC[index3];
155 terms[igain][id] = std::move(vTerms);
160 for (
unsigned int igain = 0; igain <
m_nGains; igain++ ) {
161 terms[igain][id] = std::vector<float>( 1, 0. );
169 std::unique_ptr<LArAutoCorrNoise> larAutoCorrNoise =
170 std::make_unique<LArAutoCorrNoise>( std::move( terms ), larMCsym );
173 ATH_CHECK( writeHandle.
record( rangeAutoCorr, larAutoCorrNoise.release() ) );
175 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
Base class for conditions algorithms.
This class defines the interface for accessing AutoCorrelation parameters for each channel @stereotyp...
LArVectorProxy AutoCorrRef_t
virtual AutoCorrRef_t autoCorr(const HWIdentifier &CellID, int gain) const =0
SG::WriteCondHandleKey< LArAutoCorrNoise > m_LArAutoCorrNoiseObjKey
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override
LArAutoCorrNoiseCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadCondHandleKey< LArOnOffIdMapping > m_LArOnOffIdMappingObjKey
virtual ~LArAutoCorrNoiseCondAlg() override
SG::ReadCondHandleKey< ILArAutoCorr > m_LArAutoCorrObjKey
SG::ReadCondHandleKey< LArMCSym > m_LArMCSymObjKey
Helper class to handle z-phi symmetry of calibration constants in MC.
const std::vector< HWIdentifier > & symIds() const
Return the list of symmetric hashes.
bool isOnlineConnected(const HWIdentifier &sid) const
Test whether a HWIdentifier is connected of not (inline)
Helper for the Liquid Argon Calorimeter cell identifiers.
id_iterator channel_end() const
id_iterator channel_begin() const
Returns an iterator pointing to a channel identifier collection.
bool range(EventIDRange &r)
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string