CMS 3D CMS Logo

ElementsInCone.h
Go to the documentation of this file.
1 #ifndef ElementsInCone_h
2 #define ElementsInCone_h
3 
8 
9 template <typename T, typename M, typename C>
11  public:
14  const std::vector<edm::Ptr<C> > operator()(const T& coneAxis,const M& coneMetric,double coneSize, std::vector<edm::Ptr<C> > elements)const{
15  std::vector<edm::Ptr<C> > elementsInCone;
16  for(typename std::vector<edm::Ptr<C> >::const_iterator element=elements.begin();element!=elements.end();++element) {
17  double distance = coneMetric(coneAxis,(*element)->momentum());
18  if (distance<=coneSize)elementsInCone.push_back(*element);
19  }
20  return elementsInCone;
21  }
22  /* const edm::RefVector<C> operator()(const T& coneAxis,const M& coneMetric,double coneSize,const edm::RefVector<C>& elements)const{ */
23 /* edm::RefVector<C> elementsInCone; */
24 /* for(typename edm::RefVector<C>::const_iterator element=elements.begin();element!=elements.end();++element) { */
25 /* double distance = coneMetric(coneAxis,(*element)->momentum()); */
26 /* if (distance<=coneSize)elementsInCone.push_back(*element); */
27 /* } */
28 /* return elementsInCone; */
29 /* } */
30 };
31 
32 template <typename T, typename M>
33 class ElementsInCone<T, M, std::pair<math::XYZPoint,float> >{
34  public:
37  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{
38  std::vector<std::pair<math::XYZPoint,float> > elementsInCone;
39  for(typename std::vector<std::pair<math::XYZPoint,float> >::const_iterator element=elements.begin();element!=elements.end();++element) {
40  double distance = coneMetric(coneAxis,(*element).first);
41  if (distance<=coneSize)elementsInCone.push_back(*element);
42  }
43  return elementsInCone;
44  }
45 };
46 
47 #endif
48 
const std::vector< edm::Ptr< C > > operator()(const T &coneAxis, const M &coneMetric, double coneSize, std::vector< edm::Ptr< C > > elements) const
long double T
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