@@ -140,7 +140,8 @@ inline bool record_module_data(const ModuleData *moduleDataList, unsigned module
140
140
{
141
141
assert (cfgs.size () == moduleCount);
142
142
assert (dest.size () == moduleCount);
143
- assert (std::all_of (moduleDataList, moduleDataList + moduleCount, [](const ModuleData &md)
143
+ assert (std::all_of (moduleDataList, moduleDataList + moduleCount,
144
+ [](const ModuleData &md)
144
145
{ return mvlc::readout_parser::size_consistency_check (md); }));
145
146
146
147
if (cfgs.size () != moduleCount)
@@ -218,7 +219,8 @@ bool fill(Histo &histo, double x)
218
219
}
219
220
else
220
221
{
221
- size_t bin = static_cast <size_t >((x - histo.xMin ) / (histo.xMax - histo.xMin ) * histo.bins .size ());
222
+ size_t bin =
223
+ static_cast <size_t >((x - histo.xMin ) / (histo.xMax - histo.xMin ) * histo.bins .size ());
222
224
assert (bin < histo.bins .size ());
223
225
if (bin < histo.bins .size ())
224
226
{
@@ -277,29 +279,31 @@ struct EventBuilder2::Private
277
279
{
278
280
auto &mds = eventData.moduleDatas [mi];
279
281
280
- result =
281
- result && std::all_of ( std::begin (mds), std::end (mds), [](const ModuleStorage &md)
282
- { return size_consistency_check (md); });
282
+ result = result && std::all_of ( std::begin (mds), std::end (mds),
283
+ [](const ModuleStorage &md)
284
+ { return size_consistency_check (md); });
283
285
284
286
// This will fail for the extreme case where none of the modules in
285
287
// an event yielded a timestamp. fillerTs in recordModuleData() will
286
288
// not be set and the otherwise guaranteed stamp will not be
287
289
// appended to the queue.
288
- result =
289
- result && std::all_of (std::begin (mds), std::end (mds), []( const ModuleStorage &md)
290
- { return md.timestamp .has_value (); });
290
+ result = result &&
291
+ std::all_of (std::begin (mds), std::end (mds),
292
+ []( const ModuleStorage &md) { return md.timestamp .has_value (); });
291
293
}
292
294
293
295
return result;
294
296
}
295
297
296
298
bool recordModuleData (int eventIndex, const ModuleData *moduleDataList, unsigned moduleCount)
297
299
{
298
- spdlog::trace (" entering recordModuleData: eventIndex={}, moduleCount={}" , eventIndex, moduleCount);
300
+ spdlog::trace (" entering recordModuleData: eventIndex={}, moduleCount={}" , eventIndex,
301
+ moduleCount);
299
302
300
303
if (!checkConsistency (eventIndex, moduleDataList, moduleCount))
301
304
{
302
- spdlog::warn (" recordModuleData: eventIndex={}, moduleCount={} -> module data consistency check failed" ,
305
+ spdlog::warn (" recordModuleData: eventIndex={}, moduleCount={} -> module data "
306
+ " consistency check failed" ,
303
307
eventIndex, moduleCount);
304
308
return false ;
305
309
}
@@ -330,7 +334,7 @@ struct EventBuilder2::Private
330
334
{
331
335
// The back of each 'moduleDatas' queue now contains the newest data+timestamp.
332
336
333
- #if 0
337
+ #if 0
334
338
auto &histos = eventData.dtHistograms;
335
339
auto itHistos = std::begin(histos);
336
340
@@ -352,15 +356,16 @@ struct EventBuilder2::Private
352
356
++itHistos;
353
357
}
354
358
}
355
- #endif
359
+ #endif
356
360
357
361
// Apply offsets to the timestamps.
358
362
for (unsigned mi = 0 ; mi < moduleCount; ++mi)
359
363
{
360
364
auto &ms = eventData.moduleDatas [mi].back ();
361
365
if (ms.timestamp .has_value ())
362
366
{
363
- *ms.timestamp = add_offset_to_timestamp (*ms.timestamp , eventCfg.moduleConfigs [mi].offset );
367
+ *ms.timestamp =
368
+ add_offset_to_timestamp (*ms.timestamp , eventCfg.moduleConfigs [mi].offset );
364
369
}
365
370
}
366
371
@@ -413,14 +418,14 @@ struct EventBuilder2::Private
413
418
eventIndex);
414
419
}
415
420
416
- spdlog::trace (" leaving recordModuleData: eventIndex={}, moduleCount={} -> return true" , eventIndex,
417
- moduleCount);
421
+ spdlog::trace (" leaving recordModuleData: eventIndex={}, moduleCount={} -> return true" ,
422
+ eventIndex, moduleCount);
418
423
419
424
return true ;
420
425
}
421
426
422
- spdlog::warn (" leaving recordModuleData: eventIndex={}, moduleCount={} -> return false" , eventIndex,
423
- moduleCount);
427
+ spdlog::warn (" leaving recordModuleData: eventIndex={}, moduleCount={} -> return false" ,
428
+ eventIndex, moduleCount);
424
429
425
430
++eventCtrs.recordingFailed ;
426
431
return false ;
@@ -463,15 +468,17 @@ struct EventBuilder2::Private
463
468
if (matchResult.match != WindowMatch::too_new)
464
469
{
465
470
spdlog::trace (" tryFlush: module{}, refTs={}, modTs={}, window={}, match={} -> "
466
- " newest stamp is not far enough in the future, cannot flush yet -> "
467
- " return false" ,
468
- mi, refTs, modTs, mc.window , (int )matchResult.match );
471
+ " newest stamp is not far enough in the future, cannot flush yet -> "
472
+ " return false" ,
473
+ mi, refTs, modTs, mc.window , (int )matchResult.match );
469
474
return false ;
470
475
}
471
476
}
472
477
473
- spdlog::trace (" tryFlush: refTs={}, all modules have a ts in the future -> flushing at least "
474
- " one event" , refTs);
478
+ spdlog::trace (
479
+ " tryFlush: refTs={}, all modules have a ts in the future -> flushing at least "
480
+ " one event" ,
481
+ refTs);
475
482
476
483
// pop the refTs, so we won't encounter it again. Loop because multiple modules might yield
477
484
// the exact same refTs.
@@ -494,8 +501,8 @@ struct EventBuilder2::Private
494
501
if (matchResult.match == WindowMatch::too_old)
495
502
{
496
503
spdlog::trace (" tryFlush: mi={}, refTs={}, modTs={}, window={}, too_old -> "
497
- " discard event" ,
498
- mi, refTs, modTs, moduleConfig.window );
504
+ " discard event" ,
505
+ mi, refTs, modTs, moduleConfig.window );
499
506
++eventCtrs.discardsAge [mi];
500
507
--eventCtrs.currentEvents [mi];
501
508
eventCtrs.currentMem [mi] -= moduleDatas.front ().data .size () * sizeof (u32);
@@ -522,7 +529,7 @@ struct EventBuilder2::Private
522
529
outputModuleStorage_[mi].hasDynamic = moduleConfig.hasDynamic ;
523
530
outputModuleStorage_[mi].data .resize (moduleConfig.prefixSize );
524
531
std::fill (std::begin (outputModuleStorage_[mi].data ),
525
- std::end (outputModuleStorage_[mi].data ), 0 );
532
+ std::end (outputModuleStorage_[mi].data ), 0 );
526
533
527
534
while (!moduleDatas.empty ())
528
535
{
@@ -535,8 +542,8 @@ struct EventBuilder2::Private
535
542
if (matchResult.match == WindowMatch::in_window)
536
543
{
537
544
spdlog::trace (" tryFlush: mi={}, refTs={}, modTs={}, dt={}, window={}, "
538
- " in_window -> add to out event" ,
539
- mi, refTs, modTs, dt, moduleConfig.window );
545
+ " in_window -> add to out event" ,
546
+ mi, refTs, modTs, dt, moduleConfig.window );
540
547
// Move data to the output buffer. Needed for the linear ModuleData array.
541
548
outputModuleStorage_[mi] = std::move (moduleDatas.front ());
542
549
moduleDatas.pop_front ();
@@ -547,9 +554,10 @@ struct EventBuilder2::Private
547
554
}
548
555
else if (matchResult.match == WindowMatch::too_new)
549
556
{
550
- spdlog::trace (" tryFlush: mi={}, refTs={}, modTs={}, dt={}, window={}, too_new "
551
- " -> leave in buffer" ,
552
- mi, refTs, modTs, dt, moduleConfig.window );
557
+ spdlog::trace (
558
+ " tryFlush: mi={}, refTs={}, modTs={}, dt={}, window={}, too_new "
559
+ " -> leave in buffer" ,
560
+ mi, refTs, modTs, dt, moduleConfig.window );
553
561
break ;
554
562
}
555
563
}
@@ -684,8 +692,8 @@ EventBuilder2::EventBuilder2(const EventBuilderConfig &cfg, Callbacks callbacks,
684
692
ctrs.currentMem , ctrs.maxEvents , ctrs.maxMem );
685
693
}
686
694
687
- // Create dtHistograms
688
- #if 0
695
+ // Create dtHistograms
696
+ #if 0
689
697
for (size_t ei = 0; ei < cfg.eventConfigs.size(); ++ei)
690
698
{
691
699
auto &ec = cfg.eventConfigs.at(ei);
@@ -711,7 +719,7 @@ EventBuilder2::EventBuilder2(const EventBuilderConfig &cfg, Callbacks callbacks,
711
719
}
712
720
}
713
721
}
714
- #endif
722
+ #endif
715
723
}
716
724
717
725
EventBuilder2::EventBuilder2 (const EventBuilderConfig &cfg, void *userContext)
@@ -809,8 +817,7 @@ std::string EventBuilder2::debugDump() const
809
817
std::advance (stampsEnd, stampsToPrint);
810
818
std::vector<std::string> stamps;
811
819
std::transform (stampsBegin, stampsEnd, std::back_inserter (stamps),
812
- [](const ModuleStorage &md)
813
- {
820
+ [](const ModuleStorage &md) {
814
821
return md.timestamp .has_value ()
815
822
? std::to_string (md.timestamp .value ())
816
823
: " no ts" ;
0 commit comments