CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/TrackPropagation/SteppingHelixPropagator/src/SteppingHelixStateInfo.cc

Go to the documentation of this file.
00001 
00009 //
00010 // Original Author:  Vyacheslav Krutelyov
00011 //         Created:  Wed Jan  3 16:01:24 CST 2007
00012 // $Id: SteppingHelixStateInfo.cc,v 1.13 2009/09/08 20:44:32 slava77 Exp $
00013 //
00014 //
00015 
00016 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00017 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00018 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00019 
00020 #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixStateInfo.h"
00021 #include "TrackingTools/AnalyticalJacobians/interface/JacobianCartesianToCurvilinear.h"
00022 
00023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00024 
00025 #include "DataFormats/GeometrySurface/interface/TangentPlane.h"
00026 
00027 const std::string SteppingHelixStateInfo::ResultName[MAX_RESULT] = {
00028   "RESULT_OK",
00029   "RESULT_FAULT",
00030   "RESULT_RANGEOUT",
00031   "RESULT_INACC",
00032   "RESULT_NOT_IMPLEMENTED",
00033   "RESULT_UNDEFINED"
00034 };
00035 
00036 SteppingHelixStateInfo::SteppingHelixStateInfo(const FreeTrajectoryState& fts): 
00037   path_(0), radPath_(0), dir(0), magVol(0), field(0), dEdx(0), dEdXPrime(0), radX0(1e12),
00038   status_(UNDEFINED)
00039 {
00040   p3.set(fts.momentum().x(), fts.momentum().y(), fts.momentum().z());
00041   r3.set(fts.position().x(), fts.position().y(), fts.position().z());
00042   q = fts.charge();
00043 
00044   if (fts.hasError()){
00045     covCurv = fts.curvilinearError().matrix();
00046     hasErrorPropagated_ = true;
00047   } else {
00048     covCurv = AlgebraicSymMatrix55();
00049     hasErrorPropagated_ = false;
00050   }
00051   static const std::string metname = "SteppingHelixPropagator";
00052   if (fts.hasError()){ 
00053     LogTrace(metname)<<"Created SHPStateInfo from FTS\n"<<fts;
00054     //    LogTrace(metname)<<"and cartesian error of\n"<<fts.cartesianError().matrix();
00055   }
00056   else LogTrace(metname)<<"Created SHPStateInfo from FTS without errors";
00057 
00058   isComplete = false;
00059   isValid_ = true;
00060 }
00061 
00062 TrajectoryStateOnSurface SteppingHelixStateInfo::getStateOnSurface(const Surface& surf, bool returnTangentPlane) const {
00063   static const std::string metname = "SteppingHelixPropagator";
00064   if (! isValid()) LogTrace(metname)<<"Return TSOS is invalid";
00065   else LogTrace(metname)<<"Return TSOS is valid";
00066   if (! isValid()) return TrajectoryStateOnSurface();
00067   GlobalVector p3GV(p3.x(), p3.y(), p3.z());
00068   GlobalPoint r3GP(r3.x(), r3.y(), r3.z());
00069   GlobalTrajectoryParameters tPars(r3GP, p3GV, q, field);
00070   //  CartesianTrajectoryError tCov(cov);
00071 
00072   //  CurvilinearTrajectoryError tCCov(ROOT::Math::Similarity(JacobianCartesianToCurvilinear(tPars).jacobian(), cov));
00073   CurvilinearTrajectoryError tCCov(covCurv);
00074 
00075   FreeTrajectoryState fts(tPars, tCCov);
00076   if (! hasErrorPropagated_) fts = FreeTrajectoryState(tPars);
00077 
00078 
00079   SurfaceSideDefinition::SurfaceSide side = SurfaceSideDefinition::atCenterOfSurface;
00080   if ( dir > 0 ) side =  SurfaceSideDefinition::beforeSurface;
00081   if ( dir < 0 ) side =  SurfaceSideDefinition::afterSurface;
00082   return TrajectoryStateOnSurface(fts, returnTangentPlane ? *surf.tangentPlane(fts.position()) : surf, side);
00083 }
00084 
00085 
00086 void SteppingHelixStateInfo::getFreeState(FreeTrajectoryState& fts) const {
00087   if (isValid()){
00088     GlobalVector p3GV(p3.x(), p3.y(), p3.z());
00089     GlobalPoint r3GP(r3.x(), r3.y(), r3.z());
00090     GlobalTrajectoryParameters tPars(r3GP, p3GV, q, field);
00091     //    CartesianTrajectoryError tCov(cov);
00092     //    CurvilinearTrajectoryError tCCov(ROOT::Math::Similarity(JacobianCartesianToCurvilinear(tPars).jacobian(), cov));
00093     CurvilinearTrajectoryError tCCov(covCurv);
00094     
00095     fts = (hasErrorPropagated_ ) 
00096       ? FreeTrajectoryState(tPars, tCCov) : FreeTrajectoryState(tPars);
00097     //      ? FreeTrajectoryState(tPars, tCov, tCCov) : FreeTrajectoryState(tPars);
00098     //    if (fts.hasError()) fts.curvilinearError(); //call it so it gets created
00099   }
00100 }