File indexing completed on 2026-11-09 09:32:24
0001 #include <cassert>
0002 #include <cmath>
0003 #include <csignal>
0004
0005 #include "AngleCut.hh"
0006 #include "SLOG.hh"
0007 #include "SMath.hh"
0008 #include "scuda.h"
0009 #include "squad.h"
0010
0011 const plog::Severity SPhiCut::LEVEL = SLOG::EnvLevel("SPhiCut", "DEBUG");
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 void SPhiCut::PrepareParam(quad& q0, double startPhi_pi, double deltaPhi_pi)
0056 {
0057 double phi0_pi = startPhi_pi;
0058 double phi1_pi = startPhi_pi + deltaPhi_pi;
0059
0060 double cosPhi0 = SMath::cos_pi(phi0_pi);
0061 double sinPhi0 = SMath::sin_pi(phi0_pi);
0062 double cosPhi1 = SMath::cos_pi(phi1_pi);
0063 double sinPhi1 = SMath::sin_pi(phi1_pi);
0064
0065 q0.f.x = float(cosPhi0);
0066 q0.f.y = float(sinPhi0);
0067 q0.f.z = float(cosPhi1);
0068 q0.f.w = float(sinPhi1);
0069
0070 LOG(LEVEL)
0071 << " startPhi_pi " << startPhi_pi
0072 << " deltaPhi_pi " << deltaPhi_pi
0073 << " phi0_pi " << phi0_pi
0074 << " phi1_pi " << phi1_pi
0075 << " cosPhi0 " << cosPhi0
0076 << " sinPhi0 " << sinPhi0
0077 << " cosPhi1 " << cosPhi1
0078 << " sinPhi1 " << sinPhi1;
0079 }
0080
0081 const plog::Severity SThetaCut::LEVEL = SLOG::EnvLevel("SThetaCut", "DEBUG");
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132 void SThetaCut::PrepareParam(quad& q0, quad& q1, double startTheta_pi, double deltaTheta_pi)
0133 {
0134 double theta0_pi = startTheta_pi;
0135 double theta1_pi = startTheta_pi + deltaTheta_pi;
0136 bool has_thetacut = theta0_pi > 0. || theta1_pi < 1.;
0137 assert(has_thetacut);
0138 if (!has_thetacut)
0139 std::raise(SIGINT);
0140
0141 assert(theta0_pi >= 0. && theta0_pi <= 1.);
0142 assert(theta1_pi >= 0. && theta1_pi <= 1.);
0143
0144 bool plane_theta0 = theta0_pi == 0.5;
0145 bool plane_theta1 = theta1_pi == 0.5;
0146
0147
0148
0149 const double pi = M_PIf;
0150 double theta0 = theta0_pi * pi;
0151 double theta1 = theta1_pi * pi;
0152
0153 double cosTheta0 = std::cos(theta0);
0154 double sinTheta0 = std::sin(theta0);
0155 double tanTheta0 = std::tan(theta0);
0156
0157 double cosTheta1 = std::cos(theta1);
0158 double sinTheta1 = std::sin(theta1);
0159 double tanTheta1 = std::tan(theta1);
0160
0161
0162
0163
0164 double tan2Theta0 = tanTheta0 * tanTheta0;
0165 double tan2Theta1 = tanTheta1 * tanTheta1;
0166
0167 q0.f.x = float(plane_theta0 ? 0. : cosTheta0);
0168 q0.f.y = float(plane_theta0 ? 1.0 : sinTheta0);
0169 q0.f.z = float(plane_theta1 ? 0. : cosTheta1);
0170 q0.f.w = float(plane_theta1 ? 1.0 : sinTheta1);
0171
0172 q1.f.x = float(plane_theta0 ? 0. : tan2Theta0);
0173 q1.f.y = float(plane_theta1 ? 0. : tan2Theta1);
0174
0175 LOG(LEVEL)
0176 << " startTheta_pi " << startTheta_pi
0177 << " deltaTheta_pi " << deltaTheta_pi
0178 << " plane_theta0 " << plane_theta0
0179 << " plane_theta1 " << plane_theta1
0180 << " theta0 " << theta0
0181 << " theta1 " << theta1;
0182
0183 LOG(LEVEL)
0184 << " cosTheta0 " << cosTheta0
0185 << " sinTheta0 " << sinTheta0
0186 << " cosTheta1 " << cosTheta1
0187 << " sinTheta1 " << sinTheta1
0188 << " tan2Theta0 " << tan2Theta0
0189 << " tan2Theta1 " << tan2Theta1;
0190 }