40 : packRctEm_(iConfig.getUntrackedParameter<bool>(
"packRctEm",
true)),
41 packRctCalo_(iConfig.getUntrackedParameter<bool>(
"packRctCalo",
true)),
42 fedId_(iConfig.getParameter<int>(
"gctFedId")),
43 verbose_(iConfig.getUntrackedParameter<bool>(
"verbose",
false)),
48 tokenPut_ = produces<FEDRawDataCollection>();
51 const std::string& gctInputLabelStr = gctInputTag.label();
65 tokenCaloEm_ = consumes<L1CaloEmCollection>(rctInputTag);
88 formatTranslator.setPackingEventId(eventNumber);
119 if (packRctEmThisEvent) {
121 if (rctEm.failedToGet()) {
122 packRctEmThisEvent =
false;
123 LogDebug(
"GCT") <<
"RCT EM Candidate packing requested, but failed to get them from event!";
130 if (packRctCaloThisEvent) {
132 if (rctCalo.failedToGet()) {
133 packRctCaloThisEvent =
false;
134 LogDebug(
"GCT") <<
"RCT Calo Region packing requested, but failed to get them from event!";
145 unsigned int rawSize = 88;
146 if (packRctEmThisEvent) {
149 if (packRctCaloThisEvent) {
152 fedRawData.
resize(rawSize);
153 unsigned char* pHeader = fedRawData.data();
154 unsigned char* pPayload = pHeader + 16;
155 unsigned char* pFooter = pHeader + rawSize - 8;
159 fedHeader.
set(pHeader, 1, eventNumber,
bx,
fedId_);
162 formatTranslator.writeGctOutJetBlock(pPayload,
166 hfRingSums.product(),
167 hfBitCounts.product(),
173 formatTranslator.writeGctOutEmAndEnergyBlock(
174 pPayload, isoEm.product(), nonIsoEm.product(), etTotal.product(), etHad.product(), etMiss.product());
179 if (packRctEmThisEvent) {
180 formatTranslator.writeRctEmCandBlocks(pPayload, rctEm.product());
185 if (packRctCaloThisEvent) {
186 formatTranslator.writeAllRctCaloRegionBlock(pPayload, rctCalo.product());
203 const unsigned char*
d = data.
data();
205 for (
unsigned int i = 0;
i < data.
size();
i =
i + 4) {
206 uint32_t
w = (uint32_t)d[
i] + (uint32_t)(d[
i + 1] << 8) + (uint32_t)(d[
i + 2] << 16) + (uint32_t)(d[
i + 3] << 24);
207 cout << std::hex << std::setw(4) <<
i / 4 <<
" " << std::setw(8) << w << endl;
edm::EDGetTokenT< L1GctHFBitCountsCollection > tokenGctHFBitCounts_
std::atomic< int > counter_
EventNumber_t event() const
edm::EDGetTokenT< L1GctJetCandCollection > tokenGctJetCand_forJets_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< L1GctEmCandCollection > tokenL1GctEmCand_isoEm_
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< L1CaloEmCollection > tokenCaloEm_
edm::EDGetTokenT< L1GctJetCandCollection > tokenGctJetCand_tauJets_
edm::EDGetTokenT< L1GctHtMissCollection > tokenGctHtMiss_
unsigned long long EventNumber_t
edm::EDGetTokenT< L1GctEtTotalCollection > tokenGctEtTotal_
edm::EDGetTokenT< L1CaloRegionCollection > tokenCaloRegion_
edm::EDGetTokenT< L1GctJetCountsCollection > tokenGctJetCounts_
GctDigiToRaw(const edm::ParameterSet &)
size_t size() const
Lenght of the data buffer in bytes.
edm::EDGetTokenT< L1GctJetCandCollection > tokenGctJetCand_cenJets_
edm::EDGetTokenT< L1GctEtMissCollection > tokenGctEtMiss_
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.
edm::EDGetTokenT< L1GctEtHadCollection > tokenGctEtHad_
void resize(size_t newsize)
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const final
edm::EDPutTokenT< FEDRawDataCollection > tokenPut_
edm::EDGetTokenT< L1GctHFRingEtSumsCollection > tokenGctHFRingEtSums_
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
T getParameter(std::string const &) const
edm::EDGetTokenT< L1GctEmCandCollection > tokenL1GctEmCand_nonIsoEm_
char data[epos_bytes_allocation]
static std::atomic< unsigned int > counter
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
void print(FEDRawData &data) const