Project
Loading...
Searching...
No Matches
testUserLogicEndpointDecoder.cxx File Reference
#include <boost/test/unit_test.hpp>
#include "Assertions.h"
#include "DetectorsRaw/RDHUtils.h"
#include "DumpBuffer.h"
#include "MCHRawCommon/DataFormats.h"
#include "MCHRawCommon/SampaHeader.h"
#include "MCHRawDecoder/PageDecoder.h"
#include "MCHRawDecoder/DecodedDataHandlers.h"
#include "MCHRawEncoderPayload/DataBlock.h"
#include "MCHRawEncoderPayload/PayloadEncoder.h"
#include "MoveBuffer.h"
#include "RDHManip.h"
#include "UserLogicEndpointDecoder.h"
#include <fmt/printf.h>
#include <fstream>
#include <iostream>
#include <boost/test/data/test_case.hpp>
#include <boost/mpl/list.hpp>

Go to the source code of this file.

Classes

struct  V0
 
struct  V1
 

Macros

#define BOOST_TEST_MODULE   Test MCHRaw UserLogicElinkDecoder
 
#define BOOST_TEST_MAIN
 
#define BOOST_TEST_DYN_LINK
 

Typedefs

typedef boost::mpl::list< V0, V1testTypes
 

Functions

SampaChannelHandler handlePacket (std::string &result)
 
SampaErrorHandler handleError (std::string &result)
 
std::vector< std::byte > convertBuffer2PayloadBuffer (gsl::span< const std::byte > buffer, std::optional< size_t > insertSync=std::nullopt)
 
template<typename CHARGESUM , int VERSION>
std::string decodeBuffer (int feeId, gsl::span< const std::byte > buffer)
 
template<typename CHARGESUM , int VERSION>
std::string testPayloadDecode (DsElecId ds1, DualSampaChannelId ch1, const std::vector< SampaCluster > &clustersFirstChannel, DsElecId ds2=DsElecId{0, 0, 0}, DualSampaChannelId ch2=47, const std::vector< SampaCluster > &clustersSecondChannel={}, std::optional< size_t > insertSync=std::nullopt)
 
template<int VERSION>
std::vector< uint64_t > convert (gsl::span< const uint64_t > page)
 
template<>
std::vector< uint64_t > convert< 0 > (gsl::span< const uint64_t > page)
 
template<>
std::vector< uint64_t > convert< 1 > (gsl::span< const uint64_t > page)
 
template<int VERSION = 0>
std::string testPayloadDecodeCruPages (gsl::span< const uint64_t > ipage)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (SampleModeSimplest, V, testTypes)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (SampleModeSimple, V, testTypes)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (SampleModeTwoChannels, V, testTypes)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (ChargeSumModeSimplest, V, testTypes)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (ChargeSumModeSimple, V, testTypes)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (ChargeSumModeTwoChannels, V, testTypes)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (SyncInTheMiddleChargeSumModeTwoChannels, V, testTypes)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (TestCruPageOK, V, testTypes)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (TestCruPageBadClusterSize, V, testTypes)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (TestCruPageBadN10bitWords, V, testTypes)
 

Variables

const uint64_t CruPageOK []
 
const uint64_t CruPageBadClusterSize []
 
const uint64_t CruPageBadN10bitWords []
 

Macro Definition Documentation

◆ BOOST_TEST_DYN_LINK

#define BOOST_TEST_DYN_LINK

Definition at line 17 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_TEST_MAIN

#define BOOST_TEST_MAIN

Definition at line 16 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   Test MCHRaw UserLogicElinkDecoder
Author
Laurent Aphecetche

Definition at line 15 of file testUserLogicEndpointDecoder.cxx.

Typedef Documentation

◆ testTypes

typedef boost::mpl::list<V0, V1> testTypes

Definition at line 285 of file testUserLogicEndpointDecoder.cxx.

Function Documentation

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [1/10]

BOOST_AUTO_TEST_CASE_TEMPLATE ( ChargeSumModeSimple  ,
,
testTypes   
)

Definition at line 329 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [2/10]

BOOST_AUTO_TEST_CASE_TEMPLATE ( ChargeSumModeSimplest  ,
,
testTypes   
)

Definition at line 320 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [3/10]

BOOST_AUTO_TEST_CASE_TEMPLATE ( ChargeSumModeTwoChannels  ,
,
testTypes   
)

Definition at line 341 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [4/10]

BOOST_AUTO_TEST_CASE_TEMPLATE ( SampleModeSimple  ,
,
testTypes   
)

Definition at line 300 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [5/10]

BOOST_AUTO_TEST_CASE_TEMPLATE ( SampleModeSimplest  ,
,
testTypes   
)

Definition at line 291 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [6/10]

BOOST_AUTO_TEST_CASE_TEMPLATE ( SampleModeTwoChannels  ,
,
testTypes   
)

Definition at line 309 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [7/10]

BOOST_AUTO_TEST_CASE_TEMPLATE ( SyncInTheMiddleChargeSumModeTwoChannels  ,
,
testTypes   
)

Definition at line 356 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [8/10]

BOOST_AUTO_TEST_CASE_TEMPLATE ( TestCruPageBadClusterSize  ,
,
testTypes   
)

Definition at line 385 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [9/10]

BOOST_AUTO_TEST_CASE_TEMPLATE ( TestCruPageBadN10bitWords  ,
,
testTypes   
)

Definition at line 393 of file testUserLogicEndpointDecoder.cxx.

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [10/10]

BOOST_AUTO_TEST_CASE_TEMPLATE ( TestCruPageOK  ,
,
testTypes   
)

Definition at line 376 of file testUserLogicEndpointDecoder.cxx.

◆ convert()

template<int VERSION>
std::vector< uint64_t > convert ( gsl::span< const uint64_t >  page)

◆ convert< 0 >()

template<>
std::vector< uint64_t > convert< 0 > ( gsl::span< const uint64_t >  page)

Definition at line 224 of file testUserLogicEndpointDecoder.cxx.

◆ convert< 1 >()

template<>
std::vector< uint64_t > convert< 1 > ( gsl::span< const uint64_t >  page)

Definition at line 224 of file testUserLogicEndpointDecoder.cxx.

◆ convertBuffer2PayloadBuffer()

std::vector< std::byte > convertBuffer2PayloadBuffer ( gsl::span< const std::byte >  buffer,
std::optional< size_t >  insertSync = std::nullopt 
)

Definition at line 132 of file testUserLogicEndpointDecoder.cxx.

◆ decodeBuffer()

template<typename CHARGESUM , int VERSION>
std::string decodeBuffer ( int  feeId,
gsl::span< const std::byte >  buffer 
)

Definition at line 165 of file testUserLogicEndpointDecoder.cxx.

◆ handleError()

SampaErrorHandler handleError ( std::string result)

Definition at line 124 of file testUserLogicEndpointDecoder.cxx.

◆ handlePacket()

SampaChannelHandler handlePacket ( std::string result)

Definition at line 109 of file testUserLogicEndpointDecoder.cxx.

◆ testPayloadDecode()

template<typename CHARGESUM , int VERSION>
std::string testPayloadDecode ( DsElecId  ds1,
DualSampaChannelId  ch1,
const std::vector< SampaCluster > &  clustersFirstChannel,
DsElecId  ds2 = DsElecId{0, 0, 0},
DualSampaChannelId  ch2 = 47,
const std::vector< SampaCluster > &  clustersSecondChannel = {},
std::optional< size_t >  insertSync = std::nullopt 
)

Definition at line 178 of file testUserLogicEndpointDecoder.cxx.

◆ testPayloadDecodeCruPages()

template<int VERSION = 0>
std::string testPayloadDecodeCruPages ( gsl::span< const uint64_t >  ipage)

Definition at line 257 of file testUserLogicEndpointDecoder.cxx.

Variable Documentation

◆ CruPageBadClusterSize

const uint64_t CruPageBadClusterSize[]
Initial value:
= {
0x00000A0000124006ul,
0x000C4C0F00A000A0ul,
0x010E853D00000570ul,
0x0000000000000000ul,
0x0000000000006000ul,
0x0000000000000000ul,
0x0000000000000000ul,
0x0000000000000000ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x1555540F00113ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x3F04ECA103E5Cul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x0000040215C0Eul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x00000C0301004ul,
((0x0204ul << 50) & 0xFFFC000000000000ul) + 0x0000000000400ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x1555540F00113ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x1F080CA100E4Dul,
((0x0204ul << 50) & 0xFFFC000000000000ul) + 0x00044C0100001ul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul}

Definition at line 63 of file testUserLogicEndpointDecoder.cxx.

◆ CruPageBadN10bitWords

const uint64_t CruPageBadN10bitWords[]
Initial value:
= {
0x00000A0000124006ul,
0x000C4C0F00A000A0ul,
0x010E853D00000570ul,
0x0000000000000000ul,
0x0000000000006000ul,
0x0000000000000000ul,
0x0000000000000000ul,
0x0000000000000000ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x1555540F00113ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x3F04ECA103E5Cul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x0000040215C08ul,
((0x0204ul << 50) & 0xFFFC000000000000ul) + 0x0000000000400ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x1555540F00113ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x1F080CA100E4Dul,
((0x0204ul << 50) & 0xFFFC000000000000ul) + 0x00044C0100001ul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul
}

Definition at line 85 of file testUserLogicEndpointDecoder.cxx.

◆ CruPageOK

const uint64_t CruPageOK[]
Initial value:
= {
0x00000A0000124006ul,
0x000C4C0F00A000A0ul,
0x010E853D00000570ul,
0x0000000000000000ul,
0x0000000000006000ul,
0x0000000000000000ul,
0x0000000000000000ul,
0x0000000000000000ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x1555540F00113ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x3F04ECA103E5Cul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x0000040215C0Dul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x00000C0301004ul,
((0x0204ul << 50) & 0xFFFC000000000000ul) + 0x0000000000400ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x1555540F00113ul,
((0x0200ul << 50) & 0xFFFC000000000000ul) + 0x1F080CA100E4Dul,
((0x0204ul << 50) & 0xFFFC000000000000ul) + 0x00044C0100001ul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul,
((0x3FBBul << 50) & 0xFFFC000000000000ul) + 0x1DEEDFEEDDEEDul}

Definition at line 41 of file testUserLogicEndpointDecoder.cxx.