LCFIVertex  0.7.2
pereventipfitter.cpp
1 #include <algo/inc/pereventipfitter.h>
2 #include <inc/jet.h>
3 #include <inc/track.h>
4 #include <inc/vertex.h>
5 #include <inc/event.h>
6 #include <util/inc/memorymanager.h>
7 #include <zvtop/include/candidatevertex.h>
8 #include <zvtop/include/vertexfunction.h>
9 #include <zvtop/include/VertexFitterKalman.h>
10 #include <zvtop/include/interactionpoint.h>
11 #include <inc/event.h>
12 #include <util/inc/string.h>
13 
14 #include <vector>
15 #include <string>
16 
17 using std::vector;
18 
19 namespace vertex_lcfi
20 {
25 
26  PerEventIPFitter::PerEventIPFitter()
27  {
28  _ProbThreshold = 0.01;
29  }
30 
31  string PerEventIPFitter::name() const
32  {
33  return "PerEventIPFitter";
34  }
35 
36  std::vector<string> PerEventIPFitter::parameterNames() const
37  {
38  std::vector<string> paramNames;
39  paramNames.push_back("ProbThreshold");
40  return paramNames;
41  }
42 
43  std::vector<string> PerEventIPFitter::parameterValues() const
44  {
45  std::vector<string> paramValues;
46  paramValues.push_back(makeString(_ProbThreshold));
47  return paramValues;
48  }
49 
50  void PerEventIPFitter::setStringParameter(const string & Parameter, const string & Value)
51  {
52  this->badParameter(Parameter);
53  }
54 
55  void PerEventIPFitter::setDoubleParameter(const string & Parameter, const double Value)
56  {
57  if (Parameter == "ProbThreshold")
58  {
59  _ProbThreshold = Value;
60  }
61  else this->badParameter(Parameter);
62  }
63 
64  void PerEventIPFitter::setPointerParameter(const string & Parameter, void * Value)
65  {
66  this->badParameter(Parameter);
67  }
68 
70  {
71  //TODO Check for default IP and throw if none
72  //Make trackstates for use by CandidateVertex object
73  vector<TrackState*> TrackStates;
74  for (vector<Track*>::const_iterator iTrack = MyEvent->tracks().begin(); iTrack != MyEvent->tracks().end(); ++iTrack)
75  {
76  TrackStates.push_back((*iTrack)->makeState());
77  }
78 
79  VertexFitterKalman MyFitter;
80  MyFitter.setSeed(MyEvent->interactionPoint());
81  // MyFitter.setInitialStep(1.0/1000.0);
82 
83  CandidateVertex CVertex(TrackStates, /*VertexFunction*/ 0, &MyFitter);
84  CVertex.trimByProb(_ProbThreshold);
85 
86  //Add IP to force primaryness
88 
89  Vertex* ResultVertex;
90  //Check that we have 2 or more tracks, if not return default
91  if (CVertex.trackStateList().size() >= 2)
92  {
93  ResultVertex = new Vertex(&CVertex,MyEvent);
94  }
95  else
96  {
97  ResultVertex = new Vertex(MyEvent,
98  vector<Track*>(),
99  MyEvent->interactionPoint(),
100  MyEvent->interactionPointError(),
101  /*isPrimary*/ true,
102  /*Prob*/ 0,
103  /*Prob*/ 1);
104  }
105 
106  ResultVertex->isPrimary()=true;
107  MemoryManager<Vertex>::Event()->registerObject(ResultVertex);
108  return ResultVertex;
109  }
110 }
void setDoubleParameter(const string &Parameter, const double Value)
Set Double Parameter.
Vertex * calculateFor(Event *MyEvent) const
Run the algorithm on an Event.
bool isPrimary() const
Is this vertex primary.
A collection of TrackState objects with a fit and vertex function maximum.
const std::vector< Track * > & tracks() const
Get Tracks.
Definition: event.cpp:40
void setStringParameter(const string &Parameter, const string &Value)
Set String Parameter.
void setPointerParameter(const string &Parameter, void *Value)
Set Pointer Parameter.
int trimByProb(const double ProbThreshold)
Trim trackstates in order of decreasing chi squared until the vertex has a probabilty below that of t...
static MemoryManager< T > * Event()
Returns the Event duration singleton instance of the MemoryManager for type T.
const std::vector< TrackState * > & trackStateList() const
Return the TrackStates in this Vertex.
std::vector< string > parameterValues() const
Parameter Values.
const SymMatrix3x3 & interactionPointError() const
Interaction Point position error.
Definition: event.cpp:55
const Vector3 & interactionPoint() const
Interaction Point position.
Definition: event.cpp:50
std::vector< string > parameterNames() const
Parameter Names.