CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/RecoVertex/VertexTools/src/lms_3d.cc

Go to the documentation of this file.
00001 #include "CommonTools/Statistics/interface/lms_1d.icc"
00002 #include "RecoVertex/VertexTools/interface/lms_3d.h"
00003 #include "RecoVertex/VertexPrimitives/interface/VertexException.h"
00004 #include <vector>
00005 
00008 GlobalPoint lms_3d ( std::vector<GlobalPoint> values )
00009 {
00010   const int sze = values.size();
00011   if ( sze == 0 ) {
00012       throw VertexException("lms_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>::iterator i=values.begin();
00019       i!=values.end() ; i++ ) {
00020     x_vals.push_back( i->x() );
00021     y_vals.push_back( i->y() );
00022     z_vals.push_back( i->z() );
00023   };
00024   return GlobalPoint ( lms_1d(x_vals), lms_1d(y_vals), lms_1d(z_vals) );
00025 }