LCFIVertex  0.7.2
vertexresolverequalsteps.cpp
1 #include "../include/vertexresolverequalsteps.h"
2 #include "../../util/inc/vector3.h"
3 #include "../include/vertexfunction.h"
4 
5 namespace vertex_lcfi { namespace ZVTOP
6 {
7  VertexResolverEqualSteps::VertexResolverEqualSteps()
8  {
9  }
10 
11  bool VertexResolverEqualSteps::areResolved(const Vector3& Vertex1, const Vector3& Vertex2, VertexFunction const * VF, const double Threshold) const
12  {
13  //TODO Check for null pointers
14  //NB Number of steps hardwired - could be in constructor or function call
15  int NumSteps = 10;
16  //Get the line between the two verts and a step to use to get trail points
17  Vector3 ResolveLine = Vertex2-Vertex1;
18 
19  //TODO Cut found in FORTRAN keep?
20  if (ResolveLine.mag()<(10.0/1000.0)) return 0;
21 
22  Vector3 Step = ResolveLine/NumSteps;
23  if (Step.mag()>0)
24  {
25  //Find which vertex has min VF
26  double VertexMin = VF->valueAt(Vertex1);
27  double Vertex2Value = VF->valueAt(Vertex2);
28  if (Vertex2Value < VertexMin)
29  VertexMin = Vertex2Value;
30 
31  if (!VertexMin > 0) //Check for bad denominator
32  return 0;
33 
34  //Now starting 1 step away from Vertex1 step along evaluating VF
35  //Note Numsteps -1 as we have the ends covered
36  Vector3 CurrentPoint = Vertex1+Step;
37 
38  for (short i=0;i<(NumSteps-1);++i)
39  {
40  double CurrentValue = VF->valueAt(CurrentPoint);
41  if ((CurrentValue/VertexMin) < Threshold)
42  return 1;
43  CurrentPoint = CurrentPoint+Step;
44  }
45 
46  //None of them passed the criteria so we are unresolved
47  }
48  return 0;
49 
50  }
51 }}
52