diff --git a/src/outputByOrbit.cc b/src/outputByOrbit.cc index e398c23db6fdb38fce5c599da74881681cb13cc1..bbbf32be866943b6787471569c24f23a3a197e72 100644 --- a/src/outputByOrbit.cc +++ b/src/outputByOrbit.cc @@ -44,7 +44,7 @@ OutputByOrbitStream::OutputByOrbitStream( const std::string output_filename_base current_file_size(0), file_count(-1), control(c), - current_run_number(0), + current_run_number(-1), conf(conf_), fixedOrbitsPerFile(bool(conf.getNOrbitsPerFile())), outFile() @@ -59,7 +59,6 @@ OutputByOrbitStream::OutputByOrbitStream( const std::string output_filename_base void* OutputByOrbitStream::OutputFixedOrbits( Slice& out ) { uint32_t orbitN = out.get_firstOrbitN(); - std::cout << orbitN << std::endl; uint32_t new_index = uint32_t(orbitN/conf.getNOrbitsPerFile()); size_t n = 0; bool already_opened=false; @@ -67,7 +66,7 @@ void* OutputByOrbitStream::OutputFixedOrbits( Slice& out ) { if ( control.running.load(std::memory_order_acquire) || control.output_force_write ) { //i.e should be writing data if (current_run_number != control.run_number) { - + close_and_move_file(); open_file(new_index); n = fwrite( out.begin(), 1, out.size(), outFile.getFile() ); @@ -125,6 +124,7 @@ void OutputByOrbitStream::close_and_move_file() //Used for fixedNorbits per file if ( rename(current_file_name.c_str(), target_file_name.c_str()) < 0 ) { LOG(ERROR) << tools::strerror("File rename failed"); } + current_run_number = control.run_number; } void OutputByOrbitStream::open_file(uint32_t index_) //Used for fixedNorbits per file option diff --git a/src/processor.cc b/src/processor.cc index 621c018687e18b05156118139d74d8e62bdd8316..6b5765392a38c3e59e05c7d065acbe2127c857e4 100644 --- a/src/processor.cc +++ b/src/processor.cc @@ -338,6 +338,5 @@ void* StreamProcessor::operator()( void* item ){ Slice& out = *Slice::allocate( 2*max_size); process(input, out); Slice::giveAllocated(&input); - return &out; } diff --git a/src/scdaq.cc b/src/scdaq.cc index f53386367fb20503fa7a0b63e982b34519c1dd24..d1541691817d89f17a1195b7c42f00849ac75117 100644 --- a/src/scdaq.cc +++ b/src/scdaq.cc @@ -90,13 +90,13 @@ int run_pipeline( int nbThreads, ctrl& control, config& conf ) pipeline.add_filter(elastic_processor); } + OutputByOrbitStream output_stream_orbit( conf.getOutputFilenameBase(), conf.getOutputFilenamePrefix(), control, conf ); + OutputBySizeStream output_stream_size( conf.getOutputFilenameBase(), conf.getOutputFilenamePrefix(), control); // Create file-writing stage and add it to the pipeline if ( conf.getNOrbitsPerFile() ){ - OutputByOrbitStream output_stream( conf.getOutputFilenameBase(), conf.getOutputFilenamePrefix(), control, conf ); - pipeline.add_filter( output_stream ); + pipeline.add_filter( output_stream_orbit ); }else{ - OutputBySizeStream output_stream( conf.getOutputFilenameBase(), conf.getOutputFilenamePrefix(), control); - pipeline.add_filter( output_stream ); + pipeline.add_filter( output_stream_size ); }