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