12 std::ifstream ifin3(global_coords_filename_.fullPath());
16 <<
"GlobalCoordsObtainer::GlobalCoordsObtainer() - Cannot find " << global_coords_filename_.fullPath();
26 while (ifin3.good()) {
27 ifin3 >> wh >> st >> se >> sl >>
perp >> x_phi0;
31 sl1_constants.
x_phi0 = x_phi0;
34 sl3_constants.
x_phi0 = x_phi0;
37 global_constants.push_back({
ChId.rawId(), sl1_constants, sl3_constants});
43 std::ifstream ifind(maxdrift_filename_.fullPath());
46 <<
"MPSLFilter::MPSLFilter() - Cannot find " << maxdrift_filename_.fullPath();
48 while (ifind.good()) {
49 ifind >> wh >> st >> se >> maxdrift;
50 maxdriftinfo_[wh][st][se] = maxdrift;
61 if (
ChId.wheel() > 0 || (
ChId.wheel() == 0 &&
ChId.sector() % 4 > 1)) {
65 max_drift_tdc = maxdriftinfo_[
ChId.wheel() + 2][
ChId.station() - 1][
ChId.sector() - 1];
66 int SEMICELL_IN_TDC_COUNTS = max_drift_tdc;
67 int SL1_SEMICELL_OFFSET = 96;
84 calc_atan_lut(9, 5, 21. / SEMICELL_IN_TDC_COUNTS / (6.5 * 16), 0., 4. /
std::pow(2, 13), 9, 3, 10, 16,
sgn);
114 long int a_min = -
std::pow(2, (a_size - 1));
115 long int a_max =
std::pow(2, (a_size - 1)) - 1;
116 long int b_min = -
std::pow(2, (b_size - 1));
117 long int b_max =
std::pow(2, (b_size - 1)) - 1;
119 std::map<int, lut_value> lut;
121 for (
long int x_msb = -(
long int)
std::pow(2, msb_num - 1); x_msb < (
long int)
std::pow(2, msb_num - 1); x_msb++) {
122 int x1 = ((x_msb) << lsb_num);
123 int x2 = ((x_msb + 1) << lsb_num) - 1;
125 double t1 = x1 * in_res - abscissa_0;
126 double t2 = x2 * in_res - abscissa_0;
128 double phi1 =
sgn * atan(
t1);
129 double phi2 =
sgn * atan(
t2);
131 double y1 = phi1 / out_res;
132 double y2 = phi2 / out_res;
136 double a = (
y2 -
y1) / (x2 - x1);
146 double t_max_err =
sqrt(
sgn * in_res / out_res /
a - 1);
151 double x_max_err = (t_max_err + abscissa_0) / in_res;
152 double phi_max_err =
sgn * atan(t_max_err);
153 double y_max_err = phi_max_err / out_res;
160 double b = (
y1 + y_max_err -
a * (x_max_err - x1)) / 2;
167 long int a_int = (
long int)(round(
a * (
pow(2, a_extra_bits))));
168 long int b_int = (
long int)(round(
b * (
pow(2, b_extra_bits))));
171 std::vector<long int> as = {a_min, a_int, a_max};
172 std::vector<long int>
bs = {b_min, b_int, b_max};
185 int index = to_two_comp(x_msb, msb_num);
186 lut[
index] = {a_int, b_int};
196 auto phi_lut = &luts[chid].phi;
197 auto phib_lut = &luts[chid].phib;
225 auto phi_lut_a = phi_lut_q.a;
226 auto phi_lut_b = phi_lut_q.b;
227 auto phib_lut_a = phib_lut_q.a;
228 auto phib_lut_b = phib_lut_q.b;
233 int phi_uncut = (phi_lut_b <<
PHI_B_SHL_BITS) + x_lsb * phi_lut_a;
234 int psi_uncut = (phib_lut_b <<
PHIB_B_SHL_BITS) + tanpsi_lsb * phib_lut_a;
243 double phi_f = (double)phi *
PHI_SIZE;
244 double phib_f = (double)phib *
PHIB_SIZE;
constexpr int PHI_LUT_ADDR_WIDTH
constexpr int PHI_PHIB_RES_DIFF_BITS
constexpr int PHIB_B_SHL_BITS
global_constant_per_sl sl1
std::vector< double > get_global_coordinates(uint32_t, int, int, int)
constexpr int PHI_B_SHL_BITS
T perp() const
Magnitude of transverse component.
constexpr double PHIB_SIZE
constexpr int PHIB_LUT_ADDR_WIDTH
constexpr int PHI_MULT_SHR_BITS
constexpr double PHI_SIZE
GlobalCoordsObtainer(const edm::ParameterSet &pset)
global_constant_per_sl sl3
constexpr int TANPSI_SIZE
constexpr int PHIB_MULT_SHR_BITS
std::map< int, lut_value > calc_atan_lut(int, int, double, double, double, int, int, int, int, int)
Power< A, B >::type pow(const A &a, const B &b)