CMS 3D CMS Logo

OutermostClusterizer1D.h
Go to the documentation of this file.
1 #ifndef _OutermostClusterizer1D_H_
2 #define _OutermostClusterizer1D_H_
3 
9 
10 #include <vector>
11 #include <cmath>
12 #include <algorithm>
13 
19 template <class T>
21 public:
26  ~OutermostClusterizer1D() override;
27 
28  std::pair<std::vector<Cluster1D<T> >, std::vector<const T*> > operator()(
29  const std::vector<Cluster1D<T> >&) const override;
30 
31  OutermostClusterizer1D* clone() const override;
32 
33 private:
35 };
36 
37 /*
38  * --- implementation ---
39  *
40  */
41 
42 template <class T>
44  : theEstimator(o.theEstimator->clone()) {}
45 
46 template <class T>
48 
49 template <class T>
51  delete theEstimator;
52 }
53 
54 template <class T>
56  return new OutermostClusterizer1D<T>(*this);
57 }
58 
59 template <class T>
60 std::pair<std::vector<Cluster1D<T> >, std::vector<const T*> > OutermostClusterizer1D<T>::operator()(
61  const std::vector<Cluster1D<T> >& ov) const {
62  using namespace Clusterizer1DCommons;
63  typedef Cluster1D<T> Cluster1D;
64  std::vector<const T*> unusedtracks;
65 
66  switch (ov.size()) {
67  case 0:
68  throw Clustering1DException("[OutermostClusterizer1D] no values given");
69  case 1: {
70  std::pair<std::vector<Cluster1D>, std::vector<const T*> > ret(ov, unusedtracks);
71  return ret;
72  };
73  case 2: {
74  std::pair<std::vector<Cluster1D>, std::vector<const T*> > ret(ov, unusedtracks);
75  return ret;
76  };
77  };
78 
79  std::vector<Cluster1D> v = ov;
80  sort(v.begin(), v.end(), ComparePairs<T>());
81  std::vector<Cluster1D> sols;
82  int sze = v.size() / 2;
83  Cluster1D tmp = v[0];
84  Cluster1DMerger<T> merger(*theEstimator);
85  // merge the inner half to the primary cluster
86  for (typename std::vector<Cluster1D>::const_iterator i = v.begin() + 1; i != v.begin() + sze; ++i) {
87  tmp = merger(tmp, *i);
88  }
89  sols.push_back(tmp);
90  tmp = v[sze];
91  for (typename std::vector<Cluster1D>::const_iterator i = v.begin() + sze + 1; i != v.end(); ++i) {
92  tmp = merger(tmp, *i);
93  }
94  sols.push_back(tmp);
95 
96  std::pair<std::vector<Cluster1D>, std::vector<const T*> > ret(sols, unusedtracks);
97  return ret;
98 }
99 
100 #endif
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
TrivialWeightEstimator.h
Cluster1DMerger.h
Clusterizer1DCommons
Definition: Clusterizer1DCommons.h:6
OutermostClusterizer1D::~OutermostClusterizer1D
~OutermostClusterizer1D() override
Definition: OutermostClusterizer1D.h:50
mps_fire.i
i
Definition: mps_fire.py:355
Cluster1D
Definition: Cluster1D.h:13
OutermostClusterizer1D::operator()
std::pair< std::vector< Cluster1D< T > >, std::vector< const T * > > operator()(const std::vector< Cluster1D< T > > &) const override
Definition: OutermostClusterizer1D.h:60
findQualityFiles.v
v
Definition: findQualityFiles.py:179
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
TrivialWeightEstimator
Definition: TrivialWeightEstimator.h:13
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
Clusterizer1DCommons::ComparePairs
Definition: Clusterizer1DCommons.h:11
Clusterizer1D.h
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
WeightEstimator
Definition: WeightEstimator.h:12
OutermostClusterizer1D
Definition: OutermostClusterizer1D.h:20
Cluster1DMerger
Definition: Cluster1DMerger.h:14
OutermostClusterizer1D::clone
OutermostClusterizer1D * clone() const override
Definition: OutermostClusterizer1D.h:55
OutermostClusterizer1D::theEstimator
WeightEstimator< T > * theEstimator
Definition: OutermostClusterizer1D.h:34
Clusterizer1D
Definition: Clusterizer1D.h:16
Clustering1DException.h
Clusterizer1DCommons.h
Clustering1DException
Definition: Clustering1DException.h:10
OutermostClusterizer1D::OutermostClusterizer1D
OutermostClusterizer1D(const WeightEstimator< T > &est=TrivialWeightEstimator< T >())
Definition: OutermostClusterizer1D.h:47