CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
37  // if theyre closer than 1 micron, they're
38  // indistinguishable, i.e. the same
39  // static const double max = 1e-4 * 1e-4;
40  // if ( ( left - right ).mag2() < max ) return false;
41 
42  if ( left.x() != right.x() )
43  {
44  return ( left.x() < right.x() );
45  } else if (left.y() != right.y()) {
46  return ( left.y() < right.y() );
47  } else {
48  return ( left.z() < right.z() );
49  }
50 }
51 
53  const GlobalPoint & p2 )
54 {
55  if ( (p1 - p2).mag() < maxRelinDistance() )
56  {
57  return false;
58  };
59  return Comparer()(p1,p2);
60 }
61 
63 {
64  clear();
65 }
66 
68 {
69  theLinTracks.clear();
70  theHasLinTrack.clear();
71 }
bool operator()(const GlobalPoint &, const GlobalPoint &)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T y() const
Definition: PV3DBase.h:63
bool operator()(const GlobalPoint &, const GlobalPoint &)
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
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const
double p2[4]
Definition: TauolaWrapper.h:90
RefCountedLinearizedTrackState linTrack(const GlobalPoint &, const reco::TransientTrack &)
double p1[4]
Definition: TauolaWrapper.h:89
T x() const
Definition: PV3DBase.h:62