CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
FsmwModeFinder3d Class Reference

#include <FsmwModeFinder3d.h>

Inheritance diagram for FsmwModeFinder3d:
ModeFinder3d

Public Member Functions

FsmwModeFinder3dclone () const override
 
 FsmwModeFinder3d (float fraction=.5, float weightExponent=-2., float cutoff=10, int no_weights_above=10)
 
GlobalPoint operator() (const std::vector< PointAndDistance > &) const override
 
- Public Member Functions inherited from ModeFinder3d
virtual ~ModeFinder3d ()
 

Private Attributes

float theCutoff
 
float theFraction
 
int theNoWeightsAbove
 
float theWeightExponent
 

Additional Inherited Members

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

Detailed Description

this is a half sample mode finder that works coordinate wise, in 3d.

Definition at line 12 of file FsmwModeFinder3d.h.

Constructor & Destructor Documentation

◆ FsmwModeFinder3d()

FsmwModeFinder3d::FsmwModeFinder3d ( float  fraction = .5,
float  weightExp = -2.,
float  cutoff = 10,
int  no_w_a = 10 
)

Constructor

Parameters
fractionthe fraction of data points that have to be within the interval.
weightExponentThe exponent by which the weights are taken into account. Default is "w^-1", w being the track distance + cutoff (see below).
cutoffweight = ( cutoff + 10000 * distance ) * weightExponent
no_weights_aboveignore weights as long as the number of data points is > x

Half sample mode in 3d, as a functional class.

Definition at line 10 of file FsmwModeFinder3d.cc.

References cms::cuda::assert(), and theFraction.

Referenced by clone().

Member Function Documentation

◆ clone()

FsmwModeFinder3d * FsmwModeFinder3d::clone ( void  ) const
overridevirtual

Implements ModeFinder3d.

Definition at line 50 of file FsmwModeFinder3d.cc.

References FsmwModeFinder3d().

50 { return new FsmwModeFinder3d(*this); }
FsmwModeFinder3d(float fraction=.5, float weightExponent=-2., float cutoff=10, int no_weights_above=10)

◆ operator()()

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

Implements ModeFinder3d.

Definition at line 15 of file FsmwModeFinder3d.cc.

References cms::cuda::assert(), mps_fire::i, funct::pow(), runTheMatrix::ret, theCutoff, theFraction, theNoWeightsAbove, theWeightExponent, contentValuesCheck::values, and mps_merge::weight.

15  {
16  typedef Cluster1D<void> SimpleCluster;
17  std::vector<SimpleCluster> vx, vy, vz;
18  vx.reserve(values.size() - 1);
19  vy.reserve(values.size() - 1);
20  vz.reserve(values.size() - 1);
21  std::vector<const void*> emptyvec;
22 
23  for (std::vector<PointAndDistance>::const_iterator i = values.begin(); i != values.end(); ++i) {
24  float weight = 1.;
25  if (static_cast<int>(values.size()) < theNoWeightsAbove) {
26  // compute weights if we have fewer than theNoWeightsAbove
27  // data points
28  weight = pow(theCutoff + 10000 * i->second, theWeightExponent);
29  };
30 
31  SimpleCluster tmp_x(Measurement1D(i->first.x(), 1.0), emptyvec, weight);
32  SimpleCluster tmp_y(Measurement1D(i->first.y(), 1.0), emptyvec, weight);
33  SimpleCluster tmp_z(Measurement1D(i->first.z(), 1.0), emptyvec, weight);
34  vx.push_back(tmp_x);
35  vy.push_back(tmp_y);
36  vz.push_back(tmp_z);
37  };
38 
40  std::vector<SimpleCluster> cresx = algo(vx).first;
41  std::vector<SimpleCluster> cresy = algo(vy).first;
42  std::vector<SimpleCluster> cresz = algo(vz).first;
43  assert(!cresx.empty() && !cresy.empty() && !cresz.empty());
44 
46  cresx.begin()->position().value(), cresy.begin()->position().value(), cresz.begin()->position().value());
47  return ret;
48 }
ret
prodAgent to be discontinued
Definition: weight.py:1
assert(be >=bs)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

Member Data Documentation

◆ theCutoff

float FsmwModeFinder3d::theCutoff
private

Definition at line 36 of file FsmwModeFinder3d.h.

Referenced by operator()().

◆ theFraction

float FsmwModeFinder3d::theFraction
private

Definition at line 34 of file FsmwModeFinder3d.h.

Referenced by FsmwModeFinder3d(), and operator()().

◆ theNoWeightsAbove

int FsmwModeFinder3d::theNoWeightsAbove
private

Definition at line 37 of file FsmwModeFinder3d.h.

Referenced by operator()().

◆ theWeightExponent

float FsmwModeFinder3d::theWeightExponent
private

Definition at line 35 of file FsmwModeFinder3d.h.

Referenced by operator()().