CMS 3D CMS Logo

LinTrackCache.cc
Go to the documentation of this file.
3 
4 using namespace std;
5 
6 namespace
7 {
8  float maxRelinDistance()
9  {
10  // maximum distance before relinearizing
11  static const float ret = 1e-2; /* SimpleConfigurable<float>
12  (0.01, "LinTrackCache:RelinearizeAfter").value();
13  */
14  return ret;
15  }
16 }
17 
19  ( const GlobalPoint & pos, const reco::TransientTrack & rt )
20 {
21  if ( theHasLinTrack[pos][rt] )
22  {
23  return theLinTracks[pos][rt];
24  };
25 
26  LinearizedTrackStateFactory lTrackFactory;
28  lTrackFactory.linearizedTrackState( pos, rt );
29 
30  theLinTracks[pos][rt]=lTrData;
31  theHasLinTrack[pos][rt]=true;
32  return lTrData;
33 }
34 
36  const GlobalPoint & right ) const
37 {
38  // if theyre closer than 1 micron, they're
39  // indistinguishable, i.e. the same
40  // static const double max = 1e-4 * 1e-4;
41  // if ( ( left - right ).mag2() < max ) return false;
42 
43  if ( left.x() != right.x() )
44  {
45  return ( left.x() < right.x() );
46  } else if (left.y() != right.y()) {
47  return ( left.y() < right.y() );
48  } else {
49  return ( left.z() < right.z() );
50  }
51 }
52 
54  const GlobalPoint & p2 ) const
55 {
56  if ( (p1 - p2).mag() < maxRelinDistance() )
57  {
58  return false;
59  };
60  return Comparer()(p1,p2);
61 }
62 
64 {
65  clear();
66 }
67 
69 {
70  theLinTracks.clear();
71  theHasLinTrack.clear();
72 }
bool operator()(const GlobalPoint &, const GlobalPoint &) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T y() const
Definition: PV3DBase.h:63
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
T z() const
Definition: PV3DBase.h:64
double p2[4]
Definition: TauolaWrapper.h:90
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
RefCountedLinearizedTrackState linTrack(const GlobalPoint &, const reco::TransientTrack &)
double p1[4]
Definition: TauolaWrapper.h:89
bool operator()(const GlobalPoint &, const GlobalPoint &) const
T x() const
Definition: PV3DBase.h:62