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