1414#include " Assertions.h"
1515#include " MCHRawCommon/DataFormats.h"
1616#include " MCHRawCommon/SampaHeader.h"
17- #include " MCHRawDecoder/SampaChannelHandler .h"
17+ #include " MCHRawDecoder/DecodedDataHandlers .h"
1818#include < bitset>
1919#include < fmt/format.h>
2020#include < fmt/printf.h>
@@ -33,7 +33,7 @@ namespace o2::mch::raw
3333// /
3434// / Bits coming from parts of the GBT words are added to the Elink using the
3535// / append() method and each time a SampaCluster is decoded,
36- // / it is passed to the SampaChannelHandler for further processing (or none).
36+ // / it is passed to the DecodedDataHandlers for further processing (or none).
3737// /
3838// / \nosubgrouping
3939// /
@@ -44,9 +44,9 @@ class BareElinkDecoder
4444 // / Constructor.
4545 // / \param dsId the (electronic) id of the dual sampa this elink
4646 // / is connected to
47- // / \param sampaChannelHandler a callable that is passed
48- // / each SampaCluster that will be decoded
49- BareElinkDecoder (DsElecId dsId, SampaChannelHandler sampaChannelHandler );
47+ // / \param decodedDataHandlers a structure with various callable that
48+ // / handle the Sampa packets and decoding errors
49+ BareElinkDecoder (DsElecId dsId, DecodedDataHandlers decodedDataHandlers );
5050
5151 /* * @name Main interface
5252 */
@@ -104,7 +104,7 @@ class BareElinkDecoder
104104
105105 private:
106106 DsElecId mDsId ;
107- SampaChannelHandler mSampaChannelHandler ; // < The callable that will deal with the SampaCluster objects we decode
107+ DecodedDataHandlers mDecodedDataHandlers ; // < The structure with the callables that deal with the Sampa packets and the decoding errors
108108 SampaHeader mSampaHeader ; // < Current SampaHeader
109109 uint64_t mBitBuffer ; // < Our internal bit stream buffer
110110 /* * @name internal global counters
@@ -154,9 +154,9 @@ std::string bitBufferString(const std::bitset<50>& bs, int imax)
154154
155155template <typename CHARGESUM>
156156BareElinkDecoder<CHARGESUM>::BareElinkDecoder(DsElecId dsId,
157- SampaChannelHandler sampaChannelHandler )
157+ DecodedDataHandlers decodedDataHandlers )
158158 : mDsId {dsId},
159- mSampaChannelHandler {sampaChannelHandler },
159+ mDecodedDataHandlers {decodedDataHandlers },
160160 mSampaHeader {},
161161 mBitBuffer {},
162162 mNofSync {},
@@ -422,20 +422,20 @@ std::ostream& operator<<(std::ostream& os, const o2::mch::raw::BareElinkDecoder<
422422template <>
423423void BareElinkDecoder<ChargeSumMode>::sendCluster()
424424{
425- if ( mSampaChannelHandler ) {
426- mSampaChannelHandler ( mDsId ,
427- channelNumber64 (mSampaHeader ),
428- SampaCluster (mTimestamp , mSampaHeader .bunchCrossingCounter (), mClusterSum , mClusterSize ));
425+ SampaChannelHandler handler = mDecodedDataHandlers . sampaChannelHandler ;
426+ if (handler) {
427+ handler ( mDsId , channelNumber64 (mSampaHeader ),
428+ SampaCluster (mTimestamp , mSampaHeader .bunchCrossingCounter (), mClusterSum , mClusterSize ));
429429 }
430430}
431431
432432template <>
433433void BareElinkDecoder<SampleMode>::sendCluster()
434434{
435- if ( mSampaChannelHandler ) {
436- mSampaChannelHandler ( mDsId ,
437- channelNumber64 (mSampaHeader ),
438- SampaCluster (mTimestamp , mSampaHeader .bunchCrossingCounter (), mSamples ));
435+ SampaChannelHandler handler = mDecodedDataHandlers . sampaChannelHandler ;
436+ if (handler) {
437+ handler ( mDsId , channelNumber64 (mSampaHeader ),
438+ SampaCluster (mTimestamp , mSampaHeader .bunchCrossingCounter (), mSamples ));
439439 }
440440 mSamples .clear ();
441441}
0 commit comments