LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
TriggerAlgoBase_service.cc
Go to the documentation of this file.
1 //
3 // \file TriggerAlgoBase_service.cc
4 //
6 
7 #ifndef TRIGGERALGOBASE_CC
8 #define TRIGGERALGOBASE_CC
9 
10 #include "TriggerAlgoBase.h"
11 
12 namespace trigger{
13 
14  //****************************************************************************
16  //****************************************************************************
17 
19 
20  Config(pset);
21 
22  }
23 
24  //****************************************************************************
26  //****************************************************************************
27 
28  _preceeding_slices = pset.get< int >("PreceedingWindow");
29 
30  _proceeding_slices = pset.get< int >("ProceedingWindow");
31 
32  _deadtime = pset.get< int >("DeadTime");
33 
34  }
35 
36 
37  //****************************************************************************
39  //****************************************************************************
40 
41  if(_sim_done) return;
42 
43  _time_windows.clear();
44 
45  trigdata::TrigTimeSlice_t last_timestamp=0;
46 
47  trigdata::TrigTimeSlice_t window_begin=0;
48 
49  trigdata::TrigTimeSlice_t window_end=0;
50 
52  iter != _timestamps.end();
53  ++iter){
54 
55  if(!(last_timestamp) || (*iter) > (last_timestamp + _deadtime)) {
56 
57  window_begin = ((*iter) > _preceeding_slices) ? ((*iter) - _preceeding_slices) : 0;
58 
59  window_end = (*iter) + _proceeding_slices;
60 
61  _time_windows.insert(std::make_pair(window_end,window_begin));
62 
63  last_timestamp=(*iter);
64 
65  }
66 
67  }
68 
69  _sim_done = true;
70 
71  }
72 
73  //****************************************************************************
75  //****************************************************************************
76 
77  if(!_time_windows.size()) return false;
78 
80 
81  if(start_time==_time_windows.end()) return false;
82 
83  else return ((*start_time).second < time);
84 
85  }
86 
87 
88  //DEFINE_ART_SERVICE(TriggerAlgoBase)
89 
90 } // namespace trigger
91 
92 #endif
uint64_t TrigTimeSlice_t
A unit of time used in trigger logic.
Definition: TriggerTypes.hh:9
std::set< trigdata::TrigTimeSlice_t > _timestamps
stores CANDIDATE readout trigger timestamps
trigdata::TrigTimeSlice_t _proceeding_slices
proceeding readout-window from trigger time stamp
trigdata::TrigTimeSlice_t _preceeding_slices
preceeding readout-window from trigger time stamp
intermediate_table::const_iterator const_iterator
TriggerAlgoBase(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
Default constructor with fhicl parameters.
T get(std::string const &key) const
Definition: ParameterSet.h:231
virtual void SimTrigger()
Function to analyze _timestamps and store valid readout windows in _time_windows. ...
bool _sim_done
run utility boolean, set to true after trigger simulation is run
std::map< trigdata::TrigTimeSlice_t, trigdata::TrigTimeSlice_t > _time_windows
stores VALID readout trigger time windows
void Config(fhicl::ParameterSet const &pset)
Function to extract fhicl parameters.
bool IsTriggered(trigdata::TrigTimeSlice_t time) const
Function to check if "time" (input arg.) is within any of valid readout windows or not...
trigdata::TrigTimeSlice_t _deadtime
trigger deadtime AFTER each valid trigger timestamps
virtual void ClearTriggerInfo()
Function to clear simulated trigger information.