CMS 3D CMS Logo

FsmwModeFinder3d Class Reference

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

#include <RecoVertex/VertexTools/interface/FsmwModeFinder3d.h>

Inheritance diagram for FsmwModeFinder3d:

ModeFinder3d

List of all members.

Public Member Functions

virtual FsmwModeFinder3dclone () const
 FsmwModeFinder3d (float fraction=.5, float weightExponent=-2., float cutoff=10, int no_weights_above=10)
 Constructor.
virtual GlobalPoint operator() (const std::vector< PointAndDistance > &) const

Private Attributes

float theCutoff
float theFraction
int theNoWeightsAbove
float theWeightExponent


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 ( float  fraction = .5,
float  weightExponent = -2.,
float  cutoff = 10,
int  no_weights_above = 10 
)

Constructor.

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

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

Definition at line 10 of file FsmwModeFinder3d.cc.

References theFraction.

Referenced by clone().

00011                                                                : theFraction ( fraction ),
00012         theWeightExponent ( weightExp ), theCutoff(cutoff),
00013         theNoWeightsAbove ( no_w_a )
00014 {
00015     assert ( theFraction > 0. && theFraction < 1. );
00016 }


Member Function Documentation

FsmwModeFinder3d * FsmwModeFinder3d::clone ( void   )  const [virtual]

Implements ModeFinder3d.

Definition at line 62 of file FsmwModeFinder3d.cc.

References FsmwModeFinder3d().

00063 {
00064     return new FsmwModeFinder3d( *this );
00065 }

GlobalPoint FsmwModeFinder3d::operator() ( const std::vector< PointAndDistance > &  values  )  const [virtual]

Definition at line 18 of file FsmwModeFinder3d.cc.

References i, funct::pow(), theCutoff, theFraction, theNoWeightsAbove, theWeightExponent, and weight.

00020 {
00021     typedef Cluster1D<void> SimpleCluster;
00022     std::vector< SimpleCluster > vx, vy, vz;
00023     vx.reserve ( values.size() - 1 );
00024     vy.reserve ( values.size() - 1 );
00025     vz.reserve ( values.size() - 1 );
00026     std::vector < const void * > emptyvec;
00027 
00028     for ( std::vector< PointAndDistance >::const_iterator i = values.begin();
00029           i != values.end(); ++i )
00030     {
00031         float weight = 1.;
00032         if ( static_cast<int>( values.size() ) < theNoWeightsAbove )
00033         {
00034             // compute weights if we have fewer than theNoWeightsAbove
00035             // data points
00036             weight = pow ( theCutoff + 10000 * i->second, theWeightExponent );
00037         };
00038 
00039         SimpleCluster tmp_x ( Measurement1D ( i->first.x(), 1.0 ),
00040                               emptyvec, weight );
00041         SimpleCluster tmp_y ( Measurement1D ( i->first.y(), 1.0 ),
00042                               emptyvec, weight );
00043         SimpleCluster tmp_z ( Measurement1D ( i->first.z(), 1.0 ),
00044                               emptyvec, weight );
00045         vx.push_back ( tmp_x );
00046         vy.push_back ( tmp_y );
00047         vz.push_back ( tmp_z );
00048     };
00049 
00050     FsmwClusterizer1D<void> algo( theFraction );
00051     std::vector < SimpleCluster > cresx = algo(vx).first;
00052     std::vector < SimpleCluster > cresy = algo(vy).first;
00053     std::vector < SimpleCluster > cresz = algo(vz).first;
00054     assert ( cresx.size() && cresy.size() && cresz.size() );
00055 
00056     GlobalPoint ret ( cresx.begin()->position().value(),
00057                       cresy.begin()->position().value(),
00058                       cresz.begin()->position().value() );
00059     return ret;
00060 }


Member Data Documentation

float FsmwModeFinder3d::theCutoff [private]

Definition at line 34 of file FsmwModeFinder3d.h.

Referenced by operator()().

float FsmwModeFinder3d::theFraction [private]

Definition at line 32 of file FsmwModeFinder3d.h.

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

int FsmwModeFinder3d::theNoWeightsAbove [private]

Definition at line 35 of file FsmwModeFinder3d.h.

Referenced by operator()().

float FsmwModeFinder3d::theWeightExponent [private]

Definition at line 33 of file FsmwModeFinder3d.h.

Referenced by operator()().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:21:03 2009 for CMSSW by  doxygen 1.5.4