CMS 3D CMS Logo

P2GTTriggerResultsConverter.cc
Go to the documentation of this file.
3 
6 
10 
15 
17 
18 #include <string>
19 
20 using namespace l1t;
21 
23 public:
25 
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27 
28  enum DecisionType { beforeBxMaskAndPrescale, beforePrescale, final };
29 
30 private:
31  void produce(edm::Event&, const edm::EventSetup&) override;
32  void beginRun(const edm::Run&, const edm::EventSetup&) override;
33 
38 
39  std::vector<std::string> algoNames_;
40 };
41 
43  : algoBlockToken_(consumes<P2GTAlgoBlockMap>(params.getParameter<edm::InputTag>("src"))),
44  prefix_(params.getParameter<std::string>("prefix")),
45  decisionName_(params.getParameter<std::string>("decision")),
46  decisionEnum_(decisionName_ == "beforeBxMaskAndPrescale" ? beforeBxMaskAndPrescale
47  : decisionName_ == "beforePrescale" ? beforePrescale
48  : final) {
49  produces<edm::TriggerResults>();
50 }
51 
53 
55  const P2GTAlgoBlockMap& algoBlockMap = event.get(algoBlockToken_);
56 
57  edm::HLTGlobalStatus gtDecisions(algoBlockMap.size());
58 
59  bool fillAlgoNames = false;
60 
61  if (algoNames_.size() == 0) {
62  algoNames_ = std::vector<std::string>(algoBlockMap.size());
63  fillAlgoNames = true;
64  }
65 
66  std::size_t algoIdx = 0;
67  for (const auto& [algoName, algoBlock] : algoBlockMap) {
68  bool decision = decisionEnum_ == beforeBxMaskAndPrescale ? algoBlock.decisionBeforeBxMaskAndPrescale()
69  : decisionEnum_ == beforePrescale ? algoBlock.decisionBeforePrescale()
70  : algoBlock.decisionFinal();
71 
72  gtDecisions[algoIdx] = edm::HLTPathStatus(decision ? edm::hlt::Pass : edm::hlt::Fail);
73  if (fillAlgoNames) {
74  algoNames_[algoIdx] = prefix_ + algoName + "_" + decisionName_;
75  }
76  algoIdx++;
77  }
78 
79  event.put(std::make_unique<edm::TriggerResults>(gtDecisions, algoNames_));
80 }
81 
84  desc.add<edm::InputTag>("src");
85  desc.add<std::string>("prefix", "L1_");
86  desc.ifValue(edm::ParameterDescription<std::string>("decision", "final", true),
87  edm::allowedValues<std::string>("beforeBxMaskAndPrescale", "beforePrescale", "final"));
88  descriptions.addWithDefaultLabel(desc);
89 }
90 
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
reject
Definition: HLTenums.h:19
std::vector< std::string > algoNames_
std::map< std::string, P2GTAlgoBlock > P2GTAlgoBlockMap
Definition: P2GTAlgoBlock.h:11
delete x;
Definition: CaloConfig.h:22
const edm::EDGetTokenT< P2GTAlgoBlockMap > algoBlockToken_
void produce(edm::Event &, const edm::EventSetup &) override
accept
Definition: HLTenums.h:18
P2GTTriggerResultsConverter(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void beginRun(const edm::Run &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HLT enums.
Definition: event.py:1
Definition: Run.h:45