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" 81 std::vector<std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> >
ecalLUT;
82 std::vector<std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> >
hcalLUT;
83 std::vector<std::array<std::array<uint32_t, nEtBins>, nHfEtaBins> >
hfLUT;
120 towerPutToken{produces<CaloTowerBxCollection>()},
121 regionPutToken{produces<L1CaloRegionCollection>()},
122 lutsTokens{esConsumes<edm::Transition::BeginRun>(),
123 esConsumes<edm::Transition::BeginRun>(),
124 esConsumes<edm::Transition::BeginRun>()},
128 useLSB(iConfig.getParameter<
bool>(
"useLSB")),
129 useCalib(iConfig.getParameter<
bool>(
"useCalib")),
130 useECALLUT(iConfig.getParameter<
bool>(
"useECALLUT")),
131 useHCALLUT(iConfig.getParameter<
bool>(
"useHCALLUT")),
132 useHFLUT(iConfig.getParameter<
bool>(
"useHFLUT")),
133 useHCALFBLUT(iConfig.getParameter<
bool>(
"useHCALFBLUT")),
134 verbose(iConfig.getUntrackedParameter<
bool>(
"verbose")),
137 fwVersion(iConfig.getParameter<
int>(
"firmwareVersion")) {
139 layer1 = std::make_unique<UCTLayer1>(
fwVersion);
141 vector<UCTCrate*> crates = layer1->getCrates();
142 for (uint32_t crt = 0; crt < crates.size(); crt++) {
143 vector<UCTCard*> cards = crates[crt]->getCards();
144 for (uint32_t crd = 0; crd < cards.size(); crd++) {
145 vector<UCTRegion*>
regions = cards[crd]->getRegions();
146 for (uint32_t rgn = 0; rgn <
regions.size(); rgn++) {
148 for (uint32_t twr = 0; twr <
towers.size(); twr++) {
149 twrList.push_back(
towers[twr]);
157 std::sort(twrList.begin(), twrList.end(), [](UCTTower*
a, UCTTower*
b) {
158 return CaloTools::caloTowerHash(
a->caloEta(),
a->caloPhi()) < CaloTools::caloTowerHash(
b->caloEta(),
b->caloPhi());
178 if (!
layer1->clearEvent()) {
179 LOG_ERROR <<
"UCT: Failed to clear event" << std::endl;
183 for (
const auto& ecalTp : *ecalTPs) {
186 int caloEta = ecalTp.id().ieta();
187 int caloPhi = ecalTp.id().iphi();
188 int et = ecalTp.compressedEt();
189 bool fgVeto = ecalTp.fineGrain();
190 UCTTowerIndex
t = UCTTowerIndex(caloEta, caloPhi);
191 if (!
layer1->setECALData(
t, fgVeto,
et)) {
192 LOG_ERROR <<
"UCT: Failed loading an ECAL tower" << std::endl;
198 for (
const auto& hcalTp : *hcalTPs) {
201 int caloEta = hcalTp.id().ieta();
202 uint32_t absCaloEta =
std::abs(caloEta);
204 if (absCaloEta == 29) {
208 else if (hcalTp.id().version() == 0 && absCaloEta > 29) {
210 }
else if (absCaloEta <= 41) {
211 int caloPhi = hcalTp.id().iphi();
212 int et = hcalTp.SOI_compressedEt();
213 bool fg = hcalTp.t0().fineGrain(0);
214 bool fg2 = hcalTp.t0().fineGrain(1);
215 bool fg3 = hcalTp.t0().fineGrain(2);
216 bool fg4 = hcalTp.t0().fineGrain(3);
219 UCTTowerIndex
t = UCTTowerIndex(caloEta, caloPhi);
220 uint32_t featureBits = 0;
221 if (absCaloEta > 29) {
227 }
else if (absCaloEta < 16)
228 featureBits |= (fg | ((!fg2) & (fg3 | fg4)));
229 if (!
layer1->setHCALData(
t, featureBits,
et)) {
230 LOG_ERROR <<
"caloEta = " << caloEta <<
"; caloPhi =" << caloPhi << std::endl;
231 LOG_ERROR <<
"UCT: Failed loading an HCAL tower" << std::endl;
235 LOG_ERROR <<
"Illegal Tower: caloEta = " << caloEta <<
"; caloPhi =" << caloPhi <<
"; et = " <<
et 239 LOG_ERROR <<
"Illegal Tower: caloEta = " << caloEta << std::endl;
246 LOG_ERROR <<
"UCT: Failed to process layer 1" << std::endl;
251 for (uint32_t twr = 0; twr <
twrList.size(); twr++) {
266 vector<UCTCrate*> crates =
layer1->getCrates();
267 for (uint32_t crt = 0; crt < crates.size(); crt++) {
268 vector<UCTCard*> cards = crates[crt]->getCards();
269 for (uint32_t crd = 0; crd < cards.size(); crd++) {
270 vector<UCTRegion*>
regions = cards[crd]->getRegions();
271 for (uint32_t rgn = 0; rgn <
regions.size(); rgn++) {
273 uint32_t regionData =
rawData & 0x0000FFFF;
274 uint32_t crate =
regions[rgn]->getCrate();
275 uint32_t card =
regions[rgn]->getCard();
277 bool negativeEta =
regions[rgn]->isNegativeEta();
278 uint32_t rPhi =
g.getUCTRegionPhiIndex(crate, card);
279 if (
region < NRegionsInCard) {
285 rgnCollection.push_back(
L1CaloRegion((uint16_t)regionData, (
unsigned)rEta, (
unsigned)rPhi, (int16_t)0));
311 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 ecalLUT.push_back(eCalLayer1EtaSideEtArray);
316 hcalLUT.push_back(hCalLayer1EtaSideEtArray);
317 hfLUT.push_back(hfLayer1EtaEtArray);
319 for (uint32_t twr = 0; twr <
twrList.size(); twr++) {
366 desc.add<
bool>(
"useLSB",
true);
367 desc.add<
bool>(
"useCalib",
true);
368 desc.add<
bool>(
"useECALLUT",
true);
369 desc.add<
bool>(
"useHCALLUT",
true);
370 desc.add<
bool>(
"useHFLUT",
true);
371 desc.add<
bool>(
"useHCALFBLUT",
false);
372 desc.addUntracked<
bool>(
"verbose",
false);
373 desc.add<
bool>(
"unpackEcalMask",
false);
374 desc.add<
bool>(
"unpackHcalMask",
false);
375 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)