test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MakeRegionalCand.h
Go to the documentation of this file.
1 
8 
11 
12 int GMT_eta_from_theta[128] = {239, 235, 233, 230, 227, 224, 222, 219, 217, 214, 212, 210, 207, 205, 203, 201,
13  199, 197, 195, 193, 191, 189, 187, 186, 184, 182, 180, 179, 177, 176, 174, 172,
14  171, 169, 168, 166, 165, 164, 162, 161, 160, 158, 157, 156, 154, 153, 152, 151,
15  149, 148, 147, 146, 145, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133,
16  132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117,
17  116, 116, 115, 114, 113, 112, 111, 110, 110, 109, 108, 107, 106, 106, 105, 104,
18  103, 102, 102, 101, 100, 99, 99, 98, 97, 96, 96, 95, 94, 93, 93, 92,
19  91, 91, 90, 89, 89, 88, 87, 87, 86, 85, 84, 84, 83, 83, 82, 81};
20 
21 int GetPackedEta (int theta, int sector) {
22 
23  if (theta < 0) return 0;
24  if (sector > 5) {
25  if (theta > 127) return -240;
26  else return -1*GMT_eta_from_theta[theta] - 1;
27  }
28  else {
29  if (theta > 127) return 239;
30  else return GMT_eta_from_theta[theta];
31  }
32 }
33 
34 float GetGlobalEta(int theta, int sector){ // Should use calc_eta to compute - AWB 07.05.16
35 
36  // Underlying calculation:
37  // float theta_angle = (theta*0.2851562 + 8.5)*(pi/180);
38  // float eta = (-1)*log(tan(theta_angle/2));
39 
40  return 0.010875 * GetPackedEta(theta, sector);
41 }
42 
43 int GetPackedPhi(int phi){
44 
45  // Experimentally, this factor must be between 0.979752 and 0.979758 - AWB 11.05.16
46  float phiDeg = (phi / (0.625 * 60)) * 0.979755;
47  int PackedPhi = floor( phiDeg - 35 );
48 
49  return PackedPhi;
50 
51 }
52 
53 
55  int sign, int mode,
56  int trackaddress, int sector){
57 
59 
60  int iEta = GetPackedEta(theta,sector);
61  int iPhi = GetPackedPhi(phi);
62 
64  if(sector > 5){
65  TFtype = l1t::tftype::emtf_neg;
66  sector -= 6;
67  }
68 
69  // compressed pt = pt*2 (scale) + 1 (iPt = 0 is empty candidate)
70  int iPt = pt*2 + 1;
71  if(iPt > 511)
72  iPt = 511;
73 
74  if(iPt < 0)
75  iPt = 0;
76 
77  int iQual = -999;
78 
79  int LSB = mode & 3;
80 
81  float eta = GetGlobalEta(theta,sector);
82 
83  if(eta < 1.2){
84 
85  switch(mode){
86  case(15): iQual = 8;break;
87  case(14): iQual = 4;break;
88  case(13): iQual = 4;break;
89  case(12): iQual = 4;break;
90  case(11): iQual = 4;break;
91  default: iQual = 4;break;
92  }
93 
94  }
95  else{
96 
97  switch(mode){
98  case(15): iQual = 12;break;
99  case(14): iQual = 12;break;
100  case(13): iQual = 12;break;
101  case(12): iQual = 8;break;
102  case(11): iQual = 12;break;
103  case(10): iQual = 8;break;
104  case(7): iQual = 8;break;
105  default: iQual = 4;break;
106  }
107 
108  }
109  iQual |= LSB;
110 
111  Cand.setHwPt(iPt);
112  Cand.setHwEta(iEta);
113  Cand.setHwPhi(iPhi);
114  Cand.setHwSign(sign);
115  Cand.setHwSignValid(1);
116  Cand.setHwQual(iQual);
117  // jl: FIXME this has to be adapted to the new schema of saving track addresses
118  //Cand.setTrackSubAddress(l1t::RegionalMuonCand::kME12, trackaddress&0xf);
119  //Cand.setTrackSubAddress(l1t::RegionalMuonCand::kME22, trackaddress>>4);
120  Cand.setTFIdentifiers(sector,TFtype);
121 
122 
123  return Cand;
124 
125 }
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
double sign(double x)
Geom::Theta< T > theta() const
int GetPackedPhi(int phi)
void setTFIdentifiers(int processor, tftype trackFinder)
Set the processor ID, track-finder type. From these two, the link is set.
l1t::RegionalMuonCand MakeRegionalCand(float pt, int phi, int theta, int sign, int mode, int trackaddress, int sector)
float GetGlobalEta(int theta, int sector)
void setHwQual(int bits)
Set compressed quality code as transmitted by hardware (4 bits)
void setHwPt(int bits)
Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits)
void setHwEta(int bits)
Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits)
int GetPackedEta(int theta, int sector)
int GMT_eta_from_theta[128]
Geom::Phi< T > phi() const
void setHwSignValid(int bits)
Set whether charge measurement is valid (0 for high pT muons)
void setHwSign(int bits)
Set charge sign bit (charge = (-1)^(sign))