Skip to content
Snippets Groups Projects
Commit 06fe42cc authored by Petr Zejdl's avatar Petr Zejdl
Browse files

Introducing ProcessorType option as a replacement for SystemName

parent 578410b4
No related branches found
No related tags found
1 merge request!59CMSSW json file
......@@ -6,6 +6,7 @@
#include "boost/lexical_cast.hpp"
#include <map>
#include <stdexcept>
#include "processor.h"
class config{
public:
......@@ -48,9 +49,6 @@ public:
std::string v = vmap.at("packets_per_report");
return boost::lexical_cast<uint32_t>(v.c_str());
}
const std::string& getSystemName() const {
return vmap.at("system_name");
}
const std::string& getInputFile() const {
return vmap.at("input_file");
}
......@@ -66,6 +64,18 @@ public:
std::string v = vmap.at("pt_cut");
return boost::lexical_cast<uint32_t>(v.c_str());
}
StreamProcessor::ProcessorType getProcessorType() const {
const std::string& input = vmap.at("processor_type");
if (input == "PASS_THROUGH") {
return StreamProcessor::ProcessorType::PASS_THROUGH;
}
if (input == "GMT") {
return StreamProcessor::ProcessorType::GMT;
}
throw std::invalid_argument("Configuration error: Wrong processor type '" + input + "'");
}
const std::string& getOutputFilenamePrefix() const
{
return vmap.at("output_filename_prefix");
......
......@@ -6,7 +6,6 @@
struct ctrl {
uint32_t run_number;
std::string system_name;
std::atomic<bool> running;
/* Always write data to a file regardless of the run status */
bool output_force_write;
......
......@@ -114,7 +114,7 @@ void* OutputStream::operator()( void* item )
}
/*
* Create a properly formated file name
* Create a properly formatted file name
* TODO: Change to C++
*/
static std::string format_run_file_stem(std::string& filename_prefix, uint32_t run_number, int32_t file_count)
......@@ -178,7 +178,7 @@ void OutputStream::open_next_file()
LOG(INFO) << " using index: " << file_count;
}
// Create the ouput directory
// Create the output directory
std::string output_directory = my_output_filename_base + "/" + working_dir;
create_output_directory(output_directory);
......
......@@ -4,12 +4,12 @@
#include "log.h"
#include <iomanip>
StreamProcessor::StreamProcessor(size_t max_size_, bool doZS_, std::string systemName_) :
StreamProcessor::StreamProcessor(size_t max_size_, bool doZS_, ProcessorType processorType_) :
tbb::filter(parallel),
max_size(max_size_),
nbPackets(0),
doZS(doZS_),
systemName(systemName_)
processorType(processorType_)
{
LOG(TRACE) << "Created transform filter at " << static_cast<void*>(this);
myfile.open ("example.txt");
......@@ -28,11 +28,12 @@ Slice* StreamProcessor::process(Slice& input, Slice& out)
char* q = out.begin();
uint32_t counts = 0;
if(systemName =="DMX"){
memcpy(q,p,input.size());
out.set_end(out.begin() + input.size());
out.set_counts(1);
return &out;}
if (processorType == ProcessorType::PASS_THROUGH) {
memcpy(q,p,input.size());
out.set_end(out.begin() + input.size());
out.set_counts(1);
return &out;
}
int bsize = sizeof(block1);
if((input.size()-constants::orbit_trailer_size)%bsize!=0){
......
......@@ -11,7 +11,10 @@ class Slice;
class StreamProcessor: public tbb::filter {
public:
StreamProcessor(size_t, bool, std::string);
enum class ProcessorType { PASS_THROUGH, GMT };
public:
StreamProcessor(size_t max_size_, bool doZS_, ProcessorType processorType_);
void* operator()( void* item )/*override*/;
~StreamProcessor();
......@@ -23,7 +26,7 @@ private:
size_t max_size;
uint64_t nbPackets;
bool doZS;
std::string systemName;
ProcessorType processorType;
};
#endif
......@@ -66,7 +66,7 @@ int run_pipeline( int nbThreads, ctrl& control, config& conf )
// Create reformatter and add it to the pipeline
// TODO: Created here so we are not subject of scoping, fix later...
StreamProcessor stream_processor(packetBufferSize, conf.getDoZS(), conf.getSystemName());
StreamProcessor stream_processor(packetBufferSize, conf.getDoZS(), conf.getProcessorType());
if ( conf.getEnableStreamProcessor() ) {
pipeline.add_filter( stream_processor );
}
......@@ -117,7 +117,6 @@ int main( int argc, char* argv[] ) {
control.running = false;
control.run_number = 0;
control.system_name = conf.getSystemName();
control.max_file_size = conf.getOutputMaxFileSize();//in Bytes
control.packets_per_report = conf.getPacketsPerReport();
control.output_force_write = conf.getOutputForceWrite();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment