ComparePairs

Macros

Line Code
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
#ifndef _Clusterizer1DCommons_H_
#define _Clusterizer1DCommons_H_

#include "CommonTools/Clustering1D/interface/Cluster1D.h"

namespace Clusterizer1DCommons {
  // typedef Clusterizer1DCommons::Cluster1D Cluster1D;
  inline double square(const double a) { return a * a; }

  template <class T>
  struct ComparePairs {
    bool operator()(const Cluster1D<T>& c1, const Cluster1D<T>& c2) {
      return (c1.position().value() < c2.position().value());
    };
  };

  template <class T>
  void add(const std::vector<const T*>& source, std::vector<const T*>& dest) {
    for (typename std::vector<const T*>::const_iterator i = source.begin(); i != source.end(); ++i) {
      dest.push_back(*i);
    };
  }

}  // namespace Clusterizer1DCommons

#endif