File indexing completed on 2024-04-06 12:29:20
0001 #ifndef SequentialVertexFitter_H
0002 #define SequentialVertexFitter_H
0003
0004 #include "RecoVertex/VertexPrimitives/interface/VertexFitter.h"
0005 #include "RecoVertex/VertexTools/interface/LinearizationPointFinder.h"
0006 #include "RecoVertex/VertexPrimitives/interface/VertexUpdator.h"
0007 #include "RecoVertex/VertexPrimitives/interface/VertexSmoother.h"
0008 #include "RecoVertex/VertexTools/interface/LinearizedTrackStateFactory.h"
0009 #include "RecoVertex/VertexTools/interface/VertexTrackFactory.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/Utilities/interface/isFinite.h"
0012 #include <cmath>
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 template <unsigned int N>
0034 class SequentialVertexFitter : public VertexFitter<N> {
0035 public:
0036 typedef ReferenceCountingPointer<RefittedTrackState<N> > RefCountedRefittedTrackState;
0037 typedef ReferenceCountingPointer<VertexTrack<N> > RefCountedVertexTrack;
0038 typedef ReferenceCountingPointer<LinearizedTrackState<N> > RefCountedLinearizedTrackState;
0039
0040
0041
0042
0043
0044
0045
0046 SequentialVertexFitter(const LinearizationPointFinder& linP,
0047 const VertexUpdator<N>& updator,
0048 const VertexSmoother<N>& smoother,
0049 const AbstractLTSFactory<N>& ltsf);
0050
0051
0052
0053
0054
0055 SequentialVertexFitter(const edm::ParameterSet& pSet,
0056 const LinearizationPointFinder& linP,
0057 const VertexUpdator<N>& updator,
0058 const VertexSmoother<N>& smoother,
0059 const AbstractLTSFactory<N>& ltsf);
0060
0061
0062
0063
0064
0065 SequentialVertexFitter(const SequentialVertexFitter& original);
0066
0067 ~SequentialVertexFitter() override;
0068
0069
0070
0071
0072
0073
0074
0075 void setMaximumDistance(float maxShift) { theMaxShift = maxShift; }
0076
0077
0078
0079
0080
0081 void setMaximumNumberOfIterations(int maxIterations) { theMaxStep = maxIterations; }
0082
0083
0084
0085
0086
0087
0088
0089
0090 CachingVertex<N> vertex(const std::vector<reco::TransientTrack>& tracks) const override;
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101 CachingVertex<N> vertex(const std::vector<RefCountedVertexTrack>& tracks) const override;
0102
0103
0104
0105
0106 CachingVertex<N> vertex(const std::vector<RefCountedVertexTrack>& tracks, const reco::BeamSpot& spot) const override;
0107
0108
0109
0110 CachingVertex<N> vertex(const std::vector<reco::TransientTrack>& tracks, const GlobalPoint& linPoint) const override;
0111
0112
0113
0114
0115
0116 CachingVertex<N> vertex(const std::vector<reco::TransientTrack>& tracks,
0117 const reco::BeamSpot& beamSpot) const override;
0118
0119
0120
0121
0122
0123
0124 CachingVertex<N> vertex(const std::vector<reco::TransientTrack>& tracks,
0125 const GlobalPoint& priorPos,
0126 const GlobalError& priorError) const override;
0127
0128
0129
0130
0131
0132 CachingVertex<N> vertex(const std::vector<RefCountedVertexTrack>& tracks,
0133 const GlobalPoint& priorPos,
0134 const GlobalError& priorError) const override;
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151 const LinearizationPointFinder* linearizationPointFinder() const { return theLinP; }
0152
0153 const VertexUpdator<N>* vertexUpdator() const { return theUpdator; }
0154
0155 const VertexSmoother<N>* vertexSmoother() const { return theSmoother; }
0156
0157 const float maxShift() const { return theMaxShift; }
0158
0159 const int maxStep() const { return theMaxStep; }
0160
0161 const edm::ParameterSet parameterSet() const { return thePSet; }
0162
0163 SequentialVertexFitter* clone() const override { return new SequentialVertexFitter(*this); }
0164
0165 const AbstractLTSFactory<N>* linearizedTrackStateFactory() const { return theLTrackFactory; }
0166
0167
0168
0169
0170
0171
0172
0173
0174 const bool insideTrackerBounds(const GlobalPoint& point) const {
0175 return ((point.transverse() < trackerBoundsRadius) && (abs(point.z()) < trackerBoundsHalfLength));
0176 }
0177
0178 void setTrackerBounds(float radius, float halfLength) {
0179 trackerBoundsRadius = radius;
0180 trackerBoundsHalfLength = halfLength;
0181 }
0182
0183 protected:
0184
0185
0186
0187
0188 SequentialVertexFitter() {}
0189
0190 private:
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200 CachingVertex<N> fit(const std::vector<RefCountedVertexTrack>& tracks,
0201 const VertexState priorVertex,
0202 bool withPrior) const;
0203
0204
0205
0206
0207
0208
0209
0210
0211 std::vector<RefCountedVertexTrack> linearizeTracks(const std::vector<reco::TransientTrack>& tracks,
0212 const VertexState state) const;
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224 std::vector<RefCountedVertexTrack> reLinearizeTracks(const std::vector<RefCountedVertexTrack>& tracks,
0225 const VertexState state) const;
0226
0227
0228
0229
0230
0231 void readParameters();
0232 void setDefaultParameters();
0233
0234
0235
0236
0237 inline bool hasNan(const GlobalPoint& point) const {
0238 using namespace std;
0239 return (edm::isNotFinite(point.x()) || edm::isNotFinite(point.y()) || edm::isNotFinite(point.z()));
0240 }
0241
0242 float theMaxShift;
0243 int theMaxStep;
0244
0245
0246 float trackerBoundsRadius{112.};
0247 float trackerBoundsHalfLength{273.5};
0248
0249 edm::ParameterSet thePSet;
0250 LinearizationPointFinder* theLinP;
0251 VertexUpdator<N>* theUpdator;
0252 VertexSmoother<N>* theSmoother;
0253 const AbstractLTSFactory<N>* theLTrackFactory;
0254
0255 VertexTrackFactory<N> theVTrackFactory;
0256
0257
0258 };
0259
0260 #endif