pflib v3.9.0-rc3-11-g2537d8f
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/menu/Menu.h"
11
20
25#define ENABLE_LOGGING() static auto the_log_{get_by_file(__FILE__)};
26
30using pflib::Target;
31
33static const unsigned int NEED_FIBER = 0b1u;
35static const unsigned int ONLY_FIBERLESS = 0b10u;
37static const unsigned int ONLY_HCAL = 0b100u;
38
45class pftool : public pflib::menu::Menu<Target*> {
46 public:
48 class State {
49 public:
50 static constexpr int CFG_HCALFMC = 1;
51 static constexpr int CFG_HCALOPTO_ZCU = 11;
52 static constexpr int CFG_ECALOPTO_ZCU = 12;
53 static constexpr int CFG_HCALOPTO_BW = 21;
54 static constexpr int CFG_ECALOPTO_BW = 22;
55
56 private:
68 int cfg_;
69
70 public:
72 void init(Target* tgt, int readout_config);
77 const std::string& page) const;
82 pflib::ECON econ, const std::string& page) const;
84 int readout_config() const { return cfg_; }
86 bool readout_config_is_zcu() const { return cfg_ < 20; }
89 return cfg_ == CFG_HCALFMC || cfg_ == CFG_HCALOPTO_ZCU ||
90 cfg_ == CFG_HCALOPTO_BW;
91 }
93 int iroc{0};
95 int iecon{0};
97 int ilink{0};
99 Target::DaqFormat daq_format_mode{Target::DaqFormat::SIMPLEROC};
103 int daq_rate{100};
105 std::string last_run_file{".last_run_file"};
106 };
108 static State state;
109};
Definition ECON.h:18
encapulating a given setup's access rules
Definition Target.h:24
A menu to execute commands with a specific target.
Definition Menu.h:276
static variables to share across menu
Definition pftool.h:48
int iroc
index of HGCROC currently being interacted with
Definition pftool.h:93
int readout_config() const
get the readout configurion
Definition pftool.h:84
const std::vector< std::string > & roc_page_names() const
get page names for tab completion
Definition main.cxx:51
int iecon
index of ECON currently being interacted with
Definition pftool.h:95
Target::DaqFormat daq_format_mode
current format mode to use
Definition pftool.h:99
int daq_contrib_id
contributor ID of daq
Definition pftool.h:101
const std::vector< std::string > & roc_param_names(const std::string &page) const
get the parameter names for tab completion
Definition main.cxx:55
bool readout_config_is_hcal() const
check if we are reading out a Hcal HGCROC Board
Definition pftool.h:88
std::string last_run_file
path to where the run number is stored
Definition pftool.h:105
int cfg_
readout configuration
Definition pftool.h:68
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:66
int daq_rate
daq collection rate in Hz
Definition pftool.h:103
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:61
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:71
std::map< std::string, std::vector< std::string > > econ_page_names_
list of page names for tab completion per ECON type
Definition pftool.h:63
int ilink
index of link currently being interacted with
Definition pftool.h:97
bool readout_config_is_zcu() const
check if we are reading out on a zcu
Definition pftool.h:86
const std::vector< std::string > & econ_page_names(pflib::ECON econ) const
get page names for tab completion
Definition main.cxx:66
std::map< int, std::vector< std::string > > roc_page_names_
list of page names for tab completion per ROC ID
Definition pftool.h:58
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:45
static State state
actual instance of the state
Definition pftool.h:82
static void econ(const std::string &cmd, Target *pft)
ECON menu commands.
Definition econ.cxx:147
boost::log::sources::severity_channel_logger_mt< level, std::string > logger
our logger type
Definition Logging.h:39
static const unsigned int NEED_FIBER
category for commands that need an optical fiber
Definition pftool.h:33
static const unsigned int ONLY_HCAL
menus/commands that only make sense for the Hcal
Definition pftool.h:37
::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:35