#include <GflashTrajectory.h>
Public Member Functions | |
void | _cacheSinesAndCosines (double s) const |
void | _refreshCache () const |
double | getCosPhi0 () const |
double | getCosTheta () const |
double | getCotTheta () const |
double | getCurvature () const |
double | getD0 () const |
HepGeom::Vector3D< double > | getDirection (double s=0.0) const |
void | getGflashTrajectoryPoint (GflashTrajectoryPoint &point, double s) const |
double | getL2DAtR (double r) const |
double | getPathLengthAtRhoEquals (double rho) const |
double | getPathLengthAtZ (double z) const |
double | getPhi0 () const |
HepGeom::Point3D< double > | getPosition (double s=0.0) const |
double | getSinPhi0 () const |
double | getSinTheta () const |
double | getZ0 () const |
double | getZAtR (double r) const |
GflashTrajectory () | |
void | initializeTrajectory (const HepGeom::Vector3D< double > &, const HepGeom::Point3D< double > &, double q, double Field) |
void | setCotTheta (double cotTheta) |
void | setCurvature (double curvature) |
void | setD0 (double d0) |
void | setPhi0 (double phi0) |
void | setZ0 (double z0) |
~GflashTrajectory () | |
Private Attributes | |
double | _aa |
double | _cc |
double | _cosPhi0 |
double | _cosTheta |
double | _cotTheta |
double | _curvature |
double | _d0 |
bool | _isStale |
double | _phi0 |
double | _s |
double | _sinPhi0 |
double | _sinTheta |
double | _ss |
double | _z0 |
Definition at line 6 of file GflashTrajectory.h.
GflashTrajectory::GflashTrajectory | ( | ) |
GflashTrajectory::~GflashTrajectory | ( | ) |
Definition at line 73 of file GflashTrajectory.cc.
{ }
void GflashTrajectory::_cacheSinesAndCosines | ( | double | s | ) | const |
Definition at line 257 of file GflashTrajectory.cc.
References _aa, _cc, _curvature, _refreshCache(), _s, _sinTheta, _ss, funct::cos(), alignCSCRings::s, and funct::sin().
Referenced by getDirection(), getGflashTrajectoryPoint(), and getPosition().
void GflashTrajectory::_refreshCache | ( | ) | const |
Definition at line 225 of file GflashTrajectory.cc.
References _cosPhi0, _cosTheta, _cotTheta, _isStale, _phi0, _sinPhi0, _sinTheta, funct::cos(), M_PI, funct::sin(), mathSSE::sqrt(), and theta().
Referenced by _cacheSinesAndCosines(), getCosPhi0(), getCosTheta(), getSinPhi0(), and getSinTheta().
{ if (_isStale) { _isStale=false; double theta; if ( _cotTheta==0.0 ) { theta = M_PI/2.0; } else { theta=atan(1.0/_cotTheta); if (theta<0.0) theta+=M_PI; } if (theta==0.0) { _sinTheta=0.0; _cosTheta=1.0; } else { _cosTheta=cos(theta); _sinTheta=sqrt(1-_cosTheta*_cosTheta); } if (_phi0==0.0) { _sinPhi0=0.0; _cosPhi0=1.0; } else { _cosPhi0 = cos(_phi0); _sinPhi0 = sin(_phi0); // _sinPhi0 = sqrt(1.0-_cosPhi0*_cosPhi0); // if (_phi0>M_PI) _sinPhi0 = -_sinPhi0; } } }
double GflashTrajectory::getCosPhi0 | ( | ) | const |
Definition at line 106 of file GflashTrajectory.cc.
References _cosPhi0, and _refreshCache().
{ _refreshCache(); return _cosPhi0; }
double GflashTrajectory::getCosTheta | ( | ) | const |
Definition at line 114 of file GflashTrajectory.cc.
References _cosTheta, and _refreshCache().
Referenced by getPathLengthAtZ().
{ _refreshCache(); return _cosTheta; }
double GflashTrajectory::getCotTheta | ( | ) | const [inline] |
Definition at line 21 of file GflashTrajectory.h.
References _cotTheta.
Referenced by getZAtR().
{ return _cotTheta; }
double GflashTrajectory::getCurvature | ( | ) | const [inline] |
Definition at line 22 of file GflashTrajectory.h.
References _curvature.
Referenced by getL2DAtR().
{ return _curvature; }
double GflashTrajectory::getD0 | ( | ) | const [inline] |
Definition at line 24 of file GflashTrajectory.h.
References _d0.
Referenced by getL2DAtR().
{ return _d0; };
HepGeom::Vector3D< double > GflashTrajectory::getDirection | ( | double | s = 0.0 | ) | const |
Definition at line 135 of file GflashTrajectory.cc.
References _cacheSinesAndCosines(), _cc, _cosPhi0, _cosTheta, _sinPhi0, _sinTheta, and _ss.
{ _cacheSinesAndCosines(s); if (s==0.0) { return HepGeom::Vector3D<double> (_cosPhi0*_sinTheta,_sinPhi0*_sinTheta,_cosTheta); } double xtan = _sinTheta*(_cosPhi0*_cc -_sinPhi0*_ss); double ytan = _sinTheta*(_cosPhi0*_ss +_sinPhi0*_cc); double ztan = _cosTheta; return HepGeom::Vector3D<double> (xtan,ytan,ztan); }
void GflashTrajectory::getGflashTrajectoryPoint | ( | GflashTrajectoryPoint & | point, |
double | s | ||
) | const |
Definition at line 148 of file GflashTrajectory.cc.
References _cacheSinesAndCosines(), _cc, _cosPhi0, _cosTheta, _curvature, _d0, _sinPhi0, _sinTheta, _ss, _z0, GflashTrajectoryPoint::getMomentum(), GflashTrajectoryPoint::getPosition(), and GflashTrajectoryPoint::setPathLength().
Referenced by HFGflash::gfParameterization(), GflashHadronShowerProfile::hadronicParameterization(), CalorimetryManager::HDShowerSimulation(), GflashHadronShowerProfile::hoProfile(), GflashEMShowerProfile::parameterization(), GflashShowino::simulateFirstInteractionPoint(), and GflashShowino::updateShowino().
{ _cacheSinesAndCosines(s); double cP0sT = _cosPhi0*_sinTheta, sP0sT = _sinPhi0*_sinTheta; if ( s && _curvature) { point.getPosition().set((_cosPhi0*_ss- _sinPhi0*(2.0*_curvature*_d0+1.0-_cc)) /(2.0*_curvature), (_sinPhi0*_ss+ _cosPhi0*(2.0*_curvature*_d0+1.0-_cc)) /(2.0*_curvature), s*_cosTheta + _z0); point.getMomentum().set(cP0sT*_cc-sP0sT*_ss, cP0sT*_ss+sP0sT*_cc, _cosTheta); point.setPathLength(s); } else { point.getPosition().set(-_d0*_sinPhi0+s*cP0sT, _d0*_cosPhi0+s*sP0sT, _z0+s*_cosTheta); point.getMomentum().set(cP0sT,sP0sT,_cosTheta); point.setPathLength(s); } }
double GflashTrajectory::getL2DAtR | ( | double | r | ) | const |
Definition at line 192 of file GflashTrajectory.cc.
References trackerHits::c, getCurvature(), getD0(), M_PI, and mathSSE::sqrt().
Referenced by getPathLengthAtRhoEquals(), and getZAtR().
{ double L2D; double c = getCurvature(); double d = getD0(); if (c!=0.0) { double rad = (rho*rho-d*d)/(1.0+2.0*c*d); double rprime; if (rad<0.0) { rprime = 0.0; } else { rprime = sqrt( rad ); } if (c*rprime > 1.0 || c*rprime < -1.0) { L2D = c*rprime > 0. ? M_PI/c : -M_PI/c; } else L2D = asin(c*rprime)/c; } else { double rad = rho*rho-d*d; double rprime; if (rad<0.0) rprime = 0.0; else rprime = sqrt( rad ); L2D = rprime; } return L2D; }
double GflashTrajectory::getPathLengthAtRhoEquals | ( | double | rho | ) | const |
Definition at line 179 of file GflashTrajectory.cc.
References getL2DAtR(), and getSinTheta().
Referenced by GflashShowino::evaluateLengths(), GflashEMShowerProfile::getDistanceToOut(), GflashHadronShowerProfile::hadronicParameterization(), and GflashShowino::simulateFirstInteractionPoint().
{ return (getSinTheta()?(getL2DAtR(rho)/getSinTheta()):0.0); }
double GflashTrajectory::getPathLengthAtZ | ( | double | z | ) | const |
Definition at line 184 of file GflashTrajectory.cc.
References getCosTheta(), and getZ0().
Referenced by GflashShowino::evaluateLengths(), GflashEMShowerProfile::getDistanceToOut(), HFGflash::gfParameterization(), and GflashShowino::simulateFirstInteractionPoint().
{ return (getCosTheta()?(z-getZ0())/getCosTheta():0.0); }
double GflashTrajectory::getPhi0 | ( | ) | const [inline] |
HepGeom::Point3D< double > GflashTrajectory::getPosition | ( | double | s = 0.0 | ) | const |
Definition at line 119 of file GflashTrajectory.cc.
References _cacheSinesAndCosines(), _cc, _cosPhi0, _cosTheta, _curvature, _d0, _s, _sinPhi0, _sinTheta, _ss, and _z0.
{ _cacheSinesAndCosines(s); if (s==0.0 || _curvature==0.0) { return HepGeom::Point3D<double> (-_d0*_sinPhi0+s*_cosPhi0*_sinTheta, _d0*_cosPhi0+s*_sinPhi0*_sinTheta, _z0+s*_cosTheta); } else { return HepGeom::Point3D<double> ((_cosPhi0*_ss-_sinPhi0*(2.0*_curvature*_d0+1.0-_cc)) /(2.0*_curvature), (_sinPhi0*_ss+_cosPhi0*(2.0*_curvature*_d0+1.0-_cc)) /(2.0*_curvature), _s*_cosTheta + _z0); } }
double GflashTrajectory::getSinPhi0 | ( | ) | const |
Definition at line 102 of file GflashTrajectory.cc.
References _refreshCache(), and _sinPhi0.
{ _refreshCache(); return _sinPhi0; }
double GflashTrajectory::getSinTheta | ( | ) | const |
Definition at line 110 of file GflashTrajectory.cc.
References _refreshCache(), and _sinTheta.
Referenced by getPathLengthAtRhoEquals().
{ _refreshCache(); return _sinTheta; }
double GflashTrajectory::getZ0 | ( | ) | const [inline] |
Definition at line 23 of file GflashTrajectory.h.
References _z0.
Referenced by getPathLengthAtZ().
{ return _z0; };
double GflashTrajectory::getZAtR | ( | double | r | ) | const |
Definition at line 188 of file GflashTrajectory.cc.
References _z0, getCotTheta(), and getL2DAtR().
{ return _z0 + getCotTheta()*getL2DAtR(rho); }
void GflashTrajectory::initializeTrajectory | ( | const HepGeom::Vector3D< double > & | MomentumGev, |
const HepGeom::Point3D< double > & | PositionCm, | ||
double | q, | ||
double | Field | ||
) |
Definition at line 18 of file GflashTrajectory.cc.
References _aa, _cc, _cosPhi0, _cosTheta, _cotTheta, _curvature, _d0, _isStale, _phi0, _s, _sinPhi0, _sinTheta, _ss, _z0, funct::cos(), M_PI, lumiQueryAPI::q, alignCSCRings::s, funct::sin(), x, detailsBasic3DVector::y, z, and Z0.
Referenced by HFGflash::gfParameterization(), and GflashShowino::initialize().
{ double CotTheta = 0.0 ; double W = 0; double Z0 = 0; double D0 = 0; double Phi0 =0; if (BFieldTesla != 0.0 && q != 0.0) { double CurvatureConstant=0.0029979; double Helicity = -1.0 * fabs(BFieldTesla) * fabs(q) / (BFieldTesla*q); double Radius = fabs(MomentumGev.perp()/(CurvatureConstant*BFieldTesla*q)); if(Radius==0.0) W = HUGE_VAL; else W = Helicity/Radius; double phi1 = MomentumGev.phi(); double x = PositionCm.x(), y = PositionCm.y(), z = PositionCm.z(); double sinPhi1 = sin(phi1), cosPhi1 = cos(phi1); double gamma = atan((x*cosPhi1 + y*sinPhi1)/(x*sinPhi1-y*cosPhi1 -1/W)); Phi0 = phi1+gamma; if(Phi0 > M_PI) Phi0 = Phi0 - 2.0*M_PI; if(Phi0 < -M_PI) Phi0 = Phi0 + 2.0*M_PI; D0 = ((1/W + y*cosPhi1 - x*sinPhi1) /cos(gamma) - 1/W); CotTheta = MomentumGev.z()/MomentumGev.perp(); Z0 = z + gamma*CotTheta/W; } else { CLHEP::Hep3Vector direction = MomentumGev.unit(); CLHEP::Hep3Vector projectedDirection = CLHEP::Hep3Vector(direction.x(),direction.y(),0.0).unit(); double s = projectedDirection.dot(PositionCm); double sprime = s/sin(direction.theta()); Z0 = (PositionCm - sprime*direction).z(); Phi0 = MomentumGev.phi(); CotTheta = MomentumGev.z()/MomentumGev.perp(); W = 0.0; D0 = (PositionCm.y()*cos(Phi0) - PositionCm.x()*sin(Phi0)); } _cotTheta=CotTheta; _curvature=W/2; _z0=Z0; _d0=D0; _phi0=Phi0; _isStale=1; _s=-999.999; _aa =-999.999; _ss =-999.999; _cc =-999.999; _sinPhi0 = 1.0; _cosPhi0 = 1.0; _sinTheta = 1.0; _cosTheta = 1.0; }
void GflashTrajectory::setCotTheta | ( | double | cotTheta | ) |
void GflashTrajectory::setCurvature | ( | double | curvature | ) |
Definition at line 82 of file GflashTrajectory.cc.
References _curvature, _isStale, and PixelRecoUtilities::curvature().
{ _curvature=curvature; _isStale=true; }
void GflashTrajectory::setD0 | ( | double | d0 | ) |
void GflashTrajectory::setPhi0 | ( | double | phi0 | ) |
void GflashTrajectory::setZ0 | ( | double | z0 | ) |
double GflashTrajectory::_aa [mutable, private] |
Definition at line 69 of file GflashTrajectory.h.
Referenced by _cacheSinesAndCosines(), and initializeTrajectory().
double GflashTrajectory::_cc [mutable, private] |
Definition at line 71 of file GflashTrajectory.h.
Referenced by _cacheSinesAndCosines(), getDirection(), getGflashTrajectoryPoint(), getPosition(), and initializeTrajectory().
double GflashTrajectory::_cosPhi0 [mutable, private] |
Definition at line 64 of file GflashTrajectory.h.
Referenced by _refreshCache(), getCosPhi0(), getDirection(), getGflashTrajectoryPoint(), getPosition(), and initializeTrajectory().
double GflashTrajectory::_cosTheta [mutable, private] |
Definition at line 66 of file GflashTrajectory.h.
Referenced by _refreshCache(), getCosTheta(), getDirection(), getGflashTrajectoryPoint(), getPosition(), and initializeTrajectory().
double GflashTrajectory::_cotTheta [private] |
Definition at line 55 of file GflashTrajectory.h.
Referenced by _refreshCache(), getCotTheta(), initializeTrajectory(), and setCotTheta().
double GflashTrajectory::_curvature [private] |
Definition at line 56 of file GflashTrajectory.h.
Referenced by _cacheSinesAndCosines(), getCurvature(), getGflashTrajectoryPoint(), getPosition(), initializeTrajectory(), and setCurvature().
double GflashTrajectory::_d0 [private] |
Definition at line 58 of file GflashTrajectory.h.
Referenced by getD0(), getGflashTrajectoryPoint(), getPosition(), initializeTrajectory(), and setD0().
bool GflashTrajectory::_isStale [mutable, private] |
Definition at line 62 of file GflashTrajectory.h.
Referenced by _refreshCache(), initializeTrajectory(), setCotTheta(), setCurvature(), setD0(), setPhi0(), and setZ0().
double GflashTrajectory::_phi0 [private] |
Definition at line 59 of file GflashTrajectory.h.
Referenced by _refreshCache(), getPhi0(), initializeTrajectory(), and setPhi0().
double GflashTrajectory::_s [mutable, private] |
Definition at line 67 of file GflashTrajectory.h.
Referenced by _cacheSinesAndCosines(), getPosition(), and initializeTrajectory().
double GflashTrajectory::_sinPhi0 [mutable, private] |
Definition at line 63 of file GflashTrajectory.h.
Referenced by _refreshCache(), getDirection(), getGflashTrajectoryPoint(), getPosition(), getSinPhi0(), and initializeTrajectory().
double GflashTrajectory::_sinTheta [mutable, private] |
Definition at line 65 of file GflashTrajectory.h.
Referenced by _cacheSinesAndCosines(), _refreshCache(), getDirection(), getGflashTrajectoryPoint(), getPosition(), getSinTheta(), and initializeTrajectory().
double GflashTrajectory::_ss [mutable, private] |
Definition at line 70 of file GflashTrajectory.h.
Referenced by _cacheSinesAndCosines(), getDirection(), getGflashTrajectoryPoint(), getPosition(), and initializeTrajectory().
double GflashTrajectory::_z0 [private] |
Definition at line 57 of file GflashTrajectory.h.
Referenced by getGflashTrajectoryPoint(), getPosition(), getZ0(), getZAtR(), initializeTrajectory(), and setZ0().