32 dataLabel_ = consumes<RPCDigiCollection>(
pset.getParameter<
edm::InputTag>(
"InputLabel"));
33 readoutMappingToken_ = esConsumes<RPCEMap, RPCEMapRcd>();
35 produces<FEDRawDataCollection>();
45 if (recordWatcher_.check(es)) {
47 LogTrace(
"") <<
"record has CHANGED!!, initialise readout map!";
49 theCabling = readoutMapping->
convert();
50 LogTrace(
"") <<
" READOUT MAP VERSION: " << theCabling->version() << endl;
53 auto buffers = std::make_unique<FEDRawDataCollection>();
56 pair<int, int> rpcFEDS(790, 792);
57 for (
int id = rpcFEDS.first;
id <= rpcFEDS.second; ++
id) {
59 unsigned int lvl1_ID =
ev.id().event();
82 vector<Word64> dataWords;
84 typedef vector<EventRecords>::const_iterator IR;
85 for (IR ir = merged.begin(), irEnd = merged.end(); ir != irEnd; ++ir) {
86 Word64 w = (((
Word64(ir->recordBX().data()) << 16) | ir->recordSLD().data()) << 16 | ir->recordCD().data()) << 16 |
88 dataWords.push_back(
w);
96 int dataSize = (nHeaders + nTrailers + dataWords.size()) *
sizeof(
Word64);
102 unsigned char* pHeader = raw->
data();
104 int source_ID =
fedId;
110 for (
unsigned int idata = 0; idata < dataWords.size(); idata++) {
112 *
word = dataWords[idata];
118 unsigned char* pTrailer = pHeader + raw->
size() -
sizeof(
Word64);
133 vector<EventRecords> dataRecords;
136 for (DigiRangeIterator it = digis->begin(); it != digis->end(); it++) {
138 uint32_t rawDetId = rpcDetId.
rawId();
140 for (vector<RPCDigi>::const_iterator
id =
range.first;
id !=
range.second;
id++) {
142 vector<EventRecords> rawFromDigi =
formatter.recordPack(rawDetId, digi, trigger_BX);
143 dataRecords.insert(dataRecords.end(), rawFromDigi.begin(), rawFromDigi.end());
150 LogTrace(
"RPCRawDataPacker") <<
" size of data: " << dataRecords.size();
151 vector<EventRecords> merged = EventRecords::mergeRecords(dataRecords);
152 LogTrace(
"") <<
" size of megred: " << merged.size();
~RPCPackingModule() override
dtor
size_t size() const
Lenght of the data buffer in bytes.
static std::vector< rpcrawtodigi::EventRecords > eventRecords(int fedId, int trigger_BX, const RPCDigiCollection *, const RPCRecordFormatter &)
RPCReadOutMapping const * convert() const
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.
FEDRawData * rawData(int fedId, unsigned int lvl1_ID, const RPCDigiCollection *, const RPCRecordFormatter &) const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
unsigned long long uint64_t
constexpr uint32_t rawId() const
get the raw id
RPCPackingModule(const edm::ParameterSet &)
ctor
void produce(edm::Event &, const edm::EventSetup &) override
get data, convert to raw event, attach again to Event
std::pair< const_iterator, const_iterator > Range
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.