CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/RecoVertex/VertexTools/interface/hsm_3d.h File Reference

#include <vector>
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"

Go to the source code of this file.

Functions

GlobalPoint hsm_3d (const std::vector< GlobalPoint > &values)
 cordinate wise half sample mode in 3d

Function Documentation

GlobalPoint hsm_3d ( const std::vector< GlobalPoint > &  values)

cordinate wise half sample mode in 3d

Definition at line 8 of file hsm_3d.cc.

References i, and run_regression::ret.

Referenced by HsmModeFinder3d::operator()(), and SubsetHsmModeFinder3d::operator()().

{
  const int sze = values.size();
  if ( sze == 0 ) {
      throw VertexException("hsm_3d: no values given.");
  };
  std::vector <float> x_vals, y_vals, z_vals;
  x_vals.reserve(sze-1);
  y_vals.reserve(sze-1);
  z_vals.reserve(sze-1);
  for ( std::vector<GlobalPoint>::const_iterator i=values.begin();
      i!=values.end() ; i++ )
  {
    x_vals.push_back( i->x() );
    y_vals.push_back( i->y() );
    z_vals.push_back( i->z() );
  };

  // FIXME isnt necessary, is it?
  /*
  sort ( x_vals.begin(), x_vals.end() );
  sort ( y_vals.begin(), y_vals.end() );
  sort ( z_vals.begin(), z_vals.end() );*/

  GlobalPoint ret ( hsm_1d(x_vals), hsm_1d(y_vals), hsm_1d(z_vals) );
  return ret;
}