00001 #ifndef CloseComponentsMerger_H 00002 #define CloseComponentsMerger_H 00003 00004 #include "TrackingTools/GsfTools/interface/MultiGaussianStateMerger.h" 00005 #include "TrackingTools/GsfTools/interface/DistanceBetweenComponents.h" 00006 #include "DataFormats/GeometryCommonDetAlgo/interface/DeepCopyPointerByClone.h" 00007 00008 #include "boost/shared_ptr.hpp" 00009 #include <map> 00010 00011 00018 template <unsigned int N> 00019 class CloseComponentsMerger : public MultiGaussianStateMerger<N> { 00020 00021 private: 00022 typedef SingleGaussianState<N> SingleState; 00023 typedef MultiGaussianState<N> MultiState; 00024 typedef boost::shared_ptr<SingleState> SingleStatePtr; 00025 00026 public: 00027 00028 CloseComponentsMerger(int n, 00029 const DistanceBetweenComponents<N>* distance); 00030 00031 virtual CloseComponentsMerger* clone() const 00032 { 00033 return new CloseComponentsMerger(*this); 00034 } 00035 00039 virtual MultiState merge(const MultiState& mgs) const; 00040 00041 00042 public: 00043 typedef std::multimap< double, SingleStatePtr > SingleStateMap; 00044 typedef std::pair< SingleStatePtr, typename SingleStateMap::iterator > MinDistResult; 00045 00046 private: 00047 00048 // std::pair< SingleState, SingleStateMap::iterator > 00049 MinDistResult 00050 compWithMinDistToLargestWeight(SingleStateMap&) const; 00051 00052 int theMaxNumberOfComponents; 00053 DeepCopyPointerByClone< DistanceBetweenComponents<N> > theDistance; 00054 00055 }; 00056 00057 #include "TrackingTools/GsfTools/interface/CloseComponentsMerger.icc" 00058 00059 #endif // CloseComponentsMerger_H