Skip to content

Commit 4dfd6d6

Browse files
committed
clang-format stuff
1 parent fb9857f commit 4dfd6d6

File tree

2 files changed

+55
-47
lines changed

2 files changed

+55
-47
lines changed

src/mesytec-mvlc/event_builder2.cc

+42-35
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ inline bool record_module_data(const ModuleData *moduleDataList, unsigned module
140140
{
141141
assert(cfgs.size() == moduleCount);
142142
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)
144145
{ return mvlc::readout_parser::size_consistency_check(md); }));
145146

146147
if (cfgs.size() != moduleCount)
@@ -218,7 +219,8 @@ bool fill(Histo &histo, double x)
218219
}
219220
else
220221
{
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());
222224
assert(bin < histo.bins.size());
223225
if (bin < histo.bins.size())
224226
{
@@ -277,29 +279,31 @@ struct EventBuilder2::Private
277279
{
278280
auto &mds = eventData.moduleDatas[mi];
279281

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); });
283285

284286
// This will fail for the extreme case where none of the modules in
285287
// an event yielded a timestamp. fillerTs in recordModuleData() will
286288
// not be set and the otherwise guaranteed stamp will not be
287289
// 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(); });
291293
}
292294

293295
return result;
294296
}
295297

296298
bool recordModuleData(int eventIndex, const ModuleData *moduleDataList, unsigned moduleCount)
297299
{
298-
spdlog::trace("entering recordModuleData: eventIndex={}, moduleCount={}", eventIndex, moduleCount);
300+
spdlog::trace("entering recordModuleData: eventIndex={}, moduleCount={}", eventIndex,
301+
moduleCount);
299302

300303
if (!checkConsistency(eventIndex, moduleDataList, moduleCount))
301304
{
302-
spdlog::warn("recordModuleData: eventIndex={}, moduleCount={} -> module data consistency check failed",
305+
spdlog::warn("recordModuleData: eventIndex={}, moduleCount={} -> module data "
306+
"consistency check failed",
303307
eventIndex, moduleCount);
304308
return false;
305309
}
@@ -330,7 +334,7 @@ struct EventBuilder2::Private
330334
{
331335
// The back of each 'moduleDatas' queue now contains the newest data+timestamp.
332336

333-
#if 0
337+
#if 0
334338
auto &histos = eventData.dtHistograms;
335339
auto itHistos = std::begin(histos);
336340

@@ -352,15 +356,16 @@ struct EventBuilder2::Private
352356
++itHistos;
353357
}
354358
}
355-
#endif
359+
#endif
356360

357361
// Apply offsets to the timestamps.
358362
for (unsigned mi = 0; mi < moduleCount; ++mi)
359363
{
360364
auto &ms = eventData.moduleDatas[mi].back();
361365
if (ms.timestamp.has_value())
362366
{
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);
364369
}
365370
}
366371

@@ -413,14 +418,14 @@ struct EventBuilder2::Private
413418
eventIndex);
414419
}
415420

416-
spdlog::trace("leaving recordModuleData: eventIndex={}, moduleCount={} -> return true", eventIndex,
417-
moduleCount);
421+
spdlog::trace("leaving recordModuleData: eventIndex={}, moduleCount={} -> return true",
422+
eventIndex, moduleCount);
418423

419424
return true;
420425
}
421426

422-
spdlog::warn("leaving recordModuleData: eventIndex={}, moduleCount={} -> return false", eventIndex,
423-
moduleCount);
427+
spdlog::warn("leaving recordModuleData: eventIndex={}, moduleCount={} -> return false",
428+
eventIndex, moduleCount);
424429

425430
++eventCtrs.recordingFailed;
426431
return false;
@@ -463,15 +468,17 @@ struct EventBuilder2::Private
463468
if (matchResult.match != WindowMatch::too_new)
464469
{
465470
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);
469474
return false;
470475
}
471476
}
472477

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);
475482

476483
// pop the refTs, so we won't encounter it again. Loop because multiple modules might yield
477484
// the exact same refTs.
@@ -494,8 +501,8 @@ struct EventBuilder2::Private
494501
if (matchResult.match == WindowMatch::too_old)
495502
{
496503
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);
499506
++eventCtrs.discardsAge[mi];
500507
--eventCtrs.currentEvents[mi];
501508
eventCtrs.currentMem[mi] -= moduleDatas.front().data.size() * sizeof(u32);
@@ -522,7 +529,7 @@ struct EventBuilder2::Private
522529
outputModuleStorage_[mi].hasDynamic = moduleConfig.hasDynamic;
523530
outputModuleStorage_[mi].data.resize(moduleConfig.prefixSize);
524531
std::fill(std::begin(outputModuleStorage_[mi].data),
525-
std::end(outputModuleStorage_[mi].data), 0);
532+
std::end(outputModuleStorage_[mi].data), 0);
526533

527534
while (!moduleDatas.empty())
528535
{
@@ -535,8 +542,8 @@ struct EventBuilder2::Private
535542
if (matchResult.match == WindowMatch::in_window)
536543
{
537544
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);
540547
// Move data to the output buffer. Needed for the linear ModuleData array.
541548
outputModuleStorage_[mi] = std::move(moduleDatas.front());
542549
moduleDatas.pop_front();
@@ -547,9 +554,10 @@ struct EventBuilder2::Private
547554
}
548555
else if (matchResult.match == WindowMatch::too_new)
549556
{
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);
553561
break;
554562
}
555563
}
@@ -684,8 +692,8 @@ EventBuilder2::EventBuilder2(const EventBuilderConfig &cfg, Callbacks callbacks,
684692
ctrs.currentMem, ctrs.maxEvents, ctrs.maxMem);
685693
}
686694

687-
// Create dtHistograms
688-
#if 0
695+
// Create dtHistograms
696+
#if 0
689697
for (size_t ei = 0; ei < cfg.eventConfigs.size(); ++ei)
690698
{
691699
auto &ec = cfg.eventConfigs.at(ei);
@@ -711,7 +719,7 @@ EventBuilder2::EventBuilder2(const EventBuilderConfig &cfg, Callbacks callbacks,
711719
}
712720
}
713721
}
714-
#endif
722+
#endif
715723
}
716724

717725
EventBuilder2::EventBuilder2(const EventBuilderConfig &cfg, void *userContext)
@@ -809,8 +817,7 @@ std::string EventBuilder2::debugDump() const
809817
std::advance(stampsEnd, stampsToPrint);
810818
std::vector<std::string> stamps;
811819
std::transform(stampsBegin, stampsEnd, std::back_inserter(stamps),
812-
[](const ModuleStorage &md)
813-
{
820+
[](const ModuleStorage &md) {
814821
return md.timestamp.has_value()
815822
? std::to_string(md.timestamp.value())
816823
: "no ts";

src/mesytec-mvlc/event_builder2.hpp

+13-12
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ struct MESYTEC_MVLC_EXPORT ModuleConfig
8484
s32 offset; // Offset applied to the extracted timestamp. Used to correct for module specific
8585
// timestamp offsets.
8686
u32 window; // Width of the match window in timestamp units.
87-
bool ignored = false; // If true this module does not contribute reference timestamps.
87+
bool ignored = false; // If true this module does not contribute reference timestamps.
8888
bool hasDynamic = false; // If true the module has a dynamic part (block read).
89-
u32 prefixSize = 0; // Number of words in the static prefix. May only be set if hasDynamic==false.
89+
u32 prefixSize =
90+
0; // Number of words in the static prefix. May only be set if hasDynamic==false.
9091
std::string name;
9192
};
9293

@@ -110,17 +111,17 @@ struct MESYTEC_MVLC_EXPORT EventCounters
110111
std::vector<size_t> inputHits;
111112
std::vector<size_t> outputHits;
112113
std::vector<size_t> emptyInputs;
113-
std::vector<size_t> discardsAge; // number of event discarded due to stamp age
114-
std::vector<size_t> stampFailed; // number of failed stamp extractions
114+
std::vector<size_t> discardsAge; // number of event discarded due to stamp age
115+
std::vector<size_t> stampFailed; // number of failed stamp extractions
115116

116117
// these can be determinted from the contents of the data buffers
117118
std::vector<size_t> currentEvents; // current events in the buffer
118119
std::vector<size_t> currentMem; // current buffer memory usage
119120

120121
// these are upated in tryFlush() and/or periodcally? not sure yet. possibly on-demand only when
121122
// a getCounters() method is called
122-
std::vector<size_t> maxEvents; // max events buffered so far (until flushed)
123-
std::vector<size_t> maxMem; // max mem usage so far (until flushed)
123+
std::vector<size_t> maxEvents; // max events buffered so far (until flushed)
124+
std::vector<size_t> maxMem; // max mem usage so far (until flushed)
124125

125126
// non-module specific
126127
size_t recordingFailed = 0;
@@ -135,12 +136,12 @@ struct MESYTEC_MVLC_EXPORT BuilderCounters
135136

136137
struct MESYTEC_MVLC_EXPORT Histo
137138
{
138-
std::string title;
139-
double xMin;
140-
double xMax;
141-
std::vector<size_t> bins;
142-
size_t underflows;
143-
size_t overflows;
139+
std::string title;
140+
double xMin;
141+
double xMax;
142+
std::vector<size_t> bins;
143+
size_t underflows;
144+
size_t overflows;
144145
};
145146

146147
bool fill(Histo &histo, double x);

0 commit comments

Comments
 (0)