Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:16

0001 #ifndef MatchByDEta_h_
0002 #define MatchByDEta_h_
0003 
0004 /** Define match between two objects by deltaEta.
0005  */
0006 
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 
0009 #include <cmath>
0010 
0011 namespace reco {
0012   template <typename T1, typename T2>
0013   class MatchByDEta {
0014   public:
0015     MatchByDEta(const edm::ParameterSet& cfg) : maxDEta_(cfg.getParameter<double>("maxDeltaEta")) {}
0016     bool operator()(const T1& t1, const T2& t2) const { return std::abs(t1.eta() - t2.eta()) < maxDEta_; }
0017 
0018   private:
0019     double maxDEta_;
0020   };
0021 }  // namespace reco
0022 
0023 #endif