FairRoot/PandaRoot
Functions
runPndTopixSorter.cxx File Reference
#include <PndMQTopix4Sorter.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 runPndTopixSorter.cxx.

References filename.

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