CMS 3D CMS Logo

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 60 of file SubsetHsmModeFinder3d.cc.

61 {
62  return new SubsetHsmModeFinder3d ( * this );
63 }
GlobalPoint SubsetHsmModeFinder3d::operator() ( const std::vector< PointAndDistance > &  values) const
overridevirtual

Implements ModeFinder3d.

Definition at line 20 of file SubsetHsmModeFinder3d.cc.

References begin, end, hsm_3d(), mps_fire::i, and RPCpg::pts.

22 {
23  if ( values.empty() )
24  {
25  throw VertexException ("SubsetHsmModeFinder3d: no value given.");
26  };
27 
28  std::vector < GlobalPoint > pts; pts.reserve ( values.size()-1 );
29  std::vector< PointAndDistance> sorted_values ( values.size() );
30  partial_sort_copy ( values.begin(), values.end(),
31  sorted_values.begin(), sorted_values.end(), compareByDistance() );
32 
33  std::vector< PointAndDistance>::iterator end = sorted_values.end();
34  std::vector< PointAndDistance>::iterator begin = sorted_values.begin();
35 
36  float dmax = 0.004; // 40 microns, as a first try.
37 
38  // we want at least 30 values
39  unsigned int min_num = values.size() < 30 ? values.size() : 30;
40 
41  // we also want at least 50 % of all values
42  if ( values.size() > 2 * min_num ) min_num = (int) values.size() / 2;
43 
44  while ( pts.size() < min_num )
45  {
46  // we cut at a dmax
47  std::vector< PointAndDistance>::iterator i;
48  for ( i=begin; i!=end && ( i->second < dmax ) ; ++i )
49  {
50  pts.push_back ( i->first );
51  };
52  dmax +=0.003; // add 30 microns with every iteration
53  begin=i;
54  };
55 
56  GlobalPoint ret = hsm_3d ( pts );
57  return ret;
58 }
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
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30