9 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/CSCDigiSpec.h" |
10 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/RPCDigiSpec.h" |
11 |
|
|
12 |
< |
|
13 |
< |
bool Pattern::add ( std::pair<uint32_t, unsigned int > aData) |
12 |
> |
Pattern Pattern::addOrCopy( std::pair<uint32_t, unsigned int > aData) |
13 |
|
{ |
14 |
< |
for (DataType::const_iterator it=theData.begin(); it!= theData.end(); it++) { |
15 |
< |
if (it->first == aData.first) { |
16 |
< |
return false; |
14 |
> |
for (unsigned int idx=0; idx < theData.size(); ++idx) { |
15 |
> |
if (theData[idx].first == aData.first) { |
16 |
> |
Pattern modified = *this; |
17 |
> |
modified.theData[idx].second = aData.second; |
18 |
> |
return modified; |
19 |
|
} |
20 |
|
} |
21 |
|
theData.push_back(aData); |
22 |
< |
return true; |
22 |
> |
return Pattern(); |
23 |
|
} |
24 |
|
|
25 |
< |
bool Pattern::add ( std::vector<Pattern> & vpat, std::pair<uint32_t, unsigned int > aData) |
25 |
> |
void Pattern::add ( std::vector<Pattern> & vpat, std::pair<uint32_t, unsigned int > aData) |
26 |
|
{ |
26 |
– |
bool allOK = true; |
27 |
|
std::vector<Pattern> copied; |
28 |
|
for (std::vector<Pattern>::iterator ip = vpat.begin(); ip != vpat.end(); ++ip) { |
29 |
< |
if (! ip->add(aData) ) { |
30 |
< |
allOK = false; |
31 |
< |
Pattern modified = *ip; |
32 |
< |
for (auto ic =modified.theData.begin(); ic!=modified.theData.end(); ic++) { |
33 |
< |
if (ic->first==aData.first) {ic->second = aData.second; break; } |
34 |
< |
} |
35 |
< |
copied.push_back(modified); |
36 |
< |
} |
29 |
> |
Pattern modified = ip->addOrCopy(aData); |
30 |
> |
if (modified) copied.push_back(modified); |
31 |
|
} |
32 |
|
if (copied.size() != 0) vpat.insert(vpat.end(), copied.begin(), copied.end()); |
39 |
– |
return allOK; |
33 |
|
} |
34 |
|
|
35 |
|
|