File indexing completed on 2025-01-18 03:42:24
0001 #include "SimCalorimetry/HGCalSimAlgos/interface/HGCalECONDEmulatorParameters.h"
0002 #include "DataFormats/HGCalDigi/interface/HGCalRawDataDefinitions.h"
0003
0004 using namespace hgcal::econd;
0005
0006 EmulatorParameters::EmulatorParameters(const edm::ParameterSet& iConfig)
0007 : chan_surv_prob(iConfig.getParameter<double>("channelSurv")),
0008 active(iConfig.getParameter<bool>("active")),
0009 passthrough_mode(iConfig.getParameter<bool>("passthroughMode")),
0010 expected_mode(iConfig.getParameter<bool>("expectedMode")),
0011 characterisation_mode(iConfig.getParameter<bool>("characterisationMode")),
0012 matching_ebo_numbers(iConfig.getParameter<bool>("matchingEBOnumbers")),
0013 bo_truncated(iConfig.getParameter<bool>("bufferOverflowTruncated")),
0014 enabled_erxs(iConfig.getParameter<std::vector<unsigned int> >("enabledERxs")),
0015 header_marker(iConfig.getParameter<unsigned int>("headerMarker")),
0016 num_channels_per_erx(iConfig.getParameter<unsigned int>("numChannelsPerERx")),
0017 add_econd_crc(iConfig.getParameter<bool>("addCRC")),
0018 add_idle_word(iConfig.getParameter<bool>("addIdleWord")),
0019 programmable_pattern(iConfig.getParameter<unsigned int>("programmablePattern")),
0020 error_prob({.bitO = iConfig.getParameter<double>("bitOError"),
0021 .bitB = iConfig.getParameter<double>("bitBError"),
0022 .bitE = iConfig.getParameter<double>("bitEError"),
0023 .bitT = iConfig.getParameter<double>("bitTError"),
0024 .bitH = iConfig.getParameter<double>("bitHError"),
0025 .bitS = iConfig.getParameter<double>("bitSError")}),
0026 default_totstatus(iConfig.getParameter<unsigned int>("defaultToTStatus")) {}
0027
0028 edm::ParameterSetDescription EmulatorParameters::description() {
0029 edm::ParameterSetDescription desc;
0030 desc.add<double>("channelSurv", 1.);
0031 desc.add<bool>("active", true)->setComment("is the ECON-D activated?");
0032 desc.add<bool>("passthroughMode", false)->setComment("ECON-D in pass-through mode?");
0033 desc.add<bool>("expectedMode", false)->setComment("is an Event HDR/TRL expected to be received from the HGCROCs?");
0034 desc.add<bool>("characterisationMode", false);
0035 desc.add<unsigned int>("defaultToTStatus", (unsigned int)ToTStatus::AutomaticFull);
0036 desc.add<bool>("matchingEBOnumbers", true)
0037 ->setComment(
0038 "is the transmitted E/B/O (according to mode selected by user) matching the E/B/O value in the ECON-D "
0039 "L1A FIFO?");
0040 desc.add<bool>("bufferOverflowTruncated", false)->setComment("is the packet truncated for buffer overflow?");
0041 {
0042 const unsigned int max_erxs_per_econd = 12;
0043 std::vector<unsigned int> default_enabled_erxs;
0044 for (size_t i = 0; i < max_erxs_per_econd; ++i)
0045 default_enabled_erxs.emplace_back(i);
0046 desc.add<std::vector<unsigned int> >("enabledERxs", default_enabled_erxs)
0047 ->setComment("list of channels to be enabled in readout");
0048 }
0049 desc.add<unsigned int>("headerMarker", 0x154)->setComment("9b programmable pattern; default is '0xAA' + '0b0'");
0050 desc.add<unsigned int>("numChannelsPerERx", 37)->setComment("number of channels managed in each ECON-D eRx");
0051 desc.add<bool>("addCRC", true)->setComment("add the ECON-D CRC word computed from the whole payload");
0052 desc.add<bool>("addIdleWord", false)->setComment("add an idle word at the end of each event packet");
0053 desc.add<unsigned int>("programmablePattern", 0xa5a5a5)
0054 ->setComment("a 24b programmable pattern used by backend to find event packet");
0055 desc.add<double>("bitOError", 0.)->setComment("probability that the bit-O error is set");
0056 desc.add<double>("bitBError", 0.)->setComment("probability that the bit-B error is set");
0057 desc.add<double>("bitEError", 0.)->setComment("probability that the bit-E error is set");
0058 desc.add<double>("bitTError", 0.)->setComment("probability that the bit-T error is set");
0059 desc.add<double>("bitHError", 0.)->setComment("probability that the bit-H error is set");
0060 desc.add<double>("bitSError", 0.)->setComment("probability that the bit-S error is set");
0061 return desc;
0062 }