Belle II Software development
RawCDC Class Reference

The Raw CDC class Class for RawCOPPER class data taken by CDC Currently, this class is almost same as RawCOPPER class. More...

#include <RawCDC.h>

Inheritance diagram for RawCDC:
RawCOPPER RawDataBlock

Public Types

enum  {
  POS_FORMAT_VERSION = 1 ,
  FORMAT_MASK = 0x0000FF00
}
 

Public Member Functions

 RawCDC ()
 Default constructor.
 
virtual ~RawCDC ()
 Destructor.
 
 ClassDef (RawCDC, 1)
 To derive from TObject.
 
void SetBuffer (int *bufin, int nwords, int delete_flag, int num_events, int num_nodes) OVERRIDE_CPP17
 set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
 
int GetDetectorNwords (int n, int finesse_num)
 get Detector buffer length
 
int Get1stDetectorNwords (int n)
 get Detector buffer length of slot A
 
int Get2ndDetectorNwords (int n)
 get Detector buffer length of slot B
 
int Get3rdDetectorNwords (int n)
 get Detector buffer length of slot C
 
int Get4thDetectorNwords (int n)
 get Detector buffer length of slot D
 
int * GetDetectorBuffer (int n, int finesse_num)
 get Detector buffer
 
int * Get1stDetectorBuffer (int n)
 get Detector buffer of slot A
 
int * Get2ndDetectorBuffer (int n)
 get Detector Buffer of slot B
 
int * Get3rdDetectorBuffer (int n)
 get Detector Buffer of slot C
 
int * Get4thDetectorBuffer (int n)
 get Detector Buffer of slot D
 
virtual int GetBufferPos (int n) OVERRIDE_CPP17
 get posistion of COPPER block in unit of word
 
virtual int * GetRawHdrBufPtr (int n)
 get buffer pointer of rawcopper header(Currently same as GetBufferPos)
 
virtual int * GetRawTrlBufPtr (int n)
 get buffer pointer of rawcopper trailer
 
int * GetFINESSEBuffer (int n, int finesse_num)
 get FINESSE buffer pointer
 
int * Get1stFINESSEBuffer (int n)
 get FINESSE buffer pointer for slot A
 
int * Get2ndFINESSEBuffer (int n)
 get FINESSE buffer pointer for slot B
 
int * Get3rdFINESSEBuffer (int n)
 get FINESSE buffer pointer for slot C
 
int * Get4thFINESSEBuffer (int n)
 get FINESSE buffer pointer for slot D
 
int GetExpNo (int n)
 get Experimental # from header
 
unsigned int GetExpRunSubrun (int n)
 get Experimental # from header
 
int GetRunNo (int n)
 Exp# (10bit) run# (14bit) restart # (8bit)
 
int GetSubRunNo (int n)
 get run # (14bit)
 
unsigned int GetEveNo (int n)
 get subrun #(8bit)
 
int GetDataType (int n)
 get contents of header
 
int GetTruncMask (int n)
 get contents of header
 
unsigned int GetErrorBitFlag (int n)
 get contents of header
 
void AddErrorBitFlag (int n, unsigned int error_bit_flag)
 Get Detected Error bitflag.
 
int GetPacketCRCError (int n)
 check CRC packet Error
 
int GetEventCRCError (int n)
 check CRC event Error
 
int GetEventCRC16Value (int n, int finesse_num)
 Get Event CRC16 value.
 
unsigned int GetNodeID (int n)
 get node-ID from data
 
virtual unsigned int GetCOPPERCounter (int n)
 get COPPER counter(not event number)
 
virtual int GetNumFINESSEBlock (int n)
 get # of FINNESEs which contains data
 
int GetOffsetFINESSE (int n, int finesse)
 get # of offset words
 
int GetOffset1stFINESSE (int n)
 get # of offset words for FINESSE slot A buffer position
 
int GetOffset2ndFINESSE (int n)
 get # of offset words for FINESSE slot B buffer position
 
int GetOffset3rdFINESSE (int n)
 get # of offset words for FINESSE slot C buffer position
 
int GetOffset4thFINESSE (int n)
 get # of offset words for FINESSE slot D buffer position
 
int GetFINESSENwords (int n, int finesse)
 get data size of FINESSE buffer
 
int Get1stFINESSENwords (int n)
 get data size of FINESSE slot A buffer
 
int Get2ndFINESSENwords (int n)
 get data size of FINESSE slot B buffer
 
int Get3rdFINESSENwords (int n)
 get data size of FINESSE slot C buffer
 
int Get4thFINESSENwords (int n)
 get data size of FINESSE slot D buffer
 
virtual int * GetExpRunSubrunBuf (int n)
 get b2l block from "FEE b2link header"
 
virtual unsigned int GetB2LFEE32bitEventNumber (int n)
 get b2l block from "FEE b2link header"
 
unsigned int GetMagicDriverHeader (int n)
 get magic word of COPPER driver header
 
unsigned int GetMagicFPGAHeader (int n)
 get magic word of COPPER FPGA header
 
unsigned int GetMagicFPGATrailer (int n)
 get magic word of COPPER FPGA trailer
 
unsigned int GetMagicDriverTrailer (int n)
 get magic word of COPPER driver trailer
 
unsigned int GetTrailerChksum (int n)
 Get checksum in RawTrailer.
 
bool CheckCOPPERMagic (int n)
 Check if COPPER Magic words are correct.
 
unsigned int GetTTCtimeTRGType (int n)
 Check if COPPER Magic words are correct.
 
unsigned int GetTTUtime (int n)
 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)
 should be called by DeSerializerCOPPER.cc and fill contents in RawHeader
 
unsigned int GetDriverChkSum (int n)
 read COPPER driver's checksum value
 
unsigned int CalcDriverChkSum (int n)
 calc COPPER driver's checksum value
 
unsigned int CalcXORChecksum (int *buf, int nwords)
 calc XOR checksum
 
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)
 check data contents
 
void CheckUtimeCtimeTRGType (int n)
 check data contents
 
int GetTTCtime (int n)
 Get ctime.
 
int GetTRGType (int n)
 Get trgtype.
 
void GetTTTimeVal (int n, struct timeval *tv)
 Get timeval.
 
void SetVersion ()
 read data, detect and set the version number of the data format
 
void SetVersion (std::string class_name)
 Get timeval.
 
void CheckVersionSetBuffer ()
 Check the version number of data format.
 
void ShowBuffer ()
 show m_buffer
 
void PackDetectorBuf (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)
 Packer for RawCOPPER class Pack data (format ver.
 
void PackDetectorBuf (int *const(&detector_buf_ch)[MAX_PCIE40_CH], int const(&nwords_ch)[MAX_PCIE40_CH], RawCOPPERPackerInfo rawcprpacker_info)
 Pack data for PCIe40 data-format.
 
void PackDetectorBuf4DummyData (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)
 Pack dummy data (format ver. = -1 -> Select the latest format version)
 
int GetMaxNumOfCh (int n)
 Get the max number of channels in a readout board.
 
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.
 
bool CheckOnlineRemovedDataBit (int n, int finesse_num)
 check if this channel's data has been removed on a readout PC for CDC online "masking"
 
std::string getInfoHTML () const
 Return a short summary of this object's contents in HTML format.
 
virtual int TotalBufNwords ()
 Get total length of m_buffer.
 
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

RawCOPPERFormatm_access
 class to access
 
int m_version
 do not record
 
RawDataBlockFormatm_access_dblk
 class to access
 

Protected Member Functions

 ClassDefOverride (RawCOPPER, 3)
 do not record
 
 ClassDef (RawDataBlock, 3)
 not record
 

Protected Attributes

int m_nwords
 do not record
 
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
 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
 

Detailed Description

The Raw CDC class Class for RawCOPPER class data taken by CDC Currently, this class is almost same as RawCOPPER class.

Definition at line 27 of file RawCDC.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited

Definition at line 327 of file RawCOPPER.h.

327 {
328 POS_FORMAT_VERSION = 1,
329 FORMAT_MASK = 0x0000FF00
330 };

Constructor & Destructor Documentation

◆ RawCDC()

RawCDC ( )

Default constructor.

Definition at line 14 of file RawCDC.cc.

15{
16}

◆ ~RawCDC()

~RawCDC ( )
virtual

Destructor.

Definition at line 18 of file RawCDC.cc.

19{
20}

Member Function Documentation

◆ CheckFTSWID()

virtual int CheckFTSWID ( int  n)
inlinevirtualinherited

get FTSW ID to check whether this data block is FTSW data or not

Definition at line 101 of file RawDataBlock.h.

102 {
104 return m_access_dblk->CheckFTSWID(n);
105 }
virtual int CheckFTSWID(int n)
get FTSW ID to check whether this data block is FTSW data or not
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 )
int m_num_events
number of events in this object
Definition: RawDataBlock.h:151
int m_num_nodes
number of nodes in this object
Definition: RawDataBlock.h:148
int * m_buffer
Buffer.
Definition: RawDataBlock.h:154
int m_nwords
do not record
Definition: RawDataBlock.h:145
RawDataBlockFormat * m_access_dblk
class to access
Definition: RawDataBlock.h:141

◆ CheckTLUID()

virtual int CheckTLUID ( int  n)
inlinevirtualinherited

get FTSW ID to check whether this data block is FTSW data or not

Definition at line 108 of file RawDataBlock.h.

109 {
111 return m_access_dblk->CheckTLUID(n);
112 }
virtual int CheckTLUID(int n)
get FTSW ID to check whether this data block is FTSW data or not

◆ ClassDef()

ClassDef ( RawDataBlock  ,
 
)
protectedinherited

not record

To drive from TObject

◆ ClassDefOverride()

ClassDefOverride ( RawCOPPER  ,
 
)
protectedinherited

do not record

ver.2 Change FEE format as presented at B2GM in Nov.2013 ( Nov.20, 2013) ver.3 Change FEE format as presented at B2GM in Nov.2013 ( May 1, 2014) ver.4 Do not record m_access pointer ( Dec 19, 2014)

◆ CompareHeaderValue()

void CompareHeaderValue ( int  n,
const unsigned int(&)  input_val[MAX_PCIE40_CH],
std::vector< std::vector< unsigned int > > &  result 
)
inherited

Compare value from different channels and make a statistics table.

Definition at line 313 of file RawCOPPER.cc.

314{
316 m_access->CompareHeaderValue(n, input_val, result);
317 return;
318}
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.
RawCOPPERFormat * m_access
class to access
Definition: RawCOPPER.h:333
void CheckVersionSetBuffer()
Check the version number of data format.
Definition: RawCOPPER.h:741

◆ CopyBlock()

virtual void CopyBlock ( int  n,
int *  buf_to 
)
inlinevirtualinherited

Copy one datablock to buffer.

Definition at line 115 of file RawDataBlock.h.

116 {
118 return m_access_dblk->CopyBlock(n, buf_to);
119 }
virtual void CopyBlock(int n, int *buf_to)
Copy one datablock to buffer.

◆ GetBlockNwords()

virtual int GetBlockNwords ( int  n)
inlinevirtualinherited

get size of a data block

Definition at line 94 of file RawDataBlock.h.

95 {
98 }
virtual int GetBlockNwords(int n)
get size of a data block

◆ GetBuffer()

virtual int * GetBuffer ( int  n)
inlinevirtualinherited

get nth buffer pointer

Definition at line 53 of file RawDataBlock.h.

54 {
56 return m_access_dblk->GetBuffer(n);
57 }
virtual int * GetBuffer(int n)
get nth buffer pointer

◆ getInfoHTML()

std::string getInfoHTML ( ) const
inherited

Return a short summary of this object's contents in HTML format.

Definition at line 285 of file RawCOPPER.cc.

286{
287 std::stringstream s;
288 //TODO: All these methods should be const instead.
289 RawCOPPER* nonconst_this = const_cast<RawCOPPER*>(this);
290 nonconst_this->CheckVersionSetBuffer();
291
292 const int nEntries = nonconst_this->GetNumEntries();
293 s << "Entries: " << nEntries;
294 s << ", Total size (32bit words): " << m_nwords << "<br>";
295
296 s << "COPPER format version: " << m_version;
297
298 const char a = 'A'; //finesses are counted from A to D
299 for (int iEntry = 0; iEntry < nEntries; ++iEntry) {
300 s << "<h4>Entry " << iEntry << "</h4>";
301 s << "Node ID: 0x" << std::hex << nonconst_this->GetNodeID(iEntry) << std::dec;
302 for (int iFinesse = 0; iFinesse < 4; iFinesse++) {
303 const int nWords = nonconst_this->GetDetectorNwords(iEntry, iFinesse);
304 const int* buf = nonconst_this->GetDetectorBuffer(iEntry, iFinesse);
305 s << "<p>Finesse " << char(a + iFinesse) << " (Size: " << nWords << ")</p>";
306 s << HTML::getHexDump(buf, nWords) << "<br>";
307 }
308 }
309
310 return s.str();
311}
The Raw COPPER class This class stores data received by COPPER via belle2linkt Data from all detector...
Definition: RawCOPPER.h:52
int m_version
do not record
Definition: RawCOPPER.h:336
virtual int GetNumEntries()
get # of data blocks = (# of nodes)*(# of events)
Definition: RawDataBlock.h:67
int GetDetectorNwords(int n, int finesse_num)
get Detector buffer length
Definition: RawCOPPER.h:657
int * GetDetectorBuffer(int n, int finesse_num)
get Detector buffer
Definition: RawCOPPER.h:681
unsigned int GetNodeID(int n)
get node-ID from data
Definition: RawCOPPER.h:397
std::string getHexDump(const int *buf, int length)
Create hexdump of given buffer.
Definition: HTML.cc:121

◆ GetNumEntries()

virtual int GetNumEntries ( )
inlinevirtualinherited

get # of data blocks = (# of nodes)*(# of events)

Definition at line 67 of file RawDataBlock.h.

68 {
71 }
virtual int GetNumEntries()
get # of data blocks = (# of nodes)*(# of events)

◆ GetNumEvents()

virtual int GetNumEvents ( )
inlinevirtualinherited

get # of events in m_buffer

Definition at line 81 of file RawDataBlock.h.

82 {
85 }
virtual int GetNumEvents()
get # of events in m_buffer

◆ GetNumNodes()

virtual int GetNumNodes ( )
inlinevirtualinherited

get # of data sources(e.g. # of COPPER boards) in m_buffer

Definition at line 74 of file RawDataBlock.h.

75 {
77 return m_access_dblk->GetNumNodes();
78 }
virtual int GetNumNodes()
get # of data sources(e.g. # of COPPER boards) in m_buffer

◆ GetPreAllocFlag()

virtual int GetPreAllocFlag ( )
inlinevirtualinherited

get malloc_flag

Definition at line 88 of file RawDataBlock.h.

89 {
90 return m_use_prealloc_buf;
91 }
int m_use_prealloc_buf
flag for deleting m_buffer in destructer( 0:delete, 1: not delete) When using pre-allocated buffer,...
Definition: RawDataBlock.h:158

◆ GetWholeBuffer()

virtual int * GetWholeBuffer ( )
inlinevirtualinherited

get pointer to buffer(m_buffer)

Definition at line 60 of file RawDataBlock.h.

61 {
64 }
virtual int * GetWholeBuffer()
get pointer to buffer(m_buffer)

◆ PackDetectorBuf() [1/2]

void PackDetectorBuf ( int *const(&)  detector_buf_ch[MAX_PCIE40_CH],
int const(&)  nwords_ch[MAX_PCIE40_CH],
RawCOPPERPackerInfo  rawcprpacker_info 
)
inherited

Pack data for PCIe40 data-format.

Definition at line 216 of file RawCOPPER.cc.

219{
220 if (LATEST_POSTREDUCTION_FORMAT_VER < 4) {
221 char err_buf[500];
222 sprintf(err_buf, "This function must be used for PCIe40 data(ver.4 or later). Exiting...");
223 printf("%s", err_buf); fflush(stdout);
224 B2FATAL(err_buf);
225 }
226
227 if (m_access != NULL) {
228 delete m_access;
229 }
230
232 m_version = LATEST_POSTREDUCTION_FORMAT_VER;
233 m_num_events = 1;
234 m_num_nodes = 1;
235
236 int* packed_buf = NULL;
237 packed_buf = m_access->PackDetectorBuf(&m_nwords,
238 detector_buf_ch, nwords_ch,
239 rawcprpacker_info);
240
241 int delete_flag = 1; // Not use preallocated buffer. Delete m_buffer when destructer is called.
242 SetBuffer(packed_buf, m_nwords, delete_flag, m_num_events, m_num_nodes);
243
244 delete_flag = 0; // For m_access, need not to delete m_buffer
246
247 return;
248}
virtual 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)=0
Pack data (format ver. = -1 -> Select the latest format version)
void SetBuffer(int *bufin, int nwords, int delete_flag, int num_events, int num_nodes) OVERRIDE_CPP17
set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
Definition: RawCOPPER.cc:141

◆ PackDetectorBuf() [2/2]

void PackDetectorBuf ( 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 
)
inherited

Packer for RawCOPPER class Pack data (format ver.

= -1 -> Select the latest format version)

Definition at line 183 of file RawCOPPER.cc.

189{
190 // This function should be used for packing COPPER-format data.
191 if (m_access != NULL) {
192 delete m_access;
193 }
194 m_access = new PostRawCOPPERFormat_v2; // The latest version for COPPER-format
195 m_version = 2; // The latest version for COPPER-format
196 m_num_events = 1;
197 m_num_nodes = 1;
198
199 int* packed_buf = NULL;
200 packed_buf = m_access->PackDetectorBuf(&m_nwords,
201 detector_buf_1st, nwords_1st,
202 detector_buf_2nd, nwords_2nd,
203 detector_buf_3rd, nwords_3rd,
204 detector_buf_4th, nwords_4th,
205 rawcprpacker_info);
206
207 int delete_flag = 1; // Not use preallocated buffer. Delete m_buffer when destructer is called.
208 SetBuffer(packed_buf, m_nwords, delete_flag, m_num_events, m_num_nodes);
209
210 delete_flag = 0; // For m_access, need not to delete m_buffer
212
213 return;
214}
The Raw COPPER class ver.2 This class stores data received by COPPER via belle2link Data from all det...

◆ PackDetectorBuf4DummyData()

void PackDetectorBuf4DummyData ( 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 
)
inherited

Pack dummy data (format ver. = -1 -> Select the latest format version)

Definition at line 251 of file RawCOPPER.cc.

257{
258 // This function should be used for packing COPPER-format data.
259 if (m_access != NULL) {
260 delete m_access;
261 }
262 m_access = new PostRawCOPPERFormat_v2; // The latest version for COPPER-format
263 m_version = 2; // The latest version for COPPER-format
264
265 m_num_events = 1;
266 m_num_nodes = 1;
267
268 int* packed_buf = NULL;
269 packed_buf = m_access->PackDetectorBuf(&m_nwords,
270 detector_buf_1st, nwords_1st,
271 detector_buf_2nd, nwords_2nd,
272 detector_buf_3rd, nwords_3rd,
273 detector_buf_4th, nwords_4th,
274 rawcprpacker_info);
275
276 int delete_flag = 1; // Not use preallocated buffer. Delete m_buffer when destructer is called.
277 SetBuffer(packed_buf, m_nwords, delete_flag, m_num_events, m_num_nodes);
278
279 delete_flag = 0; // For m_access, need not to delete m_buffer
281
282 return;
283}

◆ PrintData()

virtual void PrintData ( int *  buf,
int  nwords 
)
inlinevirtualinherited

print data

Definition at line 122 of file RawDataBlock.h.

123 {
125 return m_access_dblk->PrintData(buf, nwords);
126 }
virtual void PrintData(int *buf, int nwords)
print data

◆ SetBuffer()

void SetBuffer ( int *  bufin,
int  nwords,
int  delete_flag,
int  num_events,
int  num_nodes 
)
virtualinherited

set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )

Reimplemented from RawDataBlock.

Definition at line 141 of file RawCOPPER.cc.

142{
143 if (bufin == NULL) {
144 char err_buf[500];
145 sprintf(err_buf, "[DEBUG] bufin is NULL. Exting...\n");
146 printf("%s", err_buf); fflush(stdout);
147 B2FATAL(err_buf);
148 }
149
150 if (!m_use_prealloc_buf && m_buffer != NULL) delete[] m_buffer;
151
152 if (delete_flag == 0) {
153 m_use_prealloc_buf = true;
154 } else {
155 m_use_prealloc_buf = false;
156 }
157
158 m_nwords = nwords;
159 m_buffer = bufin;
160
161 m_num_nodes = num_nodes;
162 m_num_events = num_events;
163
164 SetVersion();
165
166}
void SetVersion()
read data, detect and set the version number of the data format
Definition: RawCOPPER.cc:34

◆ SetVersion() [1/2]

void SetVersion ( )
inherited

read data, detect and set the version number of the data format

Definition at line 34 of file RawCOPPER.cc.

35{
36
37 if (m_buffer == NULL) {
38 char err_buf[500];
39 sprintf(err_buf, "m_buffer is NULL. Exiting...");
40 printf("%s", err_buf); fflush(stdout);
41 B2FATAL(err_buf);
42 }
43
44 if (m_access != NULL) {
45 delete m_access;
46 }
47
48 m_version = ((m_buffer[ POS_FORMAT_VERSION ]) & FORMAT_MASK) >> 8;
49
50 switch (m_version) {
51 case LATEST_POSTREDUCTION_FORMAT_VER :
53 // printf("Calling PostRawCOPPERFormat_latest\n");
54 break;
55 case (0x80 + LATEST_POSTREDUCTION_FORMAT_VER) :
57 // printf("Calling PreRawCOPPERFormat_latest\n");
58 break;
59 case 0x2 :
61 // printf("Calling PostRawCOPPERFormat_latest\n");
62 break;
63 case (0x80 + 0x2) :
65 // printf("Calling PreRawCOPPERFormat_latest\n");
66 break;
67 case 0x1 :
69 // printf("Calling RawCOPPERFormat_v1\n");
70 break;
71 case (0x80 + 0x1) :
73 // printf("Calling PreRawCOPPERFormat_latest\n");
74 break;
75 case 0 :
77 // printf("Calling RawCOPPERFormat_v0\n");
78 break;
79 default : {
80 char err_buf[500];
81 sprintf(err_buf, "[FATAL] ERROR_EVENT : Invalid version of a data format(0x%.8x = 0x7f7f**..). Exiting...\n %s %s %d\n",
82 m_buffer[ POS_FORMAT_VERSION ], __FILE__, __PRETTY_FUNCTION__, __LINE__);
83 printf("%s", err_buf); fflush(stdout);
84 B2FATAL(err_buf); // to reduce multiple error messages
85 }
86 }
87
89
90
91
92}
The Raw COPPER class ver.1 ( the latest version since May, 2014 ) This class stores data received by ...
The Raw COPPER class ver.1 ( the latest version since May, 2014 ) This class stores data received by ...
The Raw COPPER class ver.1 ( the latest version since May, 2014 ) This class stores data received by ...
The Raw COPPER class ver.1 ( the latest version since May, 2014 ) This class stores data received by ...
The Raw COPPER class ver.0 ( from August, 2013 to April, 2014 ) This class stores data received by CO...

◆ SetVersion() [2/2]

void SetVersion ( std::string  class_name)
inherited

Get timeval.

Definition at line 94 of file RawCOPPER.cc.

95{
96
97 if (m_access != NULL) {
98 delete m_access;
99 }
100
101 if (class_name == "PostRawCOPPERFormat_latest") {
103 m_version = (0 << 7) | LATEST_POSTREDUCTION_FORMAT_VER;
104 } else if (class_name == "PreRawCOPPERFormat_latest") {
106 m_version = (1 << 7) | LATEST_POSTREDUCTION_FORMAT_VER;
107 } else if (class_name == "PostRawCOPPERFormat_v1") {
109 m_version = (0 << 7) | 1;
110 } else if (class_name == "PreRawCOPPERFormat_v1") {
112 m_version = (1 << 7) | 1;
113 } else if (class_name == "RawCOPPERFormat_v0") {
115 m_version = (0 << 7) | 0;
116 } else {
117 char err_buf[500];
118 sprintf(err_buf, "Invalid name of a data format class (%s). Exiting...\n %s %s %d\n",
119 class_name.c_str(), __FILE__, __PRETTY_FUNCTION__, __LINE__);
120 printf("%s", err_buf); fflush(stdout);
121 B2FATAL(err_buf);
122 }
123
124// if( class_name == "RawCOPPERFormat_v0" ){
125// m_access = new RawCOPPERFormat_v0;
126// m_version = ( 0 << 7 ) | 0;
127// }else if( class_name == "PreRawCOPPERFormat_v0" ){
128// m_access = new PreRawCOPPERFormat_v0;
129// m_version = ( 1 << 7 ) | 0;
130// }else if( class_name == "RawCOPPERFormat_v2" ){
131// m_access = new RawCOPPERFormat_v2;
132// m_version = ( 0 << 7 ) | 2;
133// }else if( class_name == "PreRawCOPPERFormat_v2" ){
134// m_access = new PreRawCOPPERFormat_v2;
135// m_version = ( 1 << 7 ) | 2;
136// }
138
139}

◆ ShowBuffer()

void ShowBuffer ( )
inherited

show m_buffer

Definition at line 169 of file RawCOPPER.cc.

170{
171
172 printf("\n");
173 printf("POINTER %p\n", m_buffer);
174 for (int k = 0; k < 100; k++) {
175 printf("%.8x ", m_buffer[ k ]);
176 if ((k + 1) % 10 == 0) printf("\n%.8x : ", k);
177 }
178 printf("\n");
179
180}

◆ TotalBufNwords()

virtual int TotalBufNwords ( )
inlinevirtualinherited

Get total length of m_buffer.

Definition at line 39 of file RawDataBlock.h.

40 {
43 }
virtual int TotalBufNwords()
Get total length of m_buffer.

Member Data Documentation

◆ m_access

RawCOPPERFormat* m_access
inherited

class to access

Definition at line 333 of file RawCOPPER.h.

◆ m_access_dblk

RawDataBlockFormat* m_access_dblk
inherited

class to access

Definition at line 141 of file RawDataBlock.h.

◆ m_buffer

int* m_buffer
protectedinherited

Buffer.

Definition at line 154 of file RawDataBlock.h.

◆ m_num_events

int m_num_events
protectedinherited

number of events in this object

Definition at line 151 of file RawDataBlock.h.

◆ m_num_nodes

int m_num_nodes
protectedinherited

number of nodes in this object

Definition at line 148 of file RawDataBlock.h.

◆ m_nwords

int m_nwords
protectedinherited

do not record

number of words of buffer

Definition at line 145 of file RawDataBlock.h.

◆ m_use_prealloc_buf

int m_use_prealloc_buf
protectedinherited

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 158 of file RawDataBlock.h.

◆ m_version

int m_version
inherited

do not record

Version of the format

Definition at line 336 of file RawCOPPER.h.


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