76 void makeECalTPGs(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<EcalTrigPrimDigiCollection>& ecalTPGs);
78 void makeHCalTPGs(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<HcalTrigPrimDigiCollection>& hcalTPGs);
80 void makeHFTPGs(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<HcalTrigPrimDigiCollection>& hcalTPGs);
82 void makeRegions(uint32_t lPhi,
UCTCTP7RawData& ctp7Data, std::unique_ptr<L1CaloRegionCollection>&
regions);
107 fedIDs(iConfig.getParameter<
std::
vector<
int> >(
"FEDIDs")),
110 produces<EcalTrigPrimDigiCollection>();
111 produces<HcalTrigPrimDigiCollection>();
112 produces<L1CaloRegionCollection>();
134 if (fedRawDataCollection.
isValid()) {
135 for (uint32_t
i = 0;
i <
fedIDs.size();
i++) {
143 <<
"Upacking FEDRawData for fed " <<
std::dec << fed <<
" of size " <<
fedRawData.size();
147 if (
fedRawData.size() == 0 || fedRawDataArray ==
nullptr) {
148 LogDebug(
"L1TCaloLayer1RawToDigi") <<
"Could not load FED data for " << fed <<
", putting empty collections!";
155 for (uint32_t
i = 0;
i < daqData.
nAMCs();
i++) {
162 uint32_t lPhi = amcData.layer1Phi();
177 LogError(
"L1T") <<
"Cannot unpack: no collection found";
188 LogDebug(
"L1TCaloLayer1") <<
"L1TCaloLayer1RawToDigi: Goodbye! Tired of printing junk" << endl;
193 std::unique_ptr<EcalTrigPrimDigiCollection>& ecalTPGs) {
195 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
196 int cPhi = -1 + lPhi * 4 + iPhi;
201 else if (cPhi < -1) {
202 LogError(
"L1TCaloLayer1RawToDigi") <<
"L1TCaloLayer1RawToDigi: Major error in makeECalTPGs" << std::endl;
205 for (
int cEta = -28; cEta <= 28; cEta++) {
207 bool negativeEta =
false;
218 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
219 if (ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) != 0)
220 towerDatum |= 0x0100;
222 towerDatum |= 0x2000;
224 towerDatum |= 0x4000;
228 towerDatum |= 0x8000;
230 int zSide = cEta / ((
int)
iEta);
238 ecalTPGs->push_back(tpg);
246 std::unique_ptr<HcalTrigPrimDigiCollection>& hcalTPGs) {
248 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
249 int cPhi = -1 + lPhi * 4 + iPhi;
254 else if (cPhi < -1) {
255 LogError(
"L1TCaloLayer1RawToDigi") <<
"L1TCaloLayer1RawToDigi: Major error in makeHCalTPGs" << std::endl;
258 for (
int cEta = -28; cEta <= 28; cEta++) {
260 bool negativeEta =
false;
271 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
272 if (ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) != 0)
273 towerDatum |= 0x0100;
275 towerDatum |= 0x0200;
277 towerDatum |= 0x0400;
279 towerDatum |= 0x0800;
281 towerDatum |= 0x2000;
283 towerDatum |= 0x4000;
287 towerDatum |= 0x8000;
293 hcalTPGs->push_back(tpg);
301 std::unique_ptr<HcalTrigPrimDigiCollection>& hcalTPGs) {
304 bool negativeEta =
false;
308 for (uint32_t iPhi = 0; iPhi < 2; iPhi++) {
309 if (iPhi == 1 &&
iEta == 40)
311 int cPhi = 1 + lPhi * 4 + iPhi * 2;
314 cPhi = (cPhi + 69) % 72 + 1;
326 uint32_t towerDatum = ctp7Data.
getET(cType, negativeEta,
iEta, iPhi);
327 towerDatum |= ctp7Data.
getFB(cType, negativeEta,
iEta, iPhi) << 8;
329 towerDatum |= 0x0400;
331 towerDatum |= 0x0800;
333 towerDatum |= 0x1000;
335 towerDatum |= 0x2000;
337 towerDatum |= 0x4000;
341 towerDatum |= 0x8000;
348 hcalTPGs->push_back(tpg);
356 std::unique_ptr<L1CaloRegionCollection>&
regions) {
358 bool negativeEta =
false;
363 uint32_t lEta = 10 -
region;
366 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)
bool isLinkMasked(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
void makeRegions(uint32_t lPhi, UCTCTP7RawData &ctp7Data, std::unique_ptr< L1CaloRegionCollection > ®ions)
ALPAKA_FN_ACC int side(int ieta, int iphi)
Log< level::Error, false > LogError
bool isLinkDown(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
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)
#define DEFINE_FWK_MODULE(type)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
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 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)
bool isLinkMisaligned(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)