-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdorky.cc
45 lines (38 loc) · 1.19 KB
/
dorky.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "dorky.h"
#include <algorithm>
#include <set>
namespace duplicate_removal{
DorkyEventIdentifier::DorkyEventIdentifier (unsigned long int r, unsigned long int e, unsigned long int l)
: run(r),
event(e),
lumi_section(l)
{ }
bool DorkyEventIdentifier::operator < (const DorkyEventIdentifier &other) const
{
if (run != other.run)
return run < other.run;
if (event != other.event)
return event < other.event;
if (lumi_section != other.lumi_section)
return lumi_section < other.lumi_section;
return false;
}
bool DorkyEventIdentifier::operator == (const DorkyEventIdentifier &other) const
{
if (run != other.run)
return false;
if (event != other.event)
return false;
if (lumi_section != other.lumi_section)
return false;
return true;
}
std::set<DorkyEventIdentifier> already_seen;
bool is_duplicate (const DorkyEventIdentifier &id){
std::pair<std::set<DorkyEventIdentifier>::const_iterator, bool> ret = already_seen.insert(id);
return !ret.second;
}
void clear_list(){
already_seen.clear();
}
}