-
Notifications
You must be signed in to change notification settings - Fork 13
Lazy decoding
Jonas Kunze edited this page Mar 24, 2015
·
3 revisions
Raw data coming from the detectors can be decoded by using the DecoderHandler
class. This handler implements a lazy decoding which means that data fragments are automatically decoded but not before you request a read access to it.
In the header file of this class na62-trigger-algorithms/common/decoding/DecoderHandler.h
a makro called ADD_TRB
is defined that can be used to create all the needed logic for a detector using tel boards for the read-out. When calling ADD_TRB(MyDetector)
in the body of the DecoderHandler
class following methods are generated:
- TrbFragmentDecoder getDecodedMyDetectorFragment(const uint N)
- Returns the TrbFragmentDecoder for the N'th fragment of MyDetector. This can be used if you don't want to iterate through all fragments but only get the data of one specific fragment
- uint getNumberOfMyDetectorFragments()
- Returns the number of fragments available. This is the number of active Tel boards set when starting the PC-farm (see the "activeSourceIDs" parameter). This equals the maximum number minus one that you may call "getDecodedMyDetectorFragment" with
- DecoderRange getMyDetectorDecoderRange()
- Returns an iterator that can be used in a range based loop. This way you can iterate through all available fragments with still having lazy decoding enabled
In the future similar methods for the SRB and CREAM data must be implemented! Currently there is no decoder for this data available yet.
@angelaromano could you please say a few words here?
uint_fast8_t processKtagTrigger(DecoderHandler& decoder) {
uint fragmentSpecificVariables[decoder->getNumberOfMyDetectorFragments()];
for (TrbFragmentDecoder* fragment : decoder.getMyDetectorDecoderRange()) {
const uint64_t* const edge_times = fragment->getTimes();
const uint_fast8_t* const edge_chIDs = fragment->getChIDs();
const uint_fast8_t* const edge_tdcIDs = fragment->getTdcIDs();
const bool* const edge_isLeadings = fragment->getIsLeadings();
fragmentSpecificVariables[fragment->getFragmentNumber()] = someMethod(fragment);
}
}