77 double solution = tminus < 0 ? tplus / pT2 : tminus /
pT2;
84 if (fabs(zProp) >
zCyl) {
87 solution = tminus < 0 ? tplus : tminus;
119 if (
success == 2 && xProp * xProp + yProp * yProp >
rCyl2) {
147 if (fabs(fabs(radius) - dist) >
rCyl)
159 double phiProp, zProp;
163 double rProp =
std::min(fabs(radius) + dist - 0.000001,
rCyl);
166 double sinPhiProp = (rProp * rProp - radius * radius - dist * dist) / (2. * dist * radius);
172 if (1. - fabs(sinPhiProp) < 1E-9) {
178 double delta = r0 * r0 + rcyl2 * (1. -
q0);
182 deltaPhi = radius > 0 ? (-r0 +
std::sqrt(delta)) / (1. - q0) : (-r0 -
std::sqrt(delta)) / (1. - q0);
186 if (fabs(deltaPhi) > 1E-3) {
189 phiProp = std::asin(sinPhiProp);
200 if (fabs(phiProp - phi0) > 2. *
M_PI)
201 phiProp += (phiProp > phi0 ? -2. *
M_PI : +2. *
M_PI);
207 if ((phiProp - phi0) * radius < 0.0)
208 radius > 0.0 ? phiProp += 2 *
M_PI : phiProp -= 2 *
M_PI;
218 zProp =
particle_.
Z() + (phiProp - phi0) * pZ * radius / pT;
219 if (fabs(zProp) >
zCyl) {
220 zProp =
zCyl * fabs(pZ) / pZ;
221 phiProp = phi0 + (zProp -
particle_.
Z()) / radius * pT / pZ;
230 if (
firstLoop || fabs(pZ) / pT < 1E-10) {
234 zProp =
zCyl * fabs(pZ) / pZ;
235 phiProp = phi0 + (zProp -
particle_.
Z()) / radius * pT / pZ;
262 phiProp = phi0 + (phiProp - phi0) * factor;
266 double xProp = xC + radius * sProp;
267 double yProp = yC - radius * cProp;
269 double pxProp = pT * cProp;
270 double pyProp = pT * sProp;
276 if (
success == 2 && xProp * xProp + yProp * yProp >
rCyl2) {
343 rz = fabs(fabs(radius) - distz) +
std::sqrt(x0 * x0 + y0 * y0) + 0.0000001;
344 r0 = fabs(fabs(radius) - dist0) + 0.0000001;
362 if (fabs(rz - r0) < 1E-10)
522 if (done && (c2teta < 0.99014 || c2teta > 0.9998755))
604 double Dxy2 = Dxy * Dxy;
605 double Sxy2 = Sxy * Sxy;
606 double SDxy = dx * dx + dy *
dy;
608 double ATxy = std::atan2(dy, dx);
610 double a = r2 - Dxy2 / SDxy;
611 double b = r * (r2 - Sxy);
612 double c = r4 - 2. * Sxy * r2 + Sxy2 + Dxy2;
616 std::array<double, 4> helixRs = {{0.}};
617 helixRs[0] = (b -
std::sqrt(b * b - a * c)) / (2. * a);
618 helixRs[1] = (b +
std::sqrt(b * b - a * c)) / (2. * a);
619 helixRs[2] = -helixRs[0];
620 helixRs[3] = -helixRs[1];
622 std::array<double, 4> helixPhis = {{0.}};
623 helixPhis[0] = std::asin(SSDxy / (2. * helixRs[0]));
624 helixPhis[1] = std::asin(SSDxy / (2. * helixRs[1]));
625 helixPhis[2] = -helixPhis[0];
626 helixPhis[3] = -helixPhis[1];
628 double solution1 = 0.;
629 double solution2 = 0.;
633 for (
unsigned int i = 0;
i < 4; ++
i) {
634 helixPhis[
i] = ATxy + helixPhis[
i];
647 if (fabs(fabs(fabs(helixRs[i]) - dist) - fabs(radius)) < 1
e-6) {
649 if (solution1 == 0.) {
650 solution1 = helixRs[
i];
653 }
else if (solution2 == 0.) {
654 if (helixRs[i] < solution1) {
655 solution2 = solution1;
656 solution1 = helixRs[
i];
660 solution2 = helixRs[
i];
665 std::cout <<
"warning !!! More than two solutions for this track !!! " << std::endl;
672 double helixPhi = 0.;
675 if (solution1 * solution2 == 0.) {
676 std::cout <<
"warning !!! Less than two solution for this track! " << solution1 <<
" " << solution2 << std::endl;
679 }
else if (solution1 * solution2 < 0.) {
681 double norm = pT / SSDxy;
687 if (solution1 < 0.) {
697 double norm = pT / SSDxy;
718 ip = distz - fabs(radius);
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
void setMomentum(const XYZTLorentzVector &vtx)
set the momentum
void setCharge(float q)
set the MEASURED charge
double helixRadius() const
The helix Radius.
double helixCentrePhi() const
The azimuth if the vector joining the cylinder and the helix axes.
bool propagateToPreshowerLayer1(bool first=true)
double pt() const
transverse momentum
double rCyl
Simulated particle that is to be resp has been propagated.
bool propagateToNominalVertex(const XYZTLorentzVector &hit2=XYZTLorentzVector(0., 0., 0., 0.))
void init()
Initialize internal switches and quantities.
double Perp2() const
perpendicular momentum squared
bool firstLoop
Do only the first half-loop.
int success
0:propagation still be done, 1:reached 'barrel', 2:reached 'endcaps'
double properTime
The proper time of the particle.
Sin< T >::type sin(const T &t)
BaseParticlePropagator()
Default c'tor.
bool propagateToBeamCylinder(const XYZTLorentzVector &v, double radius=0.)
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
double mass() const
get the MEASURED mass
double c_light() const
The speed of light in mm/ns (!) without clhep (yeaaahhh!)
double R2() const
vertex radius**2
bool propagateToEcal(bool first=true)
bool propagateToClosestApproach(double x0=0., double y0=0, bool first=true)
double helixCentreX() const
The x coordinate of the helix axis.
bool propagateToVFcalEntrance(bool first=true)
const XYZTLorentzVector & momentum() const
the momentum fourvector
double helixCentreDistToAxis() const
The distance between the cylinder and the helix axes.
double properDecayTime
The proper decay time of the particle.
bool propagateToHcalExit(bool first=true)
double cos2ThetaV() const
Cos< T >::type cos(const T &t)
double Y() const
y of vertex
double Py() const
y of the momentum
double Pt() const
transverse momentum
double Z() const
z of vertex
Abs< T >::type abs(const T &t)
static const std::string B
double Pz() const
z of the momentum
double charge() const
get the MEASURED charge
int propDir
The propagation direction.
bool propagateToEcalEntrance(bool first=true)
const XYZTLorentzVector & vertex() const
the vertex fourvector
bool onEndcap() const
Is the vertex already on the cylinder endcap ?
bool decayed
The particle decayed while propagated !
BaseParticlePropagator propagated() const
double helixCentreY() const
The y coordinate of the helix axis.
bool inside() const
Is the vertex inside the cylinder ? (stricly inside : true)
bool onSurface() const
Is the vertex already on the cylinder surface ?
double X() const
x of vertex
bool debug
The debug level.
double helixStartPhi() const
The azimuth of the momentum at the vertex.
bool propagateToHcalEntrance(bool first=true)
double Px() const
x of the momentum
double E() const
energy of the momentum
double bField
Magnetic field in the cylinder, oriented along the Z axis.
double T() const
vertex time
bool propagateToHOLayer(bool first=true)
bool onBarrel() const
Is the vertex already on the cylinder barrel ?
bool propagateToPreshowerLayer2(bool first=true)
void setVertex(const XYZTLorentzVector &vtx)
set the vertex
double xyImpactParameter(double x0=0., double y0=0.) const
Transverse impact parameter.
bool fiducial
The particle traverses some real material.
math::XYZTLorentzVector XYZTLorentzVector