CMS 3D CMS Logo

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

#include <FsmwModeFinder3d.h>

Inheritance diagram for FsmwModeFinder3d:
ModeFinder3d

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
 
- 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 ( 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 assert(), and theFraction.

Referenced by clone().

11  : theFraction ( fraction ),
12  theWeightExponent ( weightExp ), theCutoff(cutoff),
13  theNoWeightsAbove ( no_w_a )
14 {
15  assert ( theFraction > 0. && theFraction < 1. );
16 }
assert(m_qm.get())

Member Function Documentation

FsmwModeFinder3d * FsmwModeFinder3d::clone ( void  ) const
virtual

Implements ModeFinder3d.

Definition at line 62 of file FsmwModeFinder3d.cc.

References FsmwModeFinder3d().

63 {
64  return new FsmwModeFinder3d( *this );
65 }
FsmwModeFinder3d(float fraction=.5, float weightExponent=-2., float cutoff=10, int no_weights_above=10)
GlobalPoint FsmwModeFinder3d::operator() ( const std::vector< PointAndDistance > &  values) const
virtual

Implements ModeFinder3d.

Definition at line 18 of file FsmwModeFinder3d.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, assert(), i, funct::pow(), runTheMatrix::ret, theCutoff, theFraction, theNoWeightsAbove, theWeightExponent, create_public_lumi_plots::tmp_x, create_public_lumi_plots::tmp_y, and puppiForMET_cff::weight.

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

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