File indexing completed on 2024-04-06 11:57:20
0001 #ifndef Alignment_ReferenceTrajectories_ReferenceTrajectory_H
0002 #define Alignment_ReferenceTrajectories_ReferenceTrajectory_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #include "Alignment/ReferenceTrajectories/interface/ReferenceTrajectoryBase.h"
0039 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0040 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0041 #include "TrackingTools/TrajectoryState/interface/SurfaceSideDefinition.h"
0042
0043 #include "GblTrajectory.h"
0044
0045 class TrajectoryStateOnSurface;
0046 class MagneticField;
0047 class MaterialEffectsUpdator;
0048 class Plane;
0049 class BeamSpotTransientTrackingRecHit;
0050
0051 namespace reco {
0052 class BeamSpot;
0053 }
0054
0055 class ReferenceTrajectory : public ReferenceTrajectoryBase {
0056 public:
0057 typedef SurfaceSideDefinition::SurfaceSide SurfaceSide;
0058
0059
0060
0061
0062
0063
0064
0065
0066 ReferenceTrajectory(const TrajectoryStateOnSurface &referenceTsos,
0067 const TransientTrackingRecHit::ConstRecHitContainer &recHits,
0068 const MagneticField *magField,
0069 const reco::BeamSpot &beamSpot,
0070 const ReferenceTrajectoryBase::Config &config);
0071
0072 ~ReferenceTrajectory() override {}
0073
0074 ReferenceTrajectory *clone() const override { return new ReferenceTrajectory(*this); }
0075
0076 protected:
0077
0078 ReferenceTrajectory(unsigned int nPar, unsigned int nHits, const ReferenceTrajectoryBase::Config &config);
0079
0080
0081
0082 virtual bool construct(const TrajectoryStateOnSurface &referenceTsos,
0083 const TransientTrackingRecHit::ConstRecHitContainer &recHits,
0084 const MagneticField *magField,
0085 const reco::BeamSpot &beamSpot);
0086
0087
0088
0089 MaterialEffectsUpdator *createUpdator(MaterialEffects materialEffects, double mass) const;
0090
0091
0092
0093 virtual bool propagate(const Plane &previousSurface,
0094 const TrajectoryStateOnSurface &previousTsos,
0095 const Plane &newSurface,
0096 TrajectoryStateOnSurface &newTsos,
0097 AlgebraicMatrix &newJacobian,
0098 AlgebraicMatrix &newCurvlinJacobian,
0099 double &nextStep,
0100 const MagneticField *magField) const;
0101
0102
0103
0104 virtual void fillMeasurementAndError(const TransientTrackingRecHit::ConstRecHitPointer &hitPtr,
0105 unsigned int iRow,
0106 const TrajectoryStateOnSurface &updatedTsos);
0107
0108
0109
0110 virtual void fillDerivatives(const AlgebraicMatrix &projection,
0111 const AlgebraicMatrix &fullJacobian,
0112 unsigned int iRow);
0113
0114
0115
0116 virtual void fillTrajectoryPositions(const AlgebraicMatrix &projection,
0117 const AlgebraicVector &mixedLocalParams,
0118 unsigned int iRow);
0119
0120
0121
0122 virtual bool addMaterialEffectsCov(const std::vector<AlgebraicMatrix> &allJacobians,
0123 const std::vector<AlgebraicMatrix> &allProjections,
0124 const std::vector<AlgebraicSymMatrix> &allCurvChanges,
0125 const std::vector<AlgebraicSymMatrix> &allDeltaParaCovs);
0126
0127
0128
0129 virtual bool addMaterialEffectsBp(const std::vector<AlgebraicMatrix> &allJacobians,
0130 const std::vector<AlgebraicMatrix> &allProjections,
0131 const std::vector<AlgebraicSymMatrix> &allCurvChanges,
0132 const std::vector<AlgebraicSymMatrix> &allDeltaParaCovs,
0133 const std::vector<AlgebraicMatrix> &allLocalToCurv);
0134
0135
0136
0137 virtual bool addMaterialEffectsBrl(const std::vector<AlgebraicMatrix> &allJacobians,
0138 const std::vector<AlgebraicMatrix> &allProjections,
0139 const std::vector<AlgebraicSymMatrix> &allCurvChanges,
0140 const std::vector<AlgebraicSymMatrix> &allDeltaParaCovs,
0141 const std::vector<AlgebraicMatrix> &allLocalToCurv,
0142 const GlobalTrajectoryParameters >p);
0143
0144
0145 virtual bool addMaterialEffectsBrl(const std::vector<AlgebraicMatrix> &allProjections,
0146 const std::vector<AlgebraicSymMatrix> &allDeltaParaCovs,
0147 const std::vector<AlgebraicMatrix> &allLocalToCurv,
0148 const std::vector<double> &allSteps,
0149 const GlobalTrajectoryParameters >p,
0150 const double minStep = 1.0);
0151
0152
0153
0154 virtual bool addMaterialEffectsLocalGbl(const std::vector<AlgebraicMatrix> &allJacobians,
0155 const std::vector<AlgebraicMatrix> &allProjections,
0156 const std::vector<AlgebraicSymMatrix> &allCurvatureChanges,
0157 const std::vector<AlgebraicSymMatrix> &allDeltaParameterCovs);
0158
0159
0160
0161 virtual bool addMaterialEffectsCurvlinGbl(const std::vector<AlgebraicMatrix> &allJacobians,
0162 const std::vector<AlgebraicMatrix> &allProjections,
0163 const std::vector<AlgebraicSymMatrix> &allCurvChanges,
0164 const std::vector<AlgebraicSymMatrix> &allDeltaParaCovs,
0165 const std::vector<AlgebraicMatrix> &allLocalToCurv);
0166
0167
0168
0169 inline SurfaceSide surfaceSide(const PropagationDirection dir) const {
0170 return (dir == alongMomentum) ? SurfaceSideDefinition::beforeSurface : SurfaceSideDefinition::afterSurface;
0171 }
0172
0173
0174
0175 AlgebraicMatrix getHitProjectionMatrix(const TransientTrackingRecHit::ConstRecHitPointer &recHit) const;
0176
0177
0178
0179 template <unsigned int N>
0180 AlgebraicMatrix getHitProjectionMatrixT(const TransientTrackingRecHit::ConstRecHitPointer &recHit) const;
0181
0182 private:
0183 template <typename Derived>
0184 void clhep2eigen(const AlgebraicVector &in, Eigen::MatrixBase<Derived> &out);
0185 template <typename Derived>
0186 void clhep2eigen(const AlgebraicMatrix &in, Eigen::MatrixBase<Derived> &out);
0187 template <typename Derived>
0188 void clhep2eigen(const AlgebraicSymMatrix &in, Eigen::MatrixBase<Derived> &out);
0189
0190 const double mass_;
0191 const MaterialEffects materialEffects_;
0192 const PropagationDirection propDir_;
0193 const bool useBeamSpot_;
0194 const bool includeAPEs_;
0195 const bool allowZeroMaterial_;
0196 };
0197
0198 #endif