77 virtual void beginStream(
StreamID)
override;
79 virtual void endStream()
override;
81 void makeECalTPGs(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<EcalTrigPrimDigiCollection>& ecalTPGs);
83 void makeHCalTPGs(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<HcalTrigPrimDigiCollection>& hcalTPGs);
85 void makeHFTPGs(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<HcalTrigPrimDigiCollection>& hcalTPGs);
87 void makeRegions(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<L1CaloRegionCollection>& regions);
118 fedRawDataLabel(iConfig.getParameter<
InputTag>(
"fedRawDataLabel")),
119 fedIDs(iConfig.getParameter<std::vector<int> >(
"FEDIDs")),
121 verbose(iConfig.getParameter<bool>(
"verbose"))
124 produces<EcalTrigPrimDigiCollection>();
125 produces<HcalTrigPrimDigiCollection>();
126 produces<L1CaloRegionCollection>();
157 if (fedRawDataCollection.isValid()) {
159 for(uint32_t
i = 0;
i <
fedIDs.size();
i++) {
163 const FEDRawData& fedRawData = fedRawDataCollection->FEDData(fed);
166 if(
verbose)
LogDebug(
"L1TCaloLayer1RawToDigi") <<
"Upacking FEDRawData for fed " <<
std::dec << fed <<
" of size " << fedRawData.
size();
170 if ( fedRawData.
size() == 0 || fedRawDataArray ==
nullptr ) {
171 LogError(
"L1TCaloLayer1RawToDigi") <<
"Could not load FED data for " << fed <<
", putting empty collections!";
177 for(uint32_t
i = 0;
i < daqData.
nAMCs();
i++) {
184 uint32_t lPhi = amcData.layer1Phi();
200 LogError(
"L1T") <<
"Cannot unpack: no collection found";
210 if(
verbose &&
event == 5)
LogDebug(
"L1TCaloLayer1") <<
"L1TCaloLayer1RawToDigi: Goodbye! Tired of printing junk" << endl;
216 for(uint32_t iPhi = 0; iPhi < 4; iPhi++) {
217 int cPhi = - 1 + lPhi * 4 + iPhi;
218 if(cPhi == 0) cPhi = 72;
219 else if(cPhi == -1) cPhi = 71;
221 LogError(
"L1TCaloLayer1RawToDigi") <<
"L1TCaloLayer1RawToDigi: Major error in makeECalTPGs" << std::endl;
224 for(
int cEta = -28; cEta <= 28; cEta++) {
226 bool negativeEta =
false;
227 if(cEta < 0) negativeEta =
true;
228 uint32_t iEta =
abs(cEta);
236 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta, iEta, iPhi);
237 if(ctp7Data.
getFB(cType, negativeEta, iEta, iPhi)!=0) towerDatum |= 0x0100;
238 if(ctp7Data.
isTowerMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x2000;
239 if(ctp7Data.
isLinkMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x4000;
242 ctp7Data.
isLinkDown(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x8000;
244 int zSide = cEta / ((int) iEta);
251 ecalTPGs->push_back(tpg);
260 for(uint32_t iPhi = 0; iPhi < 4; iPhi++) {
261 int cPhi = - 1 + lPhi * 4 + iPhi;
262 if(cPhi == 0) cPhi = 72;
263 else if(cPhi == -1) cPhi = 71;
265 LogError(
"L1TCaloLayer1RawToDigi") <<
"L1TCaloLayer1RawToDigi: Major error in makeHCalTPGs" << std::endl;
268 for(
int cEta = -28; cEta <= 28; cEta++) {
270 bool negativeEta =
false;
271 if(cEta < 0) negativeEta =
true;
272 uint32_t iEta =
abs(cEta);
280 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta, iEta, iPhi);
281 if(ctp7Data.
getFB(cType, negativeEta, iEta, iPhi)!=0) towerDatum |= 0x0100;
282 if(ctp7Data.
isLinkMisaligned(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x0200;
283 if(ctp7Data.
isLinkInError(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x0400;
284 if(ctp7Data.
isLinkDown(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x0800;
285 if(ctp7Data.
isTowerMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x2000;
286 if(ctp7Data.
isLinkMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x4000;
289 ctp7Data.
isLinkDown(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x8000;
295 hcalTPGs->push_back(tpg);
304 for(uint32_t side = 0; side <= 1; side++) {
305 bool negativeEta =
false;
306 if(side == 0) negativeEta =
true;
307 for(uint32_t iEta = 30; iEta <= 40; iEta++) {
308 for(uint32_t iPhi = 0; iPhi < 2; iPhi++) {
309 if(iPhi == 1 && iEta == 40) iEta = 41;
310 int cPhi = 1 + lPhi * 4 + iPhi * 2;
311 if(iEta == 41) cPhi -= 2;
312 cPhi = (cPhi+69)%72 + 1;
314 if(negativeEta) cEta = -iEta;
323 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta, iEta, iPhi);
324 towerDatum |= ctp7Data.
getFB(cType, negativeEta, iEta, iPhi) << 8;
325 if(ctp7Data.
isLinkMisaligned(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x0400;
326 if(ctp7Data.
isLinkInError(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x0800;
327 if(ctp7Data.
isLinkDown(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x1000;
328 if(ctp7Data.
isTowerMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x2000;
329 if(ctp7Data.
isLinkMasked(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x4000;
332 ctp7Data.
isLinkDown(cType, negativeEta, iEta, iPhi)) towerDatum |= 0x8000;
339 hcalTPGs->push_back(tpg);
347 for(uint32_t side = 0; side <= 1; side++) {
348 bool negativeEta =
false;
349 if(side == 0) negativeEta =
true;
352 uint32_t lEta = 10 -
region;
353 if(!negativeEta) lEta =
region + 11;
354 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.
#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)
bool isLinkDown(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
~L1TCaloLayer1RawToDigi()
size_t size() const
Lenght of the data buffer in bytes.
void addDefault(ParameterSetDescription const &psetDescription)
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)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
L1TCaloLayer1RawToDigi(const ParameterSet &)
const uint32_t * amcPayload(uint32_t amc)
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)
virtual void endStream() override
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
virtual 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)
virtual void beginStream(StreamID) override
bool isLinkMisaligned(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)