72{
74
76 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{
m_cablingKey};
77 const LArOnOffIdMapping*
cabling{*cablingHdl};
78 if(!cabling){
80 return StatusCode::FAILURE;
81 }
82
83 LArAutoCorrComplete* larAutoCorrComplete = nullptr;
85 ATH_MSG_INFO (
" Got computed Autocorrelation from physics " );
86
87 const LArAutoCorrComplete* larAutoCorrElec = nullptr;
89 ATH_MSG_INFO (
" Got electronics noise autocorrelation from database " );
90
91 const LArPedestalComplete* larPedestalElec = nullptr;
94
95 const ILArRamp* larRamp = nullptr;
98
99 SG::ReadCondHandle<LArBadFebCont> readHandle{
m_BFKey};
101 if ( bfCont == nullptr) {
104 }
105
106
107 std::vector<HWIdentifier>::const_iterator
it =
m_onlineId->channel_begin();
108 std::vector<HWIdentifier>::const_iterator it_e =
m_onlineId->channel_end();
109 for (;
it!=it_e;++
it) {
110 HWIdentifier hwid = (*it);
111
112
113
114 if (!(
cabling->isOnlineConnected(hwid)))
continue;
115
116
122 }
124
125 ATH_MSG_VERBOSE (
" hwid,gain0,gain1,gain2 " <<
m_onlineId->channel_name(hwid) <<
" " << gain0 <<
" " << gain1 <<
" " << gain2 );
126
127
130
131
132 float sigma0_elec;
134 sigma0_elec = larPedestalElec->
pedestalRMS(hwid,gain0);
135 else {
137 continue;
138 }
140 ATH_MSG_VERBOSE (
" sigma0_elec " << sigma0_elec <<
" corr0_ele.size() " << corr0_elec.size() );
141 if (corr0_elec.size()==0) {
143 continue;
144 }
145
146 {
147 msg() << MSG::VERBOSE <<
" corr0_elec ";
148 unsigned int ii=0;
149 for (;ii<corr0_elec.size();ii++)
150 msg() << MSG::VERBOSE << corr0_elec[ii] <<
" ";
152 }
153
154 float sigma0_elec2 = sigma0_elec*sigma0_elec;
155
156
157 std::vector<float> corr2;
158 bool recovered=false;
159 if (corr.size()==0) {
160 HWIdentifier febId =
m_onlineId->feb_Id(hwid);
162 ATH_MSG_DEBUG (
" Known missing Feb, no physics autocorr " <<
m_onlineId->channel_name(hwid) <<
"... use electronics from db " );
163 } else {
164 ATH_MSG_WARNING (
" No physics autocorr for channel " <<
m_onlineId->channel_name(hwid) <<
" .. use electronics from db" );
165 }
166 if (corr0_elec.size()==0) {
168 continue;
169 }
171 if (corr0_elec.size()<(
unsigned int)(n-1))
n = corr0_elec.size()+1;
172 unsigned int size =
n*(
n+1)/2;
173 std::vector<float> corr2;
174 corr2.resize(size,0.);
176 for (
int i=0;
i<
n;
i++) {
177 for (
int j=i;j<
n;j++,
k++) {
178 if (i==j) corr2[
k]=sigma0_elec2;
179 else corr2[
k]=corr0_elec[j-
i-1]*sigma0_elec2;
180 }
181 }
182 larAutoCorrComplete->
set(hwid,gain0,corr2);
183 recovered=true;
184 }
185
186
187
189
190
192
193
195 if (corr_elec.size()==0) {
197 continue;
198 }
199 {
200 msg() << MSG::VERBOSE <<
" corr_elec ";
201 unsigned int ii=0;
202 for (;ii<corr_elec.size();ii++)
203 msg() << MSG::VERBOSE << corr_elec[ii] <<
" ";
205 }
206
207
208
209 float sigma_elec;
211 sigma_elec = larPedestalElec->
pedestalRMS(hwid,gain);
212 else {
214 continue;
215 }
216 ATH_MSG_VERBOSE (
" sigma_elec " << sigma_elec <<
" corr_elec.size() " << corr_elec.size() );
217 float sigma_elec2 = sigma_elec*sigma_elec;
218
219
224 if (rampcoeff.size()>1 && rampcoeff0.size()>1) {
225 float ramp1 = rampcoeff[1];
226 float ramp0 = rampcoeff0[1];
227 if (ramp1>0.01 && ramp0>0.01 && ramp1<1e4 && ramp0<1e4)
ratio = ramp0/ramp1;
228 }
229
231
232
233
234 std::vector<float> new_corr;
235 if (!recovered) new_corr.reserve(corr.size());
236 else new_corr.reserve(corr2.size());
237
241 float rij_0=0.;
242 if (!recovered) {
243 if (k<corr.size()) rij_0 = corr[
k];
244 }
245 else {
246 if (k<corr2.size()) rij_0 = corr2[
k];
247 }
248
249 float corre0 = 0. ;
250 float corre = 0. ;
251 if (i==j) {
252 corre0=1.;
253 corre=1.;
254 }
255 else {
256 unsigned int index = j-
i-1;
257 if (index<corr0_elec.size()) corre0=corr0_elec[
index];
258 if (index<corr_elec.size()) corre=corr_elec[
index];
259 }
260 float rij_tot = rij_0*
ratio - sigma0_elec2*corre0*
ratio + sigma_elec2*corre;
261 new_corr.push_back(rij_tot);
262 }
263 }
264
265 {
266 msg() << MSG::VERBOSE <<
" old corr ";
271 msg() << MSG::VERBOSE << corr[
k] <<
" ";
273 }
274 }
275 }
276 {
277 msg() << MSG::VERBOSE <<
" new corr ";
281 msg() << MSG::VERBOSE << new_corr[
k] <<
" ";
283 }
284 }
285
286
287 larAutoCorrComplete->
set(hwid,gain,new_corr);
288
289
290 }
291
292 }
293
294 return StatusCode::SUCCESS;
295}
#define ATH_MSG_VERBOSE(x)
LArBadXCont< LArBadFeb > LArBadFebCont
const ServiceHandle< StoreGateSvc > & detStore() const
LArVectorProxy AutoCorrRef_t
virtual RampRef_t ADC2DAC(const HWIdentifier &id, int gain) const =0
LArVectorProxy RampRef_t
This class defines the interface for accessing Ramp @stereotype Interface.
virtual AutoCorrRef_t autoCorr(const HWIdentifier &CellID, int gain) const
void set(const HWIdentifier &CellID, int gain, const std::vector< float > &vAutoCorr)
bool good() const
Returns true if no problems at all (all bits at zero)
LArBC_t status(const HWIdentifier channel) const
Query the status of a particular channel or FEB This is the main client access method.
virtual float pedestalRMS(const HWIdentifier &CellID, int gain) const override
access to RMS of Pedestal index by Identifier, and gain setting
retrieve(aClass, aKey=None)