/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
TrackingTools/GsfTools/interface/MultiGaussianState.icc
67 строк
2 KB
Andrea Bocci
Add missing newline at the end of file
27 фев 2024, 16:22
Не верифицирован
27 фев 2024, 16:22
1a154e5
Код
Авторство
О чём код?
#ifndef TrackingTools_GsfTools_MultiGaussianState_icc #define TrackingTools_GsfTools_MultiGaussianState_icc #include "TrackingTools/GsfTools/interface/MultiGaussianState.h" // template <unsigned int N> // MultiGaussianState<N>::MultiGaussianState // (const std::vector< std::shared_ptr<SingleState> >& stateV) : // theCombinedStateUp2Date(false) { // theComponents.reserve(stateV.size()); // for ( typename std::vector< std::shared_ptr<SingleState> >::const_iterator ic=stateV.begin(); // ic!=stateV.end(); ++ic ) theComponents.push_back( std::shared_ptr<const SingleState>(*ic) ); // } template <unsigned int N> double MultiGaussianState<N>::weight() const { if (theCombinedStateUp2Date) return theCombinedState->weight(); double result(0.); for (typename SingleStateContainer::const_iterator ic = theComponents.begin(); ic != theComponents.end(); ic++) result += (**ic).weight(); return result; } template <unsigned int N> const typename MultiGaussianState<N>::Vector& MultiGaussianState<N>::mean() const { checkCombinedState(); return theCombinedState->mean(); } template <unsigned int N> const typename MultiGaussianState<N>::Matrix& MultiGaussianState<N>::covariance() const { checkCombinedState(); return theCombinedState->covariance(); } template <unsigned int N> const typename MultiGaussianState<N>::Matrix& MultiGaussianState<N>::weightMatrix() const { checkCombinedState(); return theCombinedState->weightMatrix(); } template <unsigned int N> void MultiGaussianState<N>::checkCombinedState() const { if (theCombinedStateUp2Date) return; MultiGaussianStateCombiner<N> theCombiner; theCombinedState = theCombiner.combine(theComponents); theCombinedStateUp2Date = true; // ++constructsCombinedState_; } template <unsigned int N> void MultiGaussianState<N>::setWeight(double newWeight) { double wgt = weight(); if (wgt > DBL_MIN) rescaleWeight(newWeight / wgt); } template <unsigned int N> void MultiGaussianState<N>::rescaleWeight(double scale) { for (typename std::vector<SingleState>::const_iterator ic = theComponents.begin(); ic != theComponents.end(); ic++) (**ic).rescaleWeight(scale); if (theCombinedStateUp2Date) theCombinedState->rescaleWeight(scale); } #endif