17 m_errorTool(
"LVL1::TrigT1CaloMonErrorTool/TrigT1CaloMonErrorTool")
51 std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>
variables;
77 for (; cmxIterator != cmxIteratorEnd; ++cmxIterator) {
80 const uint8_t crate = (*cmxIterator)->crate();
81 const uint8_t cmx = (*cmxIterator)->cmx();
85 EMHits0 = (*cmxIterator)->hits0();
86 EMHits1 = (*cmxIterator)->hits1();
89 TauHits0 = (*cmxIterator)->hits0();
90 TauHits1 = (*cmxIterator)->hits1();
107 return StatusCode::FAILURE;
113 int Jet3BitHits0 = 0;
114 int Jet3BitHits1 = 0;
115 int Jet2BitHits0 = 0;
116 int Jet2BitHits1 = 0;
122 for (; cmxJetIterator != cmxJetIteratorEnd; ++cmxJetIterator) {
124 const uint32_t crate = (*cmxJetIterator)->crate();
127 Jet3BitHits0 = (*cmxJetIterator)->hits0();
128 Jet3BitHits1 = (*cmxJetIterator)->hits1();
129 Jet3BitHits = Jet3BitHits0 + (Jet3BitHits1<<15);
132 Jet2BitHits0 = (*cmxJetIterator)->hits0();
133 Jet2BitHits1 = (*cmxJetIterator)->hits1();
134 Jet2BitHits = Jet2BitHits0 + (Jet2BitHits1<<16);
144 return StatusCode::FAILURE;
156 for (; cmxEtSumsIterator != cmxEtSumsIteratorEnd; ++ cmxEtSumsIterator) {
158 const uint32_t crate = (*cmxEtSumsIterator)->crate();
162 TEHits = (*cmxEtSumsIterator)->et();
167 XEHits = (*cmxEtSumsIterator)->et();
172 XSHits = (*cmxEtSumsIterator)->et();
177 TERestHits = (*cmxEtSumsIterator)->et();
182 XERestHits = (*cmxEtSumsIterator)->et();
195 return StatusCode::FAILURE;
200 std::vector<uint32_t> ctp_data=const_ctpRdo->
getDataWords();
201 CTP_RDO ctpRdo(4,std::move(ctp_data));
206 ATH_MSG_DEBUG(
"CTP version number not set, skipping CTP test");
213 if (l1aPos >=
ctp.getBunchCrossings().size()) {
215 return StatusCode::SUCCESS;
218 ATH_MSG_DEBUG(
"CTP l1aPos, size : " << l1aPos <<
", " <<
ctp.getBunchCrossings().size());
219 const CTP_BC& bunch =
ctp.getBunchCrossings().at(l1aPos);
227 const int max_JET_2bit_Threshold_Number = 15;
228 const int max_JET_3bit_Threshold_Number = 10;
229 const int max_XE_Threshold_Number = 16;
230 const int max_TE_Threshold_Number = 16;
231 const int max_XS_Threshold_Number = 8;
239 int totalBits = threshBits*def.max_EM_Threshold_Number()/2;
256 totalBits = threshBits*max_JET_3bit_Threshold_Number;
262 totalBits = threshBits*max_JET_2bit_Threshold_Number;
268 totalBits = threshBits*max_TE_Threshold_Number/2;
273 totalBits = threshBits*max_XE_Threshold_Number/2;
278 totalBits = threshBits*max_XS_Threshold_Number;
283 totalBits = threshBits*max_TE_Threshold_Number/2;
288 totalBits = threshBits*max_XE_Threshold_Number/2;
295 return StatusCode::SUCCESS;
307 const int max_JET_2bit_Threshold_Number = 15;
308 const int max_JET_3bit_Threshold_Number = 10;
309 const int max_TAU_3bit_Threshold_Number = 16;
310 const int max_XE_Threshold_Number = 16;
311 const int max_TE_Threshold_Number = 16;
312 const int max_XS_Threshold_Number = 8;
316 std::map<std::string, int> threshMap;
318 const std::vector<std::shared_ptr<TrigConf::L1Threshold>>& thresholds =
getL1Menu(ctx)->
thresholds();
319 ATH_MSG_DEBUG(
"Size of thresholds vector: " << thresholds.size());
321 for (
const auto&
it : thresholds) {
324 const int threshNumber =
it->mapping();
325 int fixedThreshNumber = threshNumber;
328 if (
it->type() == def.emType() ) {
329 if (threshNumber >= (
int)def.max_EM_Threshold_Number()/2) {
330 offset += nbits*def.max_EM_Threshold_Number()/2;
331 fixedThreshNumber -= def.max_EM_Threshold_Number()/2;
335 offset += nbits*def.max_EM_Threshold_Number();
336 if (
it->type() == def.tauType() ) {
337 if (threshNumber >= (
int)max_TAU_3bit_Threshold_Number/2) {
338 offset += nbits*max_TAU_3bit_Threshold_Number/2;
339 fixedThreshNumber -= max_TAU_3bit_Threshold_Number/2;
343 offset += nbits*max_TAU_3bit_Threshold_Number;
344 if (
it->type() == def.jetType() ) {
345 if (threshNumber >= (
int)max_JET_3bit_Threshold_Number) {
346 offset += 3*max_JET_3bit_Threshold_Number;
347 fixedThreshNumber -= max_JET_3bit_Threshold_Number;
352 offset += 3*max_JET_3bit_Threshold_Number;
354 offset += 2*max_JET_2bit_Threshold_Number;
356 if (
it->type() == def.teType()) {
357 if (threshNumber >= (
int)max_TE_Threshold_Number/2) {
358 offset += nbits*max_TE_Threshold_Number/2 + nbits*max_XE_Threshold_Number/2 + nbits*max_XS_Threshold_Number;
359 fixedThreshNumber -= max_TE_Threshold_Number/2;
363 offset += nbits*max_TE_Threshold_Number/2;
364 if (
it->type() == def.xeType() ) {
365 if (threshNumber >= (
int)max_XE_Threshold_Number/2) {
366 offset += nbits*max_TE_Threshold_Number/2 + nbits*max_XE_Threshold_Number/2 + nbits*max_XS_Threshold_Number;
367 fixedThreshNumber -= max_XE_Threshold_Number/2;
371 offset += nbits*max_XE_Threshold_Number/2;
372 if (
it->type() == def.xsType() )
break;
373 offset += nbits*max_XS_Threshold_Number;
377 if (nbits == 0)
continue;
378 if (threshNumber < 0)
continue;
379 threshMap.insert(std::make_pair(
it->name(),
380 offset + fixedThreshNumber*nbits));
381 ATH_MSG_DEBUG(
"threshMap: name, offset, threshNumber, nbits " <<
it->name() <<
" " <<
offset <<
" " << fixedThreshNumber <<
" " << nbits);
386 std::vector<std::pair<std::string, int>> newMap;
389 for (
const auto&
entry : threshMap) {
393 int numBits = trigger_line.
nbits();
395 for (
int bit = 0; bit < numBits; ++bit) {
396 int newValue =
entry.second + bit;
399 newMap.push_back(std::make_pair(
entry.first, newValue));
404 std::sort(newMap.begin(), newMap.end(), [](
const auto& lhs,
const auto& rhs) {
405 return lhs.second < rhs.second;
424 for (
int bit = 0; bit <
totalBits; ++bit) {
431 const int HITbit= ((
hits >> bit) & 0
x1);
432 const int TIPbit = bunch.
getTIP().test( TIPid );
435 tipHits |= (TIPbit << bit);
437 if (HITbit && HITbit == TIPbit){
438 ctp_1d_TIPMatches = TIPid;
441 else if (HITbit != TIPbit) {
443 ctp_1d_HitNoTIPMismatch = TIPid;
447 ctp_1d_TIPNoHitMismatch = TIPid;
455 ctp_1d_L1CaloNeCTPSummary =
type;
459 ctp_1d_L1CaloEqCTPSummary =
type;