/******************************************************************************** * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * PndMQSdsHitLoaderhis software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ /** * runPndMQSdsHitLoaderestDetectorSamplerBin.cxx * * @since 2013-04-29 * @author A. Rybalchenko, N. Winckler */ #include #include "boost/program_options.hpp" #include "FairMQLogger.h" #include "FairMQSampler.h" #include "FairMQParser.h" #ifdef NANOMSG #include "FairMQTransportFactoryNN.h" #else #include "FairMQTransportFactoryZMQ.h" #endif // data format for the task #include "PndMQSdsHitLoader.h" #include "PndSdsHit.h" #include "FairMQProgOptions.h" #include "FairMQSampler.h" // boost data format #include #include using namespace std; using namespace boost::program_options; int main(int argc, char** argv) { FairMQProgOptions config; FairMQSampler sampler; sampler.CatchSignals(); namespace bpo = boost::program_options; try { std::string InputFile, ParFile, Branch; options_description samplerOptions("Sampler options"); samplerOptions.add_options() ("input-file", value(&InputFile)->default_value("")) ("parameter-file", value(&ParFile)->default_value("")) ("branch", value(&Branch)->default_value("")) ("chain-input", bpo::value()->default_value(0), "Chain input file more than once (default)"); config.AddToCmdLineOptions(samplerOptions); config.ParseAll(argc, argv); sampler.SetConfig(config); LOG(INFO) << "PID: " << getpid(); // sampler.SetProperty(FairMQSampler::fInputFile, InputFile); // sampler.SetProperty(FairMQSampler::fParFile, ParFile); // sampler.SetProperty(FairMQSampler::fBranch, Branch); //sampler.SetProperty(FairMQSampler::EventRate, options.eventRate); sampler.ChangeState("INIT_DEVICE"); sampler.WaitForEndOfState("INIT_DEVICE"); sampler.ChangeState("INIT_TASK"); sampler.WaitForEndOfState("INIT_TASK"); sampler.ChangeState("RUN"); sampler.InteractiveStateLoop(); } catch (std::exception& e) { LOG(ERROR) << e.what(); LOG(INFO) << "Command line options are the following: "; config.PrintHelp(); return 1; } return 0; }