41 rctInputLabel_(iConfig.getParameter<edm::InputTag>(
"rctInputLabel")),
42 gctInputLabel_(iConfig.getParameter<edm::InputTag>(
"gctInputLabel")),
43 packRctEm_(iConfig.getUntrackedParameter<bool>(
"packRctEm",
true)),
44 packRctCalo_(iConfig.getUntrackedParameter<bool>(
"packRctCalo",
true)),
45 fedId_(iConfig.getParameter<int>(
"gctFedId")),
46 verbose_(iConfig.getUntrackedParameter<bool>(
"verbose",
false)),
53 produces<FEDRawDataCollection>();
88 iEvent.
getByLabel(gctInputLabelStr,
"isoEm", isoEm);
90 iEvent.
getByLabel(gctInputLabelStr,
"nonIsoEm", nonIsoEm);
92 iEvent.
getByLabel(gctInputLabelStr,
"cenJets", cenJets);
94 iEvent.
getByLabel(gctInputLabelStr,
"forJets", forJets);
96 iEvent.
getByLabel(gctInputLabelStr,
"tauJets", tauJets);
98 iEvent.
getByLabel(gctInputLabelStr,
"", etTotal);
100 iEvent.
getByLabel(gctInputLabelStr,
"", etHad);
102 iEvent.
getByLabel(gctInputLabelStr,
"", etMiss);
104 iEvent.
getByLabel(gctInputLabelStr,
"", hfRingSums);
106 iEvent.
getByLabel(gctInputLabelStr,
"", hfBitCounts);
108 iEvent.
getByLabel(gctInputLabelStr,
"", htMiss);
110 iEvent.
getByLabel(gctInputLabelStr,
"", jetCounts);
115 if(packRctEmThisEvent)
118 if(rctEm.failedToGet())
120 packRctEmThisEvent =
false;
121 LogDebug(
"GCT") <<
"RCT EM Candidate packing requested, but failed to get them from event!";
128 if(packRctCaloThisEvent)
131 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) { rawSize += 232; }
147 if(packRctCaloThisEvent) { rawSize += 800; }
148 fedRawData.
resize(rawSize);
149 unsigned char * pHeader = fedRawData.data();
150 unsigned char * pPayload = pHeader + 16;
151 unsigned char * pFooter = pHeader + rawSize - 8;
155 fedHeader.
set(pHeader, 1, eventNumber, bx,
fedId_);
162 hfRingSums.product(),
163 hfBitCounts.product(),
179 if(packRctEmThisEvent)
186 if(packRctCaloThisEvent)
205 const unsigned char * d = data.
data();
207 for (
unsigned int i=0;
i<data.
size();
i=
i+4) {
208 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);
209 cout << std::hex << std::setw(4) <<
i/4 <<
" " << std::setw(8) << w << endl;
EventNumber_t event() const
#define DEFINE_FWK_MODULE(type)
unsigned long long EventNumber_t
static void set(unsigned char *trailer, int evt_lgth, int crc, int evt_stat, int tts, bool T=false)
Set all fields in the trailer.
virtual void produce(edm::Event &, const edm::EventSetup &)
GctDigiToRaw(const edm::ParameterSet &)
size_t size() const
Lenght of the data buffer in bytes.
edm::InputTag rctInputLabel_
void print(FEDRawData &data)
void resize(size_t newsize)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::InputTag gctInputLabel_
char data[epos_bytes_allocation]
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
GctFormatTranslateMCLegacy formatTranslator_
volatile std::atomic< bool > shutdown_flag false