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"
52 using namespace l1tcalo;
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;
118 towerPutToken{produces<CaloTowerBxCollection>()},
120 lutsTokens{esConsumes<edm::Transition::BeginRun>(),
121 esConsumes<edm::Transition::BeginRun>(),
122 esConsumes<edm::Transition::BeginRun>()},
138 vector<UCTCrate*> crates =
layer1->getCrates();
139 for (uint32_t crt = 0; crt < crates.size(); crt++) {
140 vector<UCTCard*> cards = crates[crt]->getCards();
141 for (uint32_t crd = 0; crd < cards.size(); crd++) {
142 vector<UCTRegion*>
regions = cards[crd]->getRegions();
143 for (uint32_t rgn = 0; rgn < regions.size(); rgn++) {
144 vector<UCTTower*>
towers = regions[rgn]->getTowers();
145 for (uint32_t twr = 0; twr < towers.size(); twr++) {
146 twrList.push_back(towers[twr]);
155 return CaloTools::caloTowerHash(a->caloEta(), a->caloPhi()) < CaloTools::caloTowerHash(
b->caloEta(),
b->caloPhi());
175 uint32_t expectedTotalET = 0;
176 if (!
layer1->clearEvent()) {
177 LOG_ERROR <<
"UCT: Failed to clear event" << std::endl;
181 for (
const auto& ecalTp : *ecalTPs) {
184 int caloEta = ecalTp.id().ieta();
185 int caloPhi = ecalTp.id().iphi();
186 int et = ecalTp.compressedEt();
187 bool fgVeto = ecalTp.fineGrain();
188 UCTTowerIndex
t = UCTTowerIndex(caloEta, caloPhi);
189 if (!
layer1->setECALData(t, fgVeto, et)) {
190 LOG_ERROR <<
"UCT: Failed loading an ECAL tower" << std::endl;
193 expectedTotalET += et;
196 if (hcalTPs.isValid()) {
197 for (
const auto& hcalTp : *hcalTPs) {
200 int caloEta = hcalTp.id().ieta();
201 uint32_t absCaloEta =
std::abs(caloEta);
203 if (absCaloEta == 29) {
207 else if (hcalTp.id().version() == 0 && absCaloEta > 29) {
209 }
else if (absCaloEta <= 41) {
210 int caloPhi = hcalTp.id().iphi();
211 int et = hcalTp.SOI_compressedEt();
212 bool fg = hcalTp.t0().fineGrain(0);
213 bool fg2 = hcalTp.t0().fineGrain(1);
215 UCTTowerIndex
t = UCTTowerIndex(caloEta, caloPhi);
216 uint32_t featureBits = 0;
220 if (absCaloEta > 29 && fg2)
222 if (!
layer1->setHCALData(t, featureBits, et)) {
223 LOG_ERROR <<
"caloEta = " << caloEta <<
"; caloPhi =" << caloPhi << std::endl;
224 LOG_ERROR <<
"UCT: Failed loading an HCAL tower" << std::endl;
227 expectedTotalET += et;
229 LOG_ERROR <<
"Illegal Tower: caloEta = " << caloEta <<
"; caloPhi =" << caloPhi <<
"; et = " << et
233 LOG_ERROR <<
"Illegal Tower: caloEta = " << caloEta << std::endl;
240 LOG_ERROR <<
"UCT: Failed to process layer 1" << std::endl;
245 for (uint32_t twr = 0; twr <
twrList.size(); twr++) {
254 towersColl.push_back(theBX, caloTower);
260 vector<UCTCrate*> crates =
layer1->getCrates();
261 for (uint32_t crt = 0; crt < crates.size(); crt++) {
262 vector<UCTCard*> cards = crates[crt]->getCards();
263 for (uint32_t crd = 0; crd < cards.size(); crd++) {
264 vector<UCTRegion*>
regions = cards[crd]->getRegions();
265 for (uint32_t rgn = 0; rgn < regions.size(); rgn++) {
266 uint32_t rawData = regions[rgn]->rawData();
267 uint32_t regionData = rawData & 0x0000FFFF;
268 uint32_t crate = regions[rgn]->getCrate();
269 uint32_t card = regions[rgn]->getCard();
270 uint32_t
region = regions[rgn]->getRegion();
271 bool negativeEta = regions[rgn]->isNegativeEta();
272 uint32_t rPhi =
g.getUCTRegionPhiIndex(crate, card);
273 if (region < NRegionsInCard) {
279 rgnCollection.push_back(
L1CaloRegion((uint16_t)regionData, (
unsigned)rEta, (
unsigned)rPhi, (int16_t)0));
303 LOG_ERROR <<
"L1TCaloLayer1::beginRun: failed to fetch LUTS - using unity" << std::endl;
304 std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> eCalLayer1EtaSideEtArray;
305 std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> hCalLayer1EtaSideEtArray;
306 std::array<std::array<uint32_t, nEtBins>, nHfEtaBins> hfLayer1EtaEtArray;
307 ecalLUT.push_back(eCalLayer1EtaSideEtArray);
308 hcalLUT.push_back(hCalLayer1EtaSideEtArray);
309 hfLUT.push_back(hfLayer1EtaEtArray);
311 for (uint32_t twr = 0; twr <
twrList.size(); twr++) {
313 int iphi =
twrList[twr]->caloPhi();
314 int ieta =
twrList[twr]->caloEta();
std::vector< std::array< std::array< uint32_t, nEtBins >, nHfEtaBins > > hfLUT
std::vector< unsigned int > hfPhiMap
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalTPSource
std::vector< std::array< std::array< std::array< uint32_t, nEtBins >, nCalSideBins >, nCalEtaBins > > ecalLUT
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)
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 int > &ePhiMap, std::vector< unsigned int > &hPhiMap, std::vector< unsigned int > &hfPhiMap, bool useLSB, bool useCalib, bool useECALLUT, bool useHCALLUT, bool useHFLUT, int fwVersion)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setHwEtRatio(int ratio)
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalTPSource
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
const L1TCaloLayer1FetchLUTsTokens lutsTokens
T getParameter(std::string const &) const
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
std::vector< unsigned int > ePhiMap