ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/Pattern.cc
(Generate patch)

Comparing UserCode/L1RpcTriggerAnalysis/src/Pattern.cc (file contents):
Revision 1.3 by konec, Fri May 24 10:26:12 2013 UTC vs.
Revision 1.4 by konec, Mon May 27 11:02:41 2013 UTC

# Line 9 | Line 9
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) {
# Line 16 | Line 27 | Pattern Pattern::addOrCopy( std::pair<ui
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);
# Line 27 | Line 40 | void Pattern::add (  std::vector<Pattern
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines