CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/RecoTauTag/TauTagTools/interface/ElementsInEllipse.h

Go to the documentation of this file.
00001 #ifndef ElementsInEllipse_h
00002 #define ElementsInEllipse_h
00003 
00004 #include "RecoTauTag/TauTagTools/interface/Ellipse.h"
00005 #include "DataFormats/Common/interface/RefVector.h"
00006 #include <utility>
00007 
00008 template  <typename T, typename C>
00009   class ElementsInEllipse{
00010     public:
00011       ElementsInEllipse(){}
00012       ~ElementsInEllipse(){}
00013      
00014       const std::pair<edm::RefVector<C>, edm::RefVector<C> > operator()(const T& axis, double rPhi, double rEta, const edm::RefVector<C>& elements)const{
00015         edm::RefVector<C> elementsInEllipse;
00016         edm::RefVector<C> elementsOutEllipse;
00017         for(typename edm::RefVector<C>::const_iterator element = elements.begin(); element != elements.end(); ++element){
00018           double distance = ellipse(axis, (*element)->momentum(), rPhi, rEta);
00019           if(distance <= 1.)elementsInEllipse.push_back(*element);
00020           else elementsOutEllipse.push_back(*element);
00021         }
00022         std::pair<edm::RefVector<C>, edm::RefVector<C> > theInOutPair(elementsInEllipse, elementsOutEllipse);
00023         return theInOutPair;
00024       }
00025   };
00026 #endif