359{
360 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{
m_cablingKey};
361 const LArOnOffIdMapping*
cabling{*cablingHdl};
362 if(!cabling) {
364 return StatusCode::FAILURE;
365 }
366
367 SG::ReadCondHandle<LArCalibLineMapping> clHdl{
m_CLKey};
368 const LArCalibLineMapping *clCont {*clHdl};
369 if(!clCont) {
371 return StatusCode::FAILURE;
372 }
373
376 }
377
378
382
384 ATH_MSG_ERROR (
"Key list is empty! No containers to process!" );
385 return StatusCode::FAILURE;
386 }
387
388 const LArAccumulatedCalibDigitContainer* larAccumulatedCalibDigitContainer = nullptr;
389
390 std::vector<std::string>::const_iterator key_it=
m_keylist.begin();
391 std::vector<std::string>::const_iterator key_it_e=
m_keylist.end();
392
393 for (;key_it!=key_it_e; ++key_it) {
394
396 if (
sc.isFailure()) {
397 ATH_MSG_WARNING (
"Cannot read LArAccumulatedCalibDigitContainer from StoreGate! key=" << *key_it );
398 continue;
399 }
400
403
404 if (it == it_end) {
405 ATH_MSG_DEBUG (
"LArAccumulatedCalibDigitContainer with key=" << *key_it <<
" is empty " );
406 continue;
407 }
408
409 const float delayScale = larAccumulatedCalibDigitContainer->
getDelayScale();
410 const float deltaDelay = 25*
ns/(delayScale*
m_NStep);
411
412
413 bool relevantForXtalk = false;
414
415
416 std::vector<int> nbOfEventSlot;
417 nbOfEventSlot.resize(15);
418
419 std::vector<int> nbOfEventPart;
420 nbOfEventPart.resize(8);
423
424
425
426 do{
427
428 const std::vector<HWIdentifier>& calibLine = clCont->
calibSlotLine((*it)->hardwareID());
429 if (!calibLine.empty()) {
431
433 relevantForXtalk = true;
434
435
436
437
438 }
439
440 if ((*it)->isPulsed()){
444
445 nbOfEventSlot[iSlot-1]++;
446
447 if (ipos_neg==1)
sideA++;
449
450 if (!
m_onlineHelper->isEmEndcapSpecialOnline((*it)->hardwareID())){
451 if (iSlot==1) nbOfEventPart[4*ibarrel_ec]++;
452 else if (iSlot < 9 - ibarrel_ec) nbOfEventPart[4*ibarrel_ec + 1]++;
453 else if (iSlot > 10 - ibarrel_ec) nbOfEventPart[4*ibarrel_ec + 2]++;
454 else nbOfEventPart[4*ibarrel_ec + 3]++;
455 }
456 }
457
459 }
460 while ((!relevantForXtalk) && (it != it_end));
461
462
463
464
465
466
467
468
469
470
471
473 msg() << MSG::DEBUG <<
"Entries : EMB PS/F/M/B=" << nbOfEventPart[0] <<
"/" << nbOfEventPart[1] <<
"/" << nbOfEventPart[2] <<
"/" << nbOfEventPart[3];
474 msg() << MSG::DEBUG <<
" - EMEC Std PS/F/M/B=" << nbOfEventPart[4] <<
"/" << nbOfEventPart[5] <<
"/" << nbOfEventPart[6] <<
"/" << nbOfEventPart[7];
476 if (!relevantForXtalk)
477 msg() << MSG::DEBUG <<
" - don't keep (partition/pattern)" <<
endmsg;
478 else
479 msg() << MSG::DEBUG <<
" - KEEP THIS EVENT" <<
endmsg;
480
481
482
483 if (relevantForXtalk){
484 bool hasbeenprinted = false;
485 for (it=larAccumulatedCalibDigitContainer->
begin();it!=it_end; ++it) {
486
487 HWIdentifier chid=(*it)->hardwareID();
488
489
493 if (
m_isInnerWheel) {
if (iFT!=3 && iFT!=10 && iFT!=16 && iFT!=22)
continue;}
494 else {if (iFT!=2 && iFT!=9 && iFT!=15 && iFT!=21) continue;}
495 else if (iFT==2 || iFT==9 || iFT==15 || iFT==21 || iFT==3 || iFT==10 || iFT==16 || iFT==22 || iFT==6)
496 continue;
497 }
498
499
501
502 if (!hasbeenprinted){
503 ATH_MSG_DEBUG (
"This event is relevant for the studied partition" );
504 hasbeenprinted = true;
505 }
506
508
510 ATH_MSG_ERROR (
"Found not-matching gain number ("<< (
int)gain <<
")" );
511 return StatusCode::FAILURE;
512 }
513
514
515
516 std::vector<double> samplesum;
517 std::vector < uint64_t >::const_iterator samplesum_it=(*it)->sampleSum().begin();
518 std::vector < uint64_t >::const_iterator samplesum_it_e=(*it)->sampleSum().end();
520 do {
521 samplesum.push_back((double)(*samplesum_it));
522 ++samplesum_it;
523 --nSample;
524 }
525 while ( (samplesum_it!=samplesum_it_e) && (nSample!=0) );
526
527
528
529 std::vector<double> sample2sum;
530 std::vector < uint64_t >::const_iterator sample2sum_it=(*it)->sample2Sum().begin();
531 std::vector < uint64_t >::const_iterator sample2sum_it_e=(*it)->sample2Sum().end();
533 do {
534 sample2sum.push_back((double)(*sample2sum_it));
535 ++sample2sum_it;
536 --nSample;
537 }
538 while ( (sample2sum_it!=sample2sum_it_e) && (nSample!=0) );
539
541 WaveMap::iterator itm = waveMap.find((*it)->DAC());
542
543 if ( itm == waveMap.end() ) {
545
546
547
548
549
550
551 itm = (waveMap.insert(WaveMap::value_type((*it)->DAC(), wave))).first;
552 }
553
554 (*itm).second.addAccumulatedEvent((
int)roundf((*it)->delay()/deltaDelay),
m_NStep,
555 samplesum, sample2sum, (*it)->nTriggers());
556 }
557 }
558 }
559 }
560
561 return StatusCode::SUCCESS;
562}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
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
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
std::map< int, LArCaliWave > WaveMap
SG::ReadCondHandleKey< LArCalibLineMapping > m_CLKey
StatusCode initializeCabling(const LArOnOffIdMapping *cabling, const LArCalibLineMapping *clCont)
std::vector< std::string > m_keylist
std::vector< HWIdentifier > m_CalibLineHW
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
std::string find(const std::string &s)
return a remapped string
::StatusCode StatusCode
StatusCode definition for legacy code.
unsigned int constexpr sideC
unsigned int constexpr sideA