Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:47

0001 #ifndef L1Trigger_TrackFindingTracklet_interface_IMATH_TrackletCalculator_h
0002 #define L1Trigger_TrackFindingTracklet_interface_IMATH_TrackletCalculator_h
0003 
0004 #include "Settings.h"
0005 #include "imath.h"
0006 
0007 //
0008 // Constants used:
0009 //   dphisector
0010 //   rmaxL6
0011 //   zmaxD5
0012 //   rmaxdisk
0013 //   kr, kphi1, kz
0014 //
0015 //   rmean[], zmean[]
0016 
0017 namespace trklet {
0018   class Globals;
0019 
0020   class IMATH_TrackletCalculator {
0021   public:
0022     IMATH_TrackletCalculator(Settings const& settings, imathGlobals* globals, int i1, int i2)
0023         : settings_(settings), globals_(globals) {
0024       if (settings_.debugTracklet()) {
0025         edm::LogVerbatim("Tracklet") << "=============================================";
0026         char s[1024];
0027         snprintf(s, 1024, "IMATH Tracklet Calculator %i %i dphisector = %f", i1, i2, settings_.dphisector());
0028         edm::LogVerbatim("Tracklet") << s;
0029         snprintf(s, 1024, "rmaxL6 = %f, zmaxD5 = %f", settings_.rmax(5), settings_.zmax(4));
0030         edm::LogVerbatim("Tracklet") << s;
0031         snprintf(
0032             s, 1024, "      stub Ks: kr, kphi1, kz = %g, %g, %g", settings_.kr(), settings_.kphi1(), settings_.kz());
0033         edm::LogVerbatim("Tracklet") << s;
0034         snprintf(s,
0035                  1024,
0036                  "  tracklet Ks: krinvpars, kphi0pars, ktpars, kzpars = %g, %g, %g, %g",
0037                  settings_.kphi1() / settings_.kr() * pow(2, settings_.rinv_shift()),
0038                  settings_.kphi1() * pow(2, settings_.phi0_shift()),
0039                  settings_.kz() / settings_.kr() * pow(2, settings_.t_shift()),
0040                  settings_.kz() * pow(2, settings_.z0_shift()));
0041         edm::LogVerbatim("Tracklet") << s;
0042         snprintf(s,
0043                  1024,
0044                  "layer proj Ks: kphiproj456, kphider, kzproj, kzder = %g, %g, %g, %g",
0045                  settings_.kphi1() * pow(2, settings_.SS_phiL_shift()),
0046                  settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderL_shift()),
0047                  settings_.kz() * pow(2, settings_.PS_zL_shift()),
0048                  settings_.kz() / settings_.kr() * pow(2, settings_.PS_zderL_shift()));
0049         edm::LogVerbatim("Tracklet") << s;
0050         snprintf(s,
0051                  1024,
0052                  " disk proj Ks: kphiprojdisk, kphiprojderdisk, krprojdisk, krprojderdisk = %g, %g, %g, %g",
0053                  settings_.kphi1() * pow(2, settings_.SS_phiD_shift()),
0054                  settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderD_shift()),
0055                  settings_.kr() * pow(2, settings_.PS_rD_shift()),
0056                  settings_.kr() / settings_.kz() * pow(2, settings_.PS_rderD_shift()));
0057         edm::LogVerbatim("Tracklet") << s;
0058         edm::LogVerbatim("Tracklet") << "=============================================";
0059 
0060         snprintf(s, 1024, "initializing 1/dr LUT %f %f", settings_.rmean(i1 - 1), settings_.rmean(i2 - 1));
0061         edm::LogVerbatim("Tracklet") << s;
0062       }
0063 
0064       drinv.initLUT(settings_.rmean(i2 - 1) - settings_.rmean(i1 - 1));
0065       r1mean.set_fval(settings_.rmean(i1 - 1));
0066       r2mean.set_fval(settings_.rmean(i2 - 1));
0067       r12mean.set_fval(settings_.rmean(i1 - 1) + settings_.rmean(i2 - 1));
0068 
0069       if (i1 == 1)
0070         z0_final.add_cut(&z0_final_L1_cut);
0071       else
0072         z0_final.add_cut(&z0_final_cut);
0073 
0074       valid_phiL_0.add_cut(&t_layer_cut);
0075       valid_phiL_1.add_cut(&t_layer_cut);
0076       valid_phiL_2.add_cut(&t_layer_cut);
0077       valid_phiL_3.add_cut(&t_layer_cut);
0078 
0079       valid_der_phiL.add_cut(&t_layer_cut);
0080 
0081       valid_zL_0.add_cut(&t_layer_cut);
0082       valid_zL_1.add_cut(&t_layer_cut);
0083       valid_zL_2.add_cut(&t_layer_cut);
0084       valid_zL_3.add_cut(&t_layer_cut);
0085 
0086       valid_der_zL.add_cut(&t_layer_cut);
0087 
0088       valid_phiD_0.add_cut(&t_disk_cut_left);
0089       valid_phiD_1.add_cut(&t_disk_cut_left);
0090       valid_phiD_2.add_cut(&t_disk_cut_left);
0091       valid_phiD_3.add_cut(&t_disk_cut_left);
0092       valid_phiD_4.add_cut(&t_disk_cut_left);
0093 
0094       valid_der_phiD.add_cut(&t_disk_cut_left);
0095 
0096       valid_rD_0.add_cut(&t_disk_cut_left);
0097       valid_rD_1.add_cut(&t_disk_cut_left);
0098       valid_rD_2.add_cut(&t_disk_cut_left);
0099       valid_rD_3.add_cut(&t_disk_cut_left);
0100       valid_rD_4.add_cut(&t_disk_cut_left);
0101 
0102       valid_der_rD.add_cut(&t_disk_cut_left);
0103 
0104       valid_phiD_0.add_cut(&t_disk_cut_right);
0105       valid_phiD_1.add_cut(&t_disk_cut_right);
0106       valid_phiD_2.add_cut(&t_disk_cut_right);
0107       valid_phiD_3.add_cut(&t_disk_cut_right);
0108       valid_phiD_4.add_cut(&t_disk_cut_right);
0109 
0110       valid_der_phiD.add_cut(&t_disk_cut_right);
0111 
0112       valid_rD_0.add_cut(&t_disk_cut_right);
0113       valid_rD_1.add_cut(&t_disk_cut_right);
0114       valid_rD_2.add_cut(&t_disk_cut_right);
0115       valid_rD_3.add_cut(&t_disk_cut_right);
0116       valid_rD_4.add_cut(&t_disk_cut_right);
0117 
0118       valid_der_rD.add_cut(&t_disk_cut_right);
0119     }
0120 
0121     ~IMATH_TrackletCalculator() = default;
0122 
0123     Settings const& settings_;
0124 
0125     imathGlobals* globals_;
0126 
0127     //max values
0128     const double dz_max = 50.;
0129     const double delta0_max = 0.005;
0130     const double a2_max = 3.;
0131     const double a2a_max = 0.1;
0132     const double x6a_max = 0.02;
0133     const double x6m_max = 2.;
0134     const double x8_max = 1.;
0135     const double x13_max = 300.;
0136     const double x22_max = 0.3;
0137     const double x23_max = 200.;
0138     const double t_max = 4.;
0139     const double z0_max = 20.;
0140     const double der_phiD_max = 0.002;
0141     const double t_disk_min = 1;
0142     const double t_disk_max = 4;
0143     const double t_layer_max = 2.5;
0144 
0145     //constants
0146     VarParam plus1{globals_, "plus1", 1., 10};
0147     VarParam plus2{globals_, "plus2", 2., 10};
0148     VarParam minus1{globals_, "minus1", -1., 10};
0149 
0150     VarParam r1mean{globals_, "r1mean", "Kr", settings_.rmax(trklet::N_LAYER - 1), settings_.kr()};
0151     VarParam r2mean{globals_, "r2mean", "Kr", settings_.rmax(trklet::N_LAYER - 1), settings_.kr()};
0152     VarParam r12mean{globals_, "r12mean", "Kr", 2 * settings_.rmax(trklet::N_DISK - 1), settings_.kr()};
0153 
0154     //inputs
0155     VarDef r1{globals_, "r1", "Kr", settings_.drmax(), settings_.kr()};
0156     VarDef r2{globals_, "r2", "Kr", settings_.drmax(), settings_.kr()};
0157     VarDef z1{globals_, "z1", "Kz", settings_.zlength(), settings_.kz()};
0158     VarDef z2{globals_, "z2", "Kz", settings_.zlength(), settings_.kz()};
0159 
0160     //0.75 below comes from phi range for coordinate can be larger than for sector
0161     VarDef phi1{globals_, "phi1", "Kphi", settings_.dphisector() / 0.75, settings_.kphi1()};
0162     VarDef phi2{globals_, "phi2", "Kphi", settings_.dphisector() / 0.75, settings_.kphi1()};
0163 
0164     VarDef rproj0{globals_, "rproj0", "Kr", settings_.rmax(trklet::N_LAYER - 1), settings_.kr()};
0165     VarDef rproj1{globals_, "rproj1", "Kr", settings_.rmax(trklet::N_LAYER - 1), settings_.kr()};
0166     VarDef rproj2{globals_, "rproj2", "Kr", settings_.rmax(trklet::N_LAYER - 1), settings_.kr()};
0167     VarDef rproj3{globals_, "rproj3", "Kr", settings_.rmax(trklet::N_LAYER - 1), settings_.kr()};
0168 
0169     VarDef zproj0{globals_, "zproj0", "Kz", settings_.zmax(trklet::N_DISK - 1), settings_.kz()};
0170     VarDef zproj1{globals_, "zproj1", "Kz", settings_.zmax(trklet::N_DISK - 1), settings_.kz()};
0171     VarDef zproj2{globals_, "zproj2", "Kz", settings_.zmax(trklet::N_DISK - 1), settings_.kz()};
0172     VarDef zproj3{globals_, "zproj3", "Kz", settings_.zmax(trklet::N_DISK - 1), settings_.kz()};
0173     VarDef zproj4{globals_, "zproj4", "Kz", settings_.zmax(trklet::N_DISK - 1), settings_.kz()};
0174 
0175     //calculations
0176 
0177     //tracklet
0178     VarAdd r1abs{globals_, "r1abs", &r1, &r1mean, settings_.rmax(trklet::N_LAYER - 1)};
0179     VarAdd r2abs{globals_, "r2abs", &r2, &r2mean, settings_.rmax(trklet::N_LAYER - 1)};
0180 
0181     VarSubtract dr{globals_, "dr", &r2, &r1};
0182 
0183     //R LUT
0184     VarInv drinv{globals_, "drinv", &dr, 0, 18, 24, 0, VarInv::mode::both};
0185 
0186     VarSubtract dphi{globals_, "dphi", &phi2, &phi1, settings_.dphisector() / 4.};
0187     VarSubtract dz{globals_, "dz", &z2, &z1, dz_max};
0188 
0189     VarMult delta0{globals_, "delta0", &dphi, &drinv, delta0_max};
0190     VarMult deltaZ{globals_, "deltaZ", &dz, &drinv};
0191     VarMult delta1{globals_, "delta1", &r1abs, &delta0};
0192     VarMult delta2{globals_, "delta2", &r2abs, &delta0};
0193     VarMult a2a{globals_, "a2a", &delta1, &delta2, a2a_max};
0194     VarNounits a2b{globals_, "a2b", &a2a};
0195     VarSubtract a2{globals_, "a2", &plus2, &a2b, a2_max};
0196     VarNeg a2n{globals_, "a2n", &a2};
0197     VarShift a{globals_, "a", &a2, 1};
0198 
0199     VarAdd Rabs{globals_, "Rabs", &r1abs, &r2abs};
0200     VarTimesC R6{globals_, "R6", &Rabs, 1. / 6., 12};
0201 
0202     VarMult x4{globals_, "x4", &R6, &delta0};
0203     VarMult x6a{globals_, "x6a", &delta2, &x4, 2 * x6a_max};
0204     VarNounits x6b{globals_, "x6b", &x6a};
0205     VarAdd x6m{globals_, "x6m", &minus1, &x6b, x6m_max};
0206     VarMult phi0a{globals_, "phi0a", &delta1, &x6m, settings_.dphisector()};
0207 
0208     VarMult z0a{globals_, "z0a", &r1abs, &deltaZ, settings_.zlength()};
0209     VarMult z0b{globals_, "z0b", &z0a, &x6m, settings_.zlength()};
0210 
0211     VarAdd phi0{globals_, "phi0", &phi1, &phi0a, 2 * settings_.dphisector()};
0212     VarMult rinv{globals_, "rinv", &a2n, &delta0, 2 * settings_.maxrinv()};
0213     VarMult t{globals_, "t", &a, &deltaZ, t_max};
0214     VarAdd z0{globals_, "z0", &z1, &z0b, 2 * z0_max};
0215 
0216     VarAdjustK rinv_final{
0217         globals_, "rinv_final", &rinv, settings_.kphi1() / settings_.kr() * pow(2, settings_.rinv_shift())};
0218     VarAdjustK phi0_final{globals_, "phi0_final", &phi0, settings_.kphi1() * pow(2, settings_.phi0_shift())};
0219     VarAdjustKR t_final{globals_, "t_final", &t, settings_.kz() / settings_.kr() * pow(2, settings_.t_shift())};
0220     VarAdjustKR z0_final{globals_, "z0_final", &z0, settings_.kz() * pow(2, settings_.z0_shift())};
0221 
0222     //projection to r
0223     VarShift x2{globals_, "x2", &delta0, 1};
0224 
0225     VarMult x1_0{globals_, "x1_0", &x2, &rproj0};
0226     VarMult x1_1{globals_, "x1_1", &x2, &rproj1};
0227     VarMult x1_2{globals_, "x1_2", &x2, &rproj2};
0228     VarMult x1_3{globals_, "x1_3", &x2, &rproj3};
0229 
0230     VarMult x8_0{globals_, "x8_0", &x1_0, &a2n, x8_max};
0231     VarMult x8_1{globals_, "x8_1", &x1_1, &a2n, x8_max};
0232     VarMult x8_2{globals_, "x8_2", &x1_2, &a2n, x8_max};
0233     VarMult x8_3{globals_, "x8_3", &x1_3, &a2n, x8_max};
0234 
0235     VarMult x12_0{globals_, "x12_0", &x8_0, &x8_0};
0236     VarMult x12_1{globals_, "x12_1", &x8_1, &x8_1};
0237     VarMult x12_2{globals_, "x12_2", &x8_2, &x8_2};
0238     VarMult x12_3{globals_, "x12_3", &x8_3, &x8_3};
0239 
0240     VarNounits x12A_0{globals_, "x12A_0", &x12_0};
0241     VarNounits x12A_1{globals_, "x12A_1", &x12_1};
0242     VarNounits x12A_2{globals_, "x12A_2", &x12_2};
0243     VarNounits x12A_3{globals_, "x12A_3", &x12_3};
0244 
0245     VarTimesC x20_0{globals_, "x20_0", &x12A_0, 1. / 6.};
0246     VarTimesC x20_1{globals_, "x20_1", &x12A_1, 1. / 6.};
0247     VarTimesC x20_2{globals_, "x20_2", &x12A_2, 1. / 6.};
0248     VarTimesC x20_3{globals_, "x20_3", &x12A_3, 1. / 6.};
0249 
0250     VarAdd x10_0{globals_, "x10_0", &plus1, &x20_0};
0251     VarAdd x10_1{globals_, "x10_1", &plus1, &x20_1};
0252     VarAdd x10_2{globals_, "x10_2", &plus1, &x20_2};
0253     VarAdd x10_3{globals_, "x10_3", &plus1, &x20_3};
0254 
0255     VarMult x22_0{globals_, "x22_0", &x8_0, &x10_0, 2 * x22_max};
0256     VarMult x22_1{globals_, "x22_1", &x8_1, &x10_1, 2 * x22_max};
0257     VarMult x22_2{globals_, "x22_2", &x8_2, &x10_2, 2 * x22_max};
0258     VarMult x22_3{globals_, "x22_3", &x8_3, &x10_3, 2 * x22_max};
0259 
0260     VarSubtract phiL_0{globals_, "phiL_0", &phi0_final, &x22_0, -1, phi0_final.nbits() + 1};
0261     VarSubtract phiL_1{globals_, "phiL_1", &phi0_final, &x22_1, -1, phi0_final.nbits() + 1};
0262     VarSubtract phiL_2{globals_, "phiL_2", &phi0_final, &x22_2, -1, phi0_final.nbits() + 1};
0263     VarSubtract phiL_3{globals_, "phiL_3", &phi0_final, &x22_3, -1, phi0_final.nbits() + 1};
0264 
0265     VarShift x3{globals_, "x3", &rinv, 1};
0266     VarNeg der_phiL{globals_, "der_phiL", &x3};
0267 
0268     VarAdjustK phiL_0_final{globals_, "phiL_0_final", &phiL_0, settings_.kphi1() * pow(2, settings_.SS_phiL_shift())};
0269     VarAdjustK phiL_1_final{globals_, "phiL_1_final", &phiL_1, settings_.kphi1() * pow(2, settings_.SS_phiL_shift())};
0270     VarAdjustK phiL_2_final{globals_, "phiL_2_final", &phiL_2, settings_.kphi1() * pow(2, settings_.SS_phiL_shift())};
0271     VarAdjustK phiL_3_final{globals_, "phiL_3_final", &phiL_3, settings_.kphi1() * pow(2, settings_.SS_phiL_shift())};
0272 
0273     VarAdjustK der_phiL_final{globals_,
0274                               "der_phiL_final",
0275                               &der_phiL,
0276                               settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderL_shift())};
0277 
0278     VarMult x11_0{globals_, "x11_0", &rproj0, &t};
0279     VarMult x11_1{globals_, "x11_1", &rproj1, &t};
0280     VarMult x11_2{globals_, "x11_2", &rproj2, &t};
0281     VarMult x11_3{globals_, "x11_3", &rproj3, &t};
0282 
0283     VarMult x23_0{globals_, "x23_0", &x11_0, &x10_0, 2 * x23_max};
0284     VarMult x23_1{globals_, "x23_1", &x11_1, &x10_1, 2 * x23_max};
0285     VarMult x23_2{globals_, "x23_2", &x11_2, &x10_2, 2 * x23_max};
0286     VarMult x23_3{globals_, "x23_3", &x11_3, &x10_3, 2 * x23_max};
0287 
0288     VarAdd zL_0{globals_, "zL_0", &z0, &x23_0};
0289     VarAdd zL_1{globals_, "zL_1", &z0, &x23_1};
0290     VarAdd zL_2{globals_, "zL_2", &z0, &x23_2};
0291     VarAdd zL_3{globals_, "zL_3", &z0, &x23_3};
0292 
0293     VarAdjustKR zL_0_final{globals_, "zL_0_final", &zL_0, settings_.kz() * pow(2, settings_.PS_zL_shift())};
0294     VarAdjustKR zL_1_final{globals_, "zL_1_final", &zL_1, settings_.kz() * pow(2, settings_.PS_zL_shift())};
0295     VarAdjustKR zL_2_final{globals_, "zL_2_final", &zL_2, settings_.kz() * pow(2, settings_.PS_zL_shift())};
0296     VarAdjustKR zL_3_final{globals_, "zL_3_final", &zL_3, settings_.kz() * pow(2, settings_.PS_zL_shift())};
0297 
0298     VarAdjustK der_zL_final{
0299         globals_, "der_zL_final", &t_final, settings_.kz() / settings_.kr() * pow(2, settings_.PS_zderL_shift())};
0300 
0301     //projection to z
0302     //
0303     VarInv invt{globals_, "invt", &t_final, 0., 18, 26, 1, VarInv::mode::both, 13};
0304 
0305     VarMult x7{globals_, "x7", &x2, &a2};
0306 
0307     VarSubtract x5_0{globals_, "x5_0", &zproj0, &z0};
0308     VarSubtract x5_1{globals_, "x5_1", &zproj1, &z0};
0309     VarSubtract x5_2{globals_, "x5_2", &zproj2, &z0};
0310     VarSubtract x5_3{globals_, "x5_3", &zproj3, &z0};
0311     VarSubtract x5_4{globals_, "x5_4", &zproj4, &z0};
0312 
0313     VarMult x13_0{globals_, "x13_0", &x5_0, &invt, x13_max};
0314     VarMult x13_1{globals_, "x13_1", &x5_1, &invt, x13_max};
0315     VarMult x13_2{globals_, "x13_2", &x5_2, &invt, x13_max};
0316     VarMult x13_3{globals_, "x13_3", &x5_3, &invt, x13_max};
0317     VarMult x13_4{globals_, "x13_4", &x5_4, &invt, x13_max};
0318 
0319     VarMult x25_0{globals_, "x25_0", &x13_0, &x7, 2 * settings_.dphisector()};
0320     VarMult x25_1{globals_, "x25_1", &x13_1, &x7, 2 * settings_.dphisector()};
0321     VarMult x25_2{globals_, "x25_2", &x13_2, &x7, 2 * settings_.dphisector()};
0322     VarMult x25_3{globals_, "x25_3", &x13_3, &x7, 2 * settings_.dphisector()};
0323     VarMult x25_4{globals_, "x25_4", &x13_4, &x7, 2 * settings_.dphisector()};
0324 
0325     VarAdd phiD_0{globals_, "phiD_0", &phi0, &x25_0, 2 * settings_.dphisector()};
0326     VarAdd phiD_1{globals_, "phiD_1", &phi0, &x25_1, 2 * settings_.dphisector()};
0327     VarAdd phiD_2{globals_, "phiD_2", &phi0, &x25_2, 2 * settings_.dphisector()};
0328     VarAdd phiD_3{globals_, "phiD_3", &phi0, &x25_3, 2 * settings_.dphisector()};
0329     VarAdd phiD_4{globals_, "phiD_4", &phi0, &x25_4, 2 * settings_.dphisector()};
0330 
0331     VarAdjustK phiD_0_final{globals_, "phiD_0_final", &phiD_0, settings_.kphi1() * pow(2, settings_.SS_phiD_shift())};
0332     VarAdjustK phiD_1_final{globals_, "phiD_1_final", &phiD_1, settings_.kphi1() * pow(2, settings_.SS_phiD_shift())};
0333     VarAdjustK phiD_2_final{globals_, "phiD_2_final", &phiD_2, settings_.kphi1() * pow(2, settings_.SS_phiD_shift())};
0334     VarAdjustK phiD_3_final{globals_, "phiD_3_final", &phiD_3, settings_.kphi1() * pow(2, settings_.SS_phiD_shift())};
0335     VarAdjustK phiD_4_final{globals_, "phiD_4_final", &phiD_4, settings_.kphi1() * pow(2, settings_.SS_phiD_shift())};
0336 
0337     VarMult der_phiD{globals_, "der_phiD", &x7, &invt, 4 * der_phiD_max};
0338 
0339     VarAdjustK der_phiD_final{globals_,
0340                               "der_phiD_final",
0341                               &der_phiD,
0342                               settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderD_shift())};
0343 
0344     VarMult x26_0{globals_, "x26_0", &x25_0, &x25_0};
0345     VarMult x26_1{globals_, "x26_1", &x25_1, &x25_1};
0346     VarMult x26_2{globals_, "x26_2", &x25_2, &x25_2};
0347     VarMult x26_3{globals_, "x26_3", &x25_3, &x25_3};
0348     VarMult x26_4{globals_, "x26_4", &x25_4, &x25_4};
0349 
0350     VarNounits x26A_0{globals_, "x26A_0", &x26_0};
0351     VarNounits x26A_1{globals_, "x26A_1", &x26_1};
0352     VarNounits x26A_2{globals_, "x26A_2", &x26_2};
0353     VarNounits x26A_3{globals_, "x26A_3", &x26_3};
0354     VarNounits x26A_4{globals_, "x26A_4", &x26_4};
0355 
0356     VarTimesC x9_0{globals_, "x9_0", &x26A_0, 1. / 6.};
0357     VarTimesC x9_1{globals_, "x9_1", &x26A_1, 1. / 6.};
0358     VarTimesC x9_2{globals_, "x9_2", &x26A_2, 1. / 6.};
0359     VarTimesC x9_3{globals_, "x9_3", &x26A_3, 1. / 6.};
0360     VarTimesC x9_4{globals_, "x9_4", &x26A_4, 1. / 6.};
0361 
0362     VarSubtract x27m_0{globals_, "x27_0", &plus1, &x9_0};
0363     VarSubtract x27m_1{globals_, "x27_1", &plus1, &x9_1};
0364     VarSubtract x27m_2{globals_, "x27_2", &plus1, &x9_2};
0365     VarSubtract x27m_3{globals_, "x27_3", &plus1, &x9_3};
0366     VarSubtract x27m_4{globals_, "x27_4", &plus1, &x9_4};
0367 
0368     VarMult rD_0{globals_, "rD_0", &x13_0, &x27m_0, 2 * settings_.rmaxdisk()};
0369     VarMult rD_1{globals_, "rD_1", &x13_1, &x27m_1, 2 * settings_.rmaxdisk()};
0370     VarMult rD_2{globals_, "rD_2", &x13_2, &x27m_2, 2 * settings_.rmaxdisk()};
0371     VarMult rD_3{globals_, "rD_3", &x13_3, &x27m_3, 2 * settings_.rmaxdisk()};
0372     VarMult rD_4{globals_, "rD_4", &x13_4, &x27m_4, 2 * settings_.rmaxdisk()};
0373 
0374     VarAdjustK rD_0_final{globals_, "rD_0_final", &rD_0, settings_.kr() * pow(2, settings_.PS_rD_shift())};
0375     VarAdjustK rD_1_final{globals_, "rD_1_final", &rD_1, settings_.kr() * pow(2, settings_.PS_rD_shift())};
0376     VarAdjustK rD_2_final{globals_, "rD_2_final", &rD_2, settings_.kr() * pow(2, settings_.PS_rD_shift())};
0377     VarAdjustK rD_3_final{globals_, "rD_3_final", &rD_3, settings_.kr() * pow(2, settings_.PS_rD_shift())};
0378     VarAdjustK rD_4_final{globals_, "rD_4_final", &rD_4, settings_.kr() * pow(2, settings_.PS_rD_shift())};
0379 
0380     VarAdjustK der_rD_final{
0381         globals_, "der_rD_final", &invt, settings_.kr() / settings_.kz() * pow(2, settings_.PS_rderD_shift())};
0382 
0383     VarCut rinv_final_cut{globals_, &rinv_final, -settings_.rinvcut(), settings_.rinvcut()};
0384     // the following two are not associated with any variable yet; this is done
0385     // in the constructor of this class since it depends on the layer
0386     VarCut z0_final_L1_cut{globals_, -settings_.z0cut(), settings_.z0cut()};
0387     VarCut z0_final_cut{globals_, -1.5 * settings_.z0cut(), 1.5 * settings_.z0cut()};
0388 
0389     VarCut r1abs_cut{globals_, &r1abs, -settings_.rmax(5), settings_.rmax(5)};
0390     VarCut r2abs_cut{globals_, &r2abs, -settings_.rmax(5), settings_.rmax(5)};
0391     VarCut dphi_cut{globals_, &dphi, -settings_.dphisector() / 4., settings_.dphisector() / 4.};
0392     VarCut dz_cut{globals_, &dz, -dz_max, dz_max};
0393     VarCut delta0_cut{globals_, &delta0, -delta0_max, delta0_max};
0394     VarCut a2a_cut{globals_, &a2a, -a2a_max, a2a_max};
0395     VarCut a2_cut{globals_, &a2, -a2_max, a2_max};
0396     VarCut x6a_cut{globals_, &x6a, -x6a_max, x6a_max};
0397     VarCut x6m_cut{globals_, &x6m, -x6m_max, x6m_max};
0398     VarCut phi0a_cut{globals_, &phi0a, -settings_.dphisector(), settings_.dphisector()};
0399     VarCut z0a_cut{globals_, &z0a, (-1) * settings_.zlength(), settings_.zlength()};
0400     VarCut phi0_cut{globals_, &phi0, -2 * settings_.dphisector(), 2 * settings_.dphisector()};
0401     VarCut rinv_cut{globals_, &rinv, -settings_.maxrinv(), settings_.maxrinv()};
0402     VarCut t_cut{globals_, &t, -t_max, t_max};
0403     VarCut z0_cut{globals_, &z0, -z0_max, z0_max};
0404     VarCut x8_0_cut{globals_, &x8_0, -x8_max, x8_max};
0405     VarCut x8_1_cut{globals_, &x8_1, -x8_max, x8_max};
0406     VarCut x8_2_cut{globals_, &x8_2, -x8_max, x8_max};
0407     VarCut x8_3_cut{globals_, &x8_3, -x8_max, x8_max};
0408     VarCut x22_0_cut{globals_, &x22_0, -x22_max, x22_max};
0409     VarCut x22_1_cut{globals_, &x22_1, -x22_max, x22_max};
0410     VarCut x22_2_cut{globals_, &x22_2, -x22_max, x22_max};
0411     VarCut x22_3_cut{globals_, &x22_3, -x22_max, x22_max};
0412     VarCut x23_0_cut{globals_, &x23_0, -x23_max, x23_max};
0413     VarCut x23_1_cut{globals_, &x23_1, -x23_max, x23_max};
0414     VarCut x23_2_cut{globals_, &x23_2, -x23_max, x23_max};
0415     VarCut x23_3_cut{globals_, &x23_3, -x23_max, x23_max};
0416     VarCut x13_0_cut{globals_, &x13_0, -x13_max, x13_max};
0417     VarCut x13_1_cut{globals_, &x13_1, -x13_max, x13_max};
0418     VarCut x13_2_cut{globals_, &x13_2, -x13_max, x13_max};
0419     VarCut x13_3_cut{globals_, &x13_3, -x13_max, x13_max};
0420     VarCut x13_4_cut{globals_, &x13_4, -x13_max, x13_max};
0421     VarCut x25_0_cut{globals_, &x25_0, -settings_.dphisector(), settings_.dphisector()};
0422     VarCut x25_1_cut{globals_, &x25_1, -settings_.dphisector(), settings_.dphisector()};
0423     VarCut x25_2_cut{globals_, &x25_2, -settings_.dphisector(), settings_.dphisector()};
0424     VarCut x25_3_cut{globals_, &x25_3, -settings_.dphisector(), settings_.dphisector()};
0425     VarCut x25_4_cut{globals_, &x25_4, -settings_.dphisector(), settings_.dphisector()};
0426     VarCut phiD_0_cut{globals_, &phiD_0, -2 * settings_.dphisector(), 2 * settings_.dphisector()};
0427     VarCut phiD_1_cut{globals_, &phiD_1, -2 * settings_.dphisector(), 2 * settings_.dphisector()};
0428     VarCut phiD_2_cut{globals_, &phiD_2, -2 * settings_.dphisector(), 2 * settings_.dphisector()};
0429     VarCut phiD_3_cut{globals_, &phiD_3, -2 * settings_.dphisector(), 2 * settings_.dphisector()};
0430     VarCut phiD_4_cut{globals_, &phiD_4, -2 * settings_.dphisector(), 2 * settings_.dphisector()};
0431     VarCut der_phiD_cut{globals_, &der_phiD, -der_phiD_max, der_phiD_max};
0432     VarCut rD_0_cut{globals_, &rD_0, -settings_.rmaxdisk(), settings_.rmaxdisk()};
0433     VarCut rD_1_cut{globals_, &rD_1, -settings_.rmaxdisk(), settings_.rmaxdisk()};
0434     VarCut rD_2_cut{globals_, &rD_2, -settings_.rmaxdisk(), settings_.rmaxdisk()};
0435     VarCut rD_3_cut{globals_, &rD_3, -settings_.rmaxdisk(), settings_.rmaxdisk()};
0436     VarCut rD_4_cut{globals_, &rD_4, -settings_.rmaxdisk(), settings_.rmaxdisk()};
0437 
0438     VarCut t_disk_cut_left{globals_, &t, -t_disk_max, -t_disk_min};
0439     VarCut t_disk_cut_right{globals_, &t, t_disk_min, t_disk_max};
0440     VarCut t_layer_cut{globals_, &t, -t_layer_max, t_layer_max};
0441 
0442     // the following flags are used to apply the cuts in TrackletCalculator
0443     // and in the output Verilog
0444     VarFlag valid_trackpar{globals_, "valid_trackpar", &rinv_final, &phi0_final, &t_final, &z0_final};
0445 
0446     VarFlag valid_phiL_0{globals_, "valid_phiL_0", &phiL_0_final};
0447     VarFlag valid_phiL_1{globals_, "valid_phiL_1", &phiL_1_final};
0448     VarFlag valid_phiL_2{globals_, "valid_phiL_2", &phiL_2_final};
0449     VarFlag valid_phiL_3{globals_, "valid_phiL_3", &phiL_3_final};
0450 
0451     VarFlag valid_zL_0{globals_, "valid_zL_0", &zL_0_final};
0452     VarFlag valid_zL_1{globals_, "valid_zL_1", &zL_1_final};
0453     VarFlag valid_zL_2{globals_, "valid_zL_2", &zL_2_final};
0454     VarFlag valid_zL_3{globals_, "valid_zL_3", &zL_3_final};
0455 
0456     VarFlag valid_der_phiL{globals_, "valid_der_phiL", &der_phiL_final};
0457     VarFlag valid_der_zL{globals_, "valid_der_zL", &der_zL_final};
0458 
0459     VarFlag valid_phiD_0{globals_, "valid_phiD_0", &phiD_0_final};
0460     VarFlag valid_phiD_1{globals_, "valid_phiD_1", &phiD_1_final};
0461     VarFlag valid_phiD_2{globals_, "valid_phiD_2", &phiD_2_final};
0462     VarFlag valid_phiD_3{globals_, "valid_phiD_3", &phiD_3_final};
0463     VarFlag valid_phiD_4{globals_, "valid_phiD_4", &phiD_4_final};
0464 
0465     VarFlag valid_rD_0{globals_, "valid_rD_0", &rD_0_final};
0466     VarFlag valid_rD_1{globals_, "valid_rD_1", &rD_1_final};
0467     VarFlag valid_rD_2{globals_, "valid_rD_2", &rD_2_final};
0468     VarFlag valid_rD_3{globals_, "valid_rD_3", &rD_3_final};
0469     VarFlag valid_rD_4{globals_, "valid_rD_4", &rD_4_final};
0470 
0471     VarFlag valid_der_phiD{globals_, "valid_der_phiD", &der_phiD_final};
0472     VarFlag valid_der_rD{globals_, "valid_der_rD", &der_rD_final};
0473   };
0474 };  // namespace trklet
0475 
0476 #endif