|
pflib v3.9.5-18-g30f792c
Pretty Fine HGCROC Interaction Library
|
Mapping for link/channel IDs for single ECON-D collection. More...
#include <SingleECONDRocErxMapping.h>
Public Member Functions | |
| SingleECONDRocErxMapping (const std::vector< std::pair< int, int > > &roc_half_to_erx, const std::vector< int > &active_rocs) | |
| Construct the mapping. | |
| std::pair< int, int > | toROCHalf (int i_erx) const |
| Get which ROC-half the input i_erx corresponds to. | |
| std::pair< int, int > | toROCChannel (int i_erx, int channel) const |
| Convert the input (i_erx, channel) index to the (i_roc, channel) index using the RocErxMapping defined for the Target and which ROCs are active. | |
| int | toErx (int i_roc, int half) const |
| Get the i_erx the input ROC-half corresponds to. | |
| std::pair< int, int > | toErxChannel (int i_roc, int channel) const |
| Convert the input (i_roc, channel) index to the (i_erx, channel) index. | |
Private Attributes | |
| std::vector< std::pair< int, int > > | roc_half_to_erx_ |
| mapping from ROC-half to eRx input to ECON-D | |
| std::vector< int > | i_erx_to_erx_ |
| map from i_erx index in decoding to eRx ID input to ECON | |
| std::vector< int > | erx_to_i_erx_ |
| Map from eRx ID input to ECON to i_erx index in decoding. | |
| std::vector< std::pair< int, int > > | erx_to_roc_half_ |
| map from eRx ID input to ECON to ROC-half | |
Mapping for link/channel IDs for single ECON-D collection.
Invert the ROC -> eRx pair mapping including which ROCs are active
As far as I (Tom) know, the data is packed into the ECON-D packet in eRx order which, depending on the wiring of the board connecting the ROCs to the ECON-D, can lead to the "first" link not being eRx 0. This means we need to do two "mappings" to get back the ROC-half a specific link from the decoded data applies to.
For example, if HGCROC0 is active on an HcalBackplane, its pair of output links are mapped to eRx (3, 2) which are then packed into the ECONDEventPacket in eRx order and unpacked with i_erx (0, 1). i_erx 0 was eRx 2 which was the upper half (half 1) of HGCROC0.
Since we are dealing with re-mapping of indices and integers, I don't use std::map - I just use std::vector (but I'm still thinking of them as maps where the "keys" are the vector indices).
| pflib::packing::SingleECONDRocErxMapping::SingleECONDRocErxMapping | ( | const std::vector< std::pair< int, int > > & | roc_half_to_erx, |
| const std::vector< int > & | active_rocs ) |
Construct the mapping.
We need to know two pieces of information:
| [in] | roc_half_to_erx | mapping of ROC halfs to the eRx input to ECON-D |
| [in] | active_rocs | the ROC indices that are active |
The main work of this constructor is inverting the input mapping and constructing the i_erx<->eRx mappings from the list of active_rocs. This "inversion" is done once to make the later conversion of these indices faster.
| int pflib::packing::SingleECONDRocErxMapping::toErx | ( | int | i_roc, |
| int | half ) const |
| std::pair< int, int > pflib::packing::SingleECONDRocErxMapping::toErxChannel | ( | int | i_roc, |
| int | channel ) const |
Convert the input (i_roc, channel) index to the (i_erx, channel) index.
| [in] | i_roc | index for an active ROC (no checking is done) |
| [in] | channel | channel index within that ROC (0-72) |
| std::pair< int, int > pflib::packing::SingleECONDRocErxMapping::toROCChannel | ( | int | i_erx, |
| int | channel ) const |
Convert the input (i_erx, channel) index to the (i_roc, channel) index using the RocErxMapping defined for the Target and which ROCs are active.
| [in] | i_erx | index for the eRx link that the ECON-D as output after decoding |
| [in] | channel | channel index within that eRx (0-36) |
| std::pair< int, int > pflib::packing::SingleECONDRocErxMapping::toROCHalf | ( | int | i_erx | ) | const |
Get which ROC-half the input i_erx corresponds to.
| [in] | i_erx | index for the eRx link that the ECON-D output |
|
private |
Map from eRx ID input to ECON to i_erx index in decoding.
This depends on which ROCs are active.
|
private |
map from eRx ID input to ECON to ROC-half
This does not depend on which ROCs are active, but it does depend on how the hardware is wired. It is just an inversion of roc_half_to_erx_ that is given to us in the constructor.
|
private |
map from i_erx index in decoding to eRx ID input to ECON
This depends on which ROCs are active.