pflib v3.12.0-1-g716e801
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#include "pflib/packing/SingleECONDRocErxMapping.h"
12
13namespace pflib {
14
15class OptoLink;
16class TRIG;
17
26class Target {
27 public:
28 virtual ~Target() = default;
29
31 virtual int nrocs() = 0;
32
34 virtual int necons() = 0;
35
37 virtual bool have_roc(int iroc) const = 0;
38
40 virtual bool have_econ(int iecon) const = 0;
41
43 virtual std::vector<int> roc_ids() const = 0;
44
46 virtual std::vector<int> econ_ids() const = 0;
47
49 virtual ROC& roc(int which) = 0;
50
52 virtual ECON& econ(int which) = 0;
53
55 virtual void hardResetROCs() = 0;
56
58 virtual void hardResetECONs() = 0;
59
61 virtual uint32_t getFirmwareVersion() { return -1; }
62
64 virtual void softResetROC(int which = -1) = 0;
65
67 virtual void softResetECON(int which = -1) = 0;
68
70 virtual Elinks& elinks() = 0;
71
73 virtual FastControl& fc() = 0;
74
76 virtual DAQ& daq() = 0;
77
79 virtual TRIG* trig(int itrig = 0) { return 0; }
80
83
85 I2C& get_i2c_bus(const std::string& name);
86
89
91 OptoLink& get_opto_link(const std::string& name) const;
92
104 virtual const std::vector<std::pair<int, int>>&
106
120
126
130 enum class DaqFormat {
141 SIMPLEROC = 1,
148 };
149
150 virtual void setup_run(int irun, DaqFormat format, int contrib_id = -1) = 0;
151 virtual std::vector<uint32_t> read_event() = 0;
152 virtual bool has_event() { return daq().getEventOccupancy() > 0; }
153
186
191
195 const std::map<int,
197 parameters);
198
199 protected:
202 mutable logging::logger the_log_{logging::get("Target")};
203
204 private:
206};
207
208Target* makeTargetFiberless();
209Target* makeTargetHcalBackplaneZCU(int ilink, uint8_t board_mask);
210Target* makeTargetHcalBackplaneBittware(int ilink, uint8_t board_mask,
211 const char* dev);
212Target* makeTargetEcalSMMZCU(int ilink, uint8_t roc_mask);
213Target* makeTargetEcalSMMBittware(int ilink, uint8_t rocmask, const char* dev);
214
215} // namespace pflib
216
217#endif // PFLIB_TARGET_H_INCLUDED
Interface with DAQ via a WishboneInterface.
Definition DAQ.h:19
Definition ECON.h:19
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:19
Trigger path management interface.
Definition TRIG.h:18
temporarily apply parameters to all of the ROCs connected to a target and then unset them
Definition Target.h:161
Target * tgt_
handle to target holding ROCs
Definition Target.h:182
TempParametersAllROCs(Target *tgt, const std::map< std::string, std::map< std::string, uint64_t > > &parameters)
applies the same parameters to all the ROCs and holds the previous registers
Definition Target.cxx:43
TempParametersAllROCs(const TempParametersAllROCs &)=delete
cannot copy or assign this lock
std::map< int, std::map< int, std::map< int, uint8_t > > > prior_registers_
set of prior registers separated by ROC
Definition Target.h:184
encapulating a given setup's access rules
Definition Target.h:26
virtual Elinks & elinks()=0
get the Elinks object
virtual const std::vector< std::pair< int, std::vector< int > > > & getHardwareRocErxMappingTRG()=0
Define the ROC-TRG -> eRx input into the ECON-T for the hardware.
DaqFormat
types of daq formats that we can do
Definition Target.h:130
@ SIMPLEROC
simple format for direct HGCROC connection
@ ECOND_SW_HEADERS
ECON-D format with headers inserted by software (on the ZCU) or firmware (on the Bittware) to mark th...
virtual void softResetECON(int which=-1)=0
Generate a soft reset to a specific ECON board, -1 for all.
virtual uint32_t getFirmwareVersion()
Get the firmware version.
Definition Target.h:61
virtual std::vector< int > roc_ids() const =0
get a list of the IDs we have set up
virtual void hardResetECONs()=0
generate a hard reset to all the ECON boards
std::vector< std::string > opto_link_names() const
names of different Optical Links we could talk to
Definition Target.cxx:20
virtual void softResetROC(int which=-1)=0
Generate a soft reset to a specific HGCROC board, -1 for all.
virtual ROC & roc(int which)=0
Get a ROC interface for the given HGCROC board.
std::vector< std::string > i2c_bus_names()
names of different I2C busses we could talk to
Definition Target.cxx:5
virtual bool have_roc(int iroc) const =0
do we have a roc with this id?
virtual const std::vector< std::pair< int, int > > & getHardwareRocErxMappingDAQ()=0
Define the ROC-half -> eRx input into the ECON-D for the hardware.
virtual FastControl & fc()=0
get the FastControl object
virtual DAQ & daq()=0
get the DAQ object
virtual void hardResetROCs()=0
Generate a hard reset to all the HGCROC boards.
I2C & get_i2c_bus(const std::string &name)
get an I2C bus by name
Definition Target.cxx:12
virtual int necons()=0
number of econds
virtual int nrocs()=0
number of boards
virtual TRIG * trig(int itrig=0)
get the TRIG object, if it exists (may return NULL)
Definition Target.h:79
OptoLink & get_opto_link(const std::string &name) const
get an OptoLink by name
Definition Target.cxx:27
virtual bool have_econ(int iecon) const =0
do we have an econ with this id?
virtual ECON & econ(int which)=0
get a ECON interface for the given econ board
const packing::SingleECONDRocErxMapping & getRocErxMapping()
get the mapping that can be used to convert between (i_erx, link_chan) and (i_roc,...
Definition Target.cxx:35
virtual std::vector< int > econ_ids() const =0
get a list of the econ IDs we have set up
TempParametersAllROCs tempApplyAllROCs(const std::map< std::string, std::map< std::string, uint64_t > > &parameters)
temporarily apply the same parameters to all the ROCs these parameters are unset when the returned ob...
Definition Target.cxx:69
Mapping for link/channel IDs for single ECON-D collection.
Definition SingleECONDRocErxMapping.h:35
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