187 std::unique_ptr<l1t::CICADABxCollection> CICADAScore = std::make_unique<l1t::CICADABxCollection>();
188 CICADAScore->setBXRange(-2, 2);
196 UCTSummaryCard summaryCard =
198 std::vector<UCTRegion> inputRegions;
199 inputRegions.reserve(252);
202 edm::LogError(
"L1TCaloSummary") <<
"UCT: Failed to get regions from region collection!";
205 if (regionCollection->size() == 0) {
207 edm::LogWarning(
"L1TCaloSummary") <<
"Switched to emulated regions since data regions was empty.\n";
213 INPUT modelInput[252];
215 UCTRegionIndex
r =
g.getUCTRegionIndexFromL1CaloRegion(
i.gctEta(),
i.gctPhi());
216 UCTTowerIndex
t =
g.getUCTTowerIndexFromL1CaloRegion(
r,
i.raw());
218 uint32_t absCaloPhi =
std::abs(
t.second);
219 bool negativeEta =
false;
222 uint32_t
crate =
g.getCrate(
t.first,
t.second);
223 uint32_t card =
g.getCard(
t.first,
t.second);
224 uint32_t
region =
g.getRegion(absCaloEta, absCaloPhi);
226 test.setRegionSummary(
i.raw());
227 inputRegions.push_back(
test);
233 modelInput[14 *
i.gctPhi() + (
i.gctEta() - 4)] =
i.et();
237 unsigned int evt =
iEvent.id().event();
239 unsigned int patternElement = evt % totalTestPatterns;
241 std::stringstream inputStream;
244 edm::LogWarning(
"L1TCaloSummary") <<
"Overwriting existing CICADA input with test pattern!\n";
246 for (
unsigned short int iPhi = 1; iPhi <= 18; ++iPhi) {
248 std::stringstream PhiRowStringStream;
249 PhiRowStringStream <<
"iPhi_" << iPhi;
250 PhiRowString = PhiRowStringStream.str();
251 std::vector<unsigned int> phiRow = element.
getParameter<std::vector<unsigned int>>(PhiRowString);
253 modelInput[14 * (iPhi - 1) + (
iEta - 1)] = phiRow.at(
iEta - 1);
254 inputStream << phiRow.at(
iEta - 1) <<
" ";
258 edm::LogInfo(
"L1TCaloSummary") <<
"Input Stream:\n" << inputStream.str();
262 OUTPUT modelResult[1] = {
264 model->prepare_input(modelInput);
266 model->read_result(modelResult);
268 CICADAScore->push_back(0, modelResult[0].to_float());
271 edm::LogInfo(
"L1TCaloSummary") <<
"Test Pattern Output: " << CICADAScore->at(0, 0);
273 summaryCard.setRegionData(inputRegions);
275 if (!summaryCard.process()) {
276 edm::LogError(
"L1TCaloSummary") <<
"UCT: Failed to process summary card" << std::endl;
285 std::list<std::shared_ptr<UCTObject>> boostedJetObjs = summaryCard.getBoostedJetObjs();
286 for (std::list<std::shared_ptr<UCTObject>>::const_iterator
i = boostedJetObjs.begin();
i != boostedJetObjs.end();
288 const std::shared_ptr<UCTObject>
object = *
i;
292 bitset<3> activeRegionEtaPattern = 0;
294 bool activeStrip =
false;
295 for (uint32_t iPhi = 0; iPhi < 3; iPhi++) {
296 if (
object->boostedJetRegionET()[3 *
iEta + iPhi] > 30 &&
297 object->boostedJetRegionET()[3 *
iEta + iPhi] >
object->et() * 0.0625)
301 activeRegionEtaPattern |= (0x1 <<
iEta);
303 bitset<3> activeRegionPhiPattern = 0;
304 for (uint32_t iPhi = 0; iPhi < 3; iPhi++) {
305 bool activeStrip =
false;
307 if (
object->boostedJetRegionET()[3 *
iEta + iPhi] > 30 &&
308 object->boostedJetRegionET()[3 *
iEta + iPhi] >
object->et() * 0.0625)
312 activeRegionPhiPattern |= (0x1 << iPhi);
314 string regionEta = activeRegionEtaPattern.to_string<char, std::string::traits_type, std::string::allocator_type>();
315 string regionPhi = activeRegionPhiPattern.to_string<char, std::string::traits_type, std::string::allocator_type>();
317 bool centralHighest =
object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[0] &&
318 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[1] &&
319 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[2] &&
320 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[3] &&
321 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[5] &&
322 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[6] &&
323 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[7] &&
324 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[8];
326 if (
abs(
eta) < 2.5 && ((regionEta ==
"101" && (regionPhi ==
"110" || regionPhi ==
"101" || regionPhi ==
"010")) ||
327 ((regionEta ==
"110" || regionEta ==
"101" || regionEta ==
"010") && regionPhi ==
"101") ||
328 (regionEta ==
"111" && (regionPhi ==
"110" || regionPhi ==
"010")) ||
329 ((regionEta ==
"110" || regionEta ==
"010") && regionPhi ==
"111") ||
330 ((regionEta ==
"010" || regionPhi ==
"010" || regionEta ==
"110" || regionPhi ==
"110" ||
331 regionEta ==
"011" || regionPhi ==
"011") &&
T getParameter(std::string const &) const
bool overwriteWithTestPatterns
Log< level::Error, false > LogError
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
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Abs< T >::type abs(const T &t)
std::vector< edm::ParameterSet > testPatterns
edm::EDGetTokenT< L1CaloRegionCollection > regionToken
Log< level::Info, false > LogInfo
edm::EDGetTokenT< L1CaloRegionCollection > backupRegionToken
std::shared_ptr< hls4mlEmulator::Model > model
double boostedJetPtFactor
double eGammaIsolationFactor
std::vector< std::vector< std::vector< uint32_t > > > pumLUT
A calorimeter trigger region (sum of 4x4 trigger towers)
Log< level::Warning, false > LogWarning