Go to the documentation of this file.00001 #ifndef PhysicsTools_IsolationUtils_TauConeIsolationAlgo_h
00002 #define PhysicsTools_IsolationUtils_TauConeIsolationAlgo_h
00003
00004 #include "DataFormats/Common/interface/RefVector.h"
00005
00006 #include "PhysicsTools/Utilities/interface/Math.h"
00007
00008 template <typename T, typename C, typename M>
00009 class TauConeIsolationAlgo {
00010 public:
00011 TauConeIsolationAlgo() {}
00012 ~TauConeIsolationAlgo() {}
00013
00014 const edm::RefVector<C> operator()(const T & coneAxis, double coneSize, const edm::RefVector<C> & elements, const M & metric) const;
00015 };
00016
00017 template <typename T, typename C, typename M>
00018 const edm::RefVector<C> TauConeIsolationAlgo<T, C, M>::operator()(const T & coneAxis, double coneSize, const edm::RefVector<C> & elements, const M & metric) const
00019 {
00020 edm::RefVector<C> elementsInCone;
00021 for( typename edm::RefVector<C>::const_iterator element = elements.begin();
00022 element != elements.end(); ++element ) {
00023 double distance = metric(coneAxis, (*element)->momentum());
00024
00025 if ( distance <= coneSize ) {
00026 elementsInCone.push_back(*element);
00027 }
00028 }
00029
00030 return elementsInCone;
00031 }
00032
00033 #endif