Belle II Software  release-08-01-10
PreRawCOPPERFormat_v1 Class Reference

The Raw COPPER class ver.1 ( the latest version since May, 2014 ) This class stores data received by COPPER via belle2linkt Data from all detectors except PXD are stored in this class. More...

#include <PreRawCOPPERFormat_v1.h>

Inheritance diagram for PreRawCOPPERFormat_v1:
Collaboration diagram for PreRawCOPPERFormat_v1:

Public Types

enum  {
  SIZE_COPPER_DRIVER_HEADER = 7 ,
  SIZE_COPPER_DRIVER_TRAILER = 2
}
 Copper data words = ( total_data_length in COPPER header ) + COPPER_HEADER_TRAILER_NWORDS.
 
enum  {
  POS_MAGIC_COPPER_1 = 0 ,
  POS_EVE_NUM_COPPER = 1 ,
  POS_SUBSYSTEM_ID = 2 ,
  POS_CRATE_ID = 3 ,
  POS_SLOT_ID = 4 ,
  POS_MAGIC_COPPER_2 = 7 ,
  POS_DATA_LENGTH = 8 ,
  POS_CH_A_DATA_LENGTH = 9 ,
  POS_CH_B_DATA_LENGTH = 10 ,
  POS_CH_C_DATA_LENGTH = 11 ,
  POS_CH_D_DATA_LENGTH = 12 ,
  SIZE_COPPER_HEADER = 13
}
 
enum  {
  POS_MAGIC_COPPER_3 = 0 ,
  POS_CHKSUM_COPPER = 1 ,
  POS_MAGIC_COPPER_4 = 2 ,
  SIZE_COPPER_TRAILER = 3
}
 
enum  {
  POS_MAGIC_B2LHSLB = 0 ,
  SIZE_B2LHSLB_HEADER = 1
}
 
enum  {
  POS_TT_CTIME_TYPE = 0 ,
  POS_TT_TAG = 1 ,
  POS_TT_UTIME = 2 ,
  POS_EXP_RUN = 3 ,
  POS_B2L_CTIME = 4 ,
  SIZE_B2LFEE_HEADER = 5
}
 
enum  {
  POS_TT_CTIME_B2LFEE = 0 ,
  POS_CHKSUM_B2LFEE = 1 ,
  SIZE_B2LFEE_TRAILER = 2
}
 
enum  {
  POS_CHKSUM_B2LHSLB = 0 ,
  SIZE_B2LHSLB_TRAILER = 1
}
 
enum  {
  COPPER_MAGIC_DRIVER_HEADER = 0x7FFF0008 ,
  COPPER_MAGIC_FPGA_HEADER = 0xFFFFFAFA ,
  COPPER_MAGIC_FPGA_TRAILER = 0xFFFFF5F5 ,
  COPPER_MAGIC_DRIVER_TRAILER = 0x7FFF0009
}
 
enum  {
  B2LHSLB_HEADER_MAGIC = 0xFFAA0000 ,
  B2LHSLB_TRAILER_MAGIC = 0xFF550000
}
 
enum  { DATA_FORMAT_VERSION = 1 }
 Format version number.
 
enum  {
  POS_NWORDS = 0 ,
  POS_NODE_ID = 6
}
 
enum  {
  POS_FTSW_ID_OLD = 5 ,
  TEMP_POS_NWORDS_HEADER = 1 ,
  OLD_FTSW_NWORDS_HEADER = 6
}
 

Public Member Functions

 PreRawCOPPERFormat_v1 ()
 Default constructor.
 
virtual ~PreRawCOPPERFormat_v1 ()
 Constructor using existing pointer to raw data buffer. More...
 
int GetDetectorNwords (int n, int finesse_num) OVERRIDE_CPP17
 get Detector buffer length
 
int * Get1stDetectorBuffer (int n) OVERRIDE_CPP17
 get Detector buffer of slot A
 
int * Get2ndDetectorBuffer (int n) OVERRIDE_CPP17
 get Detector Buffer of slot B
 
int * Get3rdDetectorBuffer (int n) OVERRIDE_CPP17
 get Detector Buffer of slot C
 
int * Get4thDetectorBuffer (int n) OVERRIDE_CPP17
 get Detector Buffer of slot D
 
unsigned int GetCOPPERCounter (int n) OVERRIDE_CPP17
 get posistion of COPPER block in unit of word More...
 
int GetOffset1stFINESSE (int n) OVERRIDE_CPP17
 get # of offset words for FINESSE slot A buffer position
 
int GetFINESSENwords (int n, int finesse) OVERRIDE_CPP17
 get data size of FINESSE buffer
 
virtual int * GetExpRunSubrunBuf (int n) OVERRIDE_CPP17
 get b2l block from "FEE b2link header" More...
 
virtual unsigned int GetB2LFEE32bitEventNumber (int n) OVERRIDE_CPP17
 get b2l block from "FEE b2link header"
 
unsigned int GetMagicDriverHeader (int n) OVERRIDE_CPP17
 get magic word of COPPER driver header
 
unsigned int GetMagicFPGAHeader (int n) OVERRIDE_CPP17
 get magic word of COPPER FPGA header
 
unsigned int GetMagicFPGATrailer (int n) OVERRIDE_CPP17
 get magic word of COPPER FPGA trailer
 
unsigned int GetMagicDriverTrailer (int n) OVERRIDE_CPP17
 get magic word of COPPER driver trailer
 
unsigned int GetTrailerChksum (int n) OVERRIDE_CPP17
 get a checksum on trailer
 
bool CheckCOPPERMagic (int n) OVERRIDE_CPP17
 Check if COPPER Magic words are correct.
 
unsigned int FillTopBlockRawHeader (unsigned int m_node_id, unsigned int prev_eve32, unsigned int prev_exprunsubrun_no, unsigned int *cur_exprunsubrun_no) OVERRIDE_CPP17
 should be called by DeSerializerCOPPER.cc and fill contents in RawHeader
 
unsigned int GetDriverChkSum (int n) OVERRIDE_CPP17
 read COPPER driver's checksum value
 
unsigned int CalcDriverChkSum (int n) OVERRIDE_CPP17
 calc COPPER driver's checksum value
 
void CheckData (int n, unsigned int prev_evenum, unsigned int *cur_evenum, unsigned int prev_copper_ctr, unsigned int *cur_copper_ctr, unsigned int prev_exprunsubrun_no, unsigned int *cur_exprunsubrun_no) OVERRIDE_CPP17
 check data contents
 
void CheckUtimeCtimeTRGType (int n) OVERRIDE_CPP17
 check data contents
 
int CheckB2LHSLBMagicWords (int *finesse_buf, int finesse_nwords)
 check magic words of B2link HSLB header/trailer
 
int CalcReducedDataSize (int *bufin, int nwords, int num_events, int num_nodes)
 reduce and merge header/trailer
 
void CopyReducedData (int *bufin, int nwords, int num_events, int num_nodes, int *buf_to, int *nwords_to)
 reduce and merge header/trailer
 
int CalcReducedNwords (int n)
 calculate reduced data size
 
int CopyReducedBuffer (int n, int *buf_to)
 copy data to reduced buffer
 
int CheckCRC16 (int n, int finesse_num)
 check CRC16 in B2LFEE trailer
 
int * PackDetectorBuf (int *packed_buf_nwords, int *detector_buf_1st, int nwords_1st, int *detector_buf_2nd, int nwords_2nd, int *detector_buf_3rd, int nwords_3rd, int *detector_buf_4th, int nwords_4th, RawCOPPERPackerInfo rawcprpacker_info) OVERRIDE_CPP17
 Pack data (format ver. = -1 -> Select the latest format version)
 
int Get1stDetectorNwords (int n) OVERRIDE_CPP17
 get Detector buffer length of slot A
 
int Get2ndDetectorNwords (int n) OVERRIDE_CPP17
 get Detector buffer length of slot B
 
int Get3rdDetectorNwords (int n) OVERRIDE_CPP17
 get Detector buffer length of slot C
 
int Get4thDetectorNwords (int n) OVERRIDE_CPP17
 get Detector buffer length of slot D
 
int * GetRawTrlBufPtr (int n) OVERRIDE_CPP17
 get buffer pointer of rawcopper trailer
 
int GetExpNo (int n) OVERRIDE_CPP17
 get Experimental # from header
 
unsigned int GetExpRunSubrun (int n) OVERRIDE_CPP17
 get Experimental # from header
 
int GetRunNo (int n) OVERRIDE_CPP17
 Exp# (10bit) run# (14bit) restart # (8bit)
 
int GetSubRunNo (int n) OVERRIDE_CPP17
 get run # (14bit)
 
unsigned int GetEveNo (int n) OVERRIDE_CPP17
 get subrun #(8bit)
 
int GetDataType (int n) OVERRIDE_CPP17
 get contents of header
 
int GetTruncMask (int n) OVERRIDE_CPP17
 get contents of header
 
unsigned int GetErrorBitFlag (int n) OVERRIDE_CPP17
 get contents of header More...
 
void AddErrorBitFlag (int n, unsigned int error_bit_flag) OVERRIDE_CPP17
 Add Detected Error bitflag.
 
unsigned int GetNodeID (int n) OVERRIDE_CPP17
 get node-ID from data
 
virtual int GetNumFINESSEBlock (int n) OVERRIDE_CPP17
 get # of FINNESEs which contains data
 
int Get1stFINESSENwords (int n) OVERRIDE_CPP17
 get data size of FINESSE slot A buffer
 
int Get2ndFINESSENwords (int n) OVERRIDE_CPP17
 get data size of FINESSE slot B buffer
 
int Get3rdFINESSENwords (int n) OVERRIDE_CPP17
 get data size of FINESSE slot C buffer
 
int Get4thFINESSENwords (int n) OVERRIDE_CPP17
 get data size of FINESSE slot D buffer
 
unsigned int GetTTCtimeTRGType (int n) OVERRIDE_CPP17
 get b2l block from "FEE b2link header" More...
 
unsigned int GetTTUtime (int n) OVERRIDE_CPP17
 Check if COPPER Magic words are correct.
 
int GetTTCtime (int n) OVERRIDE_CPP17
 Get ctime.
 
int GetTRGType (int n) OVERRIDE_CPP17
 Get trgtype.
 
void GetTTTimeVal (int n, struct timeval *tv) OVERRIDE_CPP17
 Get timeval.
 
int GetMaxNumOfCh (int n) OVERRIDE_CPP17
 Get the max number of channels in a readout board.
 
virtual int * GetDetectorBuffer (int n, int finesse_num)
 get Detector buffer
 
virtual int * GetRawHdrBufPtr (int n)
 get buffer pointer of rawcopper header(Currently same as GetBufferPos)
 
virtual int * GetFINESSEBuffer (int n, int finesse_num)
 get FINESSE buffer pointer
 
virtual int * Get1stFINESSEBuffer (int n)
 get FINESSE buffer pointer for slot A
 
virtual int * Get2ndFINESSEBuffer (int n)
 get FINESSE buffer pointer for slot B
 
virtual int * Get3rdFINESSEBuffer (int n)
 get FINESSE buffer pointer for slot C
 
virtual int * Get4thFINESSEBuffer (int n)
 get FINESSE buffer pointer for slot D
 
virtual int GetPacketCRCError (int n)
 check CRC packet Error
 
virtual int GetEventCRCError (int n)
 check CRC event Error
 
virtual int GetEventCRC16Value (int n, int finesse_num)
 Get Event CRC16 value.
 
virtual int GetOffsetFINESSE (int n, int finesse)
 get # of offset words
 
virtual int GetOffset2ndFINESSE (int n)
 get # of offset words for FINESSE slot B buffer position
 
virtual int GetOffset3rdFINESSE (int n)
 get # of offset words for FINESSE slot C buffer position
 
virtual int GetOffset4thFINESSE (int n)
 get # of offset words for FINESSE slot D buffer position
 
virtual unsigned int CalcXORChecksum (int *buf, int nwords)
 calc XOR checksum
 
virtual int * PackDetectorBuf (int *packed_buf_nwords, int *const(&detector_buf_ch)[MAX_PCIE40_CH], int const(&nwords_ch)[MAX_PCIE40_CH], RawCOPPERPackerInfo rawcpr_info)
 Pack data for PCIe40 data-format.
 
virtual void CompareHeaderValue (int n, const unsigned int(&input_val)[MAX_PCIE40_CH], std::vector< std::vector< unsigned int > > &result)
 Compare value from different channels and make a statistics table.
 
virtual void GetNodeName (int n, char *node_name, int bufsize)
 Get hostname of a node from the RawCOPPER header.
 
virtual void GetNodeName (char *node_name, unsigned int node_id, int bufsize)
 Get hostname of a node from an argument.
 
virtual bool CheckOnlineRemovedDataBit (int n, int finesse_num)
 Check if COPPER Magic words are correct.
 
virtual void SetBuffer (int *bufin, int nwords, int delete_flag, int num_events, int num_nodes)
 set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
 
virtual int TotalBufNwords ()
 Get total length of m_buffer.
 
virtual int GetBufferPos (int n)
 get position of data block in word
 
virtual int * GetBuffer (int n)
 get nth buffer pointer
 
virtual int * GetWholeBuffer ()
 get pointer to buffer(m_buffer)
 
virtual int GetNumEntries ()
 get # of data blocks = (# of nodes)*(# of events)
 
virtual int GetNumNodes ()
 get # of data sources(e.g. # of COPPER boards) in m_buffer
 
virtual int GetNumEvents ()
 get # of events in m_buffer
 
virtual int GetPreAllocFlag ()
 get malloc_flag
 
virtual int GetBlockNwords (int n)
 get size of a data block
 
virtual int CheckFTSWID (int n)
 get FTSW ID to check whether this data block is FTSW data or not
 
virtual int CheckTLUID (int n)
 get FTSW ID to check whether this data block is FTSW data or not
 
virtual void CopyBlock (int n, int *buf_to)
 Copy one datablock to buffer.
 
virtual void PrintData (int *buf, int nwords)
 print data
 

Public Attributes

PostRawCOPPERFormat_v1 m_reduced_rawcpr
 data fromat after size reduction
 
RawHeader_v1 tmp_header
 header ( not recorded )
 
RawTrailer_v1 tmp_trailer
 trailer ( not recorded )
 

Protected Attributes

int m_nwords
 number of words of buffer
 
int m_num_nodes
 number of nodes in this object
 
int m_num_events
 number of events in this object
 
int * m_buffer
 Buffer.
 
int m_use_prealloc_buf
 not recorded More...
 

Detailed Description

The Raw COPPER class ver.1 ( the latest version since May, 2014 ) This class stores data received by COPPER via belle2linkt Data from all detectors except PXD are stored in this class.

Definition at line 33 of file PreRawCOPPERFormat_v1.h.

Constructor & Destructor Documentation

◆ ~PreRawCOPPERFormat_v1()

~PreRawCOPPERFormat_v1 ( )
virtual

Constructor using existing pointer to raw data buffer.

Destructor

Definition at line 25 of file PreRawCOPPERFormat_v1.cc.

26 {
27 }

Member Data Documentation

◆ m_use_prealloc_buf

int m_use_prealloc_buf
protectedinherited

not recorded

flag for deleting m_buffer in destructer( 0:delete, 1: not delete) When using pre-allocated buffer, the buffer should be reused and not deleted in the destructer

Definition at line 102 of file RawDataBlockFormat.h.


The documentation for this class was generated from the following files: