diff --git a/src/processor.cc b/src/processor.cc index 8bd2cb86d9d30a10e75fcf2de2a1dcc65f30ac0f..a6c2e3f0b785ac6f721c5d9fa368541f08f2714d 100644 --- a/src/processor.cc +++ b/src/processor.cc @@ -6,14 +6,16 @@ StreamProcessor::StreamProcessor(size_t max_size_) : max_size(max_size_), - tbb::filter(parallel) + tbb::filter(parallel), + nbPackets(0) { fprintf(stderr,"Created transform filter at 0x%llx \n",(unsigned long long)this);} StreamProcessor::~StreamProcessor(){ // fprintf(stderr,"Wrote %d muons \n",totcount); } -Slice* process(Slice& input, Slice& out) +Slice* StreamProcessor::process(Slice& input, Slice& out) { + nbPackets++; int bsize = sizeof(block1); if((input.size()-constants::orbit_trailer_size)%bsize!=0){ std::cout << "WARNING::frame size not a multiple of block size. Will be skipped. Size=" @@ -61,7 +63,7 @@ Slice* process(Slice& input, Slice& out) uint32_t bxcount = std::max(mAcount,mBcount); if(bxcount == 0) { p+=bsize; - std::cout << "WARNING::detected a bx with zero muons, this should not happen" << std::endl; + std::cout << '#' << nbPackets << ": WARNING::detected a bx with zero muons, this should not happen. Packet is skipped." << std::endl; continue; } diff --git a/src/processor.h b/src/processor.h index 3c3a75de1db457e980a246fdf9f898db2948deaa..880536d31a07e95d88de1d4ac6c54611d32ccfa5 100644 --- a/src/processor.h +++ b/src/processor.h @@ -5,13 +5,20 @@ //reformatter +class Slice; + class StreamProcessor: public tbb::filter { public: StreamProcessor(size_t); void* operator()( void* item )/*override*/; ~StreamProcessor(); + +private: + Slice* process(Slice& input, Slice& out); + private: size_t max_size; + uint64_t nbPackets; }; #endif diff --git a/src/wzdma_input.cc b/src/wzdma_input.cc index 592c52708e62c300d5c19925fa64ab6d16571040..cdd7ed13a40a814c3723117b9d6fe69ebcaf5197 100644 --- a/src/wzdma_input.cc +++ b/src/wzdma_input.cc @@ -91,6 +91,12 @@ inline ssize_t WZDmaInputFilter::read_packet(char **buffer) if (errno == EIO) { std::cerr << "#" << ncalls << ": Trying to restart DMA (attempt #" << tries << "): "; wz_stop_dma( &dma ); + wz_close( &dma ); + + // Initialize the DMA subsystem + if ( wz_init( &dma ) < 0 ) { + throw std::system_error(errno, std::system_category(), "Cannot initialize WZ DMA device"); + } if (wz_start_dma( &dma ) < 0) { throw std::system_error(errno, std::system_category(), "Cannot start WZ DMA device");