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 
13 
14 int GetPackedEta(float theta, int sector){
15 
16  float scale = 1/0.010875;
17 
18  float theta_angle = (theta*0.2851562 + 8.5)*(3.14159265359/180);
19  float eta = (-1)*log(tan(theta_angle/2));
20  if(sector > 5)
21  eta *= -1;
22 
23  int PackedEta = eta*scale;
24  if(eta < 0)
25  PackedEta -= 1;
26 
27  if(PackedEta > 239)
28  PackedEta = 239;
29 
30  if(PackedEta < -240)
31  PackedEta = -240;
32 
33  //if(PackedEta < 0)
34  // PackedEta = 512 + PackedEta;
35 
36  return PackedEta;
37 
38 }
39 
40 float GetGlobalEta(float theta, int sector){
41 
42  float theta_angle = (theta*0.2851562 + 8.5)*(3.14159265359/180);
43  float eta = (-1)*log(tan(theta_angle/2));
44  if(sector > 5)
45  eta *= -1;
46 
47  return eta;
48 
49 }
50 
51 int GetPackedPhi(int phi){
52 
53  float phiDeg = (phi*0.0166666);
54  phiDeg -= 2.0;
55 
56 
57  int PackedPhi = phiDeg/0.625;
58 
59  //if(PackedPhi < 0)
60  // PackedPhi = 256 + PackedPhi;
61 
62  return PackedPhi;
63 
64 }
65 
66 
68  int sign, int quality,
69  int trackaddress, int sector){
70 
72 
73  int iEta = GetPackedEta(theta,sector);
74  int iPhi = GetPackedPhi(phi);
75 
77  if(sector > 5){
78  TFtype = l1t::tftype::emtf_neg;
79  sector -= 6;
80  }
81 
82  // compressed pt = pt*2 (scale) + 1 (iPt = 0 is empty candidate)
83  int iPt = pt*2 + 1;
84  if(iPt > 511)
85  iPt = 511;
86 
87  if(iPt < 0)
88  iPt = 0;
89 
90  int iQual = quality;
91 
92  int LSB = quality & 3;
93 
94  float eta = GetGlobalEta(theta,sector);
95 
96  if(eta < 1.2){
97 
98  switch(quality){
99  case(15): iQual = 8;break;
100  case(14): iQual = 4;break;
101  case(13): iQual = 4;break;
102  case(12): iQual = 4;break;
103  case(11): iQual = 4;break;
104  default: iQual = 4;break;
105  }
106 
107  }
108  else{
109 
110  switch(quality){
111  case(15): iQual = 12;break;
112  case(14): iQual = 12;break;
113  case(13): iQual = 12;break;
114  case(12): iQual = 8;break;
115  case(11): iQual = 12;break;
116  case(10): iQual = 8;break;
117  case(7): iQual = 8;break;
118  default: iQual = 4;break;
119  }
120 
121  }
122  iQual |= LSB;
123 
124  Cand.setHwPt(iPt);
125  Cand.setHwEta(iEta);
126  Cand.setHwPhi(iPhi);
127  Cand.setHwSign(sign);
128  Cand.setHwSignValid(1);
129  Cand.setHwQual(iQual);
130  // jl: FIXME this has to be adapted to the new schema of saving track addresses
131  //Cand.setTrackSubAddress(l1t::RegionalMuonCand::kME12, trackaddress&0xf);
132  //Cand.setTrackSubAddress(l1t::RegionalMuonCand::kME22, trackaddress>>4);
133  Cand.setTFIdentifiers(sector,TFtype);
134 
135 
136  return Cand;
137 
138 }
int GetPackedEta(float theta, int sector)
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
double sign(double x)
l1t::RegionalMuonCand MakeRegionalCand(float pt, int phi, int theta, int sign, int quality, int trackaddress, int sector)
Geom::Theta< T > theta() const
int GetPackedPhi(int phi)
float GetGlobalEta(float theta, int sector)
void setTFIdentifiers(int processor, tftype trackFinder)
Set the processor ID, track-finder type. From these two, the link is set.
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
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)
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))