CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions
SubsetHsmModeFinder3d Class Reference

#include <SubsetHsmModeFinder3d.h>

Inheritance diagram for SubsetHsmModeFinder3d:
ModeFinder3d

Public Member Functions

SubsetHsmModeFinder3dclone () const override
 
GlobalPoint operator() (const std::vector< PointAndDistance > &values) const override
 
- Public Member Functions inherited from ModeFinder3d
virtual ~ModeFinder3d ()
 

Additional Inherited Members

- Public Types inherited from ModeFinder3d
typedef std::pair< GlobalPoint,
float > 
PointAndDistance
 

Detailed Description

Definition at line 14 of file SubsetHsmModeFinder3d.h.

Member Function Documentation

SubsetHsmModeFinder3d * SubsetHsmModeFinder3d::clone ( void  ) const
overridevirtual

Implements ModeFinder3d.

Definition at line 52 of file SubsetHsmModeFinder3d.cc.

GlobalPoint SubsetHsmModeFinder3d::operator() ( const std::vector< PointAndDistance > &  values) const
overridevirtual

Implements ModeFinder3d.

Definition at line 16 of file SubsetHsmModeFinder3d.cc.

References SplitLinear::begin, dataset::end, hsm_3d(), mps_fire::i, RPCpg::pts, and runTheMatrix::ret.

16  {
17  if (values.empty()) {
18  throw VertexException("SubsetHsmModeFinder3d: no value given.");
19  };
20 
21  std::vector<GlobalPoint> pts;
22  pts.reserve(values.size() - 1);
23  std::vector<PointAndDistance> sorted_values(values.size());
24  partial_sort_copy(values.begin(), values.end(), sorted_values.begin(), sorted_values.end(), compareByDistance());
25 
26  std::vector<PointAndDistance>::iterator end = sorted_values.end();
27  std::vector<PointAndDistance>::iterator begin = sorted_values.begin();
28 
29  float dmax = 0.004; // 40 microns, as a first try.
30 
31  // we want at least 30 values
32  unsigned int min_num = values.size() < 30 ? values.size() : 30;
33 
34  // we also want at least 50 % of all values
35  if (values.size() > 2 * min_num)
36  min_num = (int)values.size() / 2;
37 
38  while (pts.size() < min_num) {
39  // we cut at a dmax
40  std::vector<PointAndDistance>::iterator i;
41  for (i = begin; i != end && (i->second < dmax); ++i) {
42  pts.push_back(i->first);
43  };
44  dmax += 0.003; // add 30 microns with every iteration
45  begin = i;
46  };
47 
48  GlobalPoint ret = hsm_3d(pts);
49  return ret;
50 }
tuple ret
prodAgent to be discontinued
GlobalPoint hsm_3d(const std::vector< GlobalPoint > &values)
cordinate wise half sample mode in 3d
Definition: hsm_3d.cc:8
Common base class.
static const double pts[33]
Definition: Constants.h:30
string end
Definition: dataset.py:937