CbmRoot
Loading...
Searching...
No Matches
reco/app/cbmreco_fairrun/ProgramOptions.h
Go to the documentation of this file.
1/* Copyright (C) 2022 Johann Wolfgang Goethe-Universitaet Frankfurt, Frankfurt am Main
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Jan de Cuveland [committer] */
4
5#ifndef APP_CBMRECO_PROGRAMOPTIONS_H
6#define APP_CBMRECO_PROGRAMOPTIONS_H
7
8#include <cstdint>
9#include <stdexcept>
10#include <string>
11#include <vector>
12
18class ProgramOptionsException : public std::runtime_error {
19 public:
20 explicit ProgramOptionsException(const std::string& what_arg = "") : std::runtime_error(what_arg) {}
21};
22
29 public:
31 ProgramOptions(int argc, char* argv[]) { ParseOptions(argc, argv); }
32
35
37 void operator=(const ProgramOptions&) = delete;
38
40 [[nodiscard]] const std::string& MonitorUri() const { return fMonitorUri; }
41
43 [[nodiscard]] const std::vector<std::string>& InputUri() const { return fInputUri; }
44
46 [[nodiscard]] const std::string& OutputRootFile() const { return fOutputRootFile; }
47
49 [[nodiscard]] const std::string& ConfigYamlFile() const { return fConfigYamlFile; }
50
52 [[nodiscard]] const std::string& SaveConfigYamlFile() const { return fSaveConfigYamlFile; }
53
55 [[nodiscard]] bool DumpSetup() const { return fDumpSetup; }
56
58 [[nodiscard]] int32_t MaxNumTs() const { return fMaxNumTs; }
59
61 [[nodiscard]] uint16_t HttpServerPort() const { return fHttpServerPort; }
62
63 private:
65 void ParseOptions(int argc, char* argv[]);
66
67 std::string fMonitorUri;
68
69 std::vector<std::string> fInputUri;
70 std::string fOutputRootFile = "/dev/null";
71 std::string fConfigYamlFile;
72 std::string fSaveConfigYamlFile;
73 bool fDumpSetup = false;
74 int32_t fMaxNumTs = INT32_MAX;
75 uint16_t fHttpServerPort = 0;
76};
77
78#endif /* APP_CBMRECO_PROGRAMOPTIONS_H */
ProgramOptionsException(const std::string &what_arg="")
Program options class for the "cbmreco_fairrun" application.
const std::string & OutputRootFile() const
Get output file name (.root format)
std::vector< std::string > fInputUri
URI(s) specifying input timeslice stream source(s)
bool DumpSetup() const
Get flag to dump the readout setup to yaml.
const std::vector< std::string > & InputUri() const
Get URI specifying input timeslice stream source(s)
int32_t MaxNumTs() const
Get maximum number of timeslices to process.
const std::string & MonitorUri() const
Get URI specifying the monitoring server interface.
std::string fConfigYamlFile
Configuration file name (.yaml format)
uint16_t fHttpServerPort
Port number for the HTTP server. If 0, server will not be activated.
ProgramOptions(const ProgramOptions &)=delete
Copy constructor forbidden.
std::string fMonitorUri
URI specifying the monitoring server interface.
std::string fSaveConfigYamlFile
Save configuration file name (.yaml format)
uint16_t HttpServerPort() const
Get the port number for the HTTP server.
std::string fOutputRootFile
Output file name (.root format)
const std::string & ConfigYamlFile() const
Get configuration file name (.yaml format)
void operator=(const ProgramOptions &)=delete
Assignment operator forbidden.
const std::string & SaveConfigYamlFile() const
Get save configuration file name (.yaml format)
ProgramOptions(int argc, char *argv[])
Standard constructor with command line arguments.
bool fDumpSetup
Dump the readout setup to yaml.
void ParseOptions(int argc, char *argv[])
Parse command line arguments using boost program_options.
int32_t fMaxNumTs
Maximum number of timeslices to process.
Hash for CbmL1LinkKey.