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;
118 towerPutToken{produces<CaloTowerBxCollection>()},
119 regionPutToken{produces<L1CaloRegionCollection>()},
120 lutsTokens{esConsumes<edm::Transition::BeginRun>(),
121 esConsumes<edm::Transition::BeginRun>(),
122 esConsumes<edm::Transition::BeginRun>()},
126 useLSB(iConfig.getParameter<
bool>(
"useLSB")),
127 useCalib(iConfig.getParameter<
bool>(
"useCalib")),
128 useECALLUT(iConfig.getParameter<
bool>(
"useECALLUT")),
129 useHCALLUT(iConfig.getParameter<
bool>(
"useHCALLUT")),
130 useHFLUT(iConfig.getParameter<
bool>(
"useHFLUT")),
131 verbose(iConfig.getParameter<
bool>(
"verbose")),
134 fwVersion(iConfig.getParameter<
int>(
"firmwareVersion")) {
136 layer1 = std::make_unique<UCTLayer1>(
fwVersion);
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++) {
145 for (uint32_t twr = 0; twr <
towers.size(); twr++) {
146 twrList.push_back(
towers[twr]);
154 std::sort(twrList.begin(), twrList.end(), [](UCTTower*
a, UCTTower*
b) {
155 return CaloTools::caloTowerHash(
a->caloEta(),
a->caloPhi()) < CaloTools::caloTowerHash(
b->caloEta(),
b->caloPhi());
175 if (!
layer1->clearEvent()) {
176 LOG_ERROR <<
"UCT: Failed to clear event" << std::endl;
180 for (
const auto& ecalTp : *ecalTPs) {
183 int caloEta = ecalTp.id().ieta();
184 int caloPhi = ecalTp.id().iphi();
185 int et = ecalTp.compressedEt();
186 bool fgVeto = ecalTp.fineGrain();
187 UCTTowerIndex
t = UCTTowerIndex(caloEta, caloPhi);
188 if (!
layer1->setECALData(
t, fgVeto,
et)) {
189 LOG_ERROR <<
"UCT: Failed loading an ECAL tower" << std::endl;
195 for (
const auto& hcalTp : *hcalTPs) {
198 int caloEta = hcalTp.id().ieta();
199 uint32_t absCaloEta =
std::abs(caloEta);
201 if (absCaloEta == 29) {
205 else if (hcalTp.id().version() == 0 && absCaloEta > 29) {
207 }
else if (absCaloEta <= 41) {
208 int caloPhi = hcalTp.id().iphi();
209 int et = hcalTp.SOI_compressedEt();
210 bool fg = hcalTp.t0().fineGrain(0);
211 bool fg2 = hcalTp.t0().fineGrain(1);
212 bool fg3 = hcalTp.t0().fineGrain(2);
213 bool fg4 = hcalTp.t0().fineGrain(3);
216 UCTTowerIndex
t = UCTTowerIndex(caloEta, caloPhi);
217 uint32_t featureBits = 0;
218 if (absCaloEta > 29) {
224 }
else if (absCaloEta < 16)
225 featureBits |= (fg | ((!fg2) & (fg3 | fg4)));
226 if (!
layer1->setHCALData(
t, featureBits,
et)) {
227 LOG_ERROR <<
"caloEta = " << caloEta <<
"; caloPhi =" << caloPhi << std::endl;
228 LOG_ERROR <<
"UCT: Failed loading an HCAL tower" << std::endl;
232 LOG_ERROR <<
"Illegal Tower: caloEta = " << caloEta <<
"; caloPhi =" << caloPhi <<
"; et = " <<
et 236 LOG_ERROR <<
"Illegal Tower: caloEta = " << caloEta << std::endl;
243 LOG_ERROR <<
"UCT: Failed to process layer 1" << std::endl;
248 for (uint32_t twr = 0; twr <
twrList.size(); twr++) {
263 vector<UCTCrate*> crates =
layer1->getCrates();
264 for (uint32_t crt = 0; crt < crates.size(); crt++) {
265 vector<UCTCard*> cards = crates[crt]->getCards();
266 for (uint32_t crd = 0; crd < cards.size(); crd++) {
267 vector<UCTRegion*>
regions = cards[crd]->getRegions();
268 for (uint32_t rgn = 0; rgn <
regions.size(); rgn++) {
270 uint32_t regionData =
rawData & 0x0000FFFF;
271 uint32_t crate =
regions[rgn]->getCrate();
272 uint32_t card =
regions[rgn]->getCard();
274 bool negativeEta =
regions[rgn]->isNegativeEta();
275 uint32_t rPhi =
g.getUCTRegionPhiIndex(crate, card);
276 if (
region < NRegionsInCard) {
282 rgnCollection.push_back(
L1CaloRegion((uint16_t)regionData, (
unsigned)rEta, (
unsigned)rPhi, (int16_t)0));
306 LOG_ERROR <<
"L1TCaloLayer1::beginRun: failed to fetch LUTS - using unity" << std::endl;
307 std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> eCalLayer1EtaSideEtArray;
308 std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> hCalLayer1EtaSideEtArray;
309 std::array<std::array<uint32_t, nEtBins>, nHfEtaBins> hfLayer1EtaEtArray;
310 ecalLUT.push_back(eCalLayer1EtaSideEtArray);
311 hcalLUT.push_back(hCalLayer1EtaSideEtArray);
312 hfLUT.push_back(hfLayer1EtaEtArray);
314 for (uint32_t twr = 0; twr <
twrList.size(); twr++) {
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
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)
#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
std::vector< unsigned int > ePhiMap
void push_back(int bx, T object)