LCFIVertex  0.7.2
vertexfunctionsimple.cpp
1 
2 #include "../include/vertexfunctionsimple.h"
3 
4 #include "../include/gausstube.h"
5 #include "../include/gaussellipsoid.h"
6 
7 namespace vertex_lcfi { namespace ZVTOP
8 {
9 
10  VertexFunctionSimple::VertexFunctionSimple(std::vector<Track*> & Tracks)
11  {
12  for (std::vector<Track*>::iterator iTrack = Tracks.begin();iTrack != Tracks.end();++iTrack)
13  {
14  GaussTube* element= new GaussTube(*iTrack);
15  _AllElements.push_back(element);
16  _Tubes.push_back(element);
17  _ElementsNewedByThis.push_back(element);
18  }
19  _Ellipsoid = 0;
20 
21  }
22 
23  VertexFunctionSimple::VertexFunctionSimple(std::vector<Track*> & Tracks, InteractionPoint* IP)
24  {
25  for (std::vector<Track*>::iterator iTrack = Tracks.begin();iTrack != Tracks.end();++iTrack)
26  {
27  GaussTube* element= new GaussTube(*iTrack);
28  _AllElements.push_back(element);
29  _Tubes.push_back(element);
30  _ElementsNewedByThis.push_back(element);
31  }
32  if (IP)
33  {
34  GaussEllipsoid* element= new GaussEllipsoid(IP);
35  _AllElements.push_back(element);
36  _Ellipsoid = element;
37  _ElementsNewedByThis.push_back(element);
38  }
39  else
40  _Ellipsoid = 0;
41 
42  }
43 
44 
45  VertexFunctionSimple::~VertexFunctionSimple()
46  {
47  for (std::vector<VertexFunctionElement*>::iterator iElement = _ElementsNewedByThis.begin();iElement != _ElementsNewedByThis.end();++iElement)
48  delete *iElement;
49  }
50 
51  double VertexFunctionSimple::valueAt(const Vector3 & Point) const
52  {
53  double SumOfTubes = 0;
54  double SumOfSquaredTubes = 0;
55  for (std::vector<GaussTube*>::const_iterator iTube = _Tubes.begin();iTube != _Tubes.end();++iTube)
56  {
57  double Tube = (*iTube)->valueAt(Point);
58  SumOfTubes += Tube;
59  SumOfSquaredTubes += (Tube*Tube);
60  }
61  double IPValue = 0;
62  if (_Ellipsoid)
63  IPValue = _Ellipsoid->valueAt(Point);
64  if (SumOfTubes > 0)
65  return IPValue + SumOfTubes - ( ((IPValue*IPValue)+SumOfSquaredTubes) / (IPValue+SumOfTubes));
66  else
67  return 0;
68  }
69 
70  Matrix3x3 VertexFunctionSimple::firstDervAt(const Vector3 &Point) const
71  {
72  // TODO Implement if needed this funcion could be one class up
73  return Matrix3x3();
74  }
75 
76 
77  Matrix3x3 VertexFunctionSimple::secondDervAt(const Vector3 &Point) const
78  {
79  // TODO Implement if needed this funcion could be one class up
80  return Matrix3x3();
81  }
82 
83 
84 
85 }}
86 
double valueAt(const Vector3 &Point) const
Calculate the value of the ellipsoid at a point.