9 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/CSCDigiSpec.h" |
10 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/RPCDigiSpec.h" |
11 |
|
|
12 |
+ |
bool Pattern::operator==(const Pattern& o) const |
13 |
+ |
{ |
14 |
+ |
unsigned int thissize = theData.size(); |
15 |
+ |
if (thissize != o.size()) return false; |
16 |
+ |
for (unsigned int idx=0; idx<thissize; idx++) { |
17 |
+ |
if (theData[idx].first != o.theData[idx].first) return false; |
18 |
+ |
if (theData[idx].second != o.theData[idx].second) return false; |
19 |
+ |
} |
20 |
+ |
return true; |
21 |
+ |
} |
22 |
+ |
|
23 |
|
Pattern Pattern::addOrCopy( std::pair<uint32_t, unsigned int > aData) |
24 |
|
{ |
25 |
|
for (unsigned int idx=0; idx < theData.size(); ++idx) { |
27 |
|
Pattern modified = *this; |
28 |
|
modified.theData[idx].second = aData.second; |
29 |
|
return modified; |
30 |
+ |
// if (*this == modified) return Pattern(); // nothing to do |
31 |
+ |
// else return modified; // really duplicate |
32 |
|
} |
33 |
|
} |
34 |
|
theData.push_back(aData); |
40 |
|
std::vector<Pattern> copied; |
41 |
|
for (std::vector<Pattern>::iterator ip = vpat.begin(); ip != vpat.end(); ++ip) { |
42 |
|
Pattern modified = ip->addOrCopy(aData); |
43 |
< |
if (modified) copied.push_back(modified); |
43 |
> |
if (modified && (find(copied.begin(), copied.end(), modified) == copied.end()) ) copied.push_back(modified); |
44 |
|
} |
45 |
|
if (copied.size() != 0) vpat.insert(vpat.end(), copied.begin(), copied.end()); |
46 |
|
} |