Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:13:44

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     // sets channelId of given TTTrackRef from TrackBuilder or PurgeDuplicate (if enabled), return false if track outside pt range
0026     bool channelId(const TTTrackRef& ttTrackRef, int& channelId);
0027     // number of used channels for tracks
0028     int numChannelsTrack() const { return numChannelsTrack_; }
0029     // number of used channels for stubs
0030     int numChannelsStub() const { return numChannelsStub_; }
0031     // number of used seed types in tracklet algorithm
0032     int numSeedTypes() const { return numSeedTypes_; }
0033     // sets layerId (0-7 in sequence the seed type projects to) of given TTStubRef and seedType, returns false if seeed stub
0034     bool layerId(int seedType, const TTStubRef& ttStubRef, int& layerId) const;
0035     // number layers a given seed type projects to
0036     int numProjectionLayers(int seedType) const { return (int)seedTypesProjectionLayers_.at(seedType).size(); }
0037     // max. no. layers that any seed type projects to
0038     int maxNumProjectionLayers() const { return maxNumProjectionLayers_; }
0039     // map of used DTC tfp channels in InputRouter
0040     const std::vector<int>& channelEncoding() const { return channelEncoding_; }
0041     // index of first stub channel belonging to given track channel
0042     int offsetStub(int channelTrack) const;
0043     // seed layers for given seed type id
0044     const std::vector<int>& seedingLayers(int seedType) const { return seedTypesSeedLayers_.at(seedType); }
0045     //
0046     tt::SensorModule::Type type(const TTStubRef& ttStubRef) const { return setup_->type(ttStubRef); }
0047     //
0048     int layerId(int seedType, int channel) const { return seedTypesProjectionLayers_.at(seedType).at(channel); }
0049     //
0050     int channelId(int seedType, int layerId) const;
0051     // max number of seeding layers
0052     int numSeedingLayers() const { return numSeedingLayers_; }
0053 
0054   private:
0055     // helper class to store configurations
0056     const tt::Setup* setup_;
0057     // use tracklet seed type as channel id if False, binned track pt used if True
0058     bool useDuplicateRemoval_;
0059     // pt Boundaries in GeV, last boundary is infinity
0060     std::vector<double> boundaries_;
0061     // seed type names
0062     std::vector<std::string> seedTypeNames_;
0063     // number of used seed types in tracklet algorithm
0064     int numSeedTypes_;
0065     // number of used channels for tracks
0066     int numChannelsTrack_;
0067     // number of used channels for stubs
0068     int numChannelsStub_;
0069     // seeding layers of seed types using default layer id [barrel: 1-6, discs: 11-15]
0070     std::vector<std::vector<int>> seedTypesSeedLayers_;
0071     // layers a seed types can project to using default layer id [barrel: 1-6, discs: 11-15]
0072     std::vector<std::vector<int>> seedTypesProjectionLayers_;
0073     // max. number of layers to which any seed type projects
0074     int maxNumProjectionLayers_;
0075     // map of used DTC tfp channels in InputRouter
0076     std::vector<int> channelEncoding_;
0077     // accumulated number of projections layer from seed 0 to vector index
0078     std::vector<int> offsetsStubs_;
0079     // max number of seeding layers
0080     int numSeedingLayers_;
0081   };
0082 
0083 }  // namespace trklet
0084 
0085 EVENTSETUP_DATA_DEFAULT_RECORD(trklet::ChannelAssignment, trklet::ChannelAssignmentRcd);
0086 
0087 #endif