32 : bx_min_(config.getParameter<
int>(
"bxMin"))
33 , bx_max_(config.getParameter<
int>(
"bxMax"))
34 , ignore_eod_(config.getParameter<
bool>(
"ignoreEOD"))
35 , event_type_(config.getParameter<
int>(
"eventType"))
36 , ufov_(config.getParameter<unsigned
int>(
"uFOV"))
38 produces<FEDRawDataCollection>();
49 desc.
add<
int>(
"bxMin", -2);
50 desc.
add<
int>(
"bxMax", 2);
51 desc.
add<
bool>(
"ignoreEOD",
true);
52 desc.
add<
int>(
"eventType", 1);
53 desc.
add<
unsigned int>(
"uFOV", 1);
54 descs.
add(
"RPCTwinMuxDigiToRaw", desc);
63 for (
auto const & tm_link : es_tm_link_map->
getMap()) {
69 std::sort(fed_amcs.second.begin(), fed_amcs.second.end());
70 fed_amcs.second.erase(
std::unique(fed_amcs.second.begin(), fed_amcs.second.end()), fed_amcs.second.end());
91 std::map<RPCAMCLink, std::vector<std::pair<int, rpctwinmux::RPCRecord> > > amc_bx_tmrecord;
98 std::map<int, FEDRawData> fed_data;
100 for (std::pair<
int, std::vector<RPCAMCLink> >
const & fed_amcs :
fed_amcs_) {
102 unsigned int size(0);
105 data.
resize((size + 2) * 8);
111 std::memcpy(data.
data() + size * 8, &block_header.getRecord(), 8);
115 data.
resize((size + fed_amcs.second.size()) * 8);
116 unsigned int block_content_size(0);
118 std::map<RPCAMCLink, std::vector<std::pair<int, rpctwinmux::RPCRecord> > >::const_iterator bx_tmrecord(amc_bx_tmrecord.find(amc));
119 unsigned int block_amc_size(3 + 2 * (bx_tmrecord == amc_bx_tmrecord.end() ? 0 : bx_tmrecord->second.size()));
120 block_content_size += block_amc_size;
123 ,
true,
true,
true,
true, block_amc_size
126 std::memcpy(data.
data() + size * 8, &amc_content.getRecord(), 8);
131 data.
resize((size + block_content_size) * 8);
132 for (
RPCAMCLink const & amc : fed_amcs.second) {
134 std::map<RPCAMCLink, std::vector<std::pair<int, rpctwinmux::RPCRecord> > >::const_iterator bx_tmrecord(amc_bx_tmrecord.find(amc));
135 unsigned int block_amc_size(3 + 2 * (bx_tmrecord == amc_bx_tmrecord.end() ? 0 : bx_tmrecord->second.size()));
139 ,
event.eventAuxiliary().orbitNumber()
142 std::memcpy(data.
data() + size * 8, tm_header.getRecord(), 16);
145 if (bx_tmrecord != amc_bx_tmrecord.end()) {
146 for (std::vector<std::pair<int, rpctwinmux::RPCRecord> >::const_iterator tmrecord = bx_tmrecord->second.begin()
147 ; tmrecord != bx_tmrecord->second.end() ; ++tmrecord) {
148 std::memcpy(data.
data() + size * 8, tmrecord->second.getRecord(), 16);
154 std::memcpy(data.
data() + size * 8, &tm_trailer.getRecord(), 8);
160 data.
resize((size + 2) * 8);
163 std::memcpy(data.
data() + size * 8, &block_trailer.getRecord(), 8);
T getParameter(std::string const &) const
EventNumber_t event() const
#define DEFINE_FWK_MODULE(type)
RPCAMCLink & setAMCInput(int amcinput=wildcard_)
void beginRun(edm::Run const &run, edm::EventSetup const &setup) override
int bunchCrossing() const
def setup(process, global_tag, zero_tesla=False)
RPCTwinMuxDigiToRaw(edm::ParameterSet const &config)
static void set(unsigned char *trailer, uint32_t lenght, uint16_t crc, uint8_t evt_stat, uint8_t tts, bool moreTrailers=false)
Set all fields in the trailer.
void resize(size_t newsize)
std::map< int, std::vector< RPCAMCLink > > fed_amcs_
static void fillDescriptions(edm::ConfigurationDescriptions &descs)
def unique(seq, keepstr=True)
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void getRPCTwinMuxRecords(RPCInverseLBLinkMap const &lb_map, RPCInverseAMCLinkMap const &amc_map, int min_bx, int max_bx, unsigned int bcn, RPCDigiCollection const &digis, std::map< RPCAMCLink, std::vector< std::pair< int, rpctwinmux::RPCRecord > > > &amc_bx_tmrecord, bool ignore_eod=false)
bool check(const edm::EventSetup &iSetup)
char data[epos_bytes_allocation]
~RPCTwinMuxDigiToRaw() override
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
edm::EDGetTokenT< RPCDigiCollection > digi_token_
edm::ESWatcher< RPCTwinMuxLinkMapRcd > es_tm_link_map_watcher_
void produce(edm::Event &event, edm::EventSetup const &setup) override