File indexing completed on 2024-04-06 11:57:20
0001 #ifndef Alignment_ReferenceTrajectories_ReferenceTrajectoryBase_H
0002 #define Alignment_ReferenceTrajectories_ReferenceTrajectoryBase_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
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
0091 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0092
0093
0094 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
0095 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0096 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0097 #include "TrackingTools/TrajectoryParametrization/interface/LocalTrajectoryError.h"
0098
0099 #include <vector>
0100
0101 #include <Eigen/Dense>
0102
0103 #include "GblTrajectory.h"
0104
0105 class ReferenceTrajectoryBase : public ReferenceCounted {
0106 public:
0107 typedef ReferenceCountingPointer<ReferenceTrajectoryBase> ReferenceTrajectoryPtr;
0108
0109 enum MaterialEffects {
0110 none,
0111 multipleScattering,
0112 energyLoss,
0113 combined,
0114 breakPoints,
0115 brokenLinesCoarse,
0116 brokenLinesFine,
0117 localGBL,
0118 curvlinGBL
0119 };
0120
0121 struct Config {
0122 Config(MaterialEffects matEff,
0123 PropagationDirection direction,
0124 double m = -std::numeric_limits<double>::infinity(),
0125 double est = -std::numeric_limits<double>::infinity())
0126 : materialEffects(matEff), propDir(direction), mass(m), momentumEstimate(est) {}
0127
0128 MaterialEffects materialEffects;
0129 PropagationDirection propDir;
0130 double mass;
0131 double momentumEstimate;
0132 bool useBeamSpot{false};
0133 bool hitsAreReverse{false};
0134 bool useRefittedState{false};
0135 bool constructTsosWithErrors{false};
0136 bool includeAPEs{false};
0137 bool allowZeroMaterial{false};
0138 };
0139
0140 ~ReferenceTrajectoryBase() override {}
0141
0142 bool isValid() { return theValidityFlag; }
0143
0144
0145
0146 const AlgebraicVector& measurements() const { return theMeasurements; }
0147
0148
0149
0150 const AlgebraicSymMatrix& measurementErrors() const { return theMeasurementsCov; }
0151
0152
0153
0154
0155 const AlgebraicVector& trajectoryPositions() const { return theTrajectoryPositions; }
0156
0157
0158
0159 const AlgebraicSymMatrix& trajectoryPositionErrors() const { return theTrajectoryPositionCov; }
0160
0161
0162
0163
0164 const AlgebraicMatrix& derivatives() const { return theDerivatives; }
0165
0166
0167
0168 const AlgebraicMatrix& trajectoryToCurv() const { return theInnerTrajectoryToCurvilinear; }
0169
0170
0171 const AlgebraicMatrix& localToTrajectory() const { return theInnerLocalToTrajectory; }
0172
0173
0174
0175 std::vector<std::pair<std::vector<gbl::GblPoint>, Eigen::MatrixXd> >& gblInput() { return theGblInput; }
0176
0177
0178
0179 const Eigen::MatrixXd& gblExtDerivatives() const { return theGblExtDerivatives; }
0180
0181
0182
0183 const Eigen::VectorXd& gblExtMeasurements() const { return theGblExtMeasurements; }
0184
0185
0186
0187 const Eigen::VectorXd& gblExtPrecisions() const { return theGblExtPrecisions; }
0188
0189
0190
0191 const AlgebraicVector& parameters() const { return theParameters; }
0192
0193
0194
0195 inline bool parameterErrorsAvailable() const { return theParamCovFlag; }
0196
0197
0198
0199 inline void setParameterErrors(const AlgebraicSymMatrix& error) {
0200 theParameterCov = error;
0201 theParamCovFlag = true;
0202 }
0203
0204
0205
0206 inline const AlgebraicSymMatrix& parameterErrors() const { return theParameterCov; }
0207
0208
0209
0210 const std::vector<TrajectoryStateOnSurface>& trajectoryStates() const { return theTsosVec; }
0211
0212
0213
0214
0215 const TransientTrackingRecHit::ConstRecHitContainer& recHits() const { return theRecHits; }
0216
0217 inline unsigned int numberOfHits() const { return theNumberOfHits; }
0218 inline unsigned int numberOfPar() const { return theNumberOfPars; }
0219 inline unsigned int numberOfVirtualMeas() const { return theNumberOfVirtualMeas; }
0220 inline unsigned int numberOfVirtualPar() const { return theNumberOfVirtualPars; }
0221 inline unsigned int numberOfHitMeas() const { return theNumberOfHits * nMeasPerHit; }
0222 inline int nominalField() const { return theNomField; }
0223
0224 virtual ReferenceTrajectoryBase* clone() const = 0;
0225
0226 protected:
0227 explicit ReferenceTrajectoryBase(unsigned int nPar,
0228 unsigned int nHits,
0229 unsigned int nVirtualPar,
0230 unsigned int nVirtualMeas);
0231
0232 unsigned int numberOfUsedRecHits(const TransientTrackingRecHit::ConstRecHitContainer& recHits) const;
0233 bool useRecHit(const TransientTrackingRecHit::ConstRecHitPointer& hitPtr) const;
0234
0235 bool theValidityFlag;
0236 bool theParamCovFlag;
0237
0238 unsigned int theNumberOfHits;
0239 unsigned int theNumberOfPars;
0240 unsigned int theNumberOfVirtualMeas;
0241 unsigned int theNumberOfVirtualPars;
0242
0243 std::vector<TrajectoryStateOnSurface> theTsosVec;
0244 TransientTrackingRecHit::ConstRecHitContainer theRecHits;
0245
0246 AlgebraicVector theMeasurements;
0247 AlgebraicSymMatrix theMeasurementsCov;
0248
0249 AlgebraicVector theTrajectoryPositions;
0250 AlgebraicSymMatrix theTrajectoryPositionCov;
0251
0252 AlgebraicVector theParameters;
0253 AlgebraicSymMatrix theParameterCov;
0254
0255 AlgebraicMatrix theDerivatives;
0256
0257
0258 AlgebraicMatrix theInnerTrajectoryToCurvilinear;
0259
0260 AlgebraicMatrix theInnerLocalToTrajectory;
0261
0262 std::vector<std::pair<std::vector<gbl::GblPoint>, Eigen::MatrixXd> > theGblInput;
0263 int theNomField;
0264
0265 Eigen::MatrixXd theGblExtDerivatives;
0266 Eigen::VectorXd theGblExtMeasurements;
0267 Eigen::VectorXd theGblExtPrecisions;
0268
0269 static constexpr unsigned int nMeasPerHit{2};
0270 };
0271
0272 #endif