35 #include "L1Trigger/L1TCaloLayer1/src/UCTLayer1.hh" 36 #include "L1Trigger/L1TCaloLayer1/src/UCTCrate.hh" 37 #include "L1Trigger/L1TCaloLayer1/src/UCTCard.hh" 38 #include "L1Trigger/L1TCaloLayer1/src/UCTRegion.hh" 39 #include "L1Trigger/L1TCaloLayer1/src/UCTTower.hh" 41 #include "L1Trigger/L1TCaloLayer1/src/UCTGeometry.hh" 42 #include "L1Trigger/L1TCaloLayer1/src/UCTLogging.hh" 50 #include "L1Trigger/L1TCaloLayer1/src/L1TCaloLayer1FetchLUTs.hh" 82 std::vector< std::array< std::array< std::array<uint32_t, nEtBins>, nCalSideBins >, nCalEtaBins> >
ecalLUT;
83 std::vector< std::array< std::array< std::array<uint32_t, nEtBins>, nCalSideBins >, nCalEtaBins> >
hcalLUT;
84 std::vector< std::array< std::array<uint32_t, nEtBins>, nHfEtaBins > >
hfLUT;
121 towerPutToken{produces<CaloTowerBxCollection>()},
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"))
140 vector<UCTCrate*> crates =
layer1->getCrates();
141 for(uint32_t crt = 0; crt < crates.size(); crt++) {
142 vector<UCTCard*> cards = crates[crt]->getCards();
143 for(uint32_t crd = 0; crd < cards.size(); crd++) {
144 vector<UCTRegion*>
regions = cards[crd]->getRegions();
145 for(uint32_t rgn = 0; rgn < regions.size(); rgn++) {
146 vector<UCTTower*> towers = regions[rgn]->getTowers();
147 for(uint32_t twr = 0; twr < towers.size(); twr++) {
148 twrList.push_back(towers[twr]);
157 return CaloTools::caloTowerHash(a->caloEta(), a->caloPhi()) < CaloTools::caloTowerHash(
b->caloEta(),
b->caloPhi());
179 uint32_t expectedTotalET = 0;
180 if(!
layer1->clearEvent()) {
181 LOG_ERROR <<
"UCT: Failed to clear event" << std::endl;
185 for (
const auto& ecalTp : *ecalTPs ) {
187 int caloEta = ecalTp.id().ieta();
188 int caloPhi = ecalTp.id().iphi();
189 int et = ecalTp.compressedEt();
190 bool fgVeto = ecalTp.fineGrain();
191 UCTTowerIndex
t = UCTTowerIndex(caloEta, caloPhi);
192 if(!
layer1->setECALData(t,fgVeto,et)) {
193 LOG_ERROR <<
"UCT: Failed loading an ECAL tower" << std::endl;
196 expectedTotalET +=
et;
201 for (
const auto& hcalTp : *hcalTPs ) {
203 int caloEta = hcalTp.id().ieta();
204 uint32_t absCaloEta =
std::abs(caloEta);
206 if(absCaloEta == 29) {
210 else if(hcalTp.id().version() == 0 && absCaloEta > 29) {
213 else if(absCaloEta <= 41) {
214 int caloPhi = hcalTp.id().iphi();
215 int et = hcalTp.SOI_compressedEt();
216 bool fg = hcalTp.t0().fineGrain(0);
217 bool fg2 = hcalTp.t0().fineGrain(1);
219 UCTTowerIndex
t = UCTTowerIndex(caloEta, caloPhi);
220 uint32_t featureBits = 0;
221 if(fg) featureBits |= 0b01;
223 if(absCaloEta > 29 && fg2) featureBits |= 0b10;
224 if(!
layer1->setHCALData(t, featureBits, et)) {
225 LOG_ERROR <<
"caloEta = " << caloEta <<
"; caloPhi =" << caloPhi << std::endl;
226 LOG_ERROR <<
"UCT: Failed loading an HCAL tower" << std::endl;
229 expectedTotalET +=
et;
232 LOG_ERROR <<
"Illegal Tower: caloEta = " << caloEta <<
"; caloPhi =" << caloPhi <<
"; et = " << et << std::endl;
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++) {
269 uint32_t rawData = regions[rgn]->rawData();
270 uint32_t regionData = rawData & 0x0000FFFF;
271 uint32_t crate = regions[rgn]->getCrate();
272 uint32_t card = regions[rgn]->getCard();
273 uint32_t region = regions[rgn]->getRegion();
274 bool negativeEta = regions[rgn]->isNegativeEta();
275 uint32_t rPhi = g.getUCTRegionPhiIndex(crate, card);
276 if(region < NRegionsInCard) {
277 uint32_t rEta = 10 - region;
278 if(!negativeEta) rEta = 11 + region;
279 rgnCollection.push_back(
L1CaloRegion((uint16_t) regionData, (
unsigned) rEta, (
unsigned) rPhi, (int16_t) 0));
294 if(!
L1TCaloLayer1FetchLUTs(iSetup,
ecalLUT,
hcalLUT,
hfLUT,
ePhiMap,
hPhiMap,
hfPhiMap,
useLSB,
useCalib,
useECALLUT,
useHCALLUT,
useHFLUT,
fwVersion)) {
295 LOG_ERROR <<
"L1TCaloLayer1::beginRun: failed to fetch LUTS - using unity" << std::endl;
296 std::array< std::array< std::array<uint32_t, nEtBins>, nCalSideBins >, nCalEtaBins> eCalLayer1EtaSideEtArray;
297 std::array< std::array< std::array<uint32_t, nEtBins>, nCalSideBins >, nCalEtaBins> hCalLayer1EtaSideEtArray;
298 std::array< std::array<uint32_t, nEtBins>, nHfEtaBins > hfLayer1EtaEtArray;
299 ecalLUT.push_back(eCalLayer1EtaSideEtArray);
300 hcalLUT.push_back(hCalLayer1EtaSideEtArray);
301 hfLUT.push_back(hfLayer1EtaEtArray);
303 for(uint32_t twr = 0; twr <
twrList.size(); twr++) {
305 int iphi =
twrList[twr]->caloPhi();
306 int ieta =
twrList[twr]->caloEta();
std::vector< unsigned int > hfPhiMap
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool L1TCaloLayer1FetchLUTs(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)
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalTPSource
std::vector< UCTTower * > twrList
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
std::vector< unsigned int > hPhiMap
#define DEFINE_FWK_MODULE(type)
void addDefault(ParameterSetDescription const &psetDescription)
Abs< T >::type abs(const T &t)
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
edm::EDPutTokenT< CaloTowerBxCollection > towerPutToken
et
define resolution functions of each parameter
std::vector< std::array< std::array< std::array< uint32_t, nEtBins >, nCalSideBins >, nCalEtaBins > > ecalLUT
L1TCaloLayer1(const edm::ParameterSet &)
std::vector< std::array< std::array< std::array< uint32_t, nEtBins >, nCalSideBins >, nCalEtaBins > > hcalLUT
std::vector< std::array< std::array< uint32_t, nEtBins >, nHfEtaBins > > hfLUT
std::vector< unsigned int > ePhiMap
void beginRun(edm::Run const &, edm::EventSetup const &) override
A calorimeter trigger region (sum of 4x4 trigger towers)
std::vector< L1CaloRegion > L1CaloRegionCollection
void push_back(int bx, T object)