CMS 3D CMS Logo

SingleTrackVertexConstraint.cc
Go to the documentation of this file.
5 
6 #include <algorithm>
7 using namespace std;
8 using namespace reco;
9 
10 namespace {
11  // FIXME
12  // hard-coded tracker bounds
13  // workaround while waiting for Geometry service
14  static const float TrackerBoundsRadius = 112;
15  static const float TrackerBoundsHalfLength = 273.5;
16  bool insideTrackerBounds(const GlobalPoint& point) {
17  return ((point.transverse() < TrackerBoundsRadius)
18  && (abs(point.z()) < TrackerBoundsHalfLength));
19  }
20 }
21 
23  const TransientTrack & track, const GlobalPoint& priorPos,
24  const GlobalError & priorError) const
25 {
26  VertexState priorVertexState(priorPos, priorError);
27  return constrain(track, priorVertexState);
28 }
29 
30 
32  const TransientTrack & track, const VertexState priorVertexState) const
33 {
34  // Linearize tracks
35 
36  typedef CachingVertex<5>::RefCountedVertexTrack RefCountedVertexTrack;
37  typedef VertexTrack<5>::RefCountedLinearizedTrackState RefCountedLinearizedTrackState;
38 
39  double field = track.field()->inInverseGeV(track.impactPointState().globalPosition()).z();
40  int nominalBfield = track.field()->nominalValue();
41  if ((fabs(field) < 1e-4)&&(fabs(nominalBfield)!=0)) { //protection for the case where the magnet is off
42  LogDebug("RecoVertex/SingleTrackVertexConstraint")
43  << "Initial state is very far, field is close to zero (<1e-4): " << field << "\n";
44  return BTFtuple(false, TransientTrack(), 0.);
45  }
46 
47  RefCountedLinearizedTrackState lTrData
48  = theLTrackFactory.linearizedTrackState(priorVertexState.position(), track);
49  RefCountedVertexTrack vertexTrack = theVTrackFactory.vertexTrack(lTrData, priorVertexState);
50 
51  // Fit vertex
52 
53  std::vector<RefCountedVertexTrack> initialTracks;
54  CachingVertex<5> vertex(priorVertexState,priorVertexState,initialTracks,0);
55  vertex = vertexUpdator.add(vertex, vertexTrack);
56  if (!vertex.isValid()) {
57  return BTFtuple(false, TransientTrack(), 0.);
58  } else if (doTrackerBoundCheck_ && (!insideTrackerBounds(vertex.position()))) {
59  LogDebug("RecoVertex/SingleTrackVertexConstraint")
60  << "Fitted position is out of tracker bounds.\n";
61  return BTFtuple(false, TransientTrack(), 0.);
62  }
63 
64  RefCountedVertexTrack nTrack = theVertexTrackUpdator.update(vertex, vertexTrack);
65  return BTFtuple(true, nTrack->refittedState()->transientTrack(), nTrack->smoothedChi2());
66 }
67 
69  const FreeTrajectoryState & fts, const GlobalPoint& priorPos,
70  const GlobalError& priorError) const
71 {
72  return constrain(ttFactory.build(fts), priorPos, priorError);
73 }
74 
76  const TransientTrack & track, const reco::BeamSpot & spot ) const
77 {
78  VertexState priorVertexState(spot);
79  return constrain(track, priorVertexState);
80 }
81 
83  const FreeTrajectoryState & fts, const reco::BeamSpot & spot) const
84 {
85  VertexState priorVertexState(spot);
86  return constrain(ttFactory.build(fts), priorVertexState);
87 }
88 
#define LogDebug(id)
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:56
GlobalPoint globalPosition() const
const MagneticField * field() const
GlobalPoint position() const
Definition: VertexState.h:69
T transverse() const
Definition: PV3DBase.h:73
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:39
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GlobalPoint position() const
BTFtuple constrain(const reco::TransientTrack &track, const GlobalPoint &priorPos, const GlobalError &priorError) const
fixed size matrix
bool isValid() const
boost::tuple< bool, reco::TransientTrack, float > BTFtuple
TrajectoryStateOnSurface impactPointState() 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
Definition: invegas.h:5