CMS 3D CMS Logo

Public Member Functions | Private Attributes

FsmwModeFinder3d Class Reference

#include <FsmwModeFinder3d.h>

Inheritance diagram for FsmwModeFinder3d:
ModeFinder3d unary_function

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)
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  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 theFraction.

Referenced by clone().

                                                               : theFraction ( fraction ),
        theWeightExponent ( weightExp ), theCutoff(cutoff),
        theNoWeightsAbove ( no_w_a )
{
    assert ( theFraction > 0. && theFraction < 1. );
}

Member Function Documentation

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

Implements ModeFinder3d.

Definition at line 62 of file FsmwModeFinder3d.cc.

References FsmwModeFinder3d().

{
    return new FsmwModeFinder3d( *this );
}
GlobalPoint FsmwModeFinder3d::operator() ( const std::vector< PointAndDistance > &  values) const [virtual]

Implements ModeFinder3d.

Definition at line 18 of file FsmwModeFinder3d.cc.

References algo, i, funct::pow(), run_regression::ret, theCutoff, theFraction, theNoWeightsAbove, theWeightExponent, create_public_lumi_plots::tmp_x, create_public_lumi_plots::tmp_y, and CommonMethods::weight().

{
    typedef Cluster1D<void> SimpleCluster;
    std::vector< SimpleCluster > vx, vy, vz;
    vx.reserve ( values.size() - 1 );
    vy.reserve ( values.size() - 1 );
    vz.reserve ( values.size() - 1 );
    std::vector < const void * > emptyvec;

    for ( std::vector< PointAndDistance >::const_iterator i = values.begin();
          i != values.end(); ++i )
    {
        float weight = 1.;
        if ( static_cast<int>( values.size() ) < theNoWeightsAbove )
        {
            // compute weights if we have fewer than theNoWeightsAbove
            // data points
            weight = pow ( theCutoff + 10000 * i->second, theWeightExponent );
        };

        SimpleCluster tmp_x ( Measurement1D ( i->first.x(), 1.0 ),
                              emptyvec, weight );
        SimpleCluster tmp_y ( Measurement1D ( i->first.y(), 1.0 ),
                              emptyvec, weight );
        SimpleCluster tmp_z ( Measurement1D ( i->first.z(), 1.0 ),
                              emptyvec, weight );
        vx.push_back ( tmp_x );
        vy.push_back ( tmp_y );
        vz.push_back ( tmp_z );
    };

    FsmwClusterizer1D<void> algo( theFraction );
    std::vector < SimpleCluster > cresx = algo(vx).first;
    std::vector < SimpleCluster > cresy = algo(vy).first;
    std::vector < SimpleCluster > cresz = algo(vz).first;
    assert ( cresx.size() && cresy.size() && cresz.size() );

    GlobalPoint ret ( cresx.begin()->position().value(),
                      cresy.begin()->position().value(),
                      cresz.begin()->position().value() );
    return ret;
}

Member Data Documentation

float FsmwModeFinder3d::theCutoff [private]

Definition at line 34 of file FsmwModeFinder3d.h.

Referenced by operator()().

Definition at line 32 of file FsmwModeFinder3d.h.

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

Definition at line 35 of file FsmwModeFinder3d.h.

Referenced by operator()().

Definition at line 33 of file FsmwModeFinder3d.h.

Referenced by operator()().