FairRoot/PandaRoot
Functions
runPndTopixSampler.cxx File Reference
#include <iostream>
#include "boost/program_options.hpp"
#include "FairMQLogger.h"
#include "FairMQParser.h"
#include "FairMQProgOptions.h"
#include "PndMQTopix4Sampler.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 32 of file runPndTopixSampler.cxx.

References fe, filename, PndMQTopix4Sampler::FileName, and PndMQTopix4Sampler::SetProperty().

33 {
34  PndMQTopix4Sampler sampler;
35  sampler.CatchSignals();
36 
37  FairMQProgOptions config;
38 
39  try
40  {
41  std::string text;
42  int fe;
43  double timecorr;
44 
45  options_description samplerOptions("Sampler options");
46  samplerOptions.add_options()
47  ("FileName", value<std::string>(&text)->default_value("/Users/Stockmanns/PandaSoftware/pandaRoot/pandaRoot_ActualTrunk/macro/mvd/TestBeam/2014-10-27-00-06-02--101-data--1.txt"),
48  "FileName of data to send out")
49  ("FE", value<int>(&fe)->default_value(1), "Front-End Number")
50  ("TimeCorrection", value<double>(&timecorr)->default_value(0.0),"Time offset between FE chips");
51 
52 
53  config.AddToCmdLineOptions(samplerOptions);
54 
55  config.ParseAll(argc, argv);
56 
57  std::string filename = config.GetValue<std::string>("config-json-file");
58  std::string id = config.GetValue<std::string>("id");
59 
60  config.UserParser<FairMQParser::JSON>(filename, id);
61 
62  sampler.fChannels = config.GetFairMQMap();
63 
64  LOG(INFO) << "PID: " << getpid();
65 
66 #ifdef NANOMSG
67  FairMQTransportFactory* transportFactory = new FairMQTransportFactoryNN();
68 #else
69  FairMQTransportFactory* transportFactory = new FairMQTransportFactoryZMQ();
70 #endif
71 
72  sampler.SetTransport(transportFactory);
73 
74  sampler.SetProperty(PndMQTopix4Sampler::Id, id);
76 
77  sampler.ChangeState("INIT_DEVICE");
78  sampler.WaitForEndOfState("INIT_DEVICE");
79 
80  sampler.ChangeState("INIT_TASK");
81  sampler.WaitForEndOfState("INIT_TASK");
82 
83  sampler.ChangeState("RUN");
84  sampler.InteractiveStateLoop();
85  }
86  catch (std::exception& e)
87  {
88  LOG(ERROR) << e.what();
89  LOG(INFO) << "Command line options are the following: ";
90  config.PrintHelp();
91  return 1;
92  }
93 
94  return 0;
95 }
virtual void SetProperty(const int key, const std::string &value)
int fe
Definition: anaLmdDigi.C:67
const string filename