FairRoot/PandaRoot
runPndTopixOnlineHisto.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence version 3 (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
15 //#include <PndMQTopix4ProcessorTask.h>
16 #include <PndMQTopix4OnlineHisto.h>
17 #include <iostream>
18 
19 #include "boost/program_options.hpp"
20 
21 #include "FairMQLogger.h"
22 #include "FairMQParser.h"
23 #include "FairMQProgOptions.h"
24 #include "FairMQProcessor.h"
25 #include "FairMQDevice.h"
26 
27 #include "TApplication.h"
28 
29 #ifdef NANOMSG
30 #include "FairMQTransportFactoryNN.h"
31 #else
32 #include "FairMQTransportFactoryZMQ.h"
33 #endif
34 
35 using namespace boost::program_options;
36 
37 int main(int argc, char** argv)
38 {
39  PndMQTopix4OnlineHisto processor;
40  processor.CatchSignals();
41 
42  FairMQProgOptions config;
43 
44  TApplication theApp("App",0,0);
45 
46  try
47  {
48  config.ParseAll(argc, argv);
49 
50  std::string filename = config.GetValue<std::string>("config-json-file");
51  std::string id = config.GetValue<std::string>("id");
52 
53 
54  config.UserParser<FairMQParser::JSON>(filename, id);
55 
56  processor.fChannels = config.GetFairMQMap();
57 
58  LOG(INFO) << "PID: " << getpid();
59  LOG(INFO) << "ID: " << id ;
60 
61 #ifdef NANOMSG
62  FairMQTransportFactory* transportFactory = new FairMQTransportFactoryNN();
63 #else
64  FairMQTransportFactory* transportFactory = new FairMQTransportFactoryZMQ();
65 #endif
66 
67  processor.SetTransport(transportFactory);
68 
69  processor.SetProperty(FairMQDevice::Id, id);
70 
71  //PndMQTopix4ProcessorTask* task = new PndMQTopix4ProcessorTask();
72  //processor.SetTask(task);
73 
74  processor.ChangeState("INIT_DEVICE");
75  processor.WaitForEndOfState("INIT_DEVICE");
76 
77  processor.ChangeState("INIT_TASK");
78  processor.WaitForEndOfState("INIT_TASK");
79 
80  processor.ChangeState("RUN");
81  theApp.Run();
82  processor.InteractiveStateLoop();
83  }
84  catch (std::exception& e)
85  {
86  LOG(ERROR) << e.what();
87  LOG(INFO) << "Command line options are the following: ";
88  config.PrintHelp();
89  return 1;
90  }
91 
92  return 0;
93 }
int main(int argc, char **argv)
const string filename