test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TTUTrackingAlg.h
Go to the documentation of this file.
1 #ifndef TTUTRACKINGALG_H
2 #define TTUTRACKINGALG_H 1
3 
4 // Include files
7 
8 #include <iostream>
9 #include <vector>
10 
25 class TTUTrackingAlg : public TTULogic {
26 public:
28  TTUTrackingAlg( );
29 
30  virtual ~TTUTrackingAlg( );
31 
32  //... from TTULogic interface:
33 
34  bool process( const TTUInput & );
35 
37 
38  //...
39 
40  class Seed
41  {
42  public:
43 
44  Seed() {m_sectorId = -9; m_stationId = -1; m_tkLength = 0;};
45  Seed( int _seId, int _stId, int _tl)
46  {
47  m_sectorId = _seId;
48  m_stationId = _stId;
49  m_tkLength = _tl;
50  };
51 
52  ~Seed() {};
53 
54  Seed( const Seed & _seed)
55  {
56  m_sectorId = _seed.m_sectorId;
57  m_stationId = _seed.m_stationId;
58  m_tkLength = _seed.m_tkLength;
59  };
60 
61  bool operator==(const Seed & rhs)
62  {
63  return (m_sectorId == rhs.m_sectorId)
64  && (m_stationId == rhs.m_stationId);
65  };
66 
67  int m_sectorId;
70 
71  };
72 
73  class Track
74  {
75  public:
76 
77  Track() { m_tracklength = 0; };
78  ~Track() {
79  if ( m_tracklength < 0 ) delete m_seeds[0];
80  m_seeds.clear();
81  };
82 
83  Track( const Track & trk )
84  {
85  m_seeds = trk.m_seeds;
87  };
88 
89  void add( Seed * sd ) {
90  m_seeds.push_back(sd);
91  ++m_tracklength;
92  };
93 
94  void addnone() {
95  Seed *_sd = new Seed(0,0,0);
96  m_seeds.push_back(_sd);
97  m_tracklength = -1;
98  };
99 
101  m_tracklength = m_seeds.size();
102  };
103 
104  bool operator<(const Track &rhs) {
105  return m_tracklength < rhs.m_tracklength;
106  };
107 
108  int length() { return m_tracklength;};
109 
110  std::vector<Seed*> m_seeds;
111 
112  private:
113 
115 
116  };
117 
118  typedef std::vector<Seed*>::iterator SeedsItr;
119  typedef std::vector<Track*>::iterator TracksItr;
120 
121  void setMinTrkLength( int val )
122  {
123  m_mintrklength = val;
124  };
125 
126  template< class T>
128  {
129  bool operator()( T* a, T* b ) { return (*a) < (*b) ; }
130  };
131 
132 protected:
133 
134 private:
135 
136  void runSeedBuster( const TTUInput & );
137 
138  void findNeighbors( Seed * , std::vector<Seed*> & );
139 
140  int executeTracker( Track *, std::vector<Seed*> & );
141 
142  void filter( Track * , std::vector<Seed*> & );
143 
144  void ghostBuster( Track * );
145 
146  void alignTracks();
147 
148  void cleanUp();
149 
151 
152  int m_SEscanorder[12];
153 
155 
156  std::vector<Track*> m_tracks;
157 
158  std::vector<Seed*> m_initialseeds;
159 
160  struct CompareSeeds {
161  bool operator()( const Seed * a, const Seed * b )
162  {
163  //std::cout << (*a).m_sectorId << " " << (*b).m_sectorId << " "
164  //<< (*a).m_stationId << " " << (*b).m_stationId << std::endl;
165  return ((*a).m_sectorId == (*b).m_sectorId ) && ((*a).m_stationId == (*b).m_stationId );
166  }
167  };
168 
169  struct SortBySector {
170  bool operator()( const Seed * a, const Seed * b )
171  {
172  return ((*a).m_sectorId <= (*b).m_sectorId );
173  }
174  };
175 
176  struct SortByLayer {
177  bool operator()( const Seed * a, const Seed * b )
178  {
179  return ((*a).m_stationId <= (*b).m_stationId );
180 
181  }
182  };
183 
184 
185 
186  inline void print( const std::vector<Seed*> & seeds )
187  {
188  std::vector<Seed*>::const_iterator itr;
189  for( itr = seeds.begin(); itr != seeds.end(); ++itr)
190  std::cout << (*itr) << '\t';
191  std::cout << '\n';
192  };
193 
194  bool m_debug;
195 
196 };
197 #endif // TTUTRACKINGALG_H
bool operator()(const Seed *a, const Seed *b)
int m_SEscanorder[12]
virtual ~TTUTrackingAlg()
Destructor.
bool process(const TTUInput &)
void findNeighbors(Seed *, std::vector< Seed * > &)
std::vector< Seed * > m_initialseeds
Track(const Track &trk)
void print(const std::vector< Seed * > &seeds)
void ghostBuster(Track *)
TTUTrackingAlg()
Standard constructor.
void setMinTrkLength(int val)
bool operator==(const Seed &rhs)
std::vector< Seed * >::iterator SeedsItr
void filter(Track *, std::vector< Seed * > &)
Seed(int _seId, int _stId, int _tl)
std::vector< Seed * > m_seeds
int executeTracker(Track *, std::vector< Seed * > &)
void runSeedBuster(const TTUInput &)
double sd
double b
Definition: hdecay.h:120
bool operator<(const Track &rhs)
Seed(const Seed &_seed)
double a
Definition: hdecay.h:121
void setBoardSpecs(const TTUBoardSpecs::TTUBoardConfig &)
tuple cout
Definition: gather_cfg.py:121
std::vector< Track * >::iterator TracksItr
long double T
bool operator()(const Seed *a, const Seed *b)
std::vector< Track * > m_tracks
bool operator()(const Seed *a, const Seed *b)
void add(Seed *sd)