HitSet.h
Go to the documentation of this file.
1 #ifndef HITSET__H
2 #define HITSET__H
5 #include <set>
6 
7 namespace novaddt{
8  class HitSet;
9 }
10 
11 //utility class HitSet, for hit set subtraction and addition
12 class novaddt::HitSet: public std::set<novaddt::DAQHit,novaddt::CompareDAQHit<TDC>>
13 {
14  using base_set = std::set<novaddt::DAQHit,novaddt::CompareDAQHit<TDC>>;
15  public:
17 
18  template<class AnyCollection>
19  HitSet(const AnyCollection& v):base_set(v.begin(),v.end())
20  {
21  }
22 
23  template<class AnyCollection>
24  void add(const AnyCollection& v)
25  {
26  insert(v.begin(),v.end());
27  }
28 
29  template<class AnyCollection>
30  void subtract(const AnyCollection& v)
31  {
32  for(const auto& hit: v){
33  auto it=find(hit);
34  if(it!=end())erase(it);
35  }
36  }
37 };
38 #endif
set< int >::iterator it
std::set< novaddt::DAQHit, novaddt::CompareDAQHit< TDC >> base_set
Definition: HitSet.h:14
void add(const AnyCollection &v)
Definition: HitSet.h:24
Definition: structs.h:12
HitSet(const AnyCollection &v)
Definition: HitSet.h:19
void subtract(const AnyCollection &v)
Definition: HitSet.h:30