LDMX Software
SequentialTrigger.cxx
2
4
5namespace recon {
6
15 trigger_list_ = ps.get<std::vector<std::string>>("trigger_list");
16 trigger_pass_names_ = ps.get<std::vector<std::string>>("trigger_passNames");
17 do_and_ = ps.get<bool>("doAND");
18 do_or_ = ps.get<bool>("doOR");
19 do_val_ = ps.get<bool>("doVAL");
20 // Returns an error if some bad combination of doOR and doAND is enabled.
21 if (do_and_ == do_or_) {
22 EXCEPTION_RAISE("InvalidArg",
23 "Either tried to do both or neither of doAND and doOR. "
24 "Exactly one should be true.");
25 }
26 return;
27}
28
40 bool has_passed = not(do_or_) or (do_and_);
41
42 for (int i = 0; i < trigger_list_.size(); i++) {
43 // Returns an error is a trigger collection DNE
44 try {
45 auto trig_result{event.getObject<ldmx::TriggerResult>(
47
48 // Returns true should any trigger pass and do_or_ enabled, and returns
49 // false if do_and_ and any fail
50 if (trig_result.passed()) {
51 if (do_or_) {
52 has_passed = true;
53 break;
54 }
55 } else {
56 if (do_and_) {
57 has_passed = false;
58 break;
59 }
60 }
61 } catch (...) {
62 std::string error_message =
63 "Attemping to use non-existing trigger collection " +
65 " to skim! Exiting.";
66 EXCEPTION_RAISE("InvalidArg", error_message.data());
67 return;
68 }
69 }
70
71 // Used to validate if code was working
72 if (do_val_) {
73 event.add("validation", has_passed);
74 }
75 // mark the event
76 if (has_passed)
78 else
80}
81} // namespace recon
82
#define DECLARE_ANALYZER(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:42
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78
Represents the trigger decision (pass/fail) for reconstruction.
Class that provides a trigger skimming decision from multiple Triggers based on either AND or OR.
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_pass_names_
pass name of the triggers
bool do_or_
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.
bool do_val_
enables a output collection with the keep tag for the purposes of validation
constexpr StorageControl::Hint HINT_SHOULD_DROP
storage control hint alias for backwards compatibility
constexpr StorageControl::Hint HINT_SHOULD_KEEP
storage control hint alias for backwards compatibility