17 std::vector<RpcCluster> allClusters;
21 std::sort(digis.begin(), digis.end(), [](
const RPCDigi&
a,
const RPCDigi&
b) {
return a.
strip() <
b.strip(); });
25 std::reverse(digis.begin(), digis.end());
28 typedef std::pair<unsigned int, unsigned int> Cluster;
36 for (
unsigned int iDigi = 0; iDigi < digis.size(); iDigi++) {
42 bool duplicatedDigi =
false;
43 for (
unsigned int iDigi2 = 0; iDigi2 < iDigi; iDigi2++) {
44 if (digis[iDigi].
strip() == digis[iDigi2].strip()) {
45 duplicatedDigi =
true;
54 bool addNewCluster =
true;
56 for (
auto& cluster : allClusters) {
57 if (digis[iDigi].
strip() - cluster.lastStrip == 1) {
58 cluster.lastStrip = digis[iDigi].strip();
59 addNewCluster =
false;
60 }
else if (digis[iDigi].
strip() - cluster.firstStrip == -1) {
61 cluster.firstStrip = digis[iDigi].strip();
62 addNewCluster =
false;
63 }
else if (digis[iDigi].
strip() >= cluster.firstStrip && digis[iDigi].strip() <= cluster.lastStrip) {
64 addNewCluster =
false;
69 allClusters.emplace_back(digis[iDigi].
strip(), digis[iDigi].
strip());
70 allClusters.back().bx = digis[iDigi].bx();
71 allClusters.back().timing =
convertTiming(digis[iDigi].time());
virtual int convertTiming(double timing) const
virtual ~RpcClusterization()
bool dropAllClustersIfMoreThanMax
virtual std::vector< RpcCluster > getClusters(const RPCDetId &roll, std::vector< RPCDigi > &digis) const
N.B. digis are sorted inside the function.