LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
#include "TriggerAlgoBase.h"
Public Member Functions | |
TriggerAlgoBase (fhicl::ParameterSet const &pset, art::ActivityRegistry ®) | |
Default constructor with fhicl parameters. More... | |
virtual | ~TriggerAlgoBase () |
Default destructor. More... | |
virtual void | RunTriggerSim (const art::Event &event) |
Function to run trigger simulation ... children class may be override. More... | |
virtual void | ClearTriggerInfo () |
Function to clear simulated trigger information. More... | |
bool | HasRunTriggerSim () const |
Getter for a boolean which "true" value indicates trigger simulation is run already. More... | |
bool | IsTriggered (trigdata::TrigTimeSlice_t time) const |
Function to check if "time" (input arg.) is within any of valid readout windows or not. More... | |
const std::map< trigdata::TrigTimeSlice_t, trigdata::TrigTimeSlice_t > * | GetTimeWindows () const |
Getter to a const pointer of _time_windows std::map variable. More... | |
const std::set< trigdata::TrigTimeSlice_t > * | GetTriggerTimeStamps () const |
Getter to a const pointer of _timestamps std::set variable. More... | |
Protected Member Functions | |
virtual void | FillData (const art::Event &event)=0 |
Function to fill _timestamps std::set variable ... TO BE IMPLEMENTED in children. More... | |
virtual void | SimTrigger () |
Function to analyze _timestamps and store valid readout windows in _time_windows. More... | |
void | Config (fhicl::ParameterSet const &pset) |
Function to extract fhicl parameters. More... | |
Protected Attributes | |
std::set< trigdata::TrigTimeSlice_t > | _timestamps |
stores CANDIDATE readout trigger timestamps More... | |
std::map< trigdata::TrigTimeSlice_t, trigdata::TrigTimeSlice_t > | _time_windows |
stores VALID readout trigger time windows More... | |
trigdata::TrigTimeSlice_t | _preceeding_slices |
preceeding readout-window from trigger time stamp More... | |
trigdata::TrigTimeSlice_t | _proceeding_slices |
proceeding readout-window from trigger time stamp More... | |
trigdata::TrigTimeSlice_t | _deadtime |
trigger deadtime AFTER each valid trigger timestamps More... | |
bool | _sim_done |
run utility boolean, set to true after trigger simulation is run More... | |
Simple read-out trigger logic base class. This class applies a logic of data readout trigger.
Given an input array of readout trigger timestamps, this module applies trigger deadtime and readout window to decide which data packet to be readout and stored.
In the following, I use a notation TS to represent trigdata::TrigTimeSlice_t for short. Note TS is what is used as absolute scale of time in this algorithm. Each experiment may implement different reference point or unit to this time scale. See TriggerTypes.h for definition.
std::set<TS> _timestamps should be filled with time-stamps (with an arbitrary unit of your choise) of readout candidate triggers. This should be done in FillData(art::Event& event) function, which is virtual in this header and needs to be implemented in the inherited class.
After filling timestamps, one calls SimTrigger() to analyze and decide time windows during which incoming data should be readout and stored. This function stores a valid readout time window in the std::map<TS,TS> type variable, _time_windows. This map contains the ending time stamp of each readout window as a key, and the starting time stamp as a value.
Once SimTrigger() is called, then one can ask whether a specific time T is within the valid readout windows or not by a function, IsTriggered(TS time). This function returns true if the given time stamp is included in any of valid readout window. Else, returns false.
For further specifications that may have to do with a specific experiment or electronics should implement their specific complications in the inherited class. This includes FillData() virtual function since different experiments certainly have different data format from which readout trigger candidates' timestamp is extracted.
Note: IsTriggered(TS time) function performs a search of closest readout window to "time", and hence could be expensive (though stl::upper_bound is pretty fast).
Definition at line 69 of file TriggerAlgoBase.h.
trigger::TriggerAlgoBase::TriggerAlgoBase | ( | fhicl::ParameterSet const & | pset, |
art::ActivityRegistry & | reg | ||
) |
Default constructor with fhicl parameters.
Definition at line 15 of file TriggerAlgoBase_service.cc.
References ClearTriggerInfo(), and Config().
|
inlinevirtual |
|
inlinevirtual |
Function to clear simulated trigger information.
Definition at line 86 of file TriggerAlgoBase.h.
References _sim_done, _time_windows, and _timestamps.
Referenced by TriggerAlgoBase().
|
protected |
Function to extract fhicl parameters.
Definition at line 25 of file TriggerAlgoBase_service.cc.
References _deadtime, _preceeding_slices, _proceeding_slices, and fhicl::ParameterSet::get().
Referenced by GetTriggerTimeStamps(), and TriggerAlgoBase().
|
protectedpure virtual |
Function to fill _timestamps std::set variable ... TO BE IMPLEMENTED in children.
Referenced by GetTriggerTimeStamps(), and RunTriggerSim().
|
inline |
Getter to a const pointer of _time_windows std::map variable.
Definition at line 99 of file TriggerAlgoBase.h.
References _time_windows.
|
inline |
Getter to a const pointer of _timestamps std::set variable.
Definition at line 102 of file TriggerAlgoBase.h.
References _timestamps, Config(), FillData(), and SimTrigger().
|
inline |
Getter for a boolean which "true" value indicates trigger simulation is run already.
Definition at line 93 of file TriggerAlgoBase.h.
References _sim_done, and IsTriggered().
bool trigger::TriggerAlgoBase::IsTriggered | ( | trigdata::TrigTimeSlice_t | time | ) | const |
Function to check if "time" (input arg.) is within any of valid readout windows or not.
Definition at line 74 of file TriggerAlgoBase_service.cc.
References _time_windows.
Referenced by HasRunTriggerSim().
|
inlinevirtual |
Function to run trigger simulation ... children class may be override.
Definition at line 80 of file TriggerAlgoBase.h.
References FillData(), and SimTrigger().
|
protectedvirtual |
Function to analyze _timestamps and store valid readout windows in _time_windows.
Definition at line 38 of file TriggerAlgoBase_service.cc.
References _deadtime, _preceeding_slices, _proceeding_slices, _sim_done, _time_windows, and _timestamps.
Referenced by GetTriggerTimeStamps(), and RunTriggerSim().
|
protected |
trigger deadtime AFTER each valid trigger timestamps
Definition at line 129 of file TriggerAlgoBase.h.
Referenced by Config(), and SimTrigger().
|
protected |
preceeding readout-window from trigger time stamp
Definition at line 123 of file TriggerAlgoBase.h.
Referenced by Config(), and SimTrigger().
|
protected |
proceeding readout-window from trigger time stamp
Definition at line 126 of file TriggerAlgoBase.h.
Referenced by Config(), and SimTrigger().
|
protected |
run utility boolean, set to true after trigger simulation is run
Definition at line 132 of file TriggerAlgoBase.h.
Referenced by ClearTriggerInfo(), HasRunTriggerSim(), and SimTrigger().
|
protected |
stores VALID readout trigger time windows
Definition at line 120 of file TriggerAlgoBase.h.
Referenced by ClearTriggerInfo(), GetTimeWindows(), IsTriggered(), and SimTrigger().
|
protected |
stores CANDIDATE readout trigger timestamps
Definition at line 117 of file TriggerAlgoBase.h.
Referenced by ClearTriggerInfo(), GetTriggerTimeStamps(), and SimTrigger().