CMS 3D CMS Logo

IMATH_TrackletCalculatorDisk.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTracklet_interface_IMATH_TrackletCalculatorDisk_h
2 #define L1Trigger_TrackFindingTracklet_interface_IMATH_TrackletCalculatorDisk_h
3 
4 #include "Settings.h"
5 #include "imath.h"
6 
7 //
8 // Constants used:
9 // dphisector
10 // rmaxL6
11 // zmaxD5
12 // rmaxdisk
13 // kr, kphi1, kz
14 //
15 // rmean[], zmean[]
16 
17 namespace trklet {
18 
20  public:
21  IMATH_TrackletCalculatorDisk(Settings const& settings, imathGlobals* globals, int i1, int i2)
22  : settings_(settings), globals_(globals) {
23  if (settings_.debugTracklet()) {
24  edm::LogVerbatim("Tracklet") << "=============================================";
25  char s[1024];
26  snprintf(s, 1024, "IMATH Tracklet Calculator for Disk %i %i dphisector = %f", i1, i2, settings_.dphisector());
27  edm::LogVerbatim("Tracklet") << s;
28  snprintf(s, 1024, "rmaxL6 = %f, zmaxD5 = %f", settings_.rmax(5), settings_.zmax(4));
29  edm::LogVerbatim("Tracklet") << s;
30  snprintf(
31  s, 1024, " stub Ks: kr, kphi1, kz = %g, %g, %g", settings_.kr(), settings_.kphi1(), settings_.kz());
32  edm::LogVerbatim("Tracklet") << s;
33  snprintf(s,
34  1024,
35  " tracklet Ks: krinvpars, kphi0pars, ktpars, kzpars = %g, %g, %g, %g",
39  settings_.kz() * pow(2, settings_.z0_shift()));
40  edm::LogVerbatim("Tracklet") << s;
41  snprintf(s,
42  1024,
43  "layer proj Ks: kphiproj456, kphider, kzproj, kzder = %g, %g, %g, %g",
48  edm::LogVerbatim("Tracklet") << s;
49  snprintf(s,
50  1024,
51  " disk proj Ks: kphiprojdisk, kphiprojderdisk, krprojdisk, krprojderdisk = %g, %g, %g, %g",
56  edm::LogVerbatim("Tracklet") << s;
57  edm::LogVerbatim("Tracklet") << "=============================================";
58  }
59 
62 
63  if (i2 < 0) { //t is negative
66  invt.set_mode(VarInv::mode::neg);
67  invt.initLUT(0.);
68  }
69 
73 
75 
79 
81 
85 
87 
91 
93 
97 
99 
103 
105  }
106 
107  ~IMATH_TrackletCalculatorDisk() = default;
108 
110 
112 
113  //max values
114  const double dz_max = 50.;
115  const double dr_max = 20.;
116  const double delta0_max = 0.005;
117  const double a2_max = 3.;
118  const double a2a_max = 0.1;
119  const double x6a_max = 0.02;
120  const double x6m_max = 2.;
121  const double x8_max = 1.;
122  const double x13_max = 300.;
123  const double x22_max = 0.3;
124  const double x23_max = 200.;
125  const double deltaZ_max = 8.;
126  const double der_phiD_max = 0.002;
127  const double t_max = 7.9;
128  const double t_disk_min = 1.;
129  const double t_disk_max = 7.9;
130  const double t_layer_max = 2.5;
131  const double z0_max = 20.;
132  const double z0a_max = 205.;
133 
134  //constants
135  VarParam plus2{globals_, "plus2", 2., 10};
136  VarParam plus1{globals_, "plus1", 1., 10};
137  VarParam minus1{globals_, "minus1", -1, 10};
138 
141 
142  //inputs
147 
148  VarDef phi1{globals_, "phi1", "Kphi", settings_.dphisector() / 0.75, settings_.kphi1()};
149  VarDef phi2{globals_, "phi2", "Kphi", settings_.dphisector() / 0.75, settings_.kphi1()};
150 
154 
158 
159  //calculations
160 
161  //tracklet
164 
166 
167  //R LUT
168  VarInv drinv{globals_, "drinv", &dr, 0, 18, 23, 0, VarInv::mode::pos};
169 
172 
175  VarMult delta1{globals_, "delta1", &r1, &delta0};
176  VarMult delta2{globals_, "delta2", &r2, &delta0};
179  VarSubtract a2{globals_, "a2", &plus2, &a2b, 3.};
180  VarNeg a2n{globals_, "a2n", &a2};
181  VarShift a{globals_, "a", &a2, 1};
182 
183  VarAdd Rabs{globals_, "Rabs", &r1, &r2};
184  VarTimesC R6{globals_, "R6", &Rabs, 1. / 6., 12};
185 
187  VarMult x6a{globals_, "x6a", &delta2, &x4, 8 * x6a_max};
189  VarAdd x6m{globals_, "x6m", &minus1, &x6b, 2.};
191 
194 
197  VarMult t{globals_, "t", &a, &deltaZ, 2 * t_max};
198  VarAdd z0{globals_, "z0", &z1abs, &z0b, 2 * z0_max};
199 
201  globals_, "rinv_final", &rinv, settings_.kphi1() / settings_.kr() * pow(2, settings_.rinv_shift())};
205 
206  //projection to r
207  VarShift x2{globals_, "x2", &delta0, 1};
208 
209  VarMult x1_0{globals_, "x1_0", &x2, &rproj0};
210  VarMult x1_1{globals_, "x1_1", &x2, &rproj1};
211  VarMult x1_2{globals_, "x1_2", &x2, &rproj2};
212 
216 
217  VarMult x12_0{globals_, "x12_0", &x8_0, &x8_0};
218  VarMult x12_1{globals_, "x12_1", &x8_1, &x8_1};
219  VarMult x12_2{globals_, "x12_2", &x8_2, &x8_2};
220 
224 
225  VarTimesC x20_0{globals_, "x20_0", &x12A_0, 1. / 6.};
226  VarTimesC x20_1{globals_, "x20_1", &x12A_1, 1. / 6.};
227  VarTimesC x20_2{globals_, "x20_2", &x12A_2, 1. / 6.};
228 
229  VarAdd x10_0{globals_, "x10_0", &plus1, &x20_0};
230  VarAdd x10_1{globals_, "x10_1", &plus1, &x20_1};
231  VarAdd x10_2{globals_, "x10_2", &plus1, &x20_2};
232 
233  VarMult x22_0{globals_, "x22_0", &x8_0, &x10_0, 2 * x22_max};
234  VarMult x22_1{globals_, "x22_1", &x8_1, &x10_1, 2 * x22_max};
235  VarMult x22_2{globals_, "x22_2", &x8_2, &x10_2, 2 * x22_max};
236 
240 
241  VarShift x3{globals_, "x3", &rinv, 1};
242  VarNeg der_phiL{globals_, "der_phiL", &x3};
243 
247 
249  "der_phiL_final",
250  &der_phiL,
252 
253  VarMult x11_0{globals_, "x11_0", &rproj0, &t};
254  VarMult x11_1{globals_, "x11_1", &rproj1, &t};
255  VarMult x11_2{globals_, "x11_2", &rproj2, &t};
256 
257  VarMult x23_0{globals_, "x23_0", &x11_0, &x10_0, 4 * x23_max};
258  VarMult x23_1{globals_, "x23_1", &x11_1, &x10_1, 4 * x23_max};
259  VarMult x23_2{globals_, "x23_2", &x11_2, &x10_2, 4 * x23_max};
260 
261  VarAdd zL_0{globals_, "zL_0", &z0, &x23_0};
262  VarAdd zL_1{globals_, "zL_1", &z0, &x23_1};
263  VarAdd zL_2{globals_, "zL_2", &z0, &x23_2};
264 
268 
270  globals_, "der_zL_final", &t_final, settings_.kz() / settings_.kr() * pow(2, settings_.PS_zderL_shift())};
271 
272  //projection to z
273  VarInv invt{globals_, "invt", &t_final, 0., 18, 26, 1, VarInv::mode::pos, 13};
274 
275  VarMult x7{globals_, "x7", &x2, &a2};
276 
280 
284 
288 
292 
296 
297  VarMult der_phiD{globals_, "der_phiD", &x7, &invt, 2 * der_phiD_max};
298 
300  "der_phiD_final",
301  &der_phiD,
303 
307 
311 
312  VarTimesC x9_0{globals_, "x9_0", &x26A_0, 1. / 6.};
313  VarTimesC x9_1{globals_, "x9_1", &x26A_1, 1. / 6.};
314  VarTimesC x9_2{globals_, "x9_2", &x26A_2, 1. / 6.};
315 
319 
323 
327 
329  globals_, "der_rD_final", &invt, settings_.kr() / settings_.kz() * pow(2, settings_.PS_rderD_shift())};
330 
333 
373 
377 
378  // the following flags are used to apply the cuts in TrackletCalculator
379  // and in the output Verilog
381 
385 
389 
392 
396 
400 
403  };
404 }; // namespace trklet
405 
406 #endif
Log< level::Info, true > LogVerbatim
double kz() const
Definition: Settings.h:336
int PS_rD_shift() const
Definition: Settings.h:391
int PS_zL_shift() const
Definition: Settings.h:383
constexpr int N_DISK
Definition: Settings.h:26
int PS_rderD_shift() const
Definition: Settings.h:394
int PS_zderL_shift() const
Definition: Settings.h:386
double zmax(unsigned int iDisk) const
Definition: Settings.h:175
double kphi1() const
Definition: Settings.h:333
int nbits() const
Definition: imath.h:244
double zlength() const
Definition: Settings.h:131
constexpr int pow(int x)
Definition: conifer.h:24
int phi0_shift() const
Definition: Settings.h:375
double dzmax() const
Definition: Settings.h:136
void initLUT(double offset)
Definition: imath.cc:142
double dphisector() const
Definition: Settings.h:323
int t_shift() const
Definition: Settings.h:376
void set_fval(double fval)
Definition: imath.h:449
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double rinvcut() const
Definition: Settings.h:220
int z0_shift() const
Definition: Settings.h:377
double zmean(unsigned int iDisk) const
Definition: Settings.h:174
int SS_phiD_shift() const
Definition: Settings.h:390
bool debugTracklet() const
Definition: Settings.h:192
int SS_phiderD_shift() const
Definition: Settings.h:393
double kr() const
Definition: Settings.h:338
void set_mode(mode m)
Definition: imath.h:1000
double z0cut() const
Definition: Settings.h:358
void add_cut(VarBase *cut, const bool call_set_parent_flag=true)
Definition: imath.cc:373
double rmaxdisk() const
Definition: Settings.h:132
double rmax(unsigned int iLayer) const
Definition: Settings.h:172
int SS_phiderL_shift() const
Definition: Settings.h:385
int rinv_shift() const
Definition: Settings.h:374
double maxrinv() const
Definition: Settings.h:341
int SS_phiL_shift() const
Definition: Settings.h:382
IMATH_TrackletCalculatorDisk(Settings const &settings, imathGlobals *globals, int i1, int i2)
constexpr int N_LAYER
Definition: Settings.h:25