CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/DataFormats/L1DTTrackFinder/src/L1MuDTTrackCand.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class L1MuDTTrackCand
00004 //
00005 //   Description: ouput data for DTTF trigger
00006 //
00007 //
00008 //   Author List: Jorge Troconiz  UAM Madrid
00009 //
00010 //
00011 //--------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTTrackCand.h"
00017 
00018 //-------------------------------
00019 // Collaborating Class Headers --
00020 //-------------------------------
00021 
00022 
00023 //---------------
00024 // C++ Headers --
00025 //---------------
00026 using namespace std;
00027 
00028 //-------------------
00029 // Initializations --
00030 //-------------------
00031 
00032 
00033 //----------------
00034 // Constructors --
00035 //----------------
00036 L1MuDTTrackCand::L1MuDTTrackCand() : L1MuRegionalCand(0,0) {
00037 
00038   wheel           = 0;
00039   sector          = 0;
00040   TrkTagCode      = -1;
00041   TrkAdd[0]       =  3;
00042   TrkAdd[1]       = 15;
00043   TrkAdd[2]       = 15;
00044   TrkAdd[3]       = 15;
00045   TClassCode      = 11;
00046 }
00047 
00048 L1MuDTTrackCand::L1MuDTTrackCand( unsigned dataword, int bx, int uwh, int usc,
00049                        int utag, int adr1, int adr2, int adr3, int adr4, int utc ) :
00050                    L1MuRegionalCand(dataword, bx) {
00051 
00052   wheel           = uwh;
00053   sector          = usc;
00054   TrkTagCode      = utag;
00055   TrkAdd[0]       = adr1&0x03;
00056   TrkAdd[1]       = adr2;
00057   TrkAdd[2]       = adr3;
00058   TrkAdd[3]       = adr4;
00059   TClassCode      = utc;
00060 
00061   setAdd(1);
00062   setAdd(2);
00063   setAdd(3);
00064   setAdd(4);
00065 }
00066 
00067 L1MuDTTrackCand::L1MuDTTrackCand( unsigned type_idx, unsigned phi, unsigned eta,
00068                        unsigned pt, unsigned charge, unsigned ch_valid, unsigned finehalo,
00069                        unsigned quality, int bx, int uwh, int usc, int utag,
00070                        int adr1, int adr2, int adr3, int adr4 ) :
00071                    L1MuRegionalCand(0, bx) {
00072 
00073   setType(type_idx);
00074   setPhiPacked(phi);
00075   setEtaPacked(eta);
00076   setPtPacked(pt);
00077   setChargePacked(charge);
00078   setChargeValidPacked(ch_valid);
00079   setFineHaloPacked(finehalo);
00080   setQualityPacked(quality); 
00081 
00082   wheel           = uwh;
00083   sector          = usc;
00084   TrkTagCode      = utag;
00085   TrkAdd[0]       = adr1;
00086   TrkAdd[1]       = adr2;
00087   TrkAdd[2]       = adr3;
00088   TrkAdd[3]       = adr4;
00089 
00090   setTC();
00091 }
00092 
00093 //--------------
00094 // Destructor --
00095 //--------------
00096 L1MuDTTrackCand::~L1MuDTTrackCand() {
00097 }
00098 
00099 //--------------
00100 // Operations --
00101 //--------------
00102 int L1MuDTTrackCand::whNum() const {
00103   return wheel;
00104 }
00105 
00106 int L1MuDTTrackCand::scNum() const {
00107   return sector;
00108 }
00109 
00110 int L1MuDTTrackCand::stNum(int ust) const {
00111   return TrkAdd[ust-1];
00112 }
00113 
00114 int L1MuDTTrackCand::TCNum() const {
00115   return TClassCode;
00116 }
00117 
00118 int L1MuDTTrackCand::TrkTag() const {
00119   return TrkTagCode;
00120 }
00121 
00122 void L1MuDTTrackCand::setTC() {
00123   unsigned int uqua = quality_packed();
00124 
00125   switch (uqua) {
00126     case 7:  { TClassCode =  0; break; }
00127     case 6:  { TClassCode =  1;
00128                if ( TrkAdd[3] != 15 ) TClassCode = 2;
00129                break; }
00130     case 5:  { TClassCode =  3; break; }
00131     case 4:  { TClassCode =  4; break; }
00132     case 3:  { TClassCode =  5;
00133                if ( TrkAdd[3] != 15 ) TClassCode = 6;
00134                if ( TrkAdd[2] != 15 ) TClassCode = 7;
00135                break; }
00136     case 2:  { TClassCode =  8;
00137                if ( TrkAdd[2] != 15 ) TClassCode = 9;
00138                break; }
00139     case 1:  { TClassCode = 10; break; }
00140     default: { TClassCode = 11; break; }
00141   }
00142 }
00143 
00144 void L1MuDTTrackCand::setAdd(int ust) {
00145   unsigned int uadd = stNum(ust);
00146 
00147   switch (uadd) {
00148     case  0:  { TrkAdd[ust-1] =   8; break; }
00149     case  1:  { TrkAdd[ust-1] =   9; break; }
00150     case  2:  { TrkAdd[ust-1] =   0; break; }
00151     case  3:  { TrkAdd[ust-1] =   1; break; }
00152     case  4:  { TrkAdd[ust-1] =  10; break; }
00153     case  5:  { TrkAdd[ust-1] =  11; break; }
00154     case  6:  { TrkAdd[ust-1] =   2; break; }
00155     case  7:  { TrkAdd[ust-1] =   3; break; }
00156     case  8:  { TrkAdd[ust-1] =  12; break; }
00157     case  9:  { TrkAdd[ust-1] =  13; break; }
00158     case 10:  { TrkAdd[ust-1] =   4; break; }
00159     case 11:  { TrkAdd[ust-1] =   5; break; }
00160     case 15:  { TrkAdd[ust-1] =  15; break; }
00161     default:  { TrkAdd[ust-1] =  15; break; }
00162   }
00163 
00164   if (ust!=1) return;
00165     
00166   switch (uadd) {
00167     case  0:  { TrkAdd[0] =  2; break; }
00168     case  1:  { TrkAdd[0] =  1; break; }
00169     case 15:  { TrkAdd[0] =  3; break; }
00170     default:  { TrkAdd[0] =  3; break; }
00171   }
00172 }