179{
181
182 const LArAccumulatedCalibDigitContainer* larAccumulatedCalibDigitContainer = nullptr;
183
184 std::vector<std::string>::const_iterator key_it=
m_keylist.begin();
185 std::vector<std::string>::const_iterator key_it_e=
m_keylist.end();
186 int foundkey = 0;
187 for (;key_it!=key_it_e; ++key_it) {
188
189 sc =
evtStore()->retrieve(larAccumulatedCalibDigitContainer,*key_it);
190 if (
sc.isFailure()) {
191 ATH_MSG_WARNING(
"Cannot read LArAccumulatedCalibDigitContainer from StoreGate! key=" << *key_it );
192 if ( (std::next(key_it) == key_it_e) && foundkey==0 ){
193 ATH_MSG_ERROR(
"None of the provided LArAccumulatedDigitContainer keys could be read");
194 return StatusCode::FAILURE;
195 }else{
196 continue;
197 }
198 }
199 foundkey+=1;
200
204 if (
sc.isFailure()) {
205 ATH_MSG_ERROR(
"Failed to retrieve FebErrorSummary object!" );
207 }
208 }
209 else
211 ATH_MSG_WARNING(
"No FebErrorSummaryObject found! Feb errors not checked!" );
212
213 HWIdentifier lastFailedFEB(0);
216
217 if (it == it_end) {
218 ATH_MSG_DEBUG(
"LArAccumulatedCalibDigitContainer with key=" << *key_it <<
" is empty ");
219 continue;
220 }
221
222 const float delayScale = larAccumulatedCalibDigitContainer->
getDelayScale();
223 const float deltaDelay = 25*
ns/(delayScale*
m_NStep);
224
225 for (;
it!=it_end; ++
it) {
226
227 bool ispulsed=false;
229 const std::vector<HWIdentifier>& calibLineLeg = clcabling->
calibSlotLine((*it)->hardwareID());
230 for (const HWIdentifier &calibLineHWID : calibLineLeg) {
232 }
233 } else {
234 ispulsed=(*it)->isPulsed();
235 }
238 continue;
239 }
240 HWIdentifier chid=(*it)->hardwareID();
242 if (febErrSum) {
245 if (febid!=lastFailedFEB) {
246 lastFailedFEB=febid;
248 <<
" reports error(s):" << febErrSum->
error_to_string(febErrs) <<
". Data ignored." );
249 }
250 continue;
251 }
252 }
254
256 ATH_MSG_ERROR(
"Found not-matching gain number ("<< (
int)gain <<
")" );
257 return StatusCode::FAILURE;
258 }
259
260
261 std::vector<double> samplesum;
262 std::vector < uint64_t >::const_iterator samplesum_it=(*it)->sampleSum().begin();
263 std::vector < uint64_t >::const_iterator samplesum_it_e=(*it)->sampleSum().end();
264 for (;samplesum_it!=samplesum_it_e; ++samplesum_it)
265 samplesum.push_back((double)(*samplesum_it));
266
267
268 std::vector<double> sample2sum;
269 std::vector < uint64_t >::const_iterator sample2sum_it=(*it)->sample2Sum().begin();
270 std::vector < uint64_t >::const_iterator sample2sum_it_e=(*it)->sample2Sum().end();
271 for (;sample2sum_it!=sample2sum_it_e; ++sample2sum_it)
272 sample2sum.push_back((double)(*sample2sum_it));
273
275
276
277 int dacPulsed;
278 float delay = (*it)->delay();
279 int dac=(*it)->DAC();
281 int pulsed=0;
283 const std::vector<HWIdentifier>& calibLineLeg = clcabling->
calibSlotLine((*it)->hardwareID());
284 if(calibLineLeg.empty()) {
285 ATH_MSG_WARNING(
"Why do not have calib lines for "<<(*it)->hardwareID()<<
" ?");
286 continue;
287 }
291 for (
unsigned i=0;
i<calibLineLeg.size(); ++
i) {
293 ATH_MSG_DEBUG((*it)->hardwareID().get_identifier32().get_compact() <<
" GR: line pulsed true, line="<<i+1);
294 dacPulsed=(dacPulsed | (0x1 << (15+
i+1)));
295 pulsed=(pulsed | (0x1 << (15+
i+1)));
296 }
297
298 }
299 } else {
300 dacPulsed=(*it)->DAC();
301 for(int iLine=1;iLine<5;iLine++){
302 if((*it)->isPulsed(iLine)){
303 ATH_MSG_DEBUG((*it)->hardwareID().get_identifier32().get_compact() <<
" GRAV: line pulsed true, line="<<iLine);
304 dacPulsed=(dacPulsed | (0x1 << (15+iLine)));
305 pulsed=(pulsed | (0x1 << (15+iLine)));
306 }
307 }
308 }
309
312 } else {
314 }
315
317 ATH_MSG_DEBUG(
"with " << (*it)->sampleSum().size() <<
" samples " << index <<
" DAC " <<
delay <<
" delay " << dacPulsed <<
" dacPulsed " << pulsed <<
" pulsed");
318
319 WaveMap::iterator itm = waveMap.find(index);
320
321 if ( itm == waveMap.end() ) {
323 itm = (waveMap.insert(WaveMap::value_type(index,wave))).first;
325 }
326 (*itm).second.addAccumulatedEvent(
int(std::roundf(
delay/deltaDelay)),
m_NStep,
327 samplesum, sample2sum, (*it)->nTriggers());
328
329 }
330 }
331
332 return StatusCode::SUCCESS;
333}
double delay(std::size_t d)
ServiceHandle< StoreGateSvc > & evtStore()
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
double getDelayScale() const
get the delay Scale
std::map< int, LArCaliWave > WaveMap
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
unsigned Delay(const unsigned event, const HWIdentifier calibLineID) const
bool isPulsed(const unsigned event, const HWIdentifier calibLineID) const
unsigned DAC(const unsigned event, const HWIdentifier calibLineID) const
static std::string error_to_string(uint16_t error)
interpret the error in string
uint16_t feb_error(HWIdentifier febid) const
get error for feb
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
::StatusCode StatusCode
StatusCode definition for legacy code.