pflib v3.9.4-7-gb2e7f4f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
Target.h
1#ifndef PFLIB_TARGET_H_INCLUDED
2#define PFLIB_TARGET_H_INCLUDED
3
4#include "pflib/DAQ.h"
5#include "pflib/ECON.h"
6#include "pflib/Elinks.h"
7#include "pflib/FastControl.h"
8#include "pflib/I2C.h"
9#include "pflib/ROC.h"
10#include "pflib/lpGBT.h"
11
12namespace pflib {
13
14class OptoLink;
15
24class Target {
25 public:
26 virtual ~Target() = default;
27
29 virtual int nrocs() { return -1; }
30
32 virtual int necons() { return -1; }
33
35 virtual bool have_roc(int iroc) const { return false; }
36
38 virtual bool have_econ(int iecon) const { return false; }
39
41 virtual std::vector<int> roc_ids() const { return {}; }
42
44 virtual std::vector<int> econ_ids() const { return {}; }
45
47 virtual ROC& roc(int which) {
48 PFEXCEPTION_RAISE(
49 "NoImp", "ROC Access has not been implemented for the current target.");
50 }
51
53 virtual ECON& econ(int which) {
54 PFEXCEPTION_RAISE(
55 "NoImp",
56 "ECON Access has not been implemented for the current target.");
57 }
58
60 virtual void hardResetROCs() {}
61
63 virtual void hardResetECONs() {}
64
66 virtual uint32_t getFirmwareVersion() { return -1; }
67
69 virtual void softResetROC(int which = -1) {}
70
72 virtual void softResetECON(int which = -1) {}
73
75 virtual Elinks& elinks() = 0;
76
78 virtual FastControl& fc() = 0;
79
81 virtual DAQ& daq() = 0;
82
85
87 I2C& get_i2c_bus(const std::string& name);
88
91
93 OptoLink& get_opto_link(const std::string& name) const;
94
95 virtual const std::vector<std::pair<int, int>>& getRocErxMapping() = 0;
96
100 enum class DaqFormat {
102 SIMPLEROC = 1,
104 ECOND_NO_ZS = 2,
107 };
108
109 virtual void setup_run(int irun, DaqFormat format, int contrib_id = -1) {}
110 virtual std::vector<uint32_t> read_event() = 0;
111 virtual bool has_event() { return daq().getEventOccupancy() > 0; }
112
113 protected:
116 mutable logging::logger the_log_{logging::get("Target")};
117 // private:
118 // Mapping ROC channel → eRx channel
119 std::vector<std::pair<int, int>> roc_to_erx_map_;
120};
121
122Target* makeTargetFiberless();
123Target* makeTargetHcalBackplaneZCU(int ilink, uint8_t board_mask);
124Target* makeTargetHcalBackplaneBittware(int ilink, uint8_t board_mask,
125 const char* dev);
126Target* makeTargetEcalSMMZCU(int ilink, uint8_t roc_mask);
127Target* makeTargetEcalSMMBittware(int ilink, uint8_t rocmask, const char* dev);
128
129} // namespace pflib
130
131#endif // PFLIB_TARGET_H_INCLUDED
Interface with DAQ via a WishboneInterface.
Definition DAQ.h:19
Definition ECON.h:18
Representation of FastControl controller.
Definition FastControl.h:14
Base class which encapsulates the I2C interface, represents a single bus.
Definition I2C.h:18
Definition ROC.h:18
encapulating a given setup's access rules
Definition Target.h:24
virtual Elinks & elinks()=0
get the Elinks object
virtual void hardResetECONs()
generate a hard reset to all the ECON boards
Definition Target.h:63
virtual bool have_roc(int iroc) const
do we have a roc with this id?
Definition Target.h:35
DaqFormat
types of daq formats that we can do
Definition Target.h:100
@ SIMPLEROC
simple format for direct HGCROC connection
@ ECOND_SW_HEADERS
ECON-D with headers.
@ ECOND_NO_ZS
ECON-D without applying zero suppression.
virtual void softResetECON(int which=-1)
Generate a soft reset to a specific ECON board, -1 for all.
Definition Target.h:72
virtual uint32_t getFirmwareVersion()
Get the firmware version.
Definition Target.h:66
std::vector< std::string > opto_link_names() const
names of different Optical Links we could talk to
Definition Target.cxx:20
virtual void hardResetROCs()
Generate a hard reset to all the HGCROC boards.
Definition Target.h:60
virtual std::vector< int > roc_ids() const
get a list of the IDs we have set up
Definition Target.h:41
std::vector< std::string > i2c_bus_names()
names of different I2C busses we could talk to
Definition Target.cxx:5
virtual ECON & econ(int which)
get a ECON interface for the given econ board
Definition Target.h:53
virtual FastControl & fc()=0
get the FastControl object
virtual DAQ & daq()=0
get the DAQ object
virtual int necons()
number of econds
Definition Target.h:32
virtual bool have_econ(int iecon) const
do we have an econ with this id?
Definition Target.h:38
I2C & get_i2c_bus(const std::string &name)
get an I2C bus by name
Definition Target.cxx:12
virtual std::vector< int > econ_ids() const
get a list of the econ IDs we have set up
Definition Target.h:44
virtual void softResetROC(int which=-1)
Generate a soft reset to a specific HGCROC board, -1 for all.
Definition Target.h:69
OptoLink & get_opto_link(const std::string &name) const
get an OptoLink by name
Definition Target.cxx:27
virtual int nrocs()
number of boards
Definition Target.h:29
virtual ROC & roc(int which)
Get a ROC interface for the given HGCROC board.
Definition Target.h:47
boost::log::sources::severity_channel_logger_mt< level, std::string > logger
our logger type
Definition Logging.h:39
logger get(const std::string &name)
Gets a logger with the input name for its channel.
Definition Logging.cxx:24
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3