77 void endStream()
override;
79 void makeECalTPGs(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<EcalTrigPrimDigiCollection>& ecalTPGs);
81 void makeHCalTPGs(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<HcalTrigPrimDigiCollection>& hcalTPGs);
83 void makeHFTPGs(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<HcalTrigPrimDigiCollection>& hcalTPGs);
85 void makeRegions(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<L1CaloRegionCollection>&
regions);
114 : fedRawDataLabel(iConfig.getParameter<
InputTag>(
"fedRawDataLabel")),
115 fedIDs(iConfig.getParameter<std::
vector<int> >(
"FEDIDs")),
117 verbose(iConfig.getParameter<bool>(
"verbose")) {
118 produces<EcalTrigPrimDigiCollection>();
119 produces<HcalTrigPrimDigiCollection>();
120 produces<L1CaloRegionCollection>();
144 if (fedRawDataCollection.isValid()) {
145 for (uint32_t
i = 0;
i <
fedIDs.size();
i++) {
148 const FEDRawData& fedRawData = fedRawDataCollection->FEDData(fed);
153 <<
"Upacking FEDRawData for fed " <<
std::dec << fed <<
" of size " << fedRawData.
size();
157 if (fedRawData.
size() == 0 || fedRawDataArray ==
nullptr) {
158 LogDebug(
"L1TCaloLayer1RawToDigi") <<
"Could not load FED data for " << fed <<
", putting empty collections!";
165 for (uint32_t
i = 0;
i < daqData.
nAMCs();
i++) {
172 uint32_t lPhi = amcData.layer1Phi();
187 LogError(
"L1T") <<
"Cannot unpack: no collection found";
198 LogDebug(
"L1TCaloLayer1") <<
"L1TCaloLayer1RawToDigi: Goodbye! Tired of printing junk" << endl;
203 std::unique_ptr<EcalTrigPrimDigiCollection>& ecalTPGs) {
205 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
206 int cPhi = -1 + lPhi * 4 + iPhi;
211 else if (cPhi < -1) {
212 LogError(
"L1TCaloLayer1RawToDigi") <<
"L1TCaloLayer1RawToDigi: Major error in makeECalTPGs" << std::endl;
215 for (
int cEta = -28; cEta <= 28; cEta++) {
217 bool negativeEta =
false;
220 uint32_t iEta =
abs(cEta);
228 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta, iEta, iPhi);
229 if (ctp7Data.
getFB(cType, negativeEta, iEta, iPhi) != 0)
230 towerDatum |= 0x0100;
232 towerDatum |= 0x2000;
233 if (ctp7Data.
isLinkMasked(cType, negativeEta, iEta, iPhi))
234 towerDatum |= 0x4000;
237 ctp7Data.
isLinkDown(cType, negativeEta, iEta, iPhi))
238 towerDatum |= 0x8000;
240 int zSide = cEta / ((int)iEta);
248 ecalTPGs->push_back(tpg);
256 std::unique_ptr<HcalTrigPrimDigiCollection>& hcalTPGs) {
258 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
259 int cPhi = -1 + lPhi * 4 + iPhi;
264 else if (cPhi < -1) {
265 LogError(
"L1TCaloLayer1RawToDigi") <<
"L1TCaloLayer1RawToDigi: Major error in makeHCalTPGs" << std::endl;
268 for (
int cEta = -28; cEta <= 28; cEta++) {
270 bool negativeEta =
false;
273 uint32_t iEta =
abs(cEta);
281 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta, iEta, iPhi);
282 if (ctp7Data.
getFB(cType, negativeEta, iEta, iPhi) != 0)
283 towerDatum |= 0x0100;
285 towerDatum |= 0x0200;
287 towerDatum |= 0x0400;
288 if (ctp7Data.
isLinkDown(cType, negativeEta, iEta, iPhi))
289 towerDatum |= 0x0800;
291 towerDatum |= 0x2000;
292 if (ctp7Data.
isLinkMasked(cType, negativeEta, iEta, iPhi))
293 towerDatum |= 0x4000;
296 ctp7Data.
isLinkDown(cType, negativeEta, iEta, iPhi))
297 towerDatum |= 0x8000;
303 hcalTPGs->push_back(tpg);
311 std::unique_ptr<HcalTrigPrimDigiCollection>& hcalTPGs) {
313 for (uint32_t side = 0; side <= 1; side++) {
314 bool negativeEta =
false;
317 for (uint32_t iEta = 30; iEta <= 40; iEta++) {
318 for (uint32_t iPhi = 0; iPhi < 2; iPhi++) {
319 if (iPhi == 1 && iEta == 40)
321 int cPhi = 1 + lPhi * 4 + iPhi * 2;
324 cPhi = (cPhi + 69) % 72 + 1;
336 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta, iEta, iPhi);
337 towerDatum |= ctp7Data.
getFB(cType, negativeEta, iEta, iPhi) << 8;
339 towerDatum |= 0x0400;
341 towerDatum |= 0x0800;
342 if (ctp7Data.
isLinkDown(cType, negativeEta, iEta, iPhi))
343 towerDatum |= 0x1000;
345 towerDatum |= 0x2000;
346 if (ctp7Data.
isLinkMasked(cType, negativeEta, iEta, iPhi))
347 towerDatum |= 0x4000;
350 ctp7Data.
isLinkDown(cType, negativeEta, iEta, iPhi))
351 towerDatum |= 0x8000;
358 hcalTPGs->push_back(tpg);
366 std::unique_ptr<L1CaloRegionCollection>&
regions) {
367 for (uint32_t side = 0; side <= 1; side++) {
368 bool negativeEta =
false;
373 uint32_t lEta = 10 -
region;
376 regions->push_back(
L1CaloRegion((uint16_t)regionData, (
unsigned)lEta, (
unsigned)lPhi, (int16_t)0));
std::vector< int > fedIDs
void makeHCalTPGs(uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< HcalTrigPrimDigiCollection > &hcalTPGs)
void setSample(int i, const HcalTriggerPrimitiveSample &sam)
uint32_t getFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
uint16_t *__restrict__ id
#define DEFINE_FWK_MODULE(type)
bool isLinkMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
void makeRegions(uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< L1CaloRegionCollection > ®ions)
~L1TCaloLayer1RawToDigi() override
Log< level::Error, false > LogError
bool isLinkDown(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
size_t size() const
Lenght of the data buffer in bytes.
void addDefault(ParameterSetDescription const &psetDescription)
static constexpr int verbose
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
bool isLinkInError(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool isTowerMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
Abs< T >::type abs(const T &t)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
L1TCaloLayer1RawToDigi(const ParameterSet &)
const uint32_t * amcPayload(uint32_t amc)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void makeHFTPGs(uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< HcalTrigPrimDigiCollection > &hcalTPGs)
unsigned long long uint64_t
void makeECalTPGs(uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< EcalTrigPrimDigiCollection > &ecalTPGs)
uint32_t getET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
void endStream() override
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
void produce(Event &, const EventSetup &) override
A calorimeter trigger region (sum of 4x4 trigger towers)
std::vector< L1CaloRegion > L1CaloRegionCollection
uint32_t getRegionSummary(bool negativeEta, uint32_t region)
void beginStream(StreamID) override
bool isLinkMisaligned(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)