|
ATLAS Offline Software
|
Go to the documentation of this file.
15 #include "GaudiKernel/MsgStream.h"
24 if (
log.level() <= MSG::WARNING)
log << MSG::WARNING <<
"WARNING: Possible mistake in Step function" <<
endmsg;
26 if (
d <= x0) {
return 0; }
27 if (
d > x0) {
return 1; }
32 double x0,
double y0,
double r0,
45 while (
x > inc +
zero) {
x -= inc; }
46 while (
x <
zero) {
x += inc; }
75 double x1 = -
r0 * scphi.
sn;
122 double x0 =
r0 * scphi.
sn;
123 double y0 = -
r0 * scphi.
cs;
127 double radius = std::hypot(d_x, d_y);
169 double p_1 = line_trans[
Amg::z] - z_cyl;
170 double p_2 = line_trans[
Amg::z] + z_cyl;
171 double tantheta = sctheta.
sn / sctheta.
cs;
173 double x_1 = line_trans[
Amg::x] - p_1 * scphi.
cs * tantheta;
174 double y_1 = line_trans[
Amg::y] - p_1 * scphi.
sn * tantheta;
175 double r_1 = std::hypot(x_1, y_1);
176 if (r_1 < r_cyl) {
return true; }
178 double x_2 = line_trans[
Amg::x] - p_2 * scphi.
cs * tantheta;
179 double y_2 = line_trans[
Amg::y] - p_2 * scphi.
sn * tantheta;
180 double r_2 = std::hypot(x_2, y_2);
181 if (r_2 < r_cyl) {
return true; }
187 if (std::abs(r_0) > r_cyl)
return false;
190 double s_1 = -scphi.
sn * r_0;
191 double s_2 = scphi.
cs * std::sqrt(r_cyl * r_cyl - r_0 * r_0);
195 double inv_angle = 1 / (scphi.
cs * tantheta);
197 double z_1 = line_trans[
Amg::z] + (x_1 - line_trans[
Amg::x]) * inv_angle;
199 if (std::abs(z_1) < z_cyl)
return true;
202 double z_2 = line_trans[
Amg::z] + (x_2 - line_trans[
Amg::x]) * inv_angle;
204 return std::abs(z_2) < z_cyl;
208 double hitr = hit.perp();
212 double sdistance = FLT_MAX;
214 if (sctheta.
apply(hitr, hit[
Amg::z]) < 0)
return sdistance;
220 if (std::abs(sctheta.
sn) > 1
e-7) {
222 double zext =
z0 + (hitr * sctheta.
cs + diffr * diffr * invcurvature) / sctheta.
sn;
223 sdistance = (zext - hit[
Amg::z]);
227 if (std::abs(sctheta.
sn) > 1
e-7) {
232 rext = ((hit[
Amg::z] -
z0) * sctheta.
sn - diffz * diffz * invcurvature) / sctheta.
cs;
240 sdistance = (rext - hitr);
248 if (std::abs(
ratio) < 1.)
257 if (std::abs(
ratio) < 1.) {
258 double asin_ratio = std::asin(
ratio);
259 theta1 = hit->
getTheta() + asin_ratio;
260 theta2 = hit->
getTheta() - asin_ratio;
275 const double theta = roadmom.theta();
276 const double phi = roadmom.phi();
281 double tantheta = sctheta.
sn / sctheta.
cs;
283 double r0 = scphi.
apply(roadpos.x(), -roadpos.y());
286 double invcurvature =
charge / roadmom.mag();
288 if (roadmom.mag() < 2) invcurvature = 0.;
290 double posr = std::sqrt(
pos.x() *
pos.x() +
pos.y() *
pos.y());
291 double thetan =
theta;
299 double rotationangle = 0.;
303 if ((posr * posr -
r0 *
r0) > 0) {
304 double lenr = std::sqrt(posr * posr -
r0 *
r0);
305 double len = posr - fabs(
r0);
307 rotationangle = diffr * invcurvature / sctheta.
sn;
308 xe = roadpos.x() + lenr * scphi.
cs;
309 ye = roadpos.y() + lenr * scphi.
sn;
310 ze = roadpos.z() + len / tantheta + diffr * rotationangle;
311 thetan = std::atan2(1., 1 / tantheta + 2 * rotationangle);
314 double lext = 0., rotationangle = 0.;
318 rotationangle = diffz * invcurvature / sctheta.
cs;
319 lext = (
pos.z() - roadpos.z()) * tantheta - diffz * rotationangle;
322 double effcurv = invcurvature / sctheta.
cs;
324 lext = (
pos.z() - roadpos.z()) * tantheta +
327 xe = roadpos.x() + lext * scphi.
cs;
328 ye = roadpos.y() + lext * scphi.
sn;
329 double dx = tantheta - 2 * rotationangle;
330 if (
dx != 0) thetan = std::atan2(1., 1 /
dx);
335 if (sctheta.
cs * scthetan.
cs + sctheta.
sn * scthetan.
sn < 0) {
double apply(double a, double b) const
static double angleFrom0To180(double angle)
computes angle in degrees between 0 and 180
double getMagneticTrackRatio() const
ratio of the tracklength of the particle to which hit might belong would have traversed in magnetic f...
static double signedDistanceToLine(double x0, double y0, double r0, double phi)
distance from (x0,y0) to the line (r0,phi), phi in rad
static int sgn(double d)
sign (-1 or 1) of a double
static Amg::Vector3D shortestPointOfLineToOrigin(const Amg::Vector3D &vec, double phi, double theta)
calculates the 3d-point closest to origin
Scalar phi() const
phi method
singleton-like access to IMessageSvc via open function and helper
Scalar theta() const
theta method
static int step(double d, double x0=0)
step function at place x0
Helper to simultaneously calculate sin and cos of the same angle.
constexpr double z_cylinder
length of cylinder
static double distanceToLine3D(const Amg::Vector3D &point, const Amg::Vector3D &l_trans, double phi, double theta)
distance from (x0,y0,z0) to line (x,y,z,phi,theta)
std::vector< size_t > vec
IMessageSvc * getMessageSvc(bool quiet=false)
static void thetasForCurvedHit(double ratio, MuonHoughHit *hit, double &theta1, double &theta2)
calculates theta at (x,y,z) for curved track model, for positive and negative curvature
static double distanceToLine(double x0, double y0, double r0, double phi)
distance from (x0,y0) to the line (r0,phi), phi in rad
static double angleFromMinusPiToPi(double angle)
computes angle in rad between -Pi and Pi
static double signedDistanceOfLineToOrigin2D(double x, double y, double phi)
signed distance of line with point (x,y) and angle phi to origin
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
static double incrementTillAbove0(double x, double inc, double zero=0)
increments x with inc till above x
const double r0
electron radius{cm}
constexpr double z_end
z value whereafter no magnetic field / curvature
static double angleFrom0To360(double angle)
computes angle in degrees between 0 and 360
static void extrapolateCurvedRoad(const Amg::Vector3D &roadpos, const Amg::Vector3D &roadmom, const Amg::Vector3D &pos, Amg::Vector3D &roadpose, Amg::Vector3D &roaddire)
extrapolates road to global position
MuonHoughMathUtils()
default constructor
static double thetaForCurvedHit(double invcurvature, MuonHoughHit *hit)
calculates theta at (x,y,z) for curved track model
static Amg::Vector3D shortestPointOfLineToOrigin3D(const Amg::Vector3D &vec, double phi, double theta)
calculates the 3d-point closest to origin in xy-plane
static double angleFrom0ToPi(double angle)
computes angle in rad between 0 and Pi
double charge(const T &p)
Eigen::Matrix< double, 3, 1 > Vector3D
static double distanceToLine2D(double x0, double y0, double r, double phi)
distance from (x0,y0) to line (r,phi)
def time(flags, cells_name, *args, **kw)
double getTheta() const
returns theta
Helper to simultaneously calculate sin and cos of the same angle.
static double distanceOfLineToOrigin2D(double a, double b)
distance of line y = ax + b to origin
constexpr double radius_cylinder
radius of cylinder
static bool lineThroughCylinder(const Amg::Vector3D &vec, double phi, double theta, double r_0, double z_0)
calculates if line (x,y,z,phi,theta) crosses cylinder (r_0,z_0) around origin
constexpr double tan_barrel
relation for transition between endcap and barrel 11.43 m (r) / 14m (z)
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
static std::string intToString(int i)
converts integer to string
constexpr double z_magnetic_range
range where hit is curved in endcap region
void zero(TH2 *h)
zero the contents of a 2d histogram
static double signedDistanceCurvedToHit(double z0, double theta, double invcurvature, const Amg::Vector3D &hit)
calculates distance of point (x,y,z) to curved track with z0, theta and invcurvature for curved track...
constexpr double z_magnetic_range_squared
range where hit is curved in endcap region ('squared')