CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/TrackingTools/MaterialEffects/interface/MaterialEffectsUpdator.h

Go to the documentation of this file.
00001 #ifndef _CR_MATERIALEFFECTSUPDATOR_H_
00002 #define _CR_MATERIALEFFECTSUPDATOR_H_
00003 
00014 #include "DataFormats/GeometrySurface/interface/Surface.h"
00015 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00016 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
00017 
00018 #include "FWCore/Utilities/interface/GCC11Compatibility.h"
00019 
00020 namespace materialEffect {
00021   enum CovIndex { elos=0, msxx=1, msxy=2, msyy=3};
00022   class Covariance {
00023   public:
00024     float operator[](CovIndex i) const { return data[i];}
00025     float & operator[](CovIndex i) { return data[i];}
00026     void add(AlgebraicSymMatrix55 & cov) const {
00027       cov(0,0) += data[elos];
00028       cov(1,1) += data[msxx];
00029       cov(1,2) += data[msxy];
00030       cov(2,2) += data[msyy];
00031 
00032     }
00033     Covariance & operator+=(Covariance const & cov) {
00034       for(int i=0;i!=4;++i) data[i]+=cov.data[i];
00035       return *this;
00036     }
00037   private:
00038     float data[4]={0};
00039   };
00040 
00041   struct Effect {
00042     float weight=1.f;
00043     // Change in |p| from material effects.
00044     float deltaP=0;
00045     // Contribution to covariance matrix (in local co-ordinates) from material effects.
00046     Covariance deltaCov;
00047     void combine(Effect const & e1,Effect const & e2) {
00048       weight *= e1.weight*e2.weight;
00049       deltaP+=e1.deltaP+e2.deltaP;
00050       deltaCov+=e1.deltaCov; deltaCov+=e2.deltaCov;
00051     } 
00052   };
00053 
00054 }
00055 
00056 class MaterialEffectsUpdator {  
00057 public:
00058   typedef materialEffect::Covariance Covariance;
00059   typedef materialEffect::Effect Effect;
00060   typedef  materialEffect::CovIndex CovIndex;
00061 
00064   MaterialEffectsUpdator ( double mass );
00065   virtual ~MaterialEffectsUpdator ();
00066 
00070   virtual TrajectoryStateOnSurface updateState (const TrajectoryStateOnSurface& TSoS, 
00071                                                 const PropagationDirection propDir) const;
00072 
00079   virtual bool updateStateInPlace (TrajectoryStateOnSurface& TSoS, 
00080                                    const PropagationDirection propDir) const;
00081 
00082 
00083 
00086   inline double mass () const {
00087     return theMass;
00088   }
00089 
00090   virtual MaterialEffectsUpdator* clone()  const = 0;
00091 
00092   // here comes the actual computation of the values
00093   virtual void compute (const TrajectoryStateOnSurface&, const PropagationDirection, Effect & effect) const = 0;
00094  
00095  private:
00096   double theMass;
00097 
00098 };
00099 
00100 #endif