KiTrack  1.7.0
Automaton.h
1 #ifndef Automaton_h
2 #define Automaton_h
3 
4 #include <vector>
5 #include "KiTrack/Segment.h"
6 #include "Criteria/ICriterion.h"
7 
8 
9 
10 namespace KiTrack{
11 
12 
79  class Automaton{
80 
81 
82 
83  public:
84 
85  Automaton(): _nConnections(0){}
86 
90  ~Automaton();
91 
92 
96  void addSegment ( Segment* segment );
97 
103  void lengthenSegments();
104 
108  void addCriterion ( ICriterion* criterion ){ _criteria.push_back( criterion ); }
109  void addCriteria ( std::vector< ICriterion* > criteria ){ _criteria.insert( _criteria.end() , criteria.begin() , criteria.end() ); }
110  void clearCriteria() { _criteria.clear(); };
111 
125  void doAutomaton();
126 
135  void cleanBadStates();
136 
140  void cleanBadConnections();
141 
145  void resetStates();
146 
147 
148 
164  //std::vector < std::vector< IHit* > > getTracks( unsigned minHits = 3 );
165  std::vector < std::vector< IHit* > > getTracks( unsigned minHits = 2 ); // YV, 2 mini-vector hits can form a track
166 
170  //std::vector < std::vector< IHit* > > getTracksOfSegment ( Segment* segment, std::vector< IHit* > hits , unsigned minHits = 3 );
171  std::vector < std::vector< IHit* > > getTracksOfSegment ( Segment* segment, std::vector< IHit* > hits , unsigned minHits = 2 ); // YV, 2 mini-vector hits can form a track
172 
176  std::vector <const Segment*> getSegments() const;
177 
178  unsigned getNumberOfConnections(){ return _nConnections; }
179 
180  private:
181 
190  std::vector < std::list < Segment* > > _segments;
191 
194  std::vector < ICriterion* > _criteria;
195 
196  unsigned _nConnections;
197 
198 
199 
200  };
201 
202 
203 
204 
205 
206 }
207 
208 
209 
210 
211 
212 
213 #endif
214 
215 
~Automaton()
delete all the segments
Definition: Automaton.cc:722
A Segment is something like a track or a part of a track: it consists of hits linked together...
Definition: Segment.h:40
void addSegment(Segment *segment)
Adds a segment to the automaton.
Definition: Automaton.cc:10
void cleanBadStates()
Erases all segments that don't have a state corresponding to their layer.
Definition: Automaton.cc:422
void cleanBadConnections()
Erase alls connections between segments, that don't satisfy the criteria.
Definition: Automaton.cc:514
void resetStates()
Resets all the states of the segmens to 0 by calling the resetState() method of the segment Also sets...
Definition: Automaton.cc:492
An Interface for Criteria.
Definition: ICriterion.h:20
std::vector< std::vector< IHit * > > getTracksOfSegment(Segment *segment, std::vector< IHit * > hits, unsigned minHits=2)
Returns all the tracks starting from this segment.
Definition: Automaton.cc:592
A class for the cellular automaton.
Definition: Automaton.h:79
void addCriterion(ICriterion *criterion)
Adds a criteria to the automaton.
Definition: Automaton.h:108
void doAutomaton()
Does iteration until the states of the segments don't change anymore.
Definition: Automaton.cc:326
std::vector< std::vector< IHit * > > getTracks(unsigned minHits=2)
Get all the possible tracks in the automaton.
Definition: Automaton.cc:655
void lengthenSegments()
Lengthens the segments by one via adding the first hit of the next segment it is connected to to it...
Definition: Automaton.cc:29
std::vector< const Segment * > getSegments() const
Definition: Automaton.cc:698