Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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     ChannelAssignment() {}
0023     ChannelAssignment(const edm::ParameterSet& iConfig, const tt::Setup* setup);
0024     ~ChannelAssignment() {}
0025     // returns channelId of given TTTrackRef from TrackBuilder
0026     int channelId(const TTTrackRef& ttTrackRef) const;
0027     // number of used TB channels for tracks
0028     int numChannelsTrack() const { return numChannelsTrack_; }
0029     // number of used TB channels for stubs
0030     int numChannelsStub() const { return numChannelsStub_; }
0031     // number of bits used to represent layer id [barrel: 0-5, discs: 6-10]
0032     int widthLayerId() const { return widthLayerId_; }
0033     // number of bits used to represent stub id for projected stubs
0034     int widthStubId() const { return widthStubId_; }
0035     // number of bits used to represent stub id for seed stubs
0036     int widthSeedStubId() const { return widthSeedStubId_; }
0037     // number of bits used to distinguish between tilted and untilded barrel modules or 2S and PS endcap modules
0038     int widthPSTilt() const { return widthPSTilt_; }
0039     // depth of fifos within systolic array
0040     int depthMemory() const { return depthMemory_; }
0041     // number of comparison modules used in each DR node
0042     int numComparisonModules() const { return numComparisonModules_; }
0043     // min number of shared stubs to identify duplicates
0044     int minIdenticalStubs() const { return minIdenticalStubs_; }
0045     // number of DR nodes
0046     int numNodesDR() const { return numNodesDR_; }
0047     // number of used seed types in tracklet algorithm
0048     int numSeedTypes() const { return numSeedTypes_; }
0049     // sets layerId (0-7 in sequence the seed type projects to) of given TTStubRef and seedType, returns false if seeed stub
0050     bool layerId(int seedType, const TTStubRef& ttStubRef, int& layerId) const;
0051     // number layers a given seed type projects to
0052     int numProjectionLayers(int seedType) const { return (int)seedTypesProjectionLayers_.at(seedType).size(); }
0053     // max. no. layers that any seed type projects to
0054     int maxNumProjectionLayers() const { return maxNumProjectionLayers_; }
0055     // map of used DTC tfp channels in InputRouter
0056     const std::vector<int>& channelEncoding() const { return channelEncoding_; }
0057     // index of first stub channel belonging to given track channel
0058     int offsetStub(int channelTrack) const;
0059     // seed layers for given seed type id
0060     const std::vector<int>& seedingLayers(int seedType) const { return seedTypesSeedLayers_.at(seedType); }
0061     // returns SensorModule::Type for given TTStubRef
0062     tt::SensorModule::Type type(const TTStubRef& ttStubRef) const { return setup_->type(ttStubRef); }
0063     // layers a seed types can project to using default layer id [barrel: 1-6, discs: 11-15]
0064     int layerId(int seedType, int channel) const;
0065     // 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
0066     int channelId(int seedType, int layerId) const;
0067     // max number of seeding layers
0068     int numSeedingLayers() const { return numSeedingLayers_; }
0069     // return DR node for given ttTrackRef
0070     int nodeDR(const TTTrackRef& ttTrackRef) const;
0071 
0072   private:
0073     // helper class to store configurations
0074     const tt::Setup* setup_;
0075     // DRin parameter
0076     edm::ParameterSet pSetDRin_;
0077     // number of bits used to represent layer id [barrel: 0-5, discs: 6-10]
0078     int widthLayerId_;
0079     // number of bits used to represent stub id for projected stubs
0080     int widthStubId_;
0081     // number of bits used to represent stub id for seed stubs
0082     int widthSeedStubId_;
0083     // number of bits used to distinguish between tilted and untilded barrel modules or 2S and PS endcap modules
0084     int widthPSTilt_;
0085     // depth of fifos within systolic array
0086     int depthMemory_;
0087     // positive pt Boundaries in GeV (symmetric negatives are assumed), first boundary is pt cut, last boundary is infinity, defining ot bins used by DR
0088     std::vector<double> ptBoundaries_;
0089     // DRin parameter
0090     edm::ParameterSet pSetDR_;
0091     // number of comparison modules used in each DR node
0092     int numComparisonModules_;
0093     // min number of shared stubs to identify duplicates [default: 3]
0094     int minIdenticalStubs_;
0095     // number of DR nodes
0096     int numNodesDR_;
0097     // seed type names
0098     std::vector<std::string> seedTypeNames_;
0099     // number of used seed types in tracklet algorithm
0100     int numSeedTypes_;
0101     // number of used TB channels for tracks
0102     int numChannelsTrack_;
0103     // number of used TB channels for stubs
0104     int numChannelsStub_;
0105     // seeding layers of seed types using default layer id [barrel: 1-6, discs: 11-15]
0106     std::vector<std::vector<int>> seedTypesSeedLayers_;
0107     // layers a seed types can project to using default layer id [barrel: 1-6, discs: 11-15]
0108     std::vector<std::vector<int>> seedTypesProjectionLayers_;
0109     // max. number of layers to which any seed type projects
0110     int maxNumProjectionLayers_;
0111     // map of used DTC tfp channels in InputRouter
0112     std::vector<int> channelEncoding_;
0113     // accumulated number of projections layer from seed 0 to vector index
0114     std::vector<int> offsetsStubs_;
0115     // max number of seeding layers
0116     int numSeedingLayers_;
0117   };
0118 
0119 }  // namespace trklet
0120 
0121 EVENTSETUP_DATA_DEFAULT_RECORD(trklet::ChannelAssignment, trklet::ChannelAssignmentRcd);
0122 
0123 #endif