23 phi_(
std::atan(momentum_.Py() / momentum_.Px()) +
24 (momentum_.Px() * particle.
charge() < 0 ? 3. *
M_PI / 2. :
M_PI / 2.))
33 centerX_(position_.
X() -
34 radius_ * (momentum_.Py() / momentum_.Px()) /
35 std::
sqrt((momentum_.Py() / momentum_.Px()) * (momentum_.Py() / momentum_.Px()) + 1) *
36 (momentum_.Px() * particle.
charge() < 0 ? 1. : -1.)),
37 centerY_(position_.
Y() -
38 radius_ * 1 /
std::
sqrt((momentum_.Py() / momentum_.Px()) * (momentum_.Py() / momentum_.Px()) + 1) *
39 (momentum_.Px() * particle.
charge() < 0 ? -1. : 1.))
43 centerR_(
std::
sqrt(centerX_ * centerX_ + centerY_ * centerY_)),
44 minR_(
std::
abs(centerR_ - radius_)),
45 maxR_(centerR_ + radius_)
57 return (minR_ < layer.getRadius() && maxR_ > layer.getRadius());
97 double E = centerX_ * centerX_ + centerY_ * centerY_ + radius_ * radius_ - layer.getRadius() * layer.getRadius();
98 double F = 2 * centerY_ * radius_;
99 double G = 2 * centerX_ * radius_;
101 double a =
F *
F +
G *
G;
102 double b = 2 * E *
F;
103 double c = E * E -
G *
G;
117 double phi1 = 0, phi2 = 0;
119 phi1 = std::asin((2. *
c) / (-
b + sqrtDelta));
120 phi2 = std::asin((-
b + sqrtDelta) / (2. *
a));
122 phi1 = std::asin((-
b - sqrtDelta) / (2. *
a));
123 phi2 = std::asin((2. *
c) / (-
b - sqrtDelta));
127 if (
std::abs(layer.getRadius() - getRadParticle(phi1)) > 1.0
e-2) {
130 if (
std::abs(layer.getRadius() - getRadParticle(phi2)) > 1.0
e-2) {
144 double t1 = (phi1 - phi_) / phiSpeed_;
148 double t2 = (phi2 - phi_) / phiSpeed_;
156 if (
std::abs(layer.getRadius() - getRadParticle(phi1)) > 1.0
e-2 ||
157 std::abs(layer.getRadius() - getRadParticle(phi2)) > 1.0
e-2) {
165 bool particleMovesInwards = momentum_.X() * position_.X() + momentum_.Y() * position_.Y() < 0;
167 double posX1 = centerX_ + radius_ *
std::cos(phi1);
168 double posY1 = centerY_ + radius_ *
std::sin(phi1);
169 double momX1 = momentum_.X() *
std::cos(phi1 - phi_) - momentum_.Y() *
std::sin(phi1 - phi_);
170 double momY1 = momentum_.X() *
std::sin(phi1 - phi_) + momentum_.Y() *
std::cos(phi1 - phi_);
171 bool particleMovesInwards1 = momX1 * posX1 + momY1 * posY1 < 0;
173 double posX2 = centerX_ + radius_ *
std::cos(phi2);
174 double posY2 = centerY_ + radius_ *
std::sin(phi2);
175 double momX2 = momentum_.X() *
std::cos(phi2 - phi_) - momentum_.Y() *
std::sin(phi2 - phi_);
176 double momY2 = momentum_.X() *
std::sin(phi2 - phi_) + momentum_.Y() *
std::cos(phi2 - phi_);
177 bool particleMovesInwards2 = momX2 * posX2 + momY2 * posY2 < 0;
179 if (particleMovesInwards1 != particleMovesInwards) {
181 }
else if (particleMovesInwards2 != particleMovesInwards) {
195 double deltaPhi = phiSpeed_ * deltaT;
198 position_.Z() + momentum_.Z() / momentum_.E() * deltaTimeC,
199 position_.T() + deltaT);
211 (centerY_ + radius_ *
std::sin(phi)) * (centerY_ + radius_ *
std::sin(phi)));
Sin< T >::type sin(const T &t)
Implementation of a barrel detector layer (cylindrical).
static double constexpr speedOfLight
Speed of light [cm / ns].
bool crosses(const BarrelSimplifiedGeometry &layer) const override
Check if an intersection of the trajectory with a barrel layer exists.
Mathematical representation of a straight trajectory.
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
Definition the generic trajectory of a particle (base class for helix/straight trajectories).
void move(double deltaTimeC) override
Move the particle along the helix trajectory for a given time.
HelixTrajectory(const Particle &particle, double magneticFieldZ)
Constructor.
double getRadParticle(double phi) const
Return distance of particle from center of the detector if it was at given angle phi of the helix...
double nextCrossingTimeC(const BarrelSimplifiedGeometry &layer, bool onLayer=false) const override
Return delta time (t*c) of the next intersection of trajectory and barrel layer.
double nextCrossingTimeC(const BarrelSimplifiedGeometry &layer, bool onLayer=false) const override
Return delta time (t*c) of the next intersection of trajectory and barrel layer.
Definition of a generic FastSim Particle which can be propagated through the detector (formerly Parti...
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)