MatchByDEta

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
#ifndef MatchByDEta_h_
#define MatchByDEta_h_

/** Define match between two objects by deltaEta.
 */

#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include <cmath>

namespace reco {
  template <typename T1, typename T2>
  class MatchByDEta {
  public:
    MatchByDEta(const edm::ParameterSet& cfg) : maxDEta_(cfg.getParameter<double>("maxDeltaEta")) {}
    bool operator()(const T1& t1, const T2& t2) const { return std::abs(t1.eta() - t2.eta()) < maxDEta_; }

  private:
    double maxDEta_;
  };
}  // namespace reco

#endif