Skip to content

Commit 74ba177

Browse files
martenoleshahor02
authored andcommitted
TimeSlot calib allow multiple inputs for process()
And per default make the container type the same as the input type. Useful in case the object send to the aggregator is in itself already a container as for example a histogram.
1 parent e271570 commit 74ba177

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Detectors/Calibration/include/DetectorsCalibration/TimeSlotCalibration.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ProcessingContext;
3636
namespace calibration
3737
{
3838

39-
template <typename Input, typename Container>
39+
template <typename Input, typename Container = Input>
4040
class TimeSlotCalibration
4141
{
4242
public:
@@ -104,8 +104,8 @@ class TimeSlotCalibration
104104
const Slot& getLastSlot() const { return (Slot&)mSlots.back(); }
105105
const Slot& getFirstSlot() const { return (Slot&)mSlots.front(); }
106106

107-
template <typename DATA>
108-
bool process(const DATA& data);
107+
template <typename... DATA>
108+
bool process(const DATA&... data);
109109
virtual void checkSlotsToFinalize(TFType tf, int maxDelay = 0);
110110
virtual void finalizeOldestSlot();
111111

@@ -227,8 +227,8 @@ class TimeSlotCalibration
227227

228228
//_________________________________________________
229229
template <typename Input, typename Container>
230-
template <typename DATA>
231-
bool TimeSlotCalibration<Input, Container>::process(const DATA& data)
230+
template <typename... DATA>
231+
bool TimeSlotCalibration<Input, Container>::process(const DATA&... data)
232232
{
233233
static bool firstCall = true;
234234
if (firstCall) {
@@ -251,10 +251,10 @@ bool TimeSlotCalibration<Input, Container>::process(const DATA& data)
251251
}
252252
auto& slotTF = getSlotForTF(tf);
253253
using Cont_t = typename std::remove_pointer<decltype(slotTF.getContainer())>::type;
254-
if constexpr (has_fill_method<Cont_t, void(const o2::dataformats::TFIDInfo&, const DATA&)>::value) {
255-
slotTF.getContainer()->fill(mCurrentTFInfo, data);
254+
if constexpr (has_fill_method<Cont_t, void(const o2::dataformats::TFIDInfo&, const DATA&...)>::value) {
255+
slotTF.getContainer()->fill(mCurrentTFInfo, data...);
256256
} else {
257-
slotTF.getContainer()->fill(data);
257+
slotTF.getContainer()->fill(data...);
258258
}
259259
if (tf > mMaxSeenTF) {
260260
mMaxSeenTF = tf; // keep track of the most recent TF processed

0 commit comments

Comments
 (0)