Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-03 00:12:20

0001 #ifndef L1Trigger_TrackFindingTracklet_ChannelAssignment_h
0002 #define L1Trigger_TrackFindingTracklet_ChannelAssignment_h
0003 
0004 #include "FWCore/Framework/interface/data_default_record_trait.h"
0005 #include "L1Trigger/TrackFindingTracklet/interface/ChannelAssignmentRcd.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0008 #include "L1Trigger/TrackTrigger/interface/Setup.h"
0009 
0010 #include <vector>
0011 
0012 namespace trklet {
0013 
0014   /*! \class  trklet::ChannelAssignment
0015    *  \brief  Class to assign tracklet tracks and stubs to output channel
0016    *          based on their Pt or seed type as well as DTC stubs to input channel
0017    *  \author Thomas Schuh
0018    *  \date   2020, Nov; updated 2021 Oct
0019    */
0020   class ChannelAssignment {
0021   public:
0022     struct Config {
0023       std::vector<std::string> tmMuxOrder_;
0024       int tmNumLayers_;
0025       int tmWidthStubId_;
0026       int tmWidthCot_;
0027       int numComparisonModules_;
0028       int minIdenticalStubs_;
0029       std::vector<std::string> seedTypeNames_;
0030       int numChannelsStub_;
0031       std::vector<std::vector<int>> seedTypesSeedLayers_;
0032       std::vector<std::vector<int>> seedTypesProjectionLayers_;
0033       int maxNumProjectionLayers_;
0034       std::vector<int> channelEncoding_;
0035       std::vector<int> offsetsStubs_;
0036       int numSeedingLayers_;
0037       std::vector<int> tmMuxOrderInt_;
0038     };
0039     ChannelAssignment() {}
0040     ChannelAssignment(const Config& iConfig, const tt::Setup* setup);
0041     ~ChannelAssignment() = default;
0042     // helper class to store configurations
0043     const tt::Setup* setup() const { return setup_; }
0044     // returns channelId of given TTTrackRef from TrackBuilder
0045     int channelId(const TTTrackRef& ttTrackRef) const;
0046     // number of used TB channels for tracks
0047     int numChannelsTrack() const { return numChannelsTrack_; }
0048     // number of used TB channels for stubs
0049     int numChannelsStub() const { return numChannelsStub_; }
0050     //
0051     const std::vector<int>& tmMuxOrder() const { return tmMuxOrderInt_; }
0052     // number of layers per rtack
0053     int tmNumLayers() const { return tmNumLayers_; }
0054     // number of bits used to represent stub id for projected stubs
0055     int tmWidthStubId() const { return tmWidthStubId_; }
0056     //
0057     int tmWidthCot() const { return tmWidthCot_; }
0058     // number of comparison modules used in each DR node
0059     int numComparisonModules() const { return numComparisonModules_; }
0060     // min number of shared stubs to identify duplicates
0061     int minIdenticalStubs() const { return minIdenticalStubs_; }
0062     // number of used seed types in tracklet algorithm
0063     int numSeedTypes() const { return numSeedTypes_; }
0064     // sets layerId (0-7 in sequence the seed type projects to) of given TTStubRef and seedType, returns false if seeed stub
0065     bool layerId(int seedType, const TTStubRef& ttStubRef, int& layerId) const;
0066     // number layers a given seed type projects to
0067     int numProjectionLayers(int seedType) const { return (int)seedTypesProjectionLayers_.at(seedType).size(); }
0068     // max. no. layers that any seed type projects to
0069     int maxNumProjectionLayers() const { return maxNumProjectionLayers_; }
0070     // map of used DTC tfp channels in InputRouter
0071     const std::vector<int>& channelEncoding() const { return channelEncoding_; }
0072     // index of first stub channel belonging to given track channel
0073     int offsetStub(int channelTrack) const;
0074     // seed layers for given seed type id
0075     const std::vector<int>& seedingLayers(int seedType) const { return seedTypesSeedLayers_.at(seedType); }
0076     // returns SensorModule::Type for given TTStubRef
0077     tt::SensorModule::Type type(const TTStubRef& ttStubRef) const { return setup_->type(ttStubRef); }
0078     // layers a seed types can project to using default layer id [barrel: 1-6, discs: 11-15]
0079     int layerId(int seedType, int channel) const;
0080     // returns TBout channel Id for given seed type and default layer id [barrel: 1-6, discs: 11-15], returns -1 if layerId and seedType are inconsistent
0081     int channelId(int seedType, int layerId) const;
0082     // max number of seeding layers
0083     int numSeedingLayers() const { return numSeedingLayers_; }
0084 
0085   private:
0086     // helper class to store configurations
0087     const tt::Setup* setup_;
0088     //
0089     std::vector<std::string> tmMuxOrder_;
0090     // number of layers per rtack
0091     int tmNumLayers_;
0092     // number of bits used to represent stub id for projected stubs
0093     int tmWidthStubId_;
0094     //
0095     int tmWidthCot_;
0096     // number of comparison modules used in each DR node
0097     int numComparisonModules_;
0098     // min number of shared stubs to identify duplicates [default: 3]
0099     int minIdenticalStubs_;
0100     // seed type names
0101     std::vector<std::string> seedTypeNames_;
0102     // number of used seed types in tracklet algorithm
0103     int numSeedTypes_;
0104     // number of used TB channels for tracks
0105     int numChannelsTrack_;
0106     // number of used TB channels for stubs
0107     int numChannelsStub_;
0108     // seeding layers of seed types using default layer id [barrel: 1-6, discs: 11-15]
0109     std::vector<std::vector<int>> seedTypesSeedLayers_;
0110     // layers a seed types can project to using default layer id [barrel: 1-6, discs: 11-15]
0111     std::vector<std::vector<int>> seedTypesProjectionLayers_;
0112     // max. number of layers to which any seed type projects
0113     int maxNumProjectionLayers_;
0114     // map of used DTC tfp channels in InputRouter
0115     std::vector<int> channelEncoding_;
0116     // accumulated number of projections layer from seed 0 to vector index
0117     std::vector<int> offsetsStubs_;
0118     // max number of seeding layers
0119     int numSeedingLayers_;
0120     //
0121     std::vector<int> tmMuxOrderInt_;
0122   };
0123 
0124 }  // namespace trklet
0125 
0126 EVENTSETUP_DATA_DEFAULT_RECORD(trklet::ChannelAssignment, trklet::ChannelAssignmentRcd);
0127 
0128 #endif