184 std::unique_ptr<l1t::CICADABxCollection> CICADAScore = std::make_unique<l1t::CICADABxCollection>();
185 CICADAScore->setBXRange(-2, 2);
193 UCTSummaryCard summaryCard =
195 std::vector<UCTRegion*> inputRegions;
196 inputRegions.clear();
199 edm::LogError(
"L1TCaloSummary") <<
"UCT: Failed to get regions from region collection!";
204 INPUT modelInput[252];
206 UCTRegionIndex
r =
g.getUCTRegionIndexFromL1CaloRegion(
i.gctEta(),
i.gctPhi());
207 UCTTowerIndex
t =
g.getUCTTowerIndexFromL1CaloRegion(
r,
i.raw());
209 uint32_t absCaloPhi =
std::abs(
t.second);
210 bool negativeEta =
false;
213 uint32_t
crate =
g.getCrate(
t.first,
t.second);
214 uint32_t card =
g.getCard(
t.first,
t.second);
215 uint32_t
region =
g.getRegion(absCaloEta, absCaloPhi);
217 test->setRegionSummary(
i.raw());
218 inputRegions.push_back(
test);
224 modelInput[14 *
i.gctPhi() + (
i.gctEta() - 4)] =
i.et();
228 unsigned int evt =
iEvent.id().event();
230 unsigned int patternElement = evt % totalTestPatterns;
232 std::stringstream inputStream;
235 edm::LogWarning(
"L1TCaloSummary") <<
"Overwriting existing CICADA input with test pattern!\n";
237 for (
unsigned short int iPhi = 1; iPhi <= 18; ++iPhi) {
239 std::stringstream PhiRowStringStream;
240 PhiRowStringStream <<
"iPhi_" << iPhi;
241 PhiRowString = PhiRowStringStream.str();
242 std::vector<unsigned int> phiRow = element.
getParameter<std::vector<unsigned int>>(PhiRowString);
244 modelInput[14 * (iPhi - 1) + (
iEta - 1)] = phiRow.at(
iEta - 1);
245 inputStream << phiRow.at(
iEta - 1) <<
" ";
249 edm::LogInfo(
"L1TCaloSummary") <<
"Input Stream:\n" << inputStream.str();
253 OUTPUT modelResult[1] = {
255 model->prepare_input(modelInput);
257 model->read_result(modelResult);
259 CICADAScore->push_back(0, modelResult[0].to_float());
262 edm::LogInfo(
"L1TCaloSummary") <<
"Test Pattern Output: " << CICADAScore->at(0, 0);
264 summaryCard.setRegionData(inputRegions);
266 if (!summaryCard.process()) {
267 edm::LogError(
"L1TCaloSummary") <<
"UCT: Failed to process summary card" << std::endl;
276 std::list<UCTObject*> boostedJetObjs = summaryCard.getBoostedJetObjs();
277 for (std::list<UCTObject*>::const_iterator
i = boostedJetObjs.begin();
i != boostedJetObjs.end();
i++) {
278 const UCTObject*
object = *
i;
282 bitset<3> activeRegionEtaPattern = 0;
284 bool activeStrip =
false;
285 for (uint32_t iPhi = 0; iPhi < 3; iPhi++) {
286 if (
object->boostedJetRegionET()[3 *
iEta + iPhi] > 30 &&
287 object->boostedJetRegionET()[3 *
iEta + iPhi] >
object->et() * 0.0625)
291 activeRegionEtaPattern |= (0x1 <<
iEta);
293 bitset<3> activeRegionPhiPattern = 0;
294 for (uint32_t iPhi = 0; iPhi < 3; iPhi++) {
295 bool activeStrip =
false;
297 if (
object->boostedJetRegionET()[3 *
iEta + iPhi] > 30 &&
298 object->boostedJetRegionET()[3 *
iEta + iPhi] >
object->et() * 0.0625)
302 activeRegionPhiPattern |= (0x1 << iPhi);
304 string regionEta = activeRegionEtaPattern.to_string<char, std::string::traits_type, std::string::allocator_type>();
305 string regionPhi = activeRegionPhiPattern.to_string<char, std::string::traits_type, std::string::allocator_type>();
307 bool centralHighest =
object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[0] &&
308 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[1] &&
309 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[2] &&
310 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[3] &&
311 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[5] &&
312 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[6] &&
313 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[7] &&
314 object->boostedJetRegionET()[4] >=
object->boostedJetRegionET()[8];
316 if (
abs(
eta) < 2.5 && ((regionEta ==
"101" && (regionPhi ==
"110" || regionPhi ==
"101" || regionPhi ==
"010")) ||
317 ((regionEta ==
"110" || regionEta ==
"101" || regionEta ==
"010") && regionPhi ==
"101") ||
318 (regionEta ==
"111" && (regionPhi ==
"110" || regionPhi ==
"010")) ||
319 ((regionEta ==
"110" || regionEta ==
"010") && regionPhi ==
"111") ||
320 ((regionEta ==
"010" || regionPhi ==
"010" || regionEta ==
"110" || regionPhi ==
"110" ||
321 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
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