FairRoot/PandaRoot
Functions
runPndTopixSorterMerger.cxx File Reference
#include <PndMQSorterMerger.h>
#include <iostream>
#include <TApplication.h>
#include "boost/program_options.hpp"
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "FairMQTransportFactoryZMQ.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 33 of file runPndTopixSorterMerger.cxx.

References filename.

34 {
35  PndMQSorterMerger sorter;
36  sorter.CatchSignals();
37 
38  FairMQProgOptions config;
39 
40  try
41  {
42  config.ParseAll(argc, argv);
43  std::string filename = config.GetValue<std::string>("config-json-file");
44  std::string id = config.GetValue<std::string>("id");
45 
46  config.UserParser<FairMQParser::JSON>(filename, id);
47 
48  sorter.fChannels = config.GetFairMQMap();
49 
50  LOG(INFO) << "PID: " << getpid();
51 
52 #ifdef NANOMSG
53  FairMQTransportFactory* transportFactory = new FairMQTransportFactoryNN();
54 #else
55  FairMQTransportFactory* transportFactory = new FairMQTransportFactoryZMQ();
56 #endif
57 
58  sorter.SetTransport(transportFactory);
59 
60  sorter.SetProperty(PndMQSorterMerger::Id, id);
61 
62  sorter.ChangeState("INIT_DEVICE");
63  sorter.WaitForEndOfState("INIT_DEVICE");
64 
65  sorter.ChangeState("INIT_TASK");
66  sorter.WaitForEndOfState("INIT_TASK");
67 
68  sorter.ChangeState("RUN");
69  sorter.InteractiveStateLoop();
70 
71  }
72  catch (std::exception& e)
73  {
74  LOG(ERROR) << e.what();
75  LOG(INFO) << "Command line options are the following: ";
76  config.PrintHelp();
77  return 1;
78  }
79 
80  return 0;
81 }
const string filename