Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:57

0001 /** \class SteppingHelixStateInfo
0002  *  Implementation part of the stepping helix propagator state data structure
0003  *
0004  *  \author Vyacheslav Krutelyov (slava77)
0005  */
0006 
0007 //
0008 // Original Author:  Vyacheslav Krutelyov
0009 //         Created:  Wed Jan  3 16:01:24 CST 2007
0010 //
0011 //
0012 
0013 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0014 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0015 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0016 
0017 #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixStateInfo.h"
0018 #include "TrackingTools/AnalyticalJacobians/interface/JacobianCartesianToCurvilinear.h"
0019 
0020 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0021 
0022 #include "DataFormats/GeometrySurface/interface/TangentPlane.h"
0023 
0024 const std::string SteppingHelixStateInfo::ResultName[MAX_RESULT] = {
0025     "RESULT_OK", "RESULT_FAULT", "RESULT_RANGEOUT", "RESULT_INACC", "RESULT_NOT_IMPLEMENTED", "RESULT_UNDEFINED"};
0026 
0027 SteppingHelixStateInfo::SteppingHelixStateInfo(const FreeTrajectoryState& fts)
0028     : path_(0),
0029       radPath_(0),
0030       dir(0),
0031       magVol(nullptr),
0032       isYokeVol(false),
0033       field(nullptr),
0034       dEdx(0),
0035       dEdXPrime(0),
0036       radX0(1e12),
0037       status_(UNDEFINED) {
0038   p3.set(fts.momentum().x(), fts.momentum().y(), fts.momentum().z());
0039   r3.set(fts.position().x(), fts.position().y(), fts.position().z());
0040   q = fts.charge();
0041 
0042   if (fts.hasError()) {
0043     covCurv = fts.curvilinearError().matrix();
0044     hasErrorPropagated_ = true;
0045   } else {
0046     covCurv = AlgebraicSymMatrix55();
0047     hasErrorPropagated_ = false;
0048   }
0049   static const std::string metname = "SteppingHelixPropagator";
0050   if (fts.hasError()) {
0051     LogTrace(metname) << "Created SHPStateInfo from FTS\n" << fts;
0052     //    LogTrace(metname)<<"and cartesian error of\n"<<fts.cartesianError().matrix();
0053   } else
0054     LogTrace(metname) << "Created SHPStateInfo from FTS without errors";
0055 
0056   isComplete = false;
0057   isValid_ = true;
0058 }
0059 
0060 TrajectoryStateOnSurface SteppingHelixStateInfo::getStateOnSurface(const Surface& surf, bool returnTangentPlane) const {
0061   static const std::string metname = "SteppingHelixPropagator";
0062   if (!isValid())
0063     LogTrace(metname) << "Return TSOS is invalid";
0064   else
0065     LogTrace(metname) << "Return TSOS is valid";
0066   if (!isValid())
0067     return TrajectoryStateOnSurface();
0068   GlobalVector p3GV(p3.x(), p3.y(), p3.z());
0069   GlobalPoint r3GP(r3.x(), r3.y(), r3.z());
0070   GlobalTrajectoryParameters tPars(r3GP, p3GV, q, field);
0071   //  CartesianTrajectoryError tCov(cov);
0072 
0073   //  CurvilinearTrajectoryError tCCov(ROOT::Math::Similarity(JacobianCartesianToCurvilinear(tPars).jacobian(), cov));
0074   CurvilinearTrajectoryError tCCov(covCurv);
0075 
0076   FreeTrajectoryState fts(tPars, tCCov);
0077   if (!hasErrorPropagated_)
0078     fts = FreeTrajectoryState(tPars);
0079 
0080   SurfaceSideDefinition::SurfaceSide side = SurfaceSideDefinition::atCenterOfSurface;
0081   if (dir > 0)
0082     side = SurfaceSideDefinition::beforeSurface;
0083   if (dir < 0)
0084     side = SurfaceSideDefinition::afterSurface;
0085   return TrajectoryStateOnSurface(fts, returnTangentPlane ? *surf.tangentPlane(fts.position()) : surf, side);
0086 }
0087 
0088 void SteppingHelixStateInfo::getFreeState(FreeTrajectoryState& fts) const {
0089   if (isValid()) {
0090     GlobalVector p3GV(p3.x(), p3.y(), p3.z());
0091     GlobalPoint r3GP(r3.x(), r3.y(), r3.z());
0092     GlobalTrajectoryParameters tPars(r3GP, p3GV, q, field);
0093     //    CartesianTrajectoryError tCov(cov);
0094     //    CurvilinearTrajectoryError tCCov(ROOT::Math::Similarity(JacobianCartesianToCurvilinear(tPars).jacobian(), cov));
0095     CurvilinearTrajectoryError tCCov(covCurv);
0096 
0097     fts = (hasErrorPropagated_) ? FreeTrajectoryState(tPars, tCCov) : FreeTrajectoryState(tPars);
0098     //      ? FreeTrajectoryState(tPars, tCov, tCCov) : FreeTrajectoryState(tPars);
0099     //    if (fts.hasError()) fts.curvilinearError(); //call it so it gets created
0100   }
0101 }