CMS 3D CMS Logo

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.

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

00009 {
00010   const int sze = values.size();
00011   if ( sze == 0 ) {
00012       throw VertexException("hsm_3d: no values given.");
00013   };
00014   std::vector <float> x_vals, y_vals, z_vals;
00015   x_vals.reserve(sze-1);
00016   y_vals.reserve(sze-1);
00017   z_vals.reserve(sze-1);
00018   for ( std::vector<GlobalPoint>::const_iterator i=values.begin();
00019       i!=values.end() ; i++ )
00020   {
00021     x_vals.push_back( i->x() );
00022     y_vals.push_back( i->y() );
00023     z_vals.push_back( i->z() );
00024   };
00025 
00026   // FIXME isnt necessary, is it?
00027   /*
00028   sort ( x_vals.begin(), x_vals.end() );
00029   sort ( y_vals.begin(), y_vals.end() );
00030   sort ( z_vals.begin(), z_vals.end() );*/
00031 
00032   GlobalPoint ret ( hsm_1d(x_vals), hsm_1d(y_vals), hsm_1d(z_vals) );
00033   return ret;
00034 }


Generated on Tue Jun 9 17:55:41 2009 for CMSSW by  doxygen 1.5.4