Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //-------------------------------------------------
0002 //
0003 //   Class L1MuDTTrackCand
0004 //
0005 //   Description: ouput data for DTTF trigger
0006 //
0007 //
0008 //   Author List: Jorge Troconiz  UAM Madrid
0009 //
0010 //
0011 //--------------------------------------------------
0012 
0013 //-----------------------
0014 // This Class's Header --
0015 //-----------------------
0016 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTTrackCand.h"
0017 
0018 //-------------------------------
0019 // Collaborating Class Headers --
0020 //-------------------------------
0021 
0022 //---------------
0023 // C++ Headers --
0024 //---------------
0025 
0026 //-------------------
0027 // Initializations --
0028 //-------------------
0029 
0030 //----------------
0031 // Constructors --
0032 //----------------
0033 L1MuDTTrackCand::L1MuDTTrackCand() : L1MuRegionalCand(0, 0) {
0034   wheel = 0;
0035   sector = 0;
0036   TrkTagCode = -1;
0037   TrkAdd[0] = 3;
0038   TrkAdd[1] = 15;
0039   TrkAdd[2] = 15;
0040   TrkAdd[3] = 15;
0041   TClassCode = 11;
0042 }
0043 
0044 L1MuDTTrackCand::L1MuDTTrackCand(
0045     unsigned dataword, int bx, int uwh, int usc, int utag, int adr1, int adr2, int adr3, int adr4, int utc)
0046     : L1MuRegionalCand(dataword, bx) {
0047   wheel = uwh;
0048   sector = usc;
0049   TrkTagCode = utag;
0050   TrkAdd[0] = adr1 & 0x03;
0051   TrkAdd[1] = adr2;
0052   TrkAdd[2] = adr3;
0053   TrkAdd[3] = adr4;
0054   TClassCode = utc;
0055 
0056   setAdd(1);
0057   setAdd(2);
0058   setAdd(3);
0059   setAdd(4);
0060 }
0061 
0062 L1MuDTTrackCand::L1MuDTTrackCand(unsigned type_idx,
0063                                  unsigned phi,
0064                                  unsigned eta,
0065                                  unsigned pt,
0066                                  unsigned charge,
0067                                  unsigned ch_valid,
0068                                  unsigned finehalo,
0069                                  unsigned quality,
0070                                  int bx,
0071                                  int uwh,
0072                                  int usc,
0073                                  int utag,
0074                                  int adr1,
0075                                  int adr2,
0076                                  int adr3,
0077                                  int adr4)
0078     : L1MuRegionalCand(0, bx) {
0079   setType(type_idx);
0080   setPhiPacked(phi);
0081   setEtaPacked(eta);
0082   setPtPacked(pt);
0083   setChargePacked(charge);
0084   setChargeValidPacked(ch_valid);
0085   setFineHaloPacked(finehalo);
0086   setQualityPacked(quality);
0087 
0088   wheel = uwh;
0089   sector = usc;
0090   TrkTagCode = utag;
0091   TrkAdd[0] = adr1;
0092   TrkAdd[1] = adr2;
0093   TrkAdd[2] = adr3;
0094   TrkAdd[3] = adr4;
0095 
0096   setTC();
0097 }
0098 
0099 //--------------
0100 // Destructor --
0101 //--------------
0102 L1MuDTTrackCand::~L1MuDTTrackCand() {}
0103 
0104 //--------------
0105 // Operations --
0106 //--------------
0107 int L1MuDTTrackCand::whNum() const { return wheel; }
0108 
0109 int L1MuDTTrackCand::scNum() const { return sector; }
0110 
0111 int L1MuDTTrackCand::stNum(int ust) const { return TrkAdd[ust - 1]; }
0112 
0113 int L1MuDTTrackCand::TCNum() const { return TClassCode; }
0114 
0115 int L1MuDTTrackCand::TrkTag() const { return TrkTagCode; }
0116 
0117 void L1MuDTTrackCand::setTC() {
0118   unsigned int uqua = quality_packed();
0119 
0120   switch (uqua) {
0121     case 7: {
0122       TClassCode = 0;
0123       break;
0124     }
0125     case 6: {
0126       TClassCode = 1;
0127       if (TrkAdd[3] != 15)
0128         TClassCode = 2;
0129       break;
0130     }
0131     case 5: {
0132       TClassCode = 3;
0133       break;
0134     }
0135     case 4: {
0136       TClassCode = 4;
0137       break;
0138     }
0139     case 3: {
0140       TClassCode = 5;
0141       if (TrkAdd[3] != 15)
0142         TClassCode = 6;
0143       if (TrkAdd[2] != 15)
0144         TClassCode = 7;
0145       break;
0146     }
0147     case 2: {
0148       TClassCode = 8;
0149       if (TrkAdd[2] != 15)
0150         TClassCode = 9;
0151       break;
0152     }
0153     case 1: {
0154       TClassCode = 10;
0155       break;
0156     }
0157     default: {
0158       TClassCode = 11;
0159       break;
0160     }
0161   }
0162 }
0163 
0164 void L1MuDTTrackCand::setAdd(int ust) {
0165   unsigned int uadd = stNum(ust);
0166 
0167   switch (uadd) {
0168     case 0: {
0169       TrkAdd[ust - 1] = 8;
0170       break;
0171     }
0172     case 1: {
0173       TrkAdd[ust - 1] = 9;
0174       break;
0175     }
0176     case 2: {
0177       TrkAdd[ust - 1] = 0;
0178       break;
0179     }
0180     case 3: {
0181       TrkAdd[ust - 1] = 1;
0182       break;
0183     }
0184     case 4: {
0185       TrkAdd[ust - 1] = 10;
0186       break;
0187     }
0188     case 5: {
0189       TrkAdd[ust - 1] = 11;
0190       break;
0191     }
0192     case 6: {
0193       TrkAdd[ust - 1] = 2;
0194       break;
0195     }
0196     case 7: {
0197       TrkAdd[ust - 1] = 3;
0198       break;
0199     }
0200     case 8: {
0201       TrkAdd[ust - 1] = 12;
0202       break;
0203     }
0204     case 9: {
0205       TrkAdd[ust - 1] = 13;
0206       break;
0207     }
0208     case 10: {
0209       TrkAdd[ust - 1] = 4;
0210       break;
0211     }
0212     case 11: {
0213       TrkAdd[ust - 1] = 5;
0214       break;
0215     }
0216     case 15: {
0217       TrkAdd[ust - 1] = 15;
0218       break;
0219     }
0220     default: {
0221       TrkAdd[ust - 1] = 15;
0222       break;
0223     }
0224   }
0225 
0226   if (ust != 1)
0227     return;
0228 
0229   switch (uadd) {
0230     case 0: {
0231       TrkAdd[0] = 2;
0232       break;
0233     }
0234     case 1: {
0235       TrkAdd[0] = 1;
0236       break;
0237     }
0238     case 15: {
0239       TrkAdd[0] = 3;
0240       break;
0241     }
0242     default: {
0243       TrkAdd[0] = 3;
0244       break;
0245     }
0246   }
0247 }