CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  const float TrackerBoundsRadius = 112;
15  const float TrackerBoundsHalfLength = 273.5;
16  bool insideTrackerBounds(const GlobalPoint& point) {
17  return ((point.transverse() < TrackerBoundsRadius) && (abs(point.z()) < TrackerBoundsHalfLength));
18  }
19 } // namespace
20 
22  const GlobalPoint& priorPos,
23  const GlobalError& priorError) const {
24  VertexState priorVertexState(priorPos, priorError);
25  return constrain(track, priorVertexState);
26 }
27 
29  const VertexState priorVertexState) const {
30  // Linearize tracks
31 
32  typedef CachingVertex<5>::RefCountedVertexTrack RefCountedVertexTrack;
33  typedef VertexTrack<5>::RefCountedLinearizedTrackState RefCountedLinearizedTrackState;
34 
35  double field = track.field()->inInverseGeV(track.impactPointState().globalPosition()).z();
36  int nominalBfield = track.field()->nominalValue();
37  if ((fabs(field) < 1e-4) && (fabs(nominalBfield) != 0)) { //protection for the case where the magnet is off
38  LogDebug("RecoVertex/SingleTrackVertexConstraint")
39  << "Initial state is very far, field is close to zero (<1e-4): " << field << "\n";
40  return BTFtuple(false, TransientTrack(), 0.);
41  }
42 
43  RefCountedLinearizedTrackState lTrData = theLTrackFactory.linearizedTrackState(priorVertexState.position(), track);
44  RefCountedVertexTrack vertexTrack = theVTrackFactory.vertexTrack(lTrData, priorVertexState);
45 
46  // Fit vertex
47 
48  std::vector<RefCountedVertexTrack> initialTracks;
49  CachingVertex<5> vertex(priorVertexState, priorVertexState, initialTracks, 0);
50  vertex = vertexUpdator.add(vertex, vertexTrack);
51  if (!vertex.isValid()) {
52  return BTFtuple(false, TransientTrack(), 0.);
53  } else if (doTrackerBoundCheck_ && (!insideTrackerBounds(vertex.position()))) {
54  LogDebug("RecoVertex/SingleTrackVertexConstraint") << "Fitted position is out of tracker bounds.\n";
55  return BTFtuple(false, TransientTrack(), 0.);
56  }
57 
58  RefCountedVertexTrack nTrack = theVertexTrackUpdator.update(vertex, vertexTrack);
59  return BTFtuple(true, nTrack->refittedState()->transientTrack(), nTrack->smoothedChi2());
60 }
61 
63  const GlobalPoint& priorPos,
64  const GlobalError& priorError) const {
65  return constrain(ttFactory.build(fts), priorPos, priorError);
66 }
67 
69  const reco::BeamSpot& spot) const {
70  VertexState priorVertexState(spot);
71  return constrain(track, priorVertexState);
72 }
73 
75  const reco::BeamSpot& spot) const {
76  VertexState priorVertexState(spot);
77  return constrain(ttFactory.build(fts), priorVertexState);
78 }
std::tuple< bool, reco::TransientTrack, float > BTFtuple
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:49
GlobalPoint globalPosition() const
const MagneticField * field() const
GlobalPoint position() const
Definition: VertexState.h:62
T transverse() const
Definition: PV3DBase.h:70
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
T z() const
Definition: PV3DBase.h:61
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
bool isValid() const
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
#define LogDebug(id)