Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:30

0001 #include "TrackingTools/GsfTools/interface/MultiGaussianState1D.h"
0002 #include "TrackingTools/GsfTools/interface/MultiGaussianStateCombiner1D.h"
0003 // #include "TrackingTools/GsfTools/interface/MultiGaussianState.h"
0004 
0005 double MultiGaussianState1D::weight() const {
0006   if (theCombinedStateUp2Date)
0007     return theCombinedState.weight();
0008 
0009   double result(0.);
0010   for (SingleState1dContainer::const_iterator ic = theComponents.begin(); ic != theComponents.end(); ic++)
0011     result += (*ic).weight();
0012   return result;
0013 }
0014 
0015 double MultiGaussianState1D::mean() const {
0016   checkCombinedState();
0017   return theCombinedState.mean();
0018 }
0019 
0020 double MultiGaussianState1D::variance() const {
0021   checkCombinedState();
0022   return theCombinedState.variance();
0023 }
0024 
0025 void MultiGaussianState1D::checkCombinedState() const {
0026   if (theCombinedStateUp2Date)
0027     return;
0028 
0029   MultiGaussianStateCombiner1D combiner;
0030   theCombinedState = combiner.combine(theComponents);
0031 
0032   //   typedef SingleGaussianState<1> SingleState;
0033   //   typedef std::shared_ptr< SingleGaussianState<1> > SingleStatePtr;
0034   //   typedef std::vector< SingleStatePtr > SingleStateContainer;
0035 
0036   //   SingleStateContainer components;
0037   //   for ( SingleState1dContainer::const_iterator ic=theComponents.begin();
0038   //    ic!=theComponents.end(); ic++ ) {
0039   //     SingleStatePtr ssp(new SingleState(SingleState::Vector((*ic).mean()),
0040   //                       SingleState::Matrix((*ic).variance()),
0041   //                       (*ic).weight()));
0042   //     components.push_back(ssp);
0043   //   }
0044   //   MultiGaussianState<1> multiState(components);
0045 
0046   //   theCombinedState = SingleGaussianState1D(multiState.mean()(0),
0047   //                       multiState.covariance()(0,0),
0048   //                       multiState.weight());
0049 
0050   theCombinedStateUp2Date = true;
0051 }