@@ -120,6 +120,7 @@ void L1TriggerResultsConverter::beginRun(edm::Run const&, edm::EventSetup const&
120120 if (store_unprefireable_bits_) {
121121 names_.push_back (" L1_UnprefireableEvent_TriggerRules" );
122122 names_.push_back (" L1_UnprefireableEvent_FirstBxInTrain" );
123+ names_.push_back (" L1_FinalOR_BXmin1" );
123124 }
124125 }
125126}
@@ -128,13 +129,16 @@ void L1TriggerResultsConverter::beginRun(edm::Run const&, edm::EventSetup const&
128129
129130void L1TriggerResultsConverter::produce (edm::Event& iEvent, const edm::EventSetup& iSetup) {
130131 const std::vector<bool >* wordp = nullptr ;
132+ const std::vector<bool >* wordp_bxmin1 = nullptr ;
131133 bool unprefireable_bit_triggerrules = false ;
132134 bool unprefireable_bit_firstbxintrain = false ;
135+ bool l1FinalOR_bxmin1 = false ;
133136
134137 if (!legacyL1_) {
135138 const auto & resultsProd = iEvent.get (token_);
136139 if (not resultsProd.isEmpty (0 )) {
137140 wordp = &resultsProd.at (0 , 0 ).getAlgoDecisionFinal ();
141+ wordp_bxmin1 = &resultsProd.at (-1 , 0 ).getAlgoDecisionFinal ();
138142 }
139143 if (store_unprefireable_bits_) {
140144 auto handleExtResults = iEvent.getHandle (token_ext_);
@@ -158,16 +162,19 @@ void L1TriggerResultsConverter::produce(edm::Event& iEvent, const edm::EventSetu
158162 for (size_t nidx = 0 ; nidx < indices_size; nidx++) {
159163 unsigned int const index = indices_[nidx];
160164 bool result = wordp ? wordp->at (index) : false ;
165+ bool result_bxmin1 = wordp_bxmin1 ? wordp_bxmin1->at (index) : false ;
161166 if (not mask_.empty ())
162167 result &= (mask_.at (index) != 0 );
163168 l1bitsAsHLTStatus[nidx] = edm::HLTPathStatus (result ? edm::hlt::Pass : edm::hlt::Fail);
164169 // Stores the unprefirable event decision corresponding to events in the first bx of a train.
165170 // In 2022/2023 the bx before that was manually masked.
166171 // Technically this was done by enabling the L1_FirstBunchBeforeTrain bit in the L1 menu, and vetoing that bit after L1 Final OR is evaluated.
167- if (names_[nidx] == " L1_FirstBunchBeforeTrain" && !legacyL1_) {
168- const auto & resultsProd = iEvent.get (token_);
169- if (!(&resultsProd)->isEmpty (-1 )) {
170- unprefireable_bit_firstbxintrain = (&resultsProd)->begin (-1 )->getAlgoDecisionFinal (index);
172+ if (!legacyL1_) {
173+ if (names_[nidx] == " L1_FirstBunchBeforeTrain" )
174+ unprefireable_bit_firstbxintrain = result_bxmin1;
175+ // If any other seed was fired in BX-1 there is some prefiring
176+ else if (result_bxmin1) {
177+ l1FinalOR_bxmin1 = true ;
171178 }
172179 }
173180 }
@@ -176,6 +183,7 @@ void L1TriggerResultsConverter::produce(edm::Event& iEvent, const edm::EventSetu
176183 edm::HLTPathStatus (unprefireable_bit_triggerrules ? edm::hlt::Pass : edm::hlt::Fail);
177184 l1bitsAsHLTStatus[indices_size + 1 ] =
178185 edm::HLTPathStatus (unprefireable_bit_firstbxintrain ? edm::hlt::Pass : edm::hlt::Fail);
186+ l1bitsAsHLTStatus[indices_size + 2 ] = edm::HLTPathStatus (l1FinalOR_bxmin1 ? edm::hlt::Pass : edm::hlt::Fail);
179187 }
180188 // mimic HLT trigger bits for L1
181189 auto out = std::make_unique<edm::TriggerResults>(l1bitsAsHLTStatus, names_);
0 commit comments