13 static const float TrackerBoundsRadius = 112;
14 static const float TrackerBoundsHalfLength = 273.5;
16 return ((point.
transverse() < TrackerBoundsRadius)
17 && (
abs(point.
z()) < TrackerBoundsHalfLength));
22 template <
unsigned int N>
27 theLinP(linP.
clone()), theUpdator(updator.
clone()),
28 theSmoother(smoother.
clone()), theLTrackFactory ( ltsf.
clone() )
33 template <
unsigned int N>
38 thePSet(pSet), theLinP(linP.
clone()), theUpdator(updator.
clone()),
39 theSmoother(smoother.
clone()), theLTrackFactory ( ltsf.
clone() )
45 template <
unsigned int N>
54 theMaxStep = original.
maxStep();
59 template <
unsigned int N>
65 delete theLTrackFactory;
69 template <
unsigned int N>
72 theMaxShift = thePSet.getParameter<
double>(
"maxDistance");
73 theMaxStep = thePSet.getParameter<
int>(
"maxNbrOfIterations");
76 template <
unsigned int N>
79 thePSet.addParameter<
double>(
"maxDistance", 0.01);
80 thePSet.addParameter<
int>(
"maxNbrOfIterations", 10);
84 template <
unsigned int N>
89 GlobalPoint linP = theLinP->getLinearizationPoint(tracks);
90 if (!insideTrackerBounds(linP)) linP =
GlobalPoint(0,0,0);
93 ROOT::Math::SMatrixIdentity id;
96 VertexState state(linP, error);
97 std::vector<RefCountedVertexTrack> vtContainer = linearizeTracks(tracks, state);
98 return fit(vtContainer, state,
false);
101 template <
unsigned int N>
103 const std::vector<RefCountedVertexTrack> &
tracks,
106 VertexState state(spot);
107 return fit(tracks, state,
true );
110 template <
unsigned int N>
115 GlobalPoint linP = tracks[0]->linearizedTrack()->linearizationPoint();
116 ROOT::Math::SMatrixIdentity id;
119 VertexState state(linP, error);
120 return fit(tracks, state,
false);
127 template <
unsigned int N>
133 ROOT::Math::SMatrixIdentity id;
136 VertexState state(linPoint, error);
137 std::vector<RefCountedVertexTrack> vtContainer = linearizeTracks(tracks, state);
138 return fit(vtContainer, state,
false);
146 template <
unsigned int N>
151 VertexState beamSpotState(beamSpot);
152 std::vector<RefCountedVertexTrack> vtContainer;
154 if (tracks.size() > 1) {
156 GlobalPoint linP = theLinP->getLinearizationPoint(tracks);
157 if (!insideTrackerBounds(linP)) linP =
GlobalPoint(0,0,0);
158 ROOT::Math::SMatrixIdentity id;
161 VertexState lpState(linP, error);
162 vtContainer = linearizeTracks(tracks, lpState);
165 vtContainer = linearizeTracks(tracks, beamSpotState);
168 return fit(vtContainer, beamSpotState,
true);
177 template <
unsigned int N>
179 const std::vector<reco::TransientTrack> &
tracks,
183 VertexState state(priorPos, priorError);
184 std::vector<RefCountedVertexTrack> vtContainer = linearizeTracks(tracks, state);
185 return fit(vtContainer, state,
true);
192 template <
unsigned int N>
194 const std::vector<RefCountedVertexTrack> &
tracks,
198 VertexState state(priorPos, priorError);
199 return fit(tracks, state,
true);
205 template <
unsigned int N>
206 vector<typename SequentialVertexFitter<N>::RefCountedVertexTrack>
208 const std::vector<reco::TransientTrack> &
tracks,
209 const VertexState state)
const
212 std::vector<RefCountedVertexTrack> finalTracks;
213 finalTracks.reserve(tracks.size());
214 for(vector<reco::TransientTrack>::const_iterator
i = tracks.begin();
215 i != tracks.end();
i++) {
217 = theLTrackFactory->linearizedTrackState(linP, *
i);
219 finalTracks.push_back(vTrData);
229 template <
unsigned int N>
230 vector<typename SequentialVertexFitter<N>::RefCountedVertexTrack>
232 const std::vector<RefCountedVertexTrack> &
tracks,
233 const VertexState state)
const
237 std::vector<RefCountedVertexTrack> finalTracks;
238 finalTracks.reserve(tracks.size());
239 for(
typename std::vector<RefCountedVertexTrack>::const_iterator
i = tracks.begin();
240 i != tracks.end();
i++) {
242 (**i).linearizedTrack()->stateWithNewLinearizationPoint(linP);
247 theVTrackFactory.vertexTrack(lTrData,state, (**i).weight() );
248 finalTracks.push_back(vTrData);
256 template <
unsigned int N>
259 const VertexState priorVertex,
bool withPrior )
const
261 std::vector<RefCountedVertexTrack> initialTracks;
262 GlobalPoint priorVertexPosition = priorVertex.position();
263 GlobalError priorVertexError = priorVertex.error();
265 CachingVertex<N> returnVertex(priorVertexPosition,priorVertexError,initialTracks,0);
268 priorVertexPosition,priorVertexError,initialTracks,0);
271 std::vector<RefCountedVertexTrack> globalVTracks =
tracks;
274 bool validVertex =
true;
281 if(step != 0) globalVTracks = reLinearizeTracks(tracks,
285 for (
typename std::vector<RefCountedVertexTrack>::const_iterator
i
286 = globalVTracks.begin();
i != globalVTracks.end();
i++) {
287 fVertex = theUpdator->add(fVertex,*
i);
291 validVertex = fVertex.
isValid();
293 if (validVertex && hasNan(fVertex.
position())) {
294 LogDebug(
"RecoVertex/SequentialVertexFitter")
295 <<
"Fitted position is NaN.\n";
299 if (validVertex && !insideTrackerBounds(fVertex.
position())) {
300 LogDebug(
"RecoVertex/SequentialVertexFitter")
301 <<
"Fitted position is out of tracker bounds.\n";
308 ROOT::Math::SMatrixIdentity id;
315 previousPosition = newPosition;
318 returnVertex = fVertex;
319 globalVTracks.clear();
321 }
while ( (step != theMaxStep) &&
322 (((previousPosition - newPosition).
transverse() > theMaxShift) ||
326 LogDebug(
"RecoVertex/SequentialVertexFitter")
327 <<
"Fitted position is invalid (out of tracker bounds or has NaN). Returned vertex is invalid\n";
331 if (step >= theMaxStep) {
332 LogDebug(
"RecoVertex/SequentialVertexFitter")
333 <<
"The maximum number of steps has been exceeded. Returned vertex is invalid\n";
338 returnVertex = theSmoother->smooth(returnVertex);
std::vector< RefCountedVertexTrack > reLinearizeTracks(const std::vector< RefCountedVertexTrack > &tracks, const VertexState state) const
const VertexUpdator< N > * vertexUpdator() const
CachingVertex< N > fit(const std::vector< RefCountedVertexTrack > &tracks, const VertexState priorVertex, bool withPrior) const
VertexState const & vertexState() const
Global3DPoint GlobalPoint
const AbstractLTSFactory< N > * linearizedTrackStateFactory() const
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const
const VertexSmoother< N > * vertexSmoother() const
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Abs< T >::type abs(const T &t)
virtual ~SequentialVertexFitter()
const edm::ParameterSet parameterSet() const
GlobalPoint position() const
virtual LinearizationPointFinder * clone() const =0
T transverse() const
Another name for perp()
const int maxStep() const
std::vector< RefCountedVertexTrack > linearizeTracks(const std::vector< reco::TransientTrack > &tracks, const VertexState state) const
void setDefaultParameters()
const float maxShift() const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
const LinearizationPointFinder * linearizationPointFinder() const