11 bool cosmics,
bool field,
double* trackParameters,
double*
hit,
double* phit,
bool onDisk) {
13 if (cosmics && !field) {
17 else if (cosmics && field) {
21 else if (!cosmics && !field) {
33 #ifndef TIF_COSMIC_SETUP
34 const double Rmu = 385;
35 const double zmu = 560;
37 TVector3 r0(hit[0], hit[1], hit[2]);
38 TVector3 pr(phit[0], phit[1], phit[2]);
39 TVector2 r0_xy = r0.XYvector();
40 TVector2 pr_xy = pr.Unit().XYvector();
42 ((r0_xy * pr_xy) +
sqrt((r0_xy * pr_xy) * (r0_xy * pr_xy) - r0_xy.Mod2() + Rmu * Rmu)) / c * pr.Mag() / pr.Perp();
44 double t_endcap = fabs(((phit[2] / fabs(phit[2]) * zmu) + hit[2]) / c * pr.Mag() / pr.Pz());
46 return t_barrel < t_endcap ? t_barrel : t_endcap;
48 const double y_trigger = 100;
49 double p =
sqrt(phit[0] * phit[0] + phit[1] * phit[1] + phit[2] * phit[2]);
53 return fabs((y_trigger - hit[1]) * (p / phit[1]) / c);
59 const double Rmu = 385;
60 const double zmu = 560;
63 double& kappa = trackParameters[0];
64 double&
theta = trackParameters[1];
65 double& phi_0 = trackParameters[2];
66 double& d_0 = trackParameters[3];
67 double& z_0 = trackParameters[4];
68 double invkappa = 1 / kappa;
71 double phi =
getPhi(trackParameters, hit, onDisk) - phi_0;
74 double phi_mu_b = (kappa > 0 ? -1 : 1) * acos((Rmu * Rmu - d_0 * d_0 - 2 * invkappa * invkappa + 2 * invkappa * d_0) /
75 (2 * invkappa * d_0 - 2 * invkappa * invkappa));
76 double phi_mu_e = kappa *
tan(theta) * ((phit[2] < 0 ? 1 : -1) * zmu - z_0);
78 double t_barrel = fabs(invkappa / (c *
sin(theta)) * (phi - phi_mu_b));
80 double t_endcap = fabs(invkappa / (c *
sin(theta)) * (phi - phi_mu_e));
82 return t_barrel < t_endcap ? t_barrel : t_endcap;
88 TVector3 r0(hit[0], hit[1], hit[2]);
96 double&
theta = trackParameters[1];
98 return onDisk ? fabs(hit[2] / (c *
cos(theta))) : fabs(
sqrt(hit[0] * hit[0] + hit[1] * hit[1]) / (c *
sin(theta)));
102 return trackParameters[3] *
sin(trackParameters[2]) + (1 / trackParameters[0]) * (
sin(phi) -
sin(trackParameters[2]));
106 return -trackParameters[3] *
cos(trackParameters[2]) -
107 (1 / trackParameters[0]) * (
cos(phi) -
cos(trackParameters[2]));
111 return trackParameters[4] + (phi - trackParameters[2]) / (trackParameters[0] *
tan(trackParameters[1]));
116 return trackParameters[2] + trackParameters[0] *
tan(trackParameters[1]) * (hit[2] - trackParameters[4]);
120 if (trackParameters[2] > -2.35 && trackParameters[2] < -0.78) {
122 phi = acos(-trackParameters[0] *
123 (hit[1] - (trackParameters[3] - 1 / trackParameters[0]) * (-
cos(trackParameters[2]))));
125 if (fabs(
x(trackParameters, phi) - hit[0]) > fabs(
x(trackParameters, -phi) - hit[0]))
130 asin(trackParameters[0] * (hit[0] - (trackParameters[3] - 1 / trackParameters[0]) *
sin(trackParameters[2])));
132 if ((fabs(
y(trackParameters, phi) - hit[1]) > fabs(
y(trackParameters,
TMath::Pi() - phi) - hit[1])))
143 LogDebug(
"trackParameters") <<
"outer position: " << position.x() <<
" " << position.y() <<
" " << position.z();
144 LogDebug(
"trackParameters") <<
"outer momentum: " << momentum.x() <<
" " << momentum.y() <<
" " << momentum.z();
148 position -= radius / trackParameters[0];
149 LogDebug(
"trackParameters") <<
"center of curvature: " << position.x() <<
" " << position.y() <<
" " << position.z();
151 trackParameters[3] = position.rho() - fabs(1 / trackParameters[0]);
152 if (trackParameters[0] > 0)
153 trackParameters[3] *= -1.;
155 double phi_out = trackParameters[2];
156 double phi_0 = position.phi() -
TMath::Pi() / 2;
157 if (trackParameters[0] < 0)
165 LogDebug(
"trackParameters") <<
"phi_0: " << phi_0;
166 trackParameters[2] = phi_0;
168 trackParameters[4] = tk.
outerPosition().z() - (phi_out - phi_0) / TMath::Tan(trackParameters[1]) / trackParameters[0];
static double timeOfFlightBeamB(double *trackParameters, double *hit, double *phit, bool onDisk)
const edm::EventSetup & c
static double x(double *trackParameters, double phi)
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
const math::XYZPoint & outerPosition() const
position of the outermost hit
const math::XYZPoint & innerPosition() const
position of the innermost hit
static double timeOfFlight(bool cosmics, bool field, double *trackParameters, double *hit, double *phit, bool onDisk)
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
tuple cosmics
Individual module setups ###.
static double timeOfFlightCosmicB(double *trackParameters, double *hit, double *phit, bool onDisk)
static void trackParameters(const reco::Track &tk, double *trackParameters)
static double getPhi(double *trackParameters, double *hit, bool onDisk)
static double timeOfFlightCosmic(double *hit, double *phit)
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
static double y(double *trackParameters, double phi)
static double timeOfFlightBeam(double *hit, double *phit)
static double z(double *trackParameters, double phi)
static int position[264][3]