LDMX Software
recon::SequentialTrigger Class Reference

Class that provides a trigger skimming decision from multiple Triggers based on either AND or OR. More...

#include <SequentialTrigger.h>

Public Member Functions

 SequentialTrigger (const std::string &name, framework::Process &process)
 Class constructor.
 
virtual ~SequentialTrigger ()=default
 Class destructor.
 
void configure (framework::config::Parameters &parameters) override
 Configure the processor using the given user specified parameters.
 
void produce (framework::Event &event) override
 Run the doOR or doAND check and create a SequentialTrigger object to contain the pass boolean value.
 
- Public Member Functions inherited from framework::Producer
 Producer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for a Producer is calling produce.
 
- Public Member Functions inherited from framework::EventProcessor
 DECLARE_FACTORY (EventProcessor, EventProcessor *, const std::string &, Process &)
 declare that we have a factory for this class
 
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()=default
 Class destructor.
 
virtual void beforeNewRun (ldmx::RunHeader &run_header)
 Callback for Producers to add parameters to the run header before conditions are initialized.
 
virtual void onNewRun (const ldmx::RunHeader &run_header)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessStart ()
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module_.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

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
 
bool do_and_
 
bool do_val_
 enables a output collection with the keep tag for the purposes of validation
 

Additional Inherited Members

- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramPool histograms_
 helper object for making and filling histograms
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

Class that provides a trigger skimming decision from multiple Triggers based on either AND or OR.

  • Note
    TriggerProcessor takes in a set of parameters to determine whether, upon an input collection of triggers, an OR or AND descision will be made. Each trigger layer is obtained after TriggerProcessor is run, and then running through the array the first pass returns true for doOR_ and the first fail false for doAND_. Once at worst all triggers are run through, we set the keep event flag to the resultant doOR or doAND result. If doVAL is set to true, we produce and output collection with this boolean value.

Definition at line 34 of file SequentialTrigger.h.

Constructor & Destructor Documentation

◆ SequentialTrigger()

recon::SequentialTrigger::SequentialTrigger ( const std::string & name,
framework::Process & process )
inline

Class constructor.

Definition at line 39 of file SequentialTrigger.h.

Base class for a module which produces a data product.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.

Member Function Documentation

◆ configure()

void recon::SequentialTrigger::configure ( framework::config::Parameters & ps)
overridevirtual

Configure the processor using the given user specified parameters.

Instantiates the variables used in this processor.

Parameters
parametersSet of parameters used to configure this processor.

We take trigger_list_ and trigger_passNames_ to obtain trigger collections, a do_or_ and do_and_ option to check if one of or all events pass, and do_val_ to output a validation collection

Reimplemented from framework::EventProcessor.

Definition at line 14 of file SequentialTrigger.cxx.

14 {
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}
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78
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
bool do_val_
enables a output collection with the keep tag for the purposes of validation

References do_or_, do_val_, framework::config::Parameters::get(), trigger_list_, and trigger_pass_names_.

◆ produce()

void recon::SequentialTrigger::produce ( framework::Event & event)
overridevirtual

Run the doOR or doAND check and create a SequentialTrigger object to contain the pass boolean value.

This producer takes in a list of triggers and runs an OR or AND skimmer depending on the config file.

Also sets the Storage Hint. param event The event to run skimmer on.

It will change the keep tag and produce nothing. This is unless the validation command is set to true, in which case it produces a boolean collection in an output file with the keeping flag.

Implements framework::Producer.

Definition at line 39 of file SequentialTrigger.cxx.

39 {
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}
void setStorageHint(framework::StorageControl::Hint hint)
Mark the current event as having the given storage control hint from this module_.
Represents the trigger decision (pass/fail) for reconstruction.
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

References do_or_, do_val_, framework::HINT_SHOULD_DROP, framework::HINT_SHOULD_KEEP, framework::EventProcessor::setStorageHint(), trigger_list_, and trigger_pass_names_.

Member Data Documentation

◆ do_and_

bool recon::SequentialTrigger::do_and_
private

Definition at line 71 of file SequentialTrigger.h.

◆ do_or_

bool recon::SequentialTrigger::do_or_
private

options to enable OR or AND skimming

Definition at line 70 of file SequentialTrigger.h.

Referenced by configure(), and produce().

◆ do_val_

bool recon::SequentialTrigger::do_val_
private

enables a output collection with the keep tag for the purposes of validation

Definition at line 77 of file SequentialTrigger.h.

Referenced by configure(), and produce().

◆ trigger_list_

std::vector<std::string> recon::SequentialTrigger::trigger_list_
private

The name of the input collection of triggers.

Definition at line 64 of file SequentialTrigger.h.

Referenced by configure(), and produce().

◆ trigger_pass_names_

std::vector<std::string> recon::SequentialTrigger::trigger_pass_names_
private

pass name of the triggers

Definition at line 67 of file SequentialTrigger.h.

Referenced by configure(), and produce().


The documentation for this class was generated from the following files: