Skip to content

Commit

Permalink
Merge pull request #44814 from ykumar05/from-CMSSW_10_6_X_2024-04-22-…
Browse files Browse the repository at this point in the history
…2300

High pT Tracks resolved: Backporting to CMSSW_10_6_X(RunII UL)
  • Loading branch information
cmsbuild authored May 1, 2024
2 parents 6c18860 + c5be286 commit 6eb368a
Showing 1 changed file with 28 additions and 44 deletions.
72 changes: 28 additions & 44 deletions FastSimulation/SimplifiedGeometryPropagator/src/Trajectory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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> fastsim::Trajectory::createTrajectory(const fastsim::Particle & particle, double magneticFieldZ)
{
if(particle.charge() == 0. || magneticFieldZ == 0.){
LogDebug("FastSim") << "create straight trajectory";
return std::unique_ptr<fastsim::Trajectory>(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<fastsim::Trajectory>(new fastsim::StraightTrajectory(particle));
}
else{
LogDebug("FastSim") << "create helix trajectory";
return std::unique_ptr<fastsim::Trajectory>(new fastsim::HelixTrajectory(particle, magneticFieldZ));
}
std::unique_ptr<fastsim::Trajectory> fastsim::Trajectory::createTrajectory(const fastsim::Particle &particle,
double magneticFieldZ) {
if (particle.charge() == 0. || magneticFieldZ == 0.) {
LogDebug("FastSim") << "create straight trajectory";
return std::unique_ptr<fastsim::Trajectory>(new fastsim::StraightTrajectory(particle));
} else {
LogDebug("FastSim") << "create helix trajectory";
return std::unique_ptr<fastsim::Trajectory>(new fastsim::HelixTrajectory(particle, magneticFieldZ));
}
}


double fastsim::Trajectory::nextCrossingTimeC(const fastsim::SimplifiedGeometry & layer, bool onLayer) const
{
if(layer.isForward())
{
return this->nextCrossingTimeC(static_cast<const fastsim::ForwardSimplifiedGeometry &>(layer), onLayer);
}
else
{
return this->nextCrossingTimeC(static_cast<const fastsim::BarrelSimplifiedGeometry &>(layer), onLayer);
}
double fastsim::Trajectory::nextCrossingTimeC(const fastsim::SimplifiedGeometry &layer, bool onLayer) const {
if (layer.isForward()) {
return this->nextCrossingTimeC(static_cast<const fastsim::ForwardSimplifiedGeometry &>(layer), onLayer);
} else {
return this->nextCrossingTimeC(static_cast<const fastsim::BarrelSimplifiedGeometry &>(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.;
}


0 comments on commit 6eb368a

Please sign in to comment.