CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuDTTrackCand.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class L1MuDTTrackCand
4 //
5 // Description: ouput data for DTTF trigger
6 //
7 //
8 // Author List: Jorge Troconiz UAM Madrid
9 //
10 //
11 //--------------------------------------------------
12 
13 //-----------------------
14 // This Class's Header --
15 //-----------------------
17 
18 //-------------------------------
19 // Collaborating Class Headers --
20 //-------------------------------
21 
22 
23 //---------------
24 // C++ Headers --
25 //---------------
26 using namespace std;
27 
28 //-------------------
29 // Initializations --
30 //-------------------
31 
32 
33 //----------------
34 // Constructors --
35 //----------------
37 
38  wheel = 0;
39  sector = 0;
40  TrkTagCode = -1;
41  TrkAdd[0] = 3;
42  TrkAdd[1] = 15;
43  TrkAdd[2] = 15;
44  TrkAdd[3] = 15;
45  TClassCode = 11;
46 }
47 
48 L1MuDTTrackCand::L1MuDTTrackCand( unsigned dataword, int bx, int uwh, int usc,
49  int utag, int adr1, int adr2, int adr3, int adr4, int utc ) :
50  L1MuRegionalCand(dataword, bx) {
51 
52  wheel = uwh;
53  sector = usc;
54  TrkTagCode = utag;
55  TrkAdd[0] = adr1&0x03;
56  TrkAdd[1] = adr2;
57  TrkAdd[2] = adr3;
58  TrkAdd[3] = adr4;
59  TClassCode = utc;
60 
61  setAdd(1);
62  setAdd(2);
63  setAdd(3);
64  setAdd(4);
65 }
66 
67 L1MuDTTrackCand::L1MuDTTrackCand( unsigned type_idx, unsigned phi, unsigned eta,
68  unsigned pt, unsigned charge, unsigned ch_valid, unsigned finehalo,
69  unsigned quality, int bx, int uwh, int usc, int utag,
70  int adr1, int adr2, int adr3, int adr4 ) :
71  L1MuRegionalCand(0, bx) {
72 
73  setType(type_idx);
74  setPhiPacked(phi);
75  setEtaPacked(eta);
76  setPtPacked(pt);
77  setChargePacked(charge);
78  setChargeValidPacked(ch_valid);
79  setFineHaloPacked(finehalo);
80  setQualityPacked(quality);
81 
82  wheel = uwh;
83  sector = usc;
84  TrkTagCode = utag;
85  TrkAdd[0] = adr1;
86  TrkAdd[1] = adr2;
87  TrkAdd[2] = adr3;
88  TrkAdd[3] = adr4;
89 
90  setTC();
91 }
92 
93 //--------------
94 // Destructor --
95 //--------------
97 }
98 
99 //--------------
100 // Operations --
101 //--------------
103  return wheel;
104 }
105 
107  return sector;
108 }
109 
110 int L1MuDTTrackCand::stNum(int ust) const {
111  return TrkAdd[ust-1];
112 }
113 
115  return TClassCode;
116 }
117 
119  return TrkTagCode;
120 }
121 
123  unsigned int uqua = quality_packed();
124 
125  switch (uqua) {
126  case 7: { TClassCode = 0; break; }
127  case 6: { TClassCode = 1;
128  if ( TrkAdd[3] != 15 ) TClassCode = 2;
129  break; }
130  case 5: { TClassCode = 3; break; }
131  case 4: { TClassCode = 4; break; }
132  case 3: { TClassCode = 5;
133  if ( TrkAdd[3] != 15 ) TClassCode = 6;
134  if ( TrkAdd[2] != 15 ) TClassCode = 7;
135  break; }
136  case 2: { TClassCode = 8;
137  if ( TrkAdd[2] != 15 ) TClassCode = 9;
138  break; }
139  case 1: { TClassCode = 10; break; }
140  default: { TClassCode = 11; break; }
141  }
142 }
143 
144 void L1MuDTTrackCand::setAdd(int ust) {
145  unsigned int uadd = stNum(ust);
146 
147  switch (uadd) {
148  case 0: { TrkAdd[ust-1] = 8; break; }
149  case 1: { TrkAdd[ust-1] = 9; break; }
150  case 2: { TrkAdd[ust-1] = 0; break; }
151  case 3: { TrkAdd[ust-1] = 1; break; }
152  case 4: { TrkAdd[ust-1] = 10; break; }
153  case 5: { TrkAdd[ust-1] = 11; break; }
154  case 6: { TrkAdd[ust-1] = 2; break; }
155  case 7: { TrkAdd[ust-1] = 3; break; }
156  case 8: { TrkAdd[ust-1] = 12; break; }
157  case 9: { TrkAdd[ust-1] = 13; break; }
158  case 10: { TrkAdd[ust-1] = 4; break; }
159  case 11: { TrkAdd[ust-1] = 5; break; }
160  case 15: { TrkAdd[ust-1] = 15; break; }
161  default: { TrkAdd[ust-1] = 15; break; }
162  }
163 
164  if (ust!=1) return;
165 
166  switch (uadd) {
167  case 0: { TrkAdd[0] = 2; break; }
168  case 1: { TrkAdd[0] = 1; break; }
169  case 15: { TrkAdd[0] = 3; break; }
170  default: { TrkAdd[0] = 3; break; }
171  }
172 }
void setAdd(int ust)
int whNum() const
void setChargeValidPacked(unsigned valid)
Set Charge Valid.
void setType(unsigned type)
Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC.
void setChargePacked(unsigned ch)
Set Charge (0=pos, 1=neg)
int TrkTag() const
void setPtPacked(unsigned pt)
Set Pt: 0..31.
int scNum() const
Geom::Phi< T > phi() const
void setPhiPacked(unsigned phi)
Set Phi: 0..143.
unsigned int quality_packed() const
return quality packed as in hardware
void setQualityPacked(unsigned qual)
Set Quality: 0..7.
void setEtaPacked(unsigned eta)
Set Eta: 6-bit code.
int TCNum() const
void setFineHaloPacked(unsigned fh)
Set Fine / Halo.
int stNum(int ust) const