Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1Trigger_TrackFindingTMTT_Sector_h
0002 #define L1Trigger_TrackFindingTMTT_Sector_h
0003 
0004 #include "L1Trigger/TrackFindingTMTT/interface/TP.h"
0005 
0006 #include <vector>
0007 #include <unordered_map>
0008 
0009 namespace tmtt {
0010 
0011   class Settings;
0012   class Stub;
0013 
0014   class Sector {
0015   public:
0016     // Initialization.
0017     Sector(const Settings* settings, unsigned int iPhiSec, unsigned int iEtaSec);
0018 
0019     // Check if stub within the eta and/or phi boundaries of this sector.
0020     bool inside(const Stub* stub) const { return (this->insideEta(stub) && this->insidePhi(stub)); }
0021     bool insideEta(const Stub* stub) const;
0022     bool insidePhi(const Stub* stub) const;
0023 
0024     // Check if stub is within subsectors in eta that sector may be divided into.
0025     std::vector<bool> insideEtaSubSecs(const Stub* stub) const;
0026 
0027     unsigned int iPhiSec() const { return iPhiSec_; }  // Sector number.
0028     unsigned int iEtaReg() const { return iEtaReg_; }
0029     float phiCentre() const { return phiCentre_; }  // Return phi of centre of this sector.
0030     float etaMin() const { return etaMin_; }        // Eta range covered by this sector.
0031     float etaMax() const { return etaMax_; }        // Eta range covered by this sector.
0032 
0033     float sectorHalfWidth() const { return sectorHalfWidth_; }  // Half width in phi of sector measured in radians.
0034     float zAtChosenR_Min() const {
0035       return zOuterMin_;
0036     }  // Range in z of particle at chosen radius from beam line covered by this sector.
0037     float zAtChosenR_Max() const { return zOuterMax_; }
0038 
0039     // For performance studies, note which stubs on given tracking particle are inside the sector.
0040     // Returns two booleans for each stub, indicating if they are in phi & eta sectors respectively.
0041     // You can AND them together to check if stub is in (eta,phi) sector.
0042     std::unordered_map<const Stub*, std::pair<bool, bool>> stubsInside(const TP& tp) const;
0043 
0044     // Count number of stubs in given tracking particle which are inside this (phi,eta) sector;
0045     // or inside it if only the eta cuts are applied; or inside it if only the phi cuts are applied.
0046     // The results are returned as the 3 last arguments of the function.
0047     void numStubsInside(const TP& tp,
0048                         unsigned int& nStubsInsideEtaPhi,
0049                         unsigned int& nStubsInsideEta,
0050                         unsigned int& nStubsInsidePhi) const;
0051 
0052     // Check if the helix parameters of a tracking particle (truth) are consistent with this sector.
0053     bool insidePhiSec(const TP& tp) const {
0054       return (std::abs(tp.trkPhiAtR(chosenRofPhi_) - phiCentre_) < sectorHalfWidth_);
0055     }
0056     bool insideEtaReg(const TP& tp) const {
0057       return (tp.trkZAtR(chosenRofZ_) > zOuterMin_ && tp.trkZAtR(chosenRofZ_) < zOuterMax_);
0058     }
0059 
0060   private:
0061     // Check if stub is within eta sector or subsector that is delimated by specified zTrk range.
0062     bool insideEtaRange(const Stub* stub, float zRangeMin, float zRangeMax) const;
0063 
0064     // Digitize a floating point number to 2s complement integer, dropping anything after the decimal point. (Kristian Harder)
0065     int64_t forceBitWidth(const float value, const UInt_t nBits) const;
0066 
0067     // Check if stub is within subsectors in eta that sector may be divided into. Uses digitized calculation corresponding to GP firmware. (Kristian Harder)
0068     std::vector<bool> subEtaFwCalc(const int rT, const int z) const;
0069 
0070   private:
0071     const Settings* settings_;
0072 
0073     // Sector number
0074     unsigned int iPhiSec_;
0075     unsigned int iEtaReg_;
0076     float beamWindowZ_;
0077     float etaMin_;  // Range in eta covered by this sector.
0078     float etaMax_;
0079     float chosenRofZ_;  // Use z of track at radius="chosenRofZ" to define eta sectors.
0080     float zOuterMin_;   // z range of sector at reference radius
0081     float zOuterMax_;
0082 
0083     // Define phi sector.
0084     float phiCentre_;         // phi of centre of sector.
0085     float sectorHalfWidth_;   // sector half-width excluding overlaps.
0086     float chosenRofPhi_;      // Use phi of track at radius="chosenRofPhi" to define phi sectors.
0087     float minPt_;             // Min Pt covered by HT array.
0088     float assumedPhiTrkRes_;  // Tolerance in stub phi0 (or phi65) assumed to be this fraction of phi sector width. (N.B. If > 0.5, then stubs can be shared by more than 2 phi sectors).
0089     bool useStubPhi_;  // Require stub phi to be consistent with track of Pt > HTArraySpec.HoughMinPt that crosses HT phi axis?
0090     bool useStubPhiTrk_;  // Require stub phi0 (or phi65 etc.) as estimated from stub bend, to lie within HT phi axis, allowing tolerance specified below?
0091     bool calcPhiTrkRes_;  // If true, tolerance in stub phi0 (or phi65 etc.) will be reduced below AssumedPhiTrkRes if stub bend resolution specified in HTFilling.BendResolution suggests it is safe to do so.
0092 
0093     // Possible subsectors in eta within each sector.
0094     unsigned int numSubSecsEta_;
0095     std::vector<float> zOuterMinSub_;
0096     std::vector<float> zOuterMaxSub_;
0097   };
0098 
0099 }  // namespace tmtt
0100 
0101 #endif