CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/RecoTauTag/TauTagTools/interface/ElementsInCone.h

Go to the documentation of this file.
00001 #ifndef ElementsInCone_h
00002 #define ElementsInCone_h
00003 
00004 #include "DataFormats/Common/interface/RefVector.h"
00005 #include "DataFormats/Math/interface/angle.h"
00006 #include "DataFormats/Math/interface/deltaR.h"
00007 #include "DataFormats/Math/interface/Point3D.h"
00008 
00009 template <typename T, typename M, typename C>
00010   class ElementsInCone {
00011    public:
00012     ElementsInCone() {}
00013     ~ElementsInCone() {}  
00014     const edm::RefVector<C> operator()(const T& coneAxis,const M& coneMetric,double coneSize,const edm::RefVector<C>& elements)const{
00015       edm::RefVector<C> elementsInCone;
00016       for(typename edm::RefVector<C>::const_iterator element=elements.begin();element!=elements.end();++element) {
00017         double distance = coneMetric(coneAxis,(*element)->momentum());
00018         if (distance<=coneSize)elementsInCone.push_back(*element);
00019       }
00020       return elementsInCone;      
00021     }
00022 };
00023 
00024 template <typename T, typename M> 
00025 class ElementsInCone<T, M, std::pair<math::XYZPoint,float> >{
00026    public:
00027     ElementsInCone() {}
00028     ~ElementsInCone() {}  
00029     const std::vector<std::pair<math::XYZPoint,float> > operator()(const T& coneAxis,const M& coneMetric,double coneSize,const std::vector<std::pair<math::XYZPoint,float> >& elements)const{
00030       std::vector<std::pair<math::XYZPoint,float> > elementsInCone;
00031       for(typename std::vector<std::pair<math::XYZPoint,float> >::const_iterator element=elements.begin();element!=elements.end();++element) {
00032         double distance = coneMetric(coneAxis,(*element).first);
00033         if (distance<=coneSize)elementsInCone.push_back(*element);
00034       }
00035       return elementsInCone;      
00036     }
00037 };
00038 
00039 #endif
00040