pflib v3.9.5-27-gb09aabf
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
pftool.h
Go to the documentation of this file.
1
6#pragma once
7
8#include "pflib/ECON.h"
9#include "pflib/Target.h"
10#include "pflib/logging/Logging.h"
11#include "pflib/menu/Menu.h"
12
21
26#define ENABLE_LOGGING() static auto the_log_{get_by_file(__FILE__)};
27
31using pflib::Target;
32
34static const unsigned int NEED_FIBER = 0b1u;
36static const unsigned int ONLY_FIBERLESS = 0b10u;
38static const unsigned int ONLY_HCAL = 0b100u;
40static const unsigned int ONLY_ZCU = 0b1000u;
41
48class pftool : public pflib::menu::Menu<Target*> {
49 public:
51 class State {
52 public:
53 static constexpr int CFG_HCALFMC = 1;
54 static constexpr int CFG_HCALOPTO_ZCU = 11;
55 static constexpr int CFG_ECALOPTO_ZCU = 12;
56 static constexpr int CFG_HCALOPTO_BW = 21;
57 static constexpr int CFG_ECALOPTO_BW = 22;
58
59 private:
71 int cfg_;
72
73 public:
75 void init(Target* tgt, int readout_config);
80 const std::string& page) const;
85 pflib::ECON& econ, const std::string& page) const;
87 int readout_config() const { return cfg_; }
89 bool readout_config_is_zcu() const { return cfg_ < 20; }
92 return cfg_ == CFG_HCALFMC || cfg_ == CFG_HCALOPTO_ZCU ||
93 cfg_ == CFG_HCALOPTO_BW;
94 }
96 int iroc{0};
98 int iecon{0};
100 int ilink{0};
102 Target::DaqFormat daq_format_mode{Target::DaqFormat::SIMPLEROC};
106 int daq_rate{100};
108 std::string last_run_file{".last_run_file"};
109 };
111 static State state;
112};
Definition ECON.h:19
encapulating a given setup's access rules
Definition Target.h:25
A menu to execute commands with a specific target.
Definition Menu.h:276
static variables to share across menu
Definition pftool.h:51
const std::vector< std::string > & econ_param_names(pflib::ECON &econ, const std::string &page) const
get the parameter names for tab completion
Definition main.cxx:86
int iroc
index of HGCROC currently being interacted with
Definition pftool.h:96
int readout_config() const
get the readout configurion
Definition pftool.h:87
const std::vector< std::string > & roc_page_names() const
get page names for tab completion
Definition main.cxx:66
int iecon
index of ECON currently being interacted with
Definition pftool.h:98
Target::DaqFormat daq_format_mode
current format mode to use
Definition pftool.h:102
int daq_contrib_id
contributor ID of daq
Definition pftool.h:104
const std::vector< std::string > & roc_param_names(const std::string &page) const
get the parameter names for tab completion
Definition main.cxx:70
bool readout_config_is_hcal() const
check if we are reading out a Hcal HGCROC Board
Definition pftool.h:91
std::string last_run_file
path to where the run number is stored
Definition pftool.h:108
int cfg_
readout configuration
Definition pftool.h:71
std::map< std::string, std::map< std::string, std::vector< std::string > > > econ_param_names_
list of parameter names for tab-completion per ECON type
Definition pftool.h:69
int daq_rate
daq collection rate in Hz
Definition pftool.h:106
std::map< int, std::map< std::string, std::vector< std::string > > > roc_param_names_
list of parameter names for tab-completion per ROC ID
Definition pftool.h:64
std::map< std::string, std::vector< std::string > > econ_page_names_
list of page names for tab completion per ECON type
Definition pftool.h:66
int ilink
index of link currently being interacted with
Definition pftool.h:100
bool readout_config_is_zcu() const
check if we are reading out on a zcu
Definition pftool.h:89
const std::vector< std::string > & econ_page_names(pflib::ECON &econ) const
get page names for tab completion
Definition main.cxx:81
std::map< int, std::vector< std::string > > roc_page_names_
list of page names for tab completion per ROC ID
Definition pftool.h:61
void init(Target *tgt, int readout_config)
initialize the state with a Target
Definition main.cxx:24
The type of menu we are constructing.
Definition pftool.h:48
static State state
actual instance of the state
Definition pftool.h:97
static void econ(const std::string &cmd, Target *pft)
ECON menu commands.
Definition econ.cxx:166
boost::log::sources::severity_channel_logger_mt< level, std::string > logger
our logger type
Definition Logging.h:39
static const unsigned int ONLY_ZCU
category for commands that only make sense on the ZCU
Definition pftool.h:40
static const unsigned int NEED_FIBER
category for commands that need an optical fiber
Definition pftool.h:34
static const unsigned int ONLY_HCAL
menus/commands that only make sense for the Hcal
Definition pftool.h:38
::pflib::logging::logger get_by_file(const std::string &filepath)
get a logger using the file name as the channel name
Definition main.cxx:15
static const unsigned int ONLY_FIBERLESS
category for commands that only are fiberless
Definition pftool.h:36