swh:1:snp:af87cd67498ef4fe47c76ed3e7caffe5b61facaf
Raw File
Tip revision: c7fe8e8b70fbf25abf01c02dd097916412e1045e authored by Rene Brun on 02 October 2008, 11:10:17 UTC
tag dev version
Tip revision: c7fe8e8
SeedDistance.cxx
// @(#)root/tmva $Id$ 
// Author: Andreas Hoecker, Peter Speckmayer

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Class  : SeedDistance                                                         *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *      Implementation                                                            *
 *                                                                                *
 * Authors (alphabetical):                                                        *
 *      Peter Speckmayer <speckmay@mail.cern.ch> - CERN, Switzerland              *
 *                                                                                *
 * Copyright (c) 2005:                                                            *
 *      CERN, Switzerland                                                         * 
 *      MPI-K Heidelberg, Germany                                                 * 
 *                                                                                *
 * Redistribution and use in source and binary forms, with or without             *
 * modification, are permitted according to the terms listed in LICENSE           *
 * (http://tmva.sourceforge.net/LICENSE)                                          *
 **********************************************************************************/

//_______________________________________________________________________
//                                                                      
// Class to keep a list of seeds together with a metric. The distance
// of any given point to all seeds can be calculated.
//
//_______________________________________________________________________

#include "TMVA/SeedDistance.h"

ClassImp(TMVA::SeedDistance)

//_______________________________________________________________________
TMVA::SeedDistance::SeedDistance( IMetric& metric, std::vector< std::vector<Double_t> >& seeds ) 
   : fSeeds( seeds ),
     fMetric( metric )
{
   // constructor
}            



//_______________________________________________________________________
std::vector<Double_t>& TMVA::SeedDistance::GetDistances( std::vector<Double_t>& point )
{
   // calculates distances of all seeds to a point and stores the result in a distance vector
   fDistances.clear();
   Double_t val = 0.0;
   for( std::vector< std::vector<Double_t> >::iterator itSeed = fSeeds.begin(); itSeed != fSeeds.end(); itSeed++ ){
      val = fMetric.Distance( (*itSeed), point );
      fDistances.push_back( val );
   }
   return fDistances;
}


back to top