CMS 3D CMS Logo

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  ~TTUTrackingAlg( ) override;
31 
32  //... from TTULogic interface:
33 
34  bool process( const TTUInput & ) override;
35 
36  void setBoardSpecs( const TTUBoardSpecs::TTUBoardConfig & ) override;
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  bool operator==(const Seed & rhs)
53  {
54  return (m_sectorId == rhs.m_sectorId)
55  && (m_stationId == rhs.m_stationId);
56  };
57 
58  int m_sectorId;
61 
62  };
63 
64  class Track
65  {
66  public:
67 
68  Track() { m_tracklength = 0; };
69 
70  Track( const Track&) = delete;
71  Track(Track&&) = delete;
72  Track& operator=(Track const&) = delete;
73  Track& operator=(Track&&) = delete;
74 
75  void add( Seed * sd ) {
76  m_seeds.push_back(sd);
77  ++m_tracklength;
78  };
79 
80  void addnone() {
81  if(not m_none) {
82  m_none = std::make_unique<Seed>(0,0,0);
83  }
84  m_seeds.push_back(m_none.get());
85  m_tracklength = -1;
86  };
87 
88  void updateTrkLength() {
89  m_tracklength = m_seeds.size();
90  };
91 
92  bool operator<(const Track &rhs) {
93  return m_tracklength < rhs.m_tracklength;
94  };
95 
96  int length() { return m_tracklength;};
97 
98  std::vector<Seed*> m_seeds;
99 
100  private:
101  std::unique_ptr<Seed> m_none;
103 
104  };
105 
106  void setMinTrkLength( int val )
107  {
109  };
110 
111  template< class T>
113  {
114  bool operator()( T const& a, T const& b ) { return (*a) < (*b) ; }
115  };
116 
117 protected:
118 
119 private:
120 
121  void runSeedBuster( const TTUInput & );
122 
123  void findNeighbors( Seed * , std::vector<Seed*> & );
124 
125  int executeTracker( Track *, std::vector<Seed*> & );
126 
127  void filter( Track * , std::vector<Seed*> & );
128 
129  void ghostBuster( Track * );
130 
131  void alignTracks();
132 
133  void cleanUp();
134 
136 
137  int m_SEscanorder[12];
138 
140 
141  std::vector<std::unique_ptr<Track>> m_tracks;
142 
143  std::vector<std::unique_ptr<Seed>> m_initialseeds;
144 
145  struct CompareSeeds {
146  bool operator()( const Seed * a, const Seed * b )
147  {
148  //std::cout << (*a).m_sectorId << " " << (*b).m_sectorId << " "
149  //<< (*a).m_stationId << " " << (*b).m_stationId << std::endl;
150  return ((*a).m_sectorId == (*b).m_sectorId ) && ((*a).m_stationId == (*b).m_stationId );
151  }
152  };
153 
154  struct SortBySector {
155  bool operator()( const Seed * a, const Seed * b )
156  {
157  return ((*a).m_sectorId <= (*b).m_sectorId );
158  }
159  };
160 
161  struct SortByLayer {
162  bool operator()( const Seed * a, const Seed * b )
163  {
164  return ((*a).m_stationId <= (*b).m_stationId );
165 
166  }
167  };
168 
169 
170 
171  inline void print( const std::vector<Seed*> & seeds )
172  {
173  std::vector<Seed*>::const_iterator itr;
174  for( itr = seeds.begin(); itr != seeds.end(); ++itr)
175  std::cout << (*itr) << '\t';
176  std::cout << '\n';
177  };
178 
179  bool m_debug;
180 
181 };
182 #endif // TTUTRACKINGALG_H
bool operator()(const Seed *a, const Seed *b)
std::vector< std::unique_ptr< Seed > > m_initialseeds
int m_SEscanorder[12]
void setBoardSpecs(const TTUBoardSpecs::TTUBoardConfig &) override
void findNeighbors(Seed *, std::vector< Seed * > &)
void print(const std::vector< Seed * > &seeds)
void ghostBuster(Track *)
TTUTrackingAlg()
Standard constructor.
void setMinTrkLength(int val)
std::vector< std::unique_ptr< Track > > m_tracks
bool operator==(const Seed &rhs)
void filter(Track *, std::vector< Seed * > &)
Seed(int _seId, int _stId, int _tl)
std::vector< Seed * > m_seeds
std::unique_ptr< Seed > m_none
int executeTracker(Track *, std::vector< Seed * > &)
~TTUTrackingAlg() override
Destructor.
bool process(const TTUInput &) override
bool operator()(T const &a, T const &b)
void runSeedBuster(const TTUInput &)
double sd
double b
Definition: hdecay.h:120
bool operator<(const Track &rhs)
double a
Definition: hdecay.h:121
long double T
bool operator()(const Seed *a, const Seed *b)
bool operator()(const Seed *a, const Seed *b)
void add(Seed *sd)