BasicTrigger.cxx
Go to the documentation of this file.
1 // BasicTrigger.cxx
2 //
3 // Michael Baird
4 // March 2016
5 //
6 // Basic trigger data product class for the DAQ trigger service framework.
7 //
8 
9 // DUNETPC specific includes
11 
12 // Framework includes
13 
14 // C++ includes
15 #include <iomanip>
16 
17 namespace triggersim {
18 
19  //----------------------------------------------------------------------
20  BasicTrigger::BasicTrigger(bool trigdecision,
21  unsigned int trigtype,
22  unsigned int trigsubtype,
23  Hardware::HardwareID hardwareid):
24  fTrigDecision(trigdecision),
25  fTrigType(trigtype),
26  fTrigSubType(trigsubtype),
27  fTrigHardwareID(hardwareid)
28  {}
29 
30 
31 
32  //----------------------------------------------------------------------
34  {}
35 
36 
37 
38  //----------------------------------------------------------------------
39  void BasicTrigger::setTrigType(unsigned int trigtype)
40  {
41  fTrigType = trigtype;
42  }
43 
44 
45 
46  //----------------------------------------------------------------------
47  unsigned int BasicTrigger::TrigType() const
48  {
49  return fTrigType;
50  }
51 
52 
53 
54  //----------------------------------------------------------------------
55  void BasicTrigger::setTrigSubType(unsigned int trigsubtype)
56  {
57  fTrigSubType = trigsubtype;
58  }
59 
60 
61 
62  //----------------------------------------------------------------------
63  unsigned int BasicTrigger::TrigSubType() const
64  {
65  return fTrigSubType;
66  }
67 
68 
69 
70  //----------------------------------------------------------------------
71  void BasicTrigger::setTrigDecision(bool trigdecision)
72  {
73  fTrigDecision = trigdecision;
74  }
75 
76 
77 
78  //----------------------------------------------------------------------
80  {
81  return fTrigDecision;
82  }
83 
84 
85 
86  //----------------------------------------------------------------------
87  void BasicTrigger::setMetrics(std::vector<double> metrics)
88  {
89  fMetrics = metrics;
90  }
91 
92 
93 
94  //----------------------------------------------------------------------
95  void BasicTrigger::setMetric(double metric)
96  {
97  fMetrics.push_back(metric);
98  }
99 
100 
101 
102  //----------------------------------------------------------------------
103  std::vector<double> BasicTrigger::Metrics() const
104  {
105  return fMetrics;
106  }
107 
108 
109 
110  //----------------------------------------------------------------------
111  double BasicTrigger::Metric(unsigned int i) const
112  {
113  if(fMetrics.size() > i) return fMetrics[i];
114  else {
115  std::cout << "\n\n\nWARNING!!! Requested metric index is larger than the size of fMetrics!!!\n\n\n";
116  return 0;
117  }
118  }
119 
120 
121 
122  //----------------------------------------------------------------------
123  // ostream operator.
124  //
125 #ifndef __GCCXML__
126  std::ostream& operator << (std::ostream& o, BasicTrigger const& bt) {
127 
128  o << "Trigger Type = " << bt.TrigType() << std::endl;
129  o << "Trigger Sub-Type = " << bt.TrigSubType() << std::endl;
130  o << "Trigger Decision = " << bt.TrigDecision() << std::endl;
131  o << "Trigger HardwareID = " << bt.fTrigHardwareID << std::endl;
132  return o;
133 
134  }
135 
136 
137 
138  //----------------------------------------------------------------------
139  // < operator.
140  //
141  bool operator < (BasicTrigger const& a, BasicTrigger const& b) {
142 
143  return a.TrigType() < b.TrigType();
144 
145  }
146 #endif //__GCCXML__
147 } // end namespace triggersim
unsigned int fTrigType
trigger type (types and subtypes are defined in TriggerTypes.h)
Definition: BasicTrigger.h:74
std::vector< double > Metrics() const
unsigned int TrigSubType() const
BasicTrigger(bool trigdecision=false, unsigned int trigtype=kNullTrigger, unsigned int trigsubtype=kNullTrigger, Hardware::HardwareID hardwareid=Hardware::UnknownID)
friend bool operator<(BasicTrigger const &a, BasicTrigger const &b)
void setMetrics(std::vector< double > metrics)
unsigned int fTrigSubType
trigger subtype (types and subtypes are defined in TriggerTypes.h)
Definition: BasicTrigger.h:75
Hardware::HardwareID fTrigHardwareID
Definition: BasicTrigger.h:76
void setTrigType(unsigned int trigtype)
bt
Definition: tracks.py:83
void setTrigSubType(unsigned int trigsubtype)
const double a
void setTrigDecision(bool trigdecision)
friend std::ostream & operator<<(std::ostream &o, BasicTrigger const &bt)
bool TrigDecision() const
std::vector< double > fMetrics
a vector to store trigger algorithm performance metrics
Definition: BasicTrigger.h:78
static bool * b
Definition: config.cpp:1043
unsigned int TrigType() const
void setMetric(double metric)
metrics
Definition: train.py:350
double Metric(unsigned int i) const
QTextStream & endl(QTextStream &s)
bool fTrigDecision
did the trigger algorithm decide to keep this event?
Definition: BasicTrigger.h:73