Table of Contents

Read data form daq file (March)

Files:

This method of reading data uses two classes.

https://github.com/shchablo/example_DAQ_TDC_lyon


How to use:

LyPetiRead stream;                                                                                                                                                                            
stream.open("path/to/file");                                                                                                                          
int codeRead = 1;                                                            
int size = stream.size();                                                    
int pos = 0;                                                                 
std::vector<zdaq::buffer*> buffers;                                                                             
while(codeRead > 0) {                                                        
 codeRead = stream.read(&pos, &buffers); // read data form file                                                                           
 
 for(int j = 0; j < buffers.size(); j++) {
   buffers.at(j); // take buffer
   // do analysis here.
   // uint32_t* ibuf=(uint32_t*) buffers.at(j)->payload();
   // int absbcid = ibuf[3];
   // absbcid = (absbcid << 32) | ibuf[2];
   // printf("\n number %d, GTC %d, ABSBCID %lu, mezzanine number %u,",
   // ibuf[0], ibuf[1] & 0xFFFF, absbcid, ibuf[4]);
   // printf("IP address %u.%u.%u.%u,", ibuf[5] & 0xFF, (ibuf[5] >> 8) & 0xFF,
   // (ibuf[5] >> 16) & 0xFF, (ibuf[5] >> 24) & 0xFF);
   //  uint32_t nch = ibuf[6];
   // printf("\n channels -> %d \n", nch);
   // if (ibuf[6] > 0) {
   //   uint8_t* cbuf = ( uint8_t*)&ibuf[7];
   //   for (int i = 0; i < ibuf[6]; i++) {
   //     printf("ch=%d", cbuf[8*i]);
   //   }
   // }
 }
 
 // clear memory from old buffers
 for( int j = 0; j < buffers.size(); j++)                                   
  delete buffers.at(j);                                                    
 buffers.clear();                                                                     
}
stream.close();