CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/TrackingTools/MaterialEffects/src/VolumeMaterialEffectsUpdator.cc

Go to the documentation of this file.
00001 #include "TrackingTools/MaterialEffects/interface/VolumeMaterialEffectsUpdator.h"
00002 
00003 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00004 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
00005 #include "TrackingTools/MaterialEffects/interface/VolumeMaterialEffectsEstimate.h"
00006 
00007 #include "DataFormats/GeometryCommonDetAlgo/interface/PerpendicularBoundPlaneBuilder.h"
00008 #include "TrackingTools/AnalyticalJacobians/interface/JacobianCurvilinearToLocal.h"
00009 #include "TrackingTools/AnalyticalJacobians/interface/JacobianLocalToCurvilinear.h"
00010 
00011 TrajectoryStateOnSurface
00012 VolumeMaterialEffectsUpdator::updateState (const TrajectoryStateOnSurface& tsos, 
00013                                            const PropagationDirection propDir,
00014                                            const Estimate& estimate) const
00015 {
00016   return updateState(tsos,propDir,EstimateContainer(1,&estimate));
00017 }
00018 
00019 TrajectoryStateOnSurface
00020 VolumeMaterialEffectsUpdator::updateState (const TrajectoryStateOnSurface& tsos, 
00021                                            const PropagationDirection propDir,
00022                                            const EstimateContainer& estimates) const
00023 {
00024   // Sanity check on propagation direction
00025   if ( propDir==anyDirection )  return TrajectoryStateOnSurface();
00026   //
00027   // Update momentum. In case of failure: return invalid state
00028   //
00029   double dpSum(0.);
00030   for ( EstimateContainer::const_iterator i=estimates.begin();
00031         i!=estimates.end(); ++i ) {
00032     double dp = (**i).deltaP();
00033     if ( propDir==alongMomentum )  dpSum += dp;
00034     else  dpSum -= dp;
00035   }
00036   LocalTrajectoryParameters lp = tsos.localParameters();
00037   if ( !lp.updateP(dpSum) )  return TrajectoryStateOnSurface();
00038   //
00039   // Update covariance matrix?
00040   //
00041   if ( tsos.hasError() ) {
00042 //     AlgebraicSymMatrix55 eloc(tsos.localError().matrix());
00043     AlgebraicSymMatrix55 matCov;
00044     for ( EstimateContainer::const_iterator i=estimates.begin();
00045           i!=estimates.end(); ++i ) {
00046       matCov += (**i).deltaLocalError();
00047     }
00048     //
00049     // transform to local system of trackfor the time being: brute force
00050     // could / should try to construct the matrix in curvilinear
00051     //
00052     // Plane consistent with material effects estimate (perp. to track at ref. pos.)
00053     ReferenceCountingPointer<BoundPlane> 
00054       perpPlane(PerpendicularBoundPlaneBuilder()(tsos.globalPosition(),
00055                                                  tsos.globalMomentum()));
00056     // Parameters need to construct Jacobian (ref. point and ref. direction)
00057     LocalTrajectoryParameters perpPars(LocalPoint(0.,0.,0.),
00058                                        LocalVector(0.,0.,1.),
00059                                        tsos.charge());
00060     // Jacobian to go from perpendicular plane to curvilinear
00061     JacobianLocalToCurvilinear jacLocToCurv(*perpPlane,perpPars,*tsos.magneticField());
00062     // Jacobian to go from curvilinear to local frame of the reference tsos
00063     JacobianCurvilinearToLocal jacCurvToLoc(tsos.surface(),tsos.localParameters(),
00064                                             *tsos.magneticField());
00065     // Combined Jacobian
00066     AlgebraicMatrix55 jac(jacLocToCurv.jacobian()*jacCurvToLoc.jacobian());
00067     // Add transformed material effects error matrix to the one from the TSOS
00068     AlgebraicSymMatrix55 eloc(tsos.localError().matrix());
00069     eloc += ROOT::Math::Similarity(jac,matCov);
00070     return TrajectoryStateOnSurface(lp,LocalTrajectoryError(eloc),tsos.surface(),
00071                                     &(tsos.globalParameters().magneticField()),
00072                                     tsos.surfaceSide());
00073   }
00074   else {
00075     return TrajectoryStateOnSurface(lp,tsos.surface(),
00076                                     &(tsos.globalParameters().magneticField()),
00077                                     tsos.surfaceSide());
00078   }
00079 }