CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/TrackingTools/GsfTracking/interface/GsfBetheHeitlerUpdator.h

Go to the documentation of this file.
00001 #ifndef GsfBetheHeitlerUpdator_h_
00002 #define GsfBetheHeitlerUpdator_h_
00003 
00004 #include "TrackingTools/GsfTracking/interface/GsfMaterialEffectsUpdator.h"
00005 #include "TrackingTools/GsfTracking/interface/Triplet.h"
00006 
00007 #include <vector>
00008 #include <iosfwd>
00009 #include <string>
00010 
00019 class GsfBetheHeitlerUpdator : public GsfMaterialEffectsUpdator {
00020 
00021 private:
00024   class Polynomial {
00025   public:
00027     Polynomial () {}
00031     Polynomial (const std::vector<double>& coefficients) :
00032       theCoeffs(coefficients) {}
00034     double operator() (const double& x) const {
00035       double sum(0.);
00036       for ( std::vector<double>::const_iterator i=theCoeffs.begin();
00037             i!=theCoeffs.end(); i++ )  sum = x*sum + *i;
00038       return sum;
00039     }
00040   private:
00041     std::vector<double> theCoeffs;
00042   };
00043 
00044 public:
00045   enum CorrectionFlag { NoCorrection=0, MeanCorrection=1, FullCorrection=2 };
00046 
00047 public:
00048   virtual GsfBetheHeitlerUpdator* clone() const
00049   {
00050     return new GsfBetheHeitlerUpdator(*this);
00051   }
00052   
00053 public:
00055   GsfBetheHeitlerUpdator (const std::string fileName, const int correctionFlag);
00056 //   GsfBetheHeitlerUpdator (const std::string fileName, const CorrectionFlag correctionFlag);
00057 
00058 private:
00059   typedef std::vector< Triplet<double,double,double> > GSContainer;
00060 
00061 private:
00063   virtual void compute (const TrajectoryStateOnSurface&, const PropagationDirection) const;
00065   void readParameters (const std::string);
00067   Polynomial readPolynomial (std::ifstream&,const int);
00069   inline double logisticFunction (const double x) const {return 1./(1.+exp(-x));}
00071   inline double BetheHeitlerMean (const double rl) const
00072   {
00073     return exp(-rl);
00074   }
00076   inline double BetheHeitlerVariance (const double rl) const
00077   {
00078     return exp(-rl*log(3.)/log(2.)) - exp(-2*rl);
00079   }
00081   void getMixtureParameters (const double, GSContainer&) const;
00083   void correctWeights (GSContainer&) const;
00085   double correctedFirstMean (const double, const GSContainer&) const;
00087   double correctedFirstVar (const double,const GSContainer&) const;
00088   
00089 protected:
00091   virtual bool newArguments (const TrajectoryStateOnSurface&, const PropagationDirection) const;
00093   virtual void storeArguments (const TrajectoryStateOnSurface&, const PropagationDirection) const;
00094 
00095 private:
00096   int theNrComponents;                  
00097   int theTransformationCode;            
00098   std::vector<Polynomial> thePolyWeights;    
00099   std::vector<Polynomial> thePolyMeans;      
00100   std::vector<Polynomial> thePolyVars;       
00101 
00102   int theCorrectionFlag;                
00103 
00104   mutable float theLastDz;
00105   mutable float theLastP;
00106   mutable PropagationDirection theLastPropDir;
00107   mutable float theLastRadLength;
00108 };
00109 
00110 #endif