34 #include "L1Trigger/L1TCaloLayer1/src/UCTLayer1.hh" 35 #include "L1Trigger/L1TCaloLayer1/src/UCTCrate.hh" 36 #include "L1Trigger/L1TCaloLayer1/src/UCTCard.hh" 37 #include "L1Trigger/L1TCaloLayer1/src/UCTRegion.hh" 38 #include "L1Trigger/L1TCaloLayer1/src/UCTTower.hh" 40 #include "L1Trigger/L1TCaloLayer1/src/UCTGeometry.hh" 41 #include "L1Trigger/L1TCaloLayer1/src/UCTLogging.hh" 49 #include "L1Trigger/L1TCaloLayer1/src/L1TCaloLayer1FetchLUTs.hh" 77 std::vector<std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> >
ecalLUT;
78 std::vector<std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> >
hcalLUT;
79 std::vector<std::array<std::array<uint32_t, nEtBins>, nHfEtaBins> >
hfLUT;
116 towerPutToken{produces<CaloTowerBxCollection>()},
117 regionPutToken{produces<L1CaloRegionCollection>()},
118 lutsTokens{esConsumes<edm::Transition::BeginRun>(),
119 esConsumes<edm::Transition::BeginRun>(),
120 esConsumes<edm::Transition::BeginRun>()},
124 useLSB(iConfig.getParameter<
bool>(
"useLSB")),
125 useCalib(iConfig.getParameter<
bool>(
"useCalib")),
126 useECALLUT(iConfig.getParameter<
bool>(
"useECALLUT")),
127 useHCALLUT(iConfig.getParameter<
bool>(
"useHCALLUT")),
128 useHFLUT(iConfig.getParameter<
bool>(
"useHFLUT")),
129 useHCALFBLUT(iConfig.getParameter<
bool>(
"useHCALFBLUT")),
130 verbose(iConfig.getUntrackedParameter<
bool>(
"verbose")),
133 fwVersion(iConfig.getParameter<
int>(
"firmwareVersion")) {
135 layer1 = std::make_unique<UCTLayer1>(
fwVersion);
137 vector<UCTCrate*> crates = layer1->getCrates();
138 for (uint32_t crt = 0; crt < crates.size(); crt++) {
139 vector<UCTCard*> cards = crates[crt]->getCards();
140 for (uint32_t crd = 0; crd < cards.size(); crd++) {
141 vector<UCTRegion*>
regions = cards[crd]->getRegions();
142 for (uint32_t rgn = 0; rgn <
regions.size(); rgn++) {
144 for (uint32_t twr = 0; twr <
towers.size(); twr++) {
145 twrList.push_back(
towers[twr]);
153 std::sort(twrList.begin(), twrList.end(), [](UCTTower*
a, UCTTower*
b) {
154 return CaloTools::caloTowerHash(
a->caloEta(),
a->caloPhi()) < CaloTools::caloTowerHash(
b->caloEta(),
b->caloPhi());
174 if (!
layer1->clearEvent()) {
175 LOG_ERROR <<
"UCT: Failed to clear event" << std::endl;
179 for (
const auto& ecalTp : *ecalTPs) {
182 int caloEta = ecalTp.id().ieta();
183 int caloPhi = ecalTp.id().iphi();
184 int et = ecalTp.compressedEt();
185 bool fgVeto = ecalTp.fineGrain();
186 UCTTowerIndex
t = UCTTowerIndex(caloEta, caloPhi);
187 if (!
layer1->setECALData(
t, fgVeto,
et)) {
188 LOG_ERROR <<
"UCT: Failed loading an ECAL tower" << std::endl;
194 for (
const auto& hcalTp : *hcalTPs) {
197 int caloEta = hcalTp.id().ieta();
198 uint32_t absCaloEta =
std::abs(caloEta);
200 if (absCaloEta == 29) {
204 else if (hcalTp.id().version() == 0 && absCaloEta > 29) {
206 }
else if (absCaloEta <= 41) {
207 int caloPhi = hcalTp.id().iphi();
208 int et = hcalTp.SOI_compressedEt();
209 bool fg = hcalTp.t0().fineGrain(0);
210 bool fg2 = hcalTp.t0().fineGrain(1);
211 bool fg3 = hcalTp.t0().fineGrain(2);
212 bool fg4 = hcalTp.t0().fineGrain(3);
215 UCTTowerIndex
t = UCTTowerIndex(caloEta, caloPhi);
216 uint32_t featureBits = 0;
217 if (absCaloEta > 29) {
223 }
else if (absCaloEta < 16)
224 featureBits |= (fg | ((!fg2) & (fg3 | fg4)));
225 if (!
layer1->setHCALData(
t, featureBits,
et)) {
226 LOG_ERROR <<
"caloEta = " << caloEta <<
"; caloPhi =" << caloPhi << std::endl;
227 LOG_ERROR <<
"UCT: Failed loading an HCAL tower" << std::endl;
231 LOG_ERROR <<
"Illegal Tower: caloEta = " << caloEta <<
"; caloPhi =" << caloPhi <<
"; et = " <<
et 235 LOG_ERROR <<
"Illegal Tower: caloEta = " << caloEta << std::endl;
242 LOG_ERROR <<
"UCT: Failed to process layer 1" << std::endl;
247 for (uint32_t twr = 0; twr <
twrList.size(); twr++) {
262 vector<UCTCrate*> crates =
layer1->getCrates();
263 for (uint32_t crt = 0; crt < crates.size(); crt++) {
264 vector<UCTCard*> cards = crates[crt]->getCards();
265 for (uint32_t crd = 0; crd < cards.size(); crd++) {
266 vector<UCTRegion*>
regions = cards[crd]->getRegions();
267 for (uint32_t rgn = 0; rgn <
regions.size(); rgn++) {
269 uint32_t regionData =
rawData & 0x0000FFFF;
271 uint32_t card =
regions[rgn]->getCard();
273 bool negativeEta =
regions[rgn]->isNegativeEta();
274 uint32_t rPhi =
g.getUCTRegionPhiIndex(
crate, card);
275 if (
region < NRegionsInCard) {
281 rgnCollection.push_back(
L1CaloRegion((uint16_t)regionData, (
unsigned)rEta, (
unsigned)rPhi, (int16_t)0));
307 LOG_ERROR <<
"L1TCaloLayer1::beginRun: failed to fetch LUTS - using unity" << std::endl;
312 std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> eCalLayer1EtaSideEtArray = {};
313 std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> hCalLayer1EtaSideEtArray = {};
314 std::array<std::array<uint32_t, nEtBins>, nHfEtaBins> hfLayer1EtaEtArray = {};
315 for (uint32_t
i = 0;
i < nCalEtaBins;
i++) {
316 for (uint32_t
j = 0;
j < nCalSideBins;
j++) {
317 for (uint32_t
k = 0;
k < nEtBins;
k++) {
318 eCalLayer1EtaSideEtArray[
i][
j][
k] = 0xFFFFFFFF;
319 hCalLayer1EtaSideEtArray[
i][
j][
k] = 0xFFFFFFFF;
323 for (uint32_t
i = 0;
i < nHfEtaBins;
i++) {
324 for (uint32_t
j = 0;
j < nEtBins;
j++) {
325 hfLayer1EtaEtArray[
i][
j] = 0xFFFFFFFF;
328 ecalLUT.push_back(eCalLayer1EtaSideEtArray);
329 hcalLUT.push_back(hCalLayer1EtaSideEtArray);
330 hfLUT.push_back(hfLayer1EtaEtArray);
332 for (uint32_t twr = 0; twr <
twrList.size(); twr++) {
355 desc.add<
bool>(
"useLSB",
true);
356 desc.add<
bool>(
"useCalib",
true);
357 desc.add<
bool>(
"useECALLUT",
true);
358 desc.add<
bool>(
"useHCALLUT",
true);
359 desc.add<
bool>(
"useHFLUT",
true);
360 desc.add<
bool>(
"useHCALFBLUT",
false);
361 desc.addUntracked<
bool>(
"verbose",
false);
362 desc.add<
bool>(
"unpackEcalMask",
false);
363 desc.add<
bool>(
"unpackHcalMask",
false);
364 desc.add<
int>(
"firmwareVersion", 1);
std::vector< std::array< std::array< uint32_t, nEtBins >, nHfEtaBins > > hfLUT
std::vector< unsigned int > hfPhiMap
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalTPSource
std::vector< std::array< std::array< std::array< uint32_t, nEtBins >, nCalSideBins >, nCalEtaBins > > ecalLUT
std::vector< unsigned long long int > hcalFBLUT
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
std::unique_ptr< UCTLayer1 > layer1
edm::EDPutTokenT< L1CaloRegionCollection > regionPutToken
void produce(edm::Event &, const edm::EventSetup &) override
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< std::array< std::array< std::array< uint32_t, nEtBins >, nCalSideBins >, nCalEtaBins > > hcalLUT
std::vector< UCTTower * > twrList
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setHwEtRatio(int ratio)
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalTPSource
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const L1TCaloLayer1FetchLUTsTokens lutsTokens
edm::EDPutTokenT< CaloTowerBxCollection > towerPutToken
std::vector< unsigned int > hPhiMap
L1TCaloLayer1(const edm::ParameterSet &)
void beginRun(edm::Run const &, edm::EventSetup const &) override
A calorimeter trigger region (sum of 4x4 trigger towers)
std::vector< L1CaloRegion > L1CaloRegionCollection
bool L1TCaloLayer1FetchLUTs(const L1TCaloLayer1FetchLUTsTokens &iTokens, const edm::EventSetup &iSetup, std::vector< std::array< std::array< std::array< uint32_t, nEtBins >, nCalSideBins >, nCalEtaBins > > &eLUT, std::vector< std::array< std::array< std::array< uint32_t, nEtBins >, nCalSideBins >, nCalEtaBins > > &hLUT, std::vector< std::array< std::array< uint32_t, nEtBins >, nHfEtaBins > > &hfLUT, std::vector< unsigned long long int > &hcalFBLUT, std::vector< unsigned int > &ePhiMap, std::vector< unsigned int > &hPhiMap, std::vector< unsigned int > &hfPhiMap, bool useLSB, bool useCalib, bool useECALLUT, bool useHCALLUT, bool useHFLUT, bool useHCALFBLUT, int fwVersion)
std::vector< unsigned int > ePhiMap
void push_back(int bx, T object)