Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-24 09:53:21

0001 #ifndef TTUTRACKINGALG_H
0002 #define TTUTRACKINGALG_H 1
0003 
0004 // Include files
0005 #include <memory>
0006 #include "L1Trigger/RPCTechnicalTrigger/interface/TTULogic.h"
0007 #include "L1Trigger/RPCTechnicalTrigger/interface/TTUInput.h"
0008 
0009 #include <iostream>
0010 #include <vector>
0011 
0012 /** @class TTUTrackingAlg TTUTrackingAlg.h
0013  *  
0014  *  Tracking Algorithm [ref 2]
0015  *
0016  *  ref 2: <EM>"A configurable Tracking Algorithm to detect cosmic muon
0017  *          tracks for the CMS-RPC based Technical Trigger", R.T.Rajan et al</EM>
0018  *
0019  *
0020  *  @author Andres Osorio
0021  *
0022  *  email: aosorio@uniandes.edu.co
0023  *
0024  *  @date   2008-10-18
0025  */
0026 class TTUTrackingAlg : public TTULogic {
0027 public:
0028   /// Standard constructor
0029   TTUTrackingAlg();
0030 
0031   ~TTUTrackingAlg() override;  ///< Destructor
0032 
0033   //... from TTULogic interface:
0034 
0035   bool process(const TTUInput&) override;
0036 
0037   void setBoardSpecs(const TTUBoardSpecs::TTUBoardConfig&) override;
0038 
0039   //...
0040 
0041   class Seed {
0042   public:
0043     Seed() {
0044       m_sectorId = -9;
0045       m_stationId = -1;
0046       m_tkLength = 0;
0047     };
0048     Seed(int _seId, int _stId, int _tl) {
0049       m_sectorId = _seId;
0050       m_stationId = _stId;
0051       m_tkLength = _tl;
0052     };
0053 
0054     bool operator==(const Seed& rhs) { return (m_sectorId == rhs.m_sectorId) && (m_stationId == rhs.m_stationId); };
0055 
0056     int m_sectorId;
0057     int m_stationId;
0058     int m_tkLength;
0059   };
0060 
0061   class Track {
0062   public:
0063     Track() { m_tracklength = 0; };
0064 
0065     Track(const Track&) = delete;
0066     Track(Track&&) = delete;
0067     Track& operator=(Track const&) = delete;
0068     Track& operator=(Track&&) = delete;
0069 
0070     void add(Seed* sd) {
0071       m_seeds.push_back(sd);
0072       ++m_tracklength;
0073     };
0074 
0075     void addnone() {
0076       if (not m_none) {
0077         m_none = std::make_unique<Seed>(0, 0, 0);
0078       }
0079       m_seeds.push_back(m_none.get());
0080       m_tracklength = -1;
0081     };
0082 
0083     void updateTrkLength() { m_tracklength = m_seeds.size(); };
0084 
0085     bool operator<(const Track& rhs) { return m_tracklength < rhs.m_tracklength; };
0086 
0087     int length() { return m_tracklength; };
0088 
0089     std::vector<Seed*> m_seeds;
0090 
0091   private:
0092     std::unique_ptr<Seed> m_none;
0093     int m_tracklength;
0094   };
0095 
0096   void setMinTrkLength(int val) { m_mintrklength = val; };
0097 
0098   template <class T>
0099   struct CompareMechanism {
0100     bool operator()(T const& a, T const& b) { return (*a) < (*b); }
0101   };
0102 
0103 protected:
0104 private:
0105   void runSeedBuster(const TTUInput&);
0106 
0107   void findNeighbors(Seed*, std::vector<Seed*>&);
0108 
0109   int executeTracker(Track*, std::vector<Seed*>&);
0110 
0111   void filter(Track*, std::vector<Seed*>&);
0112 
0113   void ghostBuster(Track*);
0114 
0115   void alignTracks();
0116 
0117   void cleanUp();
0118 
0119   int m_STscanorder[6];
0120 
0121   int m_SEscanorder[12];
0122 
0123   int m_mintrklength;
0124 
0125   std::vector<std::unique_ptr<Track>> m_tracks;
0126 
0127   std::vector<std::unique_ptr<Seed>> m_initialseeds;
0128 
0129   inline void print(const std::vector<Seed*>& seeds) {
0130     std::vector<Seed*>::const_iterator itr;
0131     for (itr = seeds.begin(); itr != seeds.end(); ++itr)
0132       std::cout << (*itr) << '\t';
0133     std::cout << '\n';
0134   };
0135 
0136   bool m_debug;
0137 };
0138 #endif  // TTUTRACKINGALG_H