FairRoot/PandaRoot
runPndHitEventBuilder.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 "PndMQHitEventDevice.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 #ifdef NANOMSG
28 #include "FairMQTransportFactoryNN.h"
29 #else
30 #include "FairMQTransportFactoryZMQ.h"
31 #endif
32 
33 using namespace boost::program_options;
34 
35 int main(int argc, char** argv)
36 {
38  builder.CatchSignals();
39 
40  FairMQProgOptions config;
41 
42  try
43  {
44  config.ParseAll(argc, argv);
45 
46  std::string filename = config.GetValue<std::string>("config-json-file");
47  std::string id = config.GetValue<std::string>("id");
48 
49 
50  config.UserParser<FairMQParser::JSON>(filename, id);
51 
52  builder.fChannels = config.GetFairMQMap();
53 
54  LOG(INFO) << "PID: " << getpid();
55  LOG(INFO) << "ID: " << id ;
56  builder.ListProperties();
57 
58 #ifdef NANOMSG
59  FairMQTransportFactory* transportFactory = new FairMQTransportFactoryNN();
60 #else
61  FairMQTransportFactory* transportFactory = new FairMQTransportFactoryZMQ();
62 #endif
63 
64  builder.SetTransport(transportFactory);
65 
66  builder.SetProperty(FairMQDevice::Id, id);
67 
68  //PndMQTopix4ProcessorTask* task = new PndMQTopix4ProcessorTask();
69  //builder.SetTask(task);
70 
71  builder.ChangeState("INIT_DEVICE");
72  builder.WaitForEndOfState("INIT_DEVICE");
73 
74  builder.ChangeState("INIT_TASK");
75  builder.WaitForEndOfState("INIT_TASK");
76 
77  builder.ChangeState("RUN");
78  builder.InteractiveStateLoop();
79  }
80  catch (std::exception& e)
81  {
82  LOG(ERROR) << e.what();
83  LOG(INFO) << "Command line options are the following: ";
84  config.PrintHelp();
85  return 1;
86  }
87 
88  return 0;
89 }
virtual void SetProperty(const int key, const std::string &value)
PndGapEventBuilderTask * builder
int main(int argc, char **argv)
const string filename