LDMX Software
SequentialTrigger.cxx
2
4
5namespace recon {
6
15 trigger_list_ = ps.getParameter<std::vector<std::string>>("trigger_list");
17 ps.getParameter<std::vector<std::string>>("trigger_passNames");
18 doAND_ = ps.getParameter<bool>("doAND");
19 doOR_ = ps.getParameter<bool>("doOR");
20 doVAL_ = ps.getParameter<bool>("doVAL");
21 // Returns an error if some bad combination of doOR and doAND is enabled.
22 if (doAND_ == doOR_) {
23 EXCEPTION_RAISE("InvalidArg",
24 "Either tried to do both or neither of doAND and doOR. "
25 "Exactly one should be true.");
26 }
27 return;
28}
29
41 bool hasPassed = not(doOR_) or (doAND_);
42
43 for (int i = 0; i < trigger_list_.size(); i++) {
44 // Returns an error is a trigger collection DNE
45 try {
46 auto trigResult{event.getObject<ldmx::TriggerResult>(
48
49 // Returns true should any trigger pass and doOR_ enabled, and returns
50 // false if doAND_ and any fail
51 if (trigResult.passed()) {
52 if (doOR_) {
53 hasPassed = true;
54 break;
55 }
56 } else {
57 if (doAND_) {
58 hasPassed = false;
59 break;
60 }
61 }
62 } catch (...) {
63 std::string errorMessage =
64 "Attemping to use non-existing trigger collection " +
65 trigger_list_[i] + "_" + trigger_passNames_[i] + " to skim! Exiting.";
66 EXCEPTION_RAISE("InvalidArg", errorMessage.data());
67 return;
68 }
69 }
70
71 // Used to validate if code was working
72 if (doVAL_) {
73 event.add("validation", hasPassed);
74 }
75 // mark the event
76 if (hasPassed)
78 else
80}
81} // namespace recon
82
83DECLARE_ANALYZER_NS(recon, SequentialTrigger);
#define DECLARE_ANALYZER_NS(NS, CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Class that provides a trigger skimming decision from multiple Triggers based on either AND or OR.
Class that represents the trigger decision (pass/fail) for reconstruction.
void setStorageHint(framework::StorageControl::Hint hint)
Mark the current event as having the given storage control hint from this module.
Implements an event buffer system for storing event data.
Definition Event.h:41
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
Represents the trigger decision (pass/fail) for reconstruction.
bool doVAL_
enables a output collection with the keep tag for the purposes of validation
void configure(framework::config::Parameters &parameters) override
Configure the processor using the given user specified parameters.
std::vector< std::string > trigger_list_
The name of the input collection of triggers.
std::vector< std::string > trigger_passNames_
pass name of the triggers
bool doOR_
options to enable OR or AND skimming
void produce(framework::Event &event) override
Run the doOR or doAND check and create a SequentialTrigger object to contain the pass boolean value.
constexpr StorageControl::Hint hint_shouldKeep
storage control hint alias for backwards compatibility
constexpr StorageControl::Hint hint_shouldDrop
storage control hint alias for backwards compatibility