Jpp  18.0.1-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JTrigger/JTriggerOutput.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGEROUTPUT__
2 #define __JTRIGGEROUTPUT__
3 
4 #include <vector>
5 #include <algorithm>
6 
7 #include "JTrigger/JEvent.hh"
8 
9 
10 /**
11  * \author mdejong
12  */
13 
14 namespace JTRIGGER {}
15 namespace JPP { using namespace JTRIGGER; }
16 
17 namespace JTRIGGER {
18 
19 
20  /**
21  * Set of triggered events.
22  */
24  public std::vector<JEvent>
25  {
26  public:
27  /**
28  * Default constructor.
29  */
31  std::vector<JEvent>()
32  {}
33 
34 
35  /**
36  * Merge events.
37  *
38  * \param match match criterion
39  */
40  template<class JMatch_t>
41  inline void merge(const JMatch_t& match)
42  {
43  std::sort(this->begin(), this->end());
44 
45  iterator out = this->begin();
46 
47  for (iterator i = this->begin(); i != this->end(); ++out) {
48 
49  if (out != i) {
50  *out = *i; // copy event
51  }
52 
53  while (++i != this->end() && match(*out,*i)) {
54  out->merge(*i); // merge event
55  }
56  }
57 
58  this->erase(out, this->end());
59  }
60  };
61 }
62 
63 #endif
Set of triggered events.
JTriggerOutput()
Default constructor.
void merge(const JMatch_t &match)
Merge events.
Triggered event.