pflib v3.9.4-7-gb2e7f4f
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;
39
46class pftool : public pflib::menu::Menu<Target*> {
47 public:
49 class State {
50 public:
51 static constexpr int CFG_HCALFMC = 1;
52 static constexpr int CFG_HCALOPTO_ZCU = 11;
53 static constexpr int CFG_ECALOPTO_ZCU = 12;
54 static constexpr int CFG_HCALOPTO_BW = 21;
55 static constexpr int CFG_ECALOPTO_BW = 22;
56
57 private:
69 int cfg_;
70
71 public:
73 void init(Target* tgt, int readout_config);
78 const std::string& page) const;
83 pflib::ECON econ, const std::string& page) const;
85 int readout_config() const { return cfg_; }
87 bool readout_config_is_zcu() const { return cfg_ < 20; }
90 return cfg_ == CFG_HCALFMC || cfg_ == CFG_HCALOPTO_ZCU ||
91 cfg_ == CFG_HCALOPTO_BW;
92 }
94 int iroc{0};
96 int iecon{0};
98 int ilink{0};
100 Target::DaqFormat daq_format_mode{Target::DaqFormat::SIMPLEROC};
104 int daq_rate{100};
106 std::string last_run_file{".last_run_file"};
107 };
109 static State state;
110};
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:49
int iroc
index of HGCROC currently being interacted with
Definition pftool.h:94
int readout_config() const
get the readout configurion
Definition pftool.h:85
const std::vector< std::string > & roc_page_names() const
get page names for tab completion
Definition main.cxx:62
int iecon
index of ECON currently being interacted with
Definition pftool.h:96
Target::DaqFormat daq_format_mode
current format mode to use
Definition pftool.h:100
int daq_contrib_id
contributor ID of daq
Definition pftool.h:102
const std::vector< std::string > & roc_param_names(const std::string &page) const
get the parameter names for tab completion
Definition main.cxx:66
bool readout_config_is_hcal() const
check if we are reading out a Hcal HGCROC Board
Definition pftool.h:89
std::string last_run_file
path to where the run number is stored
Definition pftool.h:106
int cfg_
readout configuration
Definition pftool.h:69
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:67
int daq_rate
daq collection rate in Hz
Definition pftool.h:104
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:62
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:82
std::map< std::string, std::vector< std::string > > econ_page_names_
list of page names for tab completion per ECON type
Definition pftool.h:64
int ilink
index of link currently being interacted with
Definition pftool.h:98
bool readout_config_is_zcu() const
check if we are reading out on a zcu
Definition pftool.h:87
const std::vector< std::string > & econ_page_names(pflib::ECON econ) const
get page names for tab completion
Definition main.cxx:77
std::map< int, std::vector< std::string > > roc_page_names_
list of page names for tab completion per ROC ID
Definition pftool.h:59
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:46
static State state
actual instance of the state
Definition pftool.h:93
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: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