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 // $Id: TTUTrackingAlg.h,v 1.4 2009/07/09 14:03:37 aosorio Exp $
2 #ifndef TTUTRACKINGALG_H
3 #define TTUTRACKINGALG_H 1
4 
5 // Include files
8 
9 #include <iostream>
10 #include <vector>
11 
26 class TTUTrackingAlg : public TTULogic {
27 public:
29  TTUTrackingAlg( );
30 
31  virtual ~TTUTrackingAlg( );
32 
33  //... from TTULogic interface:
34 
35  bool process( const TTUInput & );
36 
38 
39  //...
40 
41  class Seed
42  {
43  public:
44 
45  Seed() {m_sectorId = -9; m_stationId = -1; m_tkLength = 0;};
46  Seed( int _seId, int _stId, int _tl)
47  {
48  m_sectorId = _seId;
49  m_stationId = _stId;
50  m_tkLength = _tl;
51  };
52 
53  ~Seed() {};
54 
55  Seed( const Seed & _seed)
56  {
57  m_sectorId = _seed.m_sectorId;
58  m_stationId = _seed.m_stationId;
59  m_tkLength = _seed.m_tkLength;
60  };
61 
62  bool operator==(const Seed & rhs)
63  {
64  return (m_sectorId == rhs.m_sectorId)
65  && (m_stationId == rhs.m_stationId);
66  };
67 
68  int m_sectorId;
71 
72  };
73 
74  class Track
75  {
76  public:
77 
78  Track() { m_tracklength = 0; };
79  ~Track() {
80  if ( m_tracklength < 0 ) delete m_seeds[0];
81  m_seeds.clear();
82  };
83 
84  Track( const Track & trk )
85  {
86  m_seeds = trk.m_seeds;
88  };
89 
90  void add( Seed * sd ) {
91  m_seeds.push_back(sd);
92  ++m_tracklength;
93  };
94 
95  void addnone() {
96  Seed *_sd = new Seed(0,0,0);
97  m_seeds.push_back(_sd);
98  m_tracklength = -1;
99  };
100 
102  m_tracklength = m_seeds.size();
103  };
104 
105  bool operator<(const Track &rhs) {
106  return m_tracklength < rhs.m_tracklength;
107  };
108 
109  int length() { return m_tracklength;};
110 
111  std::vector<Seed*> m_seeds;
112 
113  private:
114 
116 
117  };
118 
119  typedef std::vector<Seed*>::iterator SeedsItr;
120  typedef std::vector<Track*>::iterator TracksItr;
121 
122  void setMinTrkLength( int val )
123  {
124  m_mintrklength = val;
125  };
126 
127  template< class T>
129  {
130  bool operator()( T* a, T* b ) { return (*a) < (*b) ; }
131  };
132 
133 protected:
134 
135 private:
136 
137  void runSeedBuster( const TTUInput & );
138 
139  void findNeighbors( Seed * , std::vector<Seed*> & );
140 
141  int executeTracker( Track *, std::vector<Seed*> & );
142 
143  void filter( Track * , std::vector<Seed*> & );
144 
145  void ghostBuster( Track * );
146 
147  void alignTracks();
148 
149  void cleanUp();
150 
152 
153  int m_SEscanorder[12];
154 
156 
157  std::vector<Track*> m_tracks;
158 
159  std::vector<Seed*> m_initialseeds;
160 
161  struct CompareSeeds {
162  bool operator()( const Seed * a, const Seed * b )
163  {
164  //std::cout << (*a).m_sectorId << " " << (*b).m_sectorId << " "
165  //<< (*a).m_stationId << " " << (*b).m_stationId << std::endl;
166  return ((*a).m_sectorId == (*b).m_sectorId ) && ((*a).m_stationId == (*b).m_stationId );
167  }
168  };
169 
170  struct SortBySector {
171  bool operator()( const Seed * a, const Seed * b )
172  {
173  return ((*a).m_sectorId <= (*b).m_sectorId );
174  }
175  };
176 
177  struct SortByLayer {
178  bool operator()( const Seed * a, const Seed * b )
179  {
180  return ((*a).m_stationId <= (*b).m_stationId );
181 
182  }
183  };
184 
185 
186 
187  inline void print( const std::vector<Seed*> & seeds )
188  {
189  std::vector<Seed*>::const_iterator itr;
190  for( itr = seeds.begin(); itr != seeds.end(); ++itr)
191  std::cout << (*itr) << '\t';
192  std::cout << '\n';
193  };
194 
195  bool m_debug;
196 
197 };
198 #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 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:41
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)