Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:45

0001 #include <DataFormats/L1CSCTrackFinder/interface/L1TrackId.h>
0002 
0003 namespace csc {
0004   L1TrackId::L1TrackId() {}
0005 
0006   L1TrackId::L1TrackId(const unsigned& side, const unsigned& sector) {
0007     /// Use a fake cscid and station... We just need to know endcap and sector
0008     id_ = CSCDetId(side, 2, 1, CSCTriggerNumbering::chamberFromTriggerLabels(sector, 0, 2, 1), 0);
0009   }
0010 
0011   L1TrackId::L1TrackId(const csc::L1TrackId& id) {
0012     m_rank = id.m_rank;
0013     m_mode = id.m_mode;
0014     m_erase = id.m_erase;
0015     m_overlap = id.m_overlap;
0016     id_ = id.id_;
0017     //stubs = id.stubs;  // add stubs back later
0018   }
0019 
0020   const csc::L1TrackId& L1TrackId::operator=(const csc::L1TrackId& rhs) {
0021     if (&rhs != this) {
0022       m_rank = rhs.m_rank;
0023       m_mode = rhs.m_mode;
0024       m_erase = rhs.m_erase;
0025       m_overlap = rhs.m_overlap;
0026       id_ = rhs.id_;
0027       //stubs = rhs.stubs;
0028     }
0029     return *this;
0030   }
0031 
0032   bool L1TrackId::sharesHit(const csc::L1TrackId& a_id) const {
0033     return false;  // finish later
0034   }
0035 
0036   void L1TrackId::setOverlap(const unsigned& rank) {
0037     if ((rank == 7) || (rank == 8) || (rank == 9) || (rank == 12) || (rank == 15) || (rank == 19) || (rank == 20) ||
0038         (rank == 24) || (rank == 25) || (rank == 29) || (rank == 30) || (rank == 32) || (rank == 34) || (rank == 36)) {
0039       m_overlap = true;
0040     } else
0041       m_overlap = false;
0042   }
0043 
0044   void L1TrackId::setRank(const unsigned& rank) {
0045     if (rank < (1 << kRankBitWidth))  // rank >= 0, since rank is unsigned
0046     {
0047       m_rank = rank;
0048       setOverlap(rank);
0049     } else {
0050       m_rank = 0;
0051     }
0052   }
0053 
0054   // Helper function to determine which 2 segments from overlap region
0055   // track participate in 2-stn Pt assignment, and what mode to use,
0056   // based on track rank
0057   // four modes in this order: B1-E1, B1-E2, B2-E1, B2-E2
0058   // Let's include only mode 2, 4 tracks (7-27-00)
0059   void L1TrackId::overlapMode(const unsigned& rank, int& mode, int& stnA, int& stnB) {
0060     switch (rank) {
0061       case 7:
0062         stnA = 2;
0063         stnB = 1;
0064         mode = 4;
0065         break;
0066       case 8:
0067         stnA = 3;
0068         stnB = 2;
0069         mode = 4;
0070         break;
0071       case 9:
0072         stnA = 2;
0073         stnB = 1;
0074         mode = 2;
0075         break;
0076       case 12:
0077         stnA = 2;
0078         stnB = 1;
0079         mode = 2;
0080         break;
0081       case 15:
0082         stnA = 2;
0083         stnB = 1;
0084         mode = 2;
0085         break;
0086       case 19:
0087         stnA = 3;
0088         stnB = 2;
0089         mode = 2;
0090         break;
0091       case 20:
0092         stnA = 2;
0093         stnB = 1;
0094         mode = 2;
0095         break;
0096       case 24:
0097         stnA = 3;
0098         stnB = 2;
0099         mode = 2;
0100         break;
0101       case 25:
0102         stnA = 2;
0103         stnB = 1;
0104         mode = 2;
0105         break;
0106       case 29:
0107         stnA = 3;
0108         stnB = 2;
0109         mode = 2;
0110         break;
0111       case 30:
0112         stnA = 2;
0113         stnB = 1;
0114         mode = 2;
0115         break;
0116       case 32:
0117         stnA = 3;
0118         stnB = 2;
0119         mode = 2;
0120         break;
0121       case 34:
0122         stnA = 3;
0123         stnB = 2;
0124         mode = 2;
0125         break;
0126       case 36:
0127         stnA = 3;
0128         stnB = 2;
0129         mode = 2;
0130         break;
0131       default:
0132         // standard case for CSC tracks
0133         stnA = 1;
0134         stnB = 2;
0135         mode = 0;
0136     }
0137   }
0138 
0139   unsigned L1TrackId::encodeLUTMode(const unsigned& rank) const {
0140     int mode;
0141     switch (rank) {
0142       case 0:
0143         mode = 0;
0144         break;
0145       case 1:
0146         mode = 10;
0147         break;
0148       case 2:
0149         mode = 9;
0150         break;
0151       case 3:
0152         mode = 8;
0153         break;
0154       case 4:
0155         mode = 5;
0156         break;
0157       case 5:
0158         mode = 7;
0159         break;
0160       case 6:
0161         mode = 6;
0162         break;
0163       case 7:
0164         mode = 15;
0165         break;
0166       case 8:
0167         mode = 13;
0168         break;
0169       case 9:
0170         mode = 14;
0171         break;
0172       case 10:
0173         mode = 7;
0174         break;
0175       case 11:
0176         mode = 6;
0177         break;
0178       case 12:
0179         mode = 14;
0180         break;
0181       case 13:
0182         mode = 7;
0183         break;
0184       case 14:
0185         mode = 6;
0186         break;
0187       case 15:
0188         mode = 14;
0189         break;
0190       case 16:
0191         mode = 4;
0192         break;
0193       case 17:
0194         mode = 3;
0195         break;
0196       case 18:
0197         mode = 2;
0198         break;
0199       case 19:
0200         mode = 12;
0201         break;
0202       case 20:
0203         mode = 11;
0204         break;
0205       case 21:
0206         mode = 4;
0207         break;
0208       case 22:
0209         mode = 3;
0210         break;
0211       case 23:
0212         mode = 2;
0213         break;
0214       case 24:
0215         mode = 12;
0216         break;
0217       case 25:
0218         mode = 11;
0219         break;
0220       case 26:
0221         mode = 4;
0222         break;
0223       case 27:
0224         mode = 3;
0225         break;
0226       case 28:
0227         mode = 2;
0228         break;
0229       case 29:
0230         mode = 12;
0231         break;
0232       case 30:
0233         mode = 11;
0234         break;
0235       case 31:
0236         mode = 2;
0237         break;
0238       case 32:
0239         mode = 11;
0240         break;
0241       case 33:
0242         mode = 2;
0243         break;
0244       case 34:
0245         mode = 11;
0246         break;
0247       case 35:
0248         mode = 2;
0249         break;
0250       case 36:
0251         mode = 11;
0252         break;
0253       default:
0254         mode = 0;
0255     }
0256     return mode;
0257   }
0258 
0259   bool L1TrackId::hasME1(const unsigned& rank) const {
0260     bool me = false;
0261     switch (rank) {
0262       case 5:
0263       case 6:
0264       case 10:
0265       case 11:
0266       case 12:
0267       case 13:
0268       case 14:
0269       case 16:
0270       case 17:
0271       case 18:
0272       case 21:
0273       case 22:
0274       case 23:
0275       case 26:
0276       case 27:
0277       case 28:
0278       case 31:
0279       case 33:
0280       case 35:
0281         me = true;
0282         break;
0283       default:
0284         me = false;
0285     }
0286     return me;
0287   }
0288 
0289   bool L1TrackId::hasME2(const unsigned& rank) const {
0290     bool me = false;
0291     switch (rank) {
0292       case 2:
0293       case 3:
0294       case 4:
0295       case 6:
0296       case 7:
0297       case 8:
0298       case 9:
0299       case 11:
0300       case 12:
0301       case 14:
0302       case 15:
0303       case 17:
0304       case 18:
0305       case 19:
0306       case 20:
0307       case 22:
0308       case 23:
0309       case 24:
0310       case 25:
0311       case 27:
0312       case 28:
0313       case 29:
0314       case 30:
0315       case 31:
0316       case 32:
0317       case 33:
0318       case 34:
0319       case 35:
0320       case 36:
0321         me = true;
0322         break;
0323       default:
0324         me = false;
0325     }
0326     return me;
0327   }
0328 
0329   bool L1TrackId::hasME3(const unsigned& rank) const {
0330     bool me = false;
0331     switch (rank) {
0332       case 1:
0333       case 3:
0334       case 4:
0335       case 5:
0336       case 10:
0337       case 13:
0338       case 16:
0339       case 18:
0340       case 21:
0341       case 23:
0342       case 26:
0343       case 28:
0344       case 31:
0345       case 33:
0346       case 35:
0347         me = true;
0348         break;
0349       default:
0350         me = false;
0351     }
0352     return me;
0353   }
0354 
0355   bool L1TrackId::hasME4(const unsigned& rank) const {
0356     bool me = false;
0357     switch (rank) {
0358       case 1:
0359       case 2:
0360       case 4:
0361       case 16:
0362       case 17:
0363       case 21:
0364       case 22:
0365       case 26:
0366       case 27:
0367       case 31:
0368       case 33:
0369       case 35:
0370         me = true;
0371         break;
0372       default:
0373         me = false;
0374     }
0375     return me;
0376   }
0377 
0378   bool L1TrackId::hasMB1(const unsigned& rank) const {
0379     bool mb = false;
0380     switch (rank) {
0381       case 9:
0382       case 12:
0383       case 15:
0384       case 19:
0385       case 20:
0386       case 24:
0387       case 25:
0388       case 29:
0389       case 30:
0390       case 32:
0391       case 34:
0392       case 36:
0393         mb = true;
0394         break;
0395       default:
0396         mb = false;
0397     }
0398     return mb;
0399   }
0400 
0401 }  // namespace csc