Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef MultiGaussianStateAssembler_h_
0002 #define MultiGaussianStateAssembler_h_
0003 
0004 #include "TrackingTools/GsfTools/interface/SingleGaussianState.h"
0005 #include "TrackingTools/GsfTools/interface/MultiGaussianState.h"
0006 
0007 #include <vector>
0008 
0009 /** \class MultiGaussianStateAssembler
0010  * Collects gaussian states and returns a MultiGaussianState.
0011  */
0012 
0013 template <unsigned int N>
0014 class MultiGaussianStateAssembler {
0015 private:
0016   typedef SingleGaussianState<N> SingleState;
0017   typedef MultiGaussianState<N> MultiState;
0018   typedef typename MultiGaussianState<N>::SingleStatePtr SingleStatePtr;
0019   typedef typename MultiGaussianState<N>::SingleStateContainer SingleStateContainer;
0020 
0021 public:
0022   //
0023   // constructors
0024   //
0025   MultiGaussianStateAssembler() = default;
0026 
0027   /** Adds a new MultiGaussianState to the list 
0028    *  of components
0029    */
0030   void addState(const MultiState& state);
0031   void addState(const SingleStatePtr& state);
0032 
0033   /** Returns the resulting MultiGaussianState 
0034    *  with weight = sum of all valid components.
0035    */
0036   MultiState combinedState();
0037   /** Returns the resulting MultiGaussianState 
0038    *  renormalised to specified weight.
0039    */
0040   MultiState combinedState(const float weight);
0041 
0042 private:
0043   /** Adds a vector of gaussian states
0044    *  to the list of components
0045    */
0046   void addStateVector(const SingleStateContainer&);
0047 
0048   /**
0049    * Preparation of combined state (cleaning & sorting)
0050    */
0051   bool prepareCombinedState();
0052 
0053   /** Returns the resulting MultiGaussianState
0054    *  with user-supplied total weight.
0055    */
0056 
0057   MultiState reweightedCombinedState(const double) const;
0058 
0059   /** Removes states with negligible weight (no renormalisation
0060    * of total weight!).
0061    */
0062   void removeSmallWeights();
0063 
0064 private:
0065   double minFractionalWeight = 1.e-16;
0066 
0067   bool combinationDone = false;
0068 
0069   double theValidWeightSum = 0;
0070   SingleStateContainer theStates;
0071 };
0072 
0073 #include "TrackingTools/GsfTools/interface/MultiGaussianStateAssembler.icc"
0074 
0075 #endif