71 std::vector<unsigned int>
mask_;
79 : legacyL1_(
params.getParameter<
bool>(
"legacyL1")),
80 store_unprefireable_bits_(!legacyL1_ ?
params.getParameter<
bool>(
"storeUnprefireableBits") :
false),
85 token_ext_(store_unprefireable_bits_
91 produces<edm::TriggerResults>();
109 for (
auto const& keyval :
mapping) {
110 names_.push_back(keyval.first);
111 indices_.push_back(keyval.second.algoBitNumber());
116 for (
auto const& keyval :
mapping) {
117 names_.push_back(keyval.first);
118 indices_.push_back(keyval.second.getIndex());
121 names_.push_back(
"L1_UnprefireableEvent_TriggerRules");
122 names_.push_back(
"L1_UnprefireableEvent_FirstBxInTrain");
123 names_.push_back(
"L1_FinalOR_BXmin1");
124 names_.push_back(
"L1_FinalOR_BXmin2");
132 const std::vector<bool>* wordp =
nullptr;
133 const std::vector<bool>* wordp_bxmin1 =
nullptr;
134 const std::vector<bool>* wordp_bxmin2 =
nullptr;
135 bool unprefireable_bit_triggerrules =
false;
136 bool unprefireable_bit_firstbxintrain =
false;
137 bool l1FinalOR_bxmin1 =
false;
138 bool l1FinalOR_bxmin2 =
false;
142 if (not resultsProd.isEmpty(0)) {
143 wordp = &resultsProd.at(0, 0).getAlgoDecisionFinal();
145 if (not resultsProd.isEmpty(-1)) {
146 wordp_bxmin1 = &resultsProd.at(-1, 0).getAlgoDecisionFinal();
148 if (not resultsProd.isEmpty(-2)) {
149 wordp_bxmin2 = &resultsProd.at(-2, 0).getAlgoDecisionFinal();
153 if (handleExtResults.isValid()) {
154 if (not handleExtResults->isEmpty(0)) {
156 unprefireable_bit_triggerrules =
160 LogDebug(
"Unprefirable bit (trigger rules) not found, always set to false");
166 wordp = &resultsProd.decisionWord();
169 unsigned indices_size =
indices_.size();
170 for (
size_t nidx = 0; nidx < indices_size; nidx++) {
173 bool result_bxmin1 = wordp_bxmin1 ? wordp_bxmin1->at(
index) :
false;
174 bool result_bxmin2 = wordp_bxmin2 ? wordp_bxmin2->at(
index) :
false;
175 if (not
mask_.empty())
182 if (
names_[nidx] ==
"L1_FirstBunchBeforeTrain")
183 unprefireable_bit_firstbxintrain = result_bxmin1;
185 else if (result_bxmin1) {
186 l1FinalOR_bxmin1 =
true;
187 }
else if (result_bxmin2) {
188 l1FinalOR_bxmin2 =
true;
193 l1bitsAsHLTStatus[indices_size] =
195 l1bitsAsHLTStatus[indices_size + 1] =
201 auto out = std::make_unique<edm::TriggerResults>(l1bitsAsHLTStatus,
names_);
208 desc.add<
bool>(
"legacyL1")->setComment(
"is legacy L1");
210 "L1 input (L1GlobalTriggerReadoutRecord if legacy, GlobalAlgBlkBxCollection otherwise)");
211 desc.add<
bool>(
"storeUnprefireableBits",
false)
212 ->setComment(
"Activate storage of L1 unprefireable bits (needs L1 external decision input)");
214 ->setComment(
"L1 external decision input (GlobalExtBlkBxCollection, only supported if not legacy");
215 descriptions.
add(
"L1TriggerResultsConverter",
desc);
std::vector< unsigned int > indices_
std::vector< std::string > names_
static const unsigned int maxExternalConditions
~L1TriggerResultsConverter() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void beginRun(edm::Run const &, edm::EventSetup const &) override
void produce(edm::Event &, const edm::EventSetup &) override
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > token_
#define DEFINE_FWK_MODULE(type)
L1TriggerResultsConverter(const edm::ParameterSet &)
const edm::EDGetTokenT< GlobalExtBlkBxCollection > token_ext_
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > tokenLegacy_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< unsigned int > mask_
edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > l1utmTrigToken_
const bool store_unprefireable_bits_
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd > l1gtalgoMaskToken_
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > l1gtmenuToken_