Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:53

0001 #ifndef L1Trigger_TrackFindingTracklet_DR_h
0002 #define L1Trigger_TrackFindingTracklet_DR_h
0003 
0004 #include "L1Trigger/TrackTrigger/interface/Setup.h"
0005 #include "L1Trigger/TrackerTFP/interface/DataFormats.h"
0006 #include "L1Trigger/TrackFindingTracklet/interface/ChannelAssignment.h"
0007 
0008 #include <vector>
0009 
0010 namespace trklet {
0011 
0012   /*! \class  trklet::DR
0013    *  \brief  Class to bit- and clock-accurate emulate duplicate removal
0014    *          DR identifies duplicates based on pairs of tracks that share stubs in at least 3 layers.
0015    *          It keeps the first such track in each pair.
0016    *  \author Thomas Schuh
0017    *  \date   2023, Feb
0018    */
0019   class DR {
0020   public:
0021     DR(const edm::ParameterSet& iConfig,
0022        const tt::Setup* setup_,
0023        const trackerTFP::DataFormats* dataFormats,
0024        const ChannelAssignment* channelAssignment,
0025        int region);
0026     ~DR() {}
0027     // read in and organize input tracks and stubs
0028     void consume(const tt::StreamsTrack& streamsTrack, const tt::StreamsStub& streamsStub);
0029     // fill output products
0030     void produce(tt::StreamsStub& accpetedStubs,
0031                  tt::StreamsTrack& acceptedTracks,
0032                  tt::StreamsStub& lostStubs,
0033                  tt::StreamsTrack& lostTracks);
0034 
0035   private:
0036     struct Stub {
0037       Stub(const tt::FrameStub& frame, int stubId, int channel) : frame_(frame), stubId_(stubId), channel_(channel) {}
0038       bool operator==(const Stub& s) const { return s.stubId_ == stubId_; }
0039       tt::FrameStub frame_;
0040       // all stubs id
0041       int stubId_;
0042       // kf layer id
0043       int channel_;
0044     };
0045     struct Track {
0046       // max number of stubs a track may formed of (we allow only one stub per layer)
0047       static constexpr int max_ = 7;
0048       Track() { stubs_.reserve(max_); }
0049       Track(const tt::FrameTrack& frame, const std::vector<Stub*>& stubs) : frame_(frame), stubs_(stubs) {}
0050       tt::FrameTrack frame_;
0051       std::vector<Stub*> stubs_;
0052     };
0053     // compares two tracks, returns true if those are considered duplicates
0054     bool equalEnough(Track* t0, Track* t1) const;
0055     // true if truncation is enbaled
0056     bool enableTruncation_;
0057     // provides run-time constants
0058     const tt::Setup* setup_;
0059     // provides dataformats
0060     const trackerTFP::DataFormats* dataFormats_;
0061     // helper class to assign tracks to channel
0062     const ChannelAssignment* channelAssignment_;
0063     // processing region (0 - 8) aka processing phi nonant
0064     const int region_;
0065     // storage of input tracks
0066     std::vector<Track> tracks_;
0067     // storage of input stubs
0068     std::vector<Stub> stubs_;
0069     // h/w liked organized pointer to input tracks
0070     std::vector<std::vector<Track*>> input_;
0071   };
0072 
0073 }  // namespace trklet
0074 
0075 #endif