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  int verbose()
9  {
10  static const int ret = 0; /* SimpleConfigurable<int>
11  (0, "LinTrackCache:Debug").value(); */
12  return ret;
13  }
14 
15  float maxRelinDistance()
16  {
17  // maximum distance before relinearizing
18  static const float ret = 1e-2; /* SimpleConfigurable<float>
19  (0.01, "LinTrackCache:RelinearizeAfter").value();
20  */
21  return ret;
22  }
23 }
24 
26  ( const GlobalPoint & pos, const reco::TransientTrack & rt )
27 {
28  if ( theHasLinTrack[pos][rt] )
29  {
30  return theLinTracks[pos][rt];
31  };
32 
33  LinearizedTrackStateFactory lTrackFactory;
35  lTrackFactory.linearizedTrackState( pos, rt );
36 
37  theLinTracks[pos][rt]=lTrData;
38  theHasLinTrack[pos][rt]=true;
39  return lTrData;
40 }
41 
43 {
44  // if theyre closer than 1 micron, they're
45  // indistinguishable, i.e. the same
46  // static const double max = 1e-4 * 1e-4;
47  // if ( ( left - right ).mag2() < max ) return false;
48 
49  if ( left.x() != right.x() )
50  {
51  return ( left.x() < right.x() );
52  } else if (left.y() != right.y()) {
53  return ( left.y() < right.y() );
54  } else {
55  return ( left.z() < right.z() );
56  }
57 }
58 
60  const GlobalPoint & p2 )
61 {
62  if ( (p1 - p2).mag() < maxRelinDistance() )
63  {
64  return false;
65  };
66  return Comparer()(p1,p2);
67 }
68 
70 {
71  clear();
72 }
73 
75 {
76  theLinTracks.clear();
77  theHasLinTrack.clear();
78 }
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