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:
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  public:
42  Seed() {
43  m_sectorId = -9;
44  m_stationId = -1;
45  m_tkLength = 0;
46  };
47  Seed(int _seId, int _stId, int _tl) {
48  m_sectorId = _seId;
49  m_stationId = _stId;
50  m_tkLength = _tl;
51  };
52 
53  bool operator==(const Seed& rhs) { return (m_sectorId == rhs.m_sectorId) && (m_stationId == rhs.m_stationId); };
54 
55  int m_sectorId;
58  };
59 
60  class Track {
61  public:
62  Track() { m_tracklength = 0; };
63 
64  Track(const Track&) = delete;
65  Track(Track&&) = delete;
66  Track& operator=(Track const&) = delete;
67  Track& operator=(Track&&) = delete;
68 
69  void add(Seed* sd) {
70  m_seeds.push_back(sd);
71  ++m_tracklength;
72  };
73 
74  void addnone() {
75  if (not m_none) {
76  m_none = std::make_unique<Seed>(0, 0, 0);
77  }
78  m_seeds.push_back(m_none.get());
79  m_tracklength = -1;
80  };
81 
82  void updateTrkLength() { m_tracklength = m_seeds.size(); };
83 
84  bool operator<(const Track& rhs) { return m_tracklength < rhs.m_tracklength; };
85 
86  int length() { return m_tracklength; };
87 
88  std::vector<Seed*> m_seeds;
89 
90  private:
91  std::unique_ptr<Seed> m_none;
93  };
94 
96 
97  template <class T>
99  bool operator()(T const& a, T const& b) { return (*a) < (*b); }
100  };
101 
102 protected:
103 private:
104  void runSeedBuster(const TTUInput&);
105 
106  void findNeighbors(Seed*, std::vector<Seed*>&);
107 
108  int executeTracker(Track*, std::vector<Seed*>&);
109 
110  void filter(Track*, std::vector<Seed*>&);
111 
112  void ghostBuster(Track*);
113 
114  void alignTracks();
115 
116  void cleanUp();
117 
119 
120  int m_SEscanorder[12];
121 
123 
124  std::vector<std::unique_ptr<Track>> m_tracks;
125 
126  std::vector<std::unique_ptr<Seed>> m_initialseeds;
127 
128  struct CompareSeeds {
129  bool operator()(const Seed* a, const Seed* b) {
130  //std::cout << (*a).m_sectorId << " " << (*b).m_sectorId << " "
131  //<< (*a).m_stationId << " " << (*b).m_stationId << std::endl;
132  return ((*a).m_sectorId == (*b).m_sectorId) && ((*a).m_stationId == (*b).m_stationId);
133  }
134  };
135 
136  struct SortBySector {
137  bool operator()(const Seed* a, const Seed* b) { return ((*a).m_sectorId <= (*b).m_sectorId); }
138  };
139 
140  struct SortByLayer {
141  bool operator()(const Seed* a, const Seed* b) { return ((*a).m_stationId <= (*b).m_stationId); }
142  };
143 
144  inline void print(const std::vector<Seed*>& seeds) {
145  std::vector<Seed*>::const_iterator itr;
146  for (itr = seeds.begin(); itr != seeds.end(); ++itr)
147  std::cout << (*itr) << '\t';
148  std::cout << '\n';
149  };
150 
151  bool m_debug;
152 };
153 #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:118
bool operator<(const Track &rhs)
double a
Definition: hdecay.h:119
long double T
bool operator()(const Seed *a, const Seed *b)
bool operator()(const Seed *a, const Seed *b)
void add(Seed *sd)