diff --git a/FastSimulation/SimplifiedGeometryPropagator/src/Trajectory.cc b/FastSimulation/SimplifiedGeometryPropagator/src/Trajectory.cc index efd29392649e1..17b44bb551cae 100644 --- a/FastSimulation/SimplifiedGeometryPropagator/src/Trajectory.cc +++ b/FastSimulation/SimplifiedGeometryPropagator/src/Trajectory.cc @@ -7,55 +7,39 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FastSimulation/SimplifiedGeometryPropagator/interface/Constants.h" -fastsim::Trajectory::~Trajectory(){} +fastsim::Trajectory::~Trajectory() {} -fastsim::Trajectory::Trajectory(const fastsim::Particle & particle) -{ - position_ = particle.position(); - momentum_ = particle.momentum(); +fastsim::Trajectory::Trajectory(const fastsim::Particle &particle) { + position_ = particle.position(); + momentum_ = particle.momentum(); } -std::unique_ptr fastsim::Trajectory::createTrajectory(const fastsim::Particle & particle, double magneticFieldZ) -{ - if(particle.charge() == 0. || magneticFieldZ == 0.){ - LogDebug("FastSim") << "create straight trajectory"; - return std::unique_ptr(new fastsim::StraightTrajectory(particle)); - } - else if(std::abs(particle.momentum().Pt() / (fastsim::Constants::speedOfLight * 1e-4 * particle.charge() * magneticFieldZ)) > 1e5){ - LogDebug("FastSim") << "create straight trajectory (huge radius)"; - return std::unique_ptr(new fastsim::StraightTrajectory(particle)); - } - else{ - LogDebug("FastSim") << "create helix trajectory"; - return std::unique_ptr(new fastsim::HelixTrajectory(particle, magneticFieldZ)); - } +std::unique_ptr fastsim::Trajectory::createTrajectory(const fastsim::Particle &particle, + double magneticFieldZ) { + if (particle.charge() == 0. || magneticFieldZ == 0.) { + LogDebug("FastSim") << "create straight trajectory"; + return std::unique_ptr(new fastsim::StraightTrajectory(particle)); + } else { + LogDebug("FastSim") << "create helix trajectory"; + return std::unique_ptr(new fastsim::HelixTrajectory(particle, magneticFieldZ)); + } } - -double fastsim::Trajectory::nextCrossingTimeC(const fastsim::SimplifiedGeometry & layer, bool onLayer) const -{ - if(layer.isForward()) - { - return this->nextCrossingTimeC(static_cast(layer), onLayer); - } - else - { - return this->nextCrossingTimeC(static_cast(layer), onLayer); - } +double fastsim::Trajectory::nextCrossingTimeC(const fastsim::SimplifiedGeometry &layer, bool onLayer) const { + if (layer.isForward()) { + return this->nextCrossingTimeC(static_cast(layer), onLayer); + } else { + return this->nextCrossingTimeC(static_cast(layer), onLayer); + } } - -double fastsim::Trajectory::nextCrossingTimeC(const fastsim::ForwardSimplifiedGeometry & layer, bool onLayer) const -{ - if(onLayer) - { - return -1; - } - // t = (z - z_0) / v_z - // substitute: v_z = p_z / E * c ( note: extra * c absorbed in p_z units) - // => t*c = (z - z_0) / p_z * E - double deltaTimeC = (layer.getZ() - position_.Z()) / momentum_.Z() * momentum_.E(); - return deltaTimeC > 0. ? deltaTimeC : -1.; +double fastsim::Trajectory::nextCrossingTimeC(const fastsim::ForwardSimplifiedGeometry &layer, bool onLayer) const { + if (onLayer) { + return -1; + } + // t = (z - z_0) / v_z + // substitute: v_z = p_z / E * c ( note: extra * c absorbed in p_z units) + // => t*c = (z - z_0) / p_z * E + double deltaTimeC = (layer.getZ() - position_.Z()) / momentum_.Z() * momentum_.E(); + return deltaTimeC > 0. ? deltaTimeC : -1.; } - -