File indexing completed on 2024-04-20 02:31:50
0001 #include "DataFormats/Math/interface/LorentzVector.h"
0002 #include "FastSimulation/SimplifiedGeometryPropagator/interface/StraightTrajectory.h"
0003 #include "FastSimulation/SimplifiedGeometryPropagator/interface/HelixTrajectory.h"
0004 #include "FastSimulation/SimplifiedGeometryPropagator/interface/ForwardSimplifiedGeometry.h"
0005 #include "FastSimulation/SimplifiedGeometryPropagator/interface/BarrelSimplifiedGeometry.h"
0006 #include "FastSimulation/SimplifiedGeometryPropagator/interface/Particle.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "FastSimulation/SimplifiedGeometryPropagator/interface/Constants.h"
0009
0010 fastsim::Trajectory::~Trajectory() {}
0011
0012 fastsim::Trajectory::Trajectory(const fastsim::Particle &particle) {
0013 position_ = particle.position();
0014 momentum_ = particle.momentum();
0015 }
0016
0017 std::unique_ptr<fastsim::Trajectory> fastsim::Trajectory::createTrajectory(const fastsim::Particle &particle,
0018 double magneticFieldZ) {
0019 if (particle.charge() == 0. || magneticFieldZ == 0.) {
0020 LogDebug("FastSim") << "create straight trajectory";
0021 return std::unique_ptr<fastsim::Trajectory>(new fastsim::StraightTrajectory(particle));
0022 } else {
0023 LogDebug("FastSim") << "create helix trajectory";
0024 return std::unique_ptr<fastsim::Trajectory>(new fastsim::HelixTrajectory(particle, magneticFieldZ));
0025 }
0026 }
0027
0028 double fastsim::Trajectory::nextCrossingTimeC(const fastsim::SimplifiedGeometry &layer, bool onLayer) const {
0029 if (layer.isForward()) {
0030 return this->nextCrossingTimeC(static_cast<const fastsim::ForwardSimplifiedGeometry &>(layer), onLayer);
0031 } else {
0032 return this->nextCrossingTimeC(static_cast<const fastsim::BarrelSimplifiedGeometry &>(layer), onLayer);
0033 }
0034 }
0035
0036 double fastsim::Trajectory::nextCrossingTimeC(const fastsim::ForwardSimplifiedGeometry &layer, bool onLayer) const {
0037 if (onLayer) {
0038 return -1;
0039 }
0040
0041
0042
0043 double deltaTimeC = (layer.getZ() - position_.Z()) / momentum_.Z() * momentum_.E();
0044 return deltaTimeC > 0. ? deltaTimeC : -1.;
0045 }