test
CMS 3D CMS Logo

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

#include <SubsetHsmModeFinder3d.h>

Inheritance diagram for SubsetHsmModeFinder3d:
ModeFinder3d

Public Member Functions

virtual SubsetHsmModeFinder3dclone () const
 
virtual GlobalPoint operator() (const std::vector< PointAndDistance > &values) const
 
- 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
virtual

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
virtual

Implements ModeFinder3d.

Definition at line 20 of file SubsetHsmModeFinder3d.cc.

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

22 {
23  if ( values.size() == 0 )
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 }
int i
Definition: DBlmapReader.cc:9
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
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30