CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SP.h
Go to the documentation of this file.
1 // Class for Sector Processor (SP) Output Data Record
2 
3 #ifndef __l1t_emtf_SP_h__
4 #define __l1t_emtf_SP_h__
5 
6 #include <boost/cstdint.hpp>
7 
8 namespace l1t {
9  namespace emtf {
10  class SP {
11  public:
12 
13  explicit SP(uint64_t dataword);
14 
15  SP() :
16  pt_lut_address(-99), phi_local_int(-99), phi_GMT_int(-99), eta_GMT_int(-99), pt_int(-99),
18  me4_TBIN(-99), me3_TBIN(-99), me2_TBIN(-99), me1_TBIN(-99), tbin_num(-99),
19  hl(-99), c(-99), vc(-99), vt(-99), se(-99), bc0(-99),
20  pt(-99), phi_local(-99), phi_local_rad(-99), phi_global(-99), phi_GMT(-99), phi_GMT_corr(-99),
21  phi_GMT_rad(-99), phi_GMT_global(-99), eta_GMT(-99), format_errors(0), dataword(-99)
22  {};
23 
24  /* Could we have the fill constructor take the "true" eta/phi/pt and fill the integers? - AWB 02.02.16 */
25  SP(int int_pt_lut_address, int int_phi_local_int, int int_phi_GMT_int, int int_eta_GMT_int, int int_pt_int,
26  int int_quality, int int_bx, int int_me2_csc_id, int int_me2_trk_stub_num, int int_me3_csc_id, int int_me3_trk_stub_num,
27  int int_me4_csc_id, int int_me4_trk_stub_num, int int_me1_subsector, int int_me1_csc_id, int int_me1_trk_stub_num,
28  int int_me4_TBIN, int int_me3_TBIN, int int_me2_TBIN, int int_me1_TBIN, int int_TBIN_num,
29  int int_hl, int int_c, int int_vc, int int_vt, int int_se, int int_bc0) :
30  /* float flt_pt, float flt_phi_local, float flt_phi_local_rad, float flt_phi_GMT, float flt_phi_GMT_rad, float flt_eta_GMT) : */
31  pt_lut_address(int_pt_lut_address), phi_local_int(int_phi_local_int), phi_GMT_int(int_phi_GMT_int), eta_GMT_int(int_eta_GMT_int), pt_int(int_pt_int),
32  quality(int_quality), bx(int_bx), me2_csc_id(int_me2_csc_id), me2_trk_stub_num(int_me2_trk_stub_num), me3_csc_id(int_me3_csc_id),
33  me3_trk_stub_num(int_me3_trk_stub_num), me4_csc_id(int_me4_csc_id), me4_trk_stub_num(int_me4_trk_stub_num),
34  me1_subsector(int_me1_subsector), me1_csc_id(int_me1_csc_id), me1_trk_stub_num(int_me1_trk_stub_num),
35  me4_TBIN(int_me4_TBIN), me3_TBIN(int_me3_TBIN), me2_TBIN(int_me2_TBIN), me1_TBIN(int_me1_TBIN), tbin_num(int_TBIN_num),
36  hl(int_hl), c(int_c), vc(int_vc), vt(int_vt), se(int_se), bc0(int_bc0),
37  /* pt(flt_pt), phi_local(flt_phi_local), phi_local_rad(flt_phi_local_rad), phi_GMT(flt_phi_GMT), phi_GMT_rad(flt_phi_GMT_rad), eta_GMT(flt_eta_GMT), */
38  format_errors(0), dataword(-99)
39  {};
40 
41  virtual ~SP() {};
42 
43  float pi = 3.141592653589793238;
44 
45  // phi_local gives the exact phi value (marked "phi_full" in the format document)
46  // phi_GMT (the value used by GMT) is a rough estimate, with offsets of 1-2 degrees for some phi values
47  // The conversion used is: phi_GMT = (360/576)*phi_GMT_int + (180/576)
48  // More accurate would be: phi_GMT = 1.0208*(360/576)*phi_GMT_int + 1.0208*(180/576) + 0.552
49 
50  float calc_pt (int bits) { return (bits - 1) * 0.5; };
51  int calc_pt_int (float val) { return (val * 2) + 1; };
52  float calc_phi_local (int bits) { return (bits / 60.0) - 2.0; };
53  float calc_phi_local_rad (int bits) { return (bits * pi / 10800) - (pi / 90); };
54  int calc_phi_local_int (float val) { return (val + 2) * 60; };
55  float calc_phi_GMT (int bits) { return (bits * 0.625) + 0.3125; }; /* x (360/576) + (180/576) */
56  float calc_phi_GMT_corr (int bits) { return (bits * 0.625 * 1.0208) + 0.3125 * 1.0208 + 0.552; }; /* AWB mod 09.02.16 */
57  float calc_phi_GMT_rad (int bits) { return (bits * pi / 288) + (pi / 576); }; /* x (2*pi/576) + (pi/576) */
58  int calc_phi_GMT_int (float val) { return (val - 0.3125) / 0.625; }; /* - (180/576) / (360/576) */
59  float calc_eta_GMT (int bits) { return bits * 0.010875; };
60  int calc_eta_GMT_int (float val) { return val / 0.010875; };
61  float calc_phi_global (float loc, int sect) { return loc + 15 + (sect - 1) * 60;};
62 
63 
64  // Setting pt, phi_local, phi_GMT, or eta_GMT automatically sets all formats (integer, degrees, radians)
65  void set_pt_int (int bits) { pt_int = bits;
66  set_pt_only ( calc_pt (pt_int ) ); };
67  void set_pt (float val) { pt = val;
68  set_pt_int_only ( calc_pt_int (pt ) ); };
69 
73  void set_phi_local (float val) { phi_local = val;
76  void set_phi_local_rad (float val) { phi_local_rad = val;
77  set_phi_local_only ( val * 180 / pi );
79 
84  void set_phi_GMT (float val) { phi_GMT = val;
88  void set_phi_GMT_rad (float val) { phi_GMT_rad = val;
89  set_phi_GMT_only ( val * 180 / pi );
92 
93  void set_phi_global (float loc, int sect) { set_phi_global_only ( calc_phi_global (loc, sect) ); };
94  void set_phi_GMT_global(float loc, int sect) { set_phi_GMT_global_only ( calc_phi_global (loc, sect) ); };
95 
98  void set_eta_GMT (float val) { eta_GMT = val;
100 
101 
103  void set_quality (int bits) { quality = bits; };
104  void set_bx (int bits) { bx = bits; };
105  void set_me2_csc_id (int bits) { me2_csc_id = bits; };
107  void set_me3_csc_id (int bits) { me3_csc_id = bits; };
109  void set_me4_csc_id (int bits) { me4_csc_id = bits; };
112  void set_me1_csc_id (int bits) { me1_csc_id = bits; };
114  void set_me4_TBIN (int bits) { me4_TBIN = bits; };
115  void set_me3_TBIN (int bits) { me3_TBIN = bits; };
116  void set_me2_TBIN (int bits) { me2_TBIN = bits; };
117  void set_me1_TBIN (int bits) { me1_TBIN = bits; };
118  void set_TBIN_num (int bits) { tbin_num = bits; };
119  void set_hl (int bits) { hl = bits; };
120  void set_c (int bits) { c = bits; };
121  void set_vc (int bits) { vc = bits; };
122  void set_vt (int bits) { vt = bits; };
123  void set_se (int bits) { se = bits; };
124  void set_bc0 (int bits) { bc0 = bits; };
125  void add_format_error() { format_errors += 1; };
126  void set_dataword(uint64_t bits) { dataword = bits; };
127 
128 
129  const int Pt_lut_address() const { return pt_lut_address ; };
130  const int Phi_local_int() const { return phi_local_int ; };
131  const int Phi_GMT_int() const { return phi_GMT_int ; };
132  const int Eta_GMT_int() const { return eta_GMT_int ; };
133  const int Pt_int() const { return pt_int ; };
134  const int Quality() const { return quality ; };
135  const int BX() const { return bx ; };
136  const int ME2_csc_id() const { return me2_csc_id ; };
137  const int ME2_trk_stub_num() const { return me2_trk_stub_num; };
138  const int ME3_csc_id() const { return me3_csc_id ; };
139  const int ME3_trk_stub_num() const { return me3_trk_stub_num; };
140  const int ME4_csc_id() const { return me4_csc_id ; };
141  const int ME4_trk_stub_num() const { return me4_trk_stub_num; };
142  const int ME1_subsector() const { return me1_subsector ; };
143  const int ME1_csc_id() const { return me1_csc_id ; };
144  const int ME1_trk_stub_num() const { return me1_trk_stub_num; };
145  const int ME4_TBIN() const { return me4_TBIN ; };
146  const int ME3_TBIN() const { return me3_TBIN ; };
147  const int ME2_TBIN() const { return me2_TBIN ; };
148  const int ME1_TBIN() const { return me1_TBIN ; };
149  const int TBIN_num() const { return tbin_num ; };
150  const int HL() const { return hl ; };
151  const int C() const { return c ; };
152  const int VC() const { return vc ; };
153  const int VT() const { return vt ; };
154  const int SE() const { return se ; };
155  const int BC0() const { return bc0 ; };
156  const float Pt() const { return pt ; };
157  const float Phi_local() const { return phi_local ; };
158  const float Phi_local_rad() const { return phi_local_rad ; };
159  const float Phi_global() const { return phi_global ; };
160  const float Phi_GMT() const { return phi_GMT ; };
161  const float Phi_GMT_corr() const { return phi_GMT_corr ; };
162  const float Phi_GMT_rad() const { return phi_GMT_rad ; };
163  const float Phi_GMT_global() const { return phi_GMT_global ; };
164  const float Eta_GMT() const { return eta_GMT ; };
165  const int Format_Errors() const { return format_errors; };
166  const uint64_t Dataword() const { return dataword; };
167 
168 
169  private:
170  // Set only specific formats of values
171  void set_pt_only (float val) { pt = val; };
172  void set_pt_int_only (float val) { pt_int = val; };
173  void set_phi_local_only (float val) { phi_local = val; };
174  void set_phi_local_rad_only (float val) { phi_local_rad = val; };
175  void set_phi_local_int_only (float val) { phi_local_int = val; };
176  void set_phi_global_only (float val) { phi_global = val; };
177  void set_phi_GMT_only (float val) { phi_GMT = val; };
178  void set_phi_GMT_corr_only (float val) { phi_GMT_corr = val; };
179  void set_phi_GMT_rad_only (float val) { phi_GMT_rad = val; };
180  void set_phi_GMT_int_only (float val) { phi_GMT_int = val; };
181  void set_phi_GMT_global_only(float val) { phi_GMT_global = val; };
182  void set_eta_GMT_only (float val) { eta_GMT = val; };
183  void set_eta_GMT_int_only (float val) { eta_GMT_int = val; };
184 
185  int pt_lut_address ;
189  int pt_int ;
190  int quality ;
191  int bx ;
196  int me4_csc_id ;
199  int me1_csc_id ;
201  int me4_TBIN ;
202  int me3_TBIN ;
203  int me2_TBIN ;
204  int me1_TBIN ;
205  int tbin_num ;
206  int hl ;
207  int c ;
208  int vc ;
209  int vt ;
210  int se ;
211  int bc0 ;
212  float pt ;
213  float phi_local ;
215  float phi_global ;
216  float phi_GMT ;
217  float phi_GMT_corr ;
218  float phi_GMT_rad ;
220  float eta_GMT ;
223 
224  }; // End of class SP
225 
226  // Define a vector of SP
227  typedef std::vector<SP> SPCollection;
228 
229  } // End of namespace emtf
230 } // End of namespace l1t
231 
232 #endif /* define __l1t_emtf_SP_h__ */
int calc_pt_int(float val)
Definition: SP.h:51
void set_me3_trk_stub_num(int bits)
Definition: SP.h:108
int c
Definition: SP.h:207
int phi_GMT_int
Definition: SP.h:187
const float Phi_local() const
Definition: SP.h:157
void set_me1_trk_stub_num(int bits)
Definition: SP.h:113
const int VT() const
Definition: SP.h:153
void set_vt(int bits)
Definition: SP.h:122
const int Eta_GMT_int() const
Definition: SP.h:132
void set_phi_GMT_corr_only(float val)
Definition: SP.h:178
uint64_t dataword
Definition: SP.h:222
int pt_lut_address
Definition: SP.h:183
int vc
Definition: SP.h:208
void set_pt_lut_address(int bits)
Definition: SP.h:102
float calc_phi_GMT_rad(int bits)
Definition: SP.h:57
int bc0
Definition: SP.h:211
const float Eta_GMT() const
Definition: SP.h:164
int phi_local_int
Definition: SP.h:186
const uint64_t Dataword() const
Definition: SP.h:166
void set_phi_GMT_global(float loc, int sect)
Definition: SP.h:94
int pt_int
Definition: SP.h:189
const float Phi_global() const
Definition: SP.h:159
void set_me2_trk_stub_num(int bits)
Definition: SP.h:106
const float Phi_local_rad() const
Definition: SP.h:158
int me1_csc_id
Definition: SP.h:199
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
float calc_phi_global(float loc, int sect)
Definition: SP.h:61
const int BC0() const
Definition: SP.h:155
int format_errors
Definition: SP.h:221
int se
Definition: SP.h:210
void set_bx(int bits)
Definition: SP.h:104
void set_pt_int(int bits)
Definition: SP.h:65
void set_dataword(uint64_t bits)
Definition: SP.h:126
const float Phi_GMT_global() const
Definition: SP.h:163
int hl
Definition: SP.h:206
int quality
Definition: SP.h:190
const int ME1_trk_stub_num() const
Definition: SP.h:144
float phi_local_rad
Definition: SP.h:214
const int Format_Errors() const
Definition: SP.h:165
void set_phi_local_rad(float val)
Definition: SP.h:76
int vt
Definition: SP.h:209
const int TBIN_num() const
Definition: SP.h:149
void set_pt_int_only(float val)
Definition: SP.h:172
void set_pt(float val)
Definition: SP.h:67
SP(int int_pt_lut_address, int int_phi_local_int, int int_phi_GMT_int, int int_eta_GMT_int, int int_pt_int, int int_quality, int int_bx, int int_me2_csc_id, int int_me2_trk_stub_num, int int_me3_csc_id, int int_me3_trk_stub_num, int int_me4_csc_id, int int_me4_trk_stub_num, int int_me1_subsector, int int_me1_csc_id, int int_me1_trk_stub_num, int int_me4_TBIN, int int_me3_TBIN, int int_me2_TBIN, int int_me1_TBIN, int int_TBIN_num, int int_hl, int int_c, int int_vc, int int_vt, int int_se, int int_bc0)
Definition: SP.h:25
const int BX() const
Definition: SP.h:135
const float Phi_GMT_rad() const
Definition: SP.h:162
const int ME1_subsector() const
Definition: SP.h:142
void set_phi_GMT_global_only(float val)
Definition: SP.h:181
void set_phi_GMT_int(int bits)
Definition: SP.h:80
void set_me4_TBIN(int bits)
Definition: SP.h:114
void set_se(int bits)
Definition: SP.h:123
void set_phi_local_int(int bits)
Definition: SP.h:70
void set_me2_csc_id(int bits)
Definition: SP.h:105
float calc_pt(int bits)
Definition: SP.h:50
void set_eta_GMT(float val)
Definition: SP.h:98
const int ME3_csc_id() const
Definition: SP.h:138
float calc_phi_local(int bits)
Definition: SP.h:52
void set_me4_csc_id(int bits)
Definition: SP.h:109
void set_phi_GMT_int_only(float val)
Definition: SP.h:180
float calc_phi_GMT(int bits)
Definition: SP.h:55
int calc_phi_GMT_int(float val)
Definition: SP.h:58
const float Phi_GMT() const
Definition: SP.h:160
int me2_trk_stub_num
Definition: SP.h:193
void set_hl(int bits)
Definition: SP.h:119
float phi_local
Definition: SP.h:213
const int VC() const
Definition: SP.h:152
virtual ~SP()
Definition: SP.h:41
const int ME2_csc_id() const
Definition: SP.h:136
int eta_GMT_int
Definition: SP.h:188
void set_eta_GMT_only(float val)
Definition: SP.h:182
const int ME2_trk_stub_num() const
Definition: SP.h:137
void set_me3_TBIN(int bits)
Definition: SP.h:115
const int ME3_trk_stub_num() const
Definition: SP.h:139
int me4_TBIN
Definition: SP.h:201
void set_phi_GMT(float val)
Definition: SP.h:84
int me3_TBIN
Definition: SP.h:202
void set_bc0(int bits)
Definition: SP.h:124
int me4_trk_stub_num
Definition: SP.h:197
int me4_csc_id
Definition: SP.h:196
const int Phi_local_int() const
Definition: SP.h:130
SP()
Definition: SP.h:15
float pt
Definition: SP.h:212
int calc_eta_GMT_int(float val)
Definition: SP.h:60
int me1_subsector
Definition: SP.h:198
void set_me4_trk_stub_num(int bits)
Definition: SP.h:110
void set_me2_TBIN(int bits)
Definition: SP.h:116
void set_c(int bits)
Definition: SP.h:120
float phi_global
Definition: SP.h:215
int me2_csc_id
Definition: SP.h:192
float phi_GMT_global
Definition: SP.h:219
int me3_trk_stub_num
Definition: SP.h:195
void set_phi_local_only(float val)
Definition: SP.h:173
void set_vc(int bits)
Definition: SP.h:121
const int ME4_TBIN() const
Definition: SP.h:145
int bx
Definition: SP.h:191
void set_phi_GMT_rad_only(float val)
Definition: SP.h:179
const int ME2_TBIN() const
Definition: SP.h:147
float eta_GMT
Definition: SP.h:220
int calc_phi_local_int(float val)
Definition: SP.h:54
void set_phi_local(float val)
Definition: SP.h:73
void set_eta_GMT_int(int bits)
Definition: SP.h:96
float calc_phi_local_rad(int bits)
Definition: SP.h:53
const int C() const
Definition: SP.h:151
void set_quality(int bits)
Definition: SP.h:103
float phi_GMT
Definition: SP.h:216
const int ME1_csc_id() const
Definition: SP.h:143
void set_phi_GMT_only(float val)
Definition: SP.h:177
unsigned long long uint64_t
Definition: Time.h:15
const float Phi_GMT_corr() const
Definition: SP.h:161
void set_TBIN_num(int bits)
Definition: SP.h:118
const int ME4_trk_stub_num() const
Definition: SP.h:141
const int ME1_TBIN() const
Definition: SP.h:148
float calc_phi_GMT_corr(int bits)
Definition: SP.h:56
int me1_TBIN
Definition: SP.h:204
void set_me3_csc_id(int bits)
Definition: SP.h:107
const int Pt_int() const
Definition: SP.h:133
void set_phi_GMT_rad(float val)
Definition: SP.h:88
const int Phi_GMT_int() const
Definition: SP.h:131
const int SE() const
Definition: SP.h:154
void set_phi_global_only(float val)
Definition: SP.h:176
const int Quality() const
Definition: SP.h:134
float phi_GMT_rad
Definition: SP.h:218
void set_me1_csc_id(int bits)
Definition: SP.h:112
int tbin_num
Definition: SP.h:205
const int Pt_lut_address() const
Definition: SP.h:129
void set_me1_subsector(int bits)
Definition: SP.h:111
float pi
Definition: SP.h:43
void set_me1_TBIN(int bits)
Definition: SP.h:117
void set_phi_local_int_only(float val)
Definition: SP.h:175
void set_phi_global(float loc, int sect)
Definition: SP.h:93
std::vector< SP > SPCollection
Definition: SP.h:227
const float Pt() const
Definition: SP.h:156
void set_eta_GMT_int_only(float val)
Definition: SP.h:183
int me1_trk_stub_num
Definition: SP.h:200
void set_pt_only(float val)
Definition: SP.h:171
const int ME4_csc_id() const
Definition: SP.h:140
float calc_eta_GMT(int bits)
Definition: SP.h:59
int me3_csc_id
Definition: SP.h:194
void add_format_error()
Definition: SP.h:125
int me2_TBIN
Definition: SP.h:203
const int HL() const
Definition: SP.h:150
void set_phi_local_rad_only(float val)
Definition: SP.h:174
float phi_GMT_corr
Definition: SP.h:217
const int ME3_TBIN() const
Definition: SP.h:146